-
-
Notifications
You must be signed in to change notification settings - Fork 92
feat(main): add sticky scroll and quick line deletion settings #898
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚨 Pull request needs attention.
Review Summary
Commits Considered (6)
- 09c5e5d: fix(main): remove unused setting and refactor names
- dcd8b5a: feat(main): implement MigrationManager for migrating old setting value
- 303229c: fix(main): improve setting description and fix line spacing issues
- 1ad69bf: feat(main): add sticky scroll and quick line deletion settings
- ef0169a: fix(main): reorder settings
- ee36f92: refactor(main): format
SettingsEditorScreen.kt
Files Processed (8)
- core/main/src/main/java/com/rk/App.kt (4 hunks)
- core/main/src/main/java/com/rk/libcommons/editor/KarbonEditor.kt (5 hunks)
- core/main/src/main/java/com/rk/settings/MigrationManager.kt (1 hunk)
- core/main/src/main/java/com/rk/settings/Settings.kt (4 hunks)
- core/main/src/main/java/com/rk/tabs/EditorTab.kt (1 hunk)
- core/main/src/main/java/com/rk/xededitor/ui/screens/settings/editor/EditorFontScreen.kt (1 hunk)
- core/main/src/main/java/com/rk/xededitor/ui/screens/settings/editor/SettingsEditorScreen.kt (10 hunks)
- core/resources/src/main/res/values/strings.xml (3 hunks)
Actionable Comments (1)
-
core/main/src/main/java/com/rk/settings/MigrationManager.kt [18-28]
maintainability: "Consolidate version tracking preference."
Skipped Comments (3)
-
core/main/src/main/java/com/rk/settings/MigrationManager.kt [12-12]
maintainability: "Future migration versioning."
-
core/main/src/main/java/com/rk/xededitor/ui/screens/settings/editor/SettingsEditorScreen.kt [283-284]
enhancement: "Review minimum line spacing value."
-
core/main/src/main/java/com/rk/xededitor/ui/screens/settings/editor/SettingsEditorScreen.kt [359-366]
maintainability: "Consider encapsulating helper function."
| val prefs = context.getSharedPreferences("migration_prefs", Context.MODE_PRIVATE) | ||
| val lastVersion = prefs.getInt("last_version_code", 0) | ||
|
|
||
| if (lastVersion == CURRENT_VERSION) return | ||
|
|
||
| // Line spacing migration to multiplier | ||
| if (lastVersion == 0 && Settings.line_spacing == 0f) { | ||
| Settings.line_spacing = 1f | ||
| } | ||
|
|
||
| prefs.edit { putInt("last_version_code", CURRENT_VERSION) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The MigrationManager uses migration_prefs and the key "last_version_code" to track the last applied migration version. However, Settings.kt also defines var lastVersionCode by CachedPreference("last_version_code", -1L). This creates two separate preferences for tracking a "last version code" with the same key name but in different preference files. This could lead to confusion or unexpected behavior if both were intended to track the same concept. Consider consolidating the version tracking into a single, clearly defined preference.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚨 Pull request needs attention.
Review Summary
Commits Considered (1)
- e85ae3b: Merge branch 'main' into feat/add-settings
Files Processed (8)
- core/main/src/main/java/com/rk/App.kt (4 hunks)
- core/main/src/main/java/com/rk/libcommons/editor/KarbonEditor.kt (5 hunks)
- core/main/src/main/java/com/rk/settings/MigrationManager.kt (1 hunk)
- core/main/src/main/java/com/rk/settings/Settings.kt (4 hunks)
- core/main/src/main/java/com/rk/tabs/EditorTab.kt (1 hunk)
- core/main/src/main/java/com/rk/xededitor/ui/screens/settings/editor/EditorFontScreen.kt (1 hunk)
- core/main/src/main/java/com/rk/xededitor/ui/screens/settings/editor/SettingsEditorScreen.kt (10 hunks)
- core/resources/src/main/res/values/strings.xml (3 hunks)
Actionable Comments (1)
-
core/main/src/main/java/com/rk/settings/MigrationManager.kt [18-19]
possible bug: "Consolidate version tracking preference."
Skipped Comments (4)
-
core/main/src/main/java/com/rk/settings/MigrationManager.kt [12-12]
maintainability: "Clarify
CURRENT_VERSIONupdate policy." -
core/main/src/main/java/com/rk/settings/Settings.kt [76-76]
enhancement: "Review default line spacing value."
-
core/main/src/main/java/com/rk/xededitor/ui/screens/settings/editor/SettingsEditorScreen.kt [283-283]
enhancement: "Improve line spacing input validation."
-
core/main/src/main/java/com/rk/xededitor/ui/screens/settings/editor/SettingsEditorScreen.kt [359-366]
maintainability: "Consider scope of
reapplyEditorSettingsfunction."
| val prefs = context.getSharedPreferences("migration_prefs", Context.MODE_PRIVATE) | ||
| val lastVersion = prefs.getInt("last_version_code", 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The MigrationManager introduces its own migration_prefs and a last_version_code key. However, Settings.kt already defines lastVersionCode using a CachedPreference with the same key. This creates two distinct preference entries for tracking the application's version, which can lead to inconsistencies or make it unclear which version is the authoritative one for migration purposes. It would be more robust to consolidate version tracking into a single source, ideally leveraging the existing Settings.lastVersionCode.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh no... How could this happen to me, it seems like such a migration system was already implemented
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚨 Pull request needs attention.
Review Summary
Commits Considered (2)
Files Processed (2)
- core/main/src/main/java/com/rk/App.kt (3 hunks)
- core/main/src/main/java/com/rk/UpdateManager.kt (2 hunks)
Actionable Comments (1)
-
core/main/src/main/java/com/rk/UpdateManager.kt [48-48]
possible bug: "Implement migration for line spacing setting."
Skipped Comments (2)
-
core/main/src/main/java/com/rk/App.kt [95-95]
bug: "Correct typo in font setting name."
-
core/main/src/main/java/com/rk/UpdateManager.kt [14-15]
best practice: "Add existence check before recursive deletion."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚨 Pull request needs attention.
Review Summary
Commits Considered (1)
- 1c25a04: fix(main): improve migration logic
Files Processed (1)
- core/main/src/main/java/com/rk/UpdateManager.kt (1 hunk)
Actionable Comments (1)
-
core/main/src/main/java/com/rk/UpdateManager.kt [33-35]
possible issue: "Review impact of clearing user preferences during update."
Skipped Comments (0)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✅ LGTM!
Review Summary
Commits Considered (1)
- b66fd17: fix(main): improve migration logic
Files Processed (1)
- core/main/src/main/java/com/rk/UpdateManager.kt (1 hunk)
Actionable Comments (0)
Skipped Comments (1)
-
core/main/src/main/java/com/rk/UpdateManager.kt [14-16]
readability: "Simplify file deletion logic by removing redundant existence check."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✅ LGTM!
Review Summary
Commits Considered (1)
- a03d45e: fix(main): improve migration logic
Files Processed (1)
- core/main/src/main/java/com/rk/UpdateManager.kt (1 hunk)
Actionable Comments (0)
Skipped Comments (1)
-
core/main/src/main/java/com/rk/UpdateManager.kt [33-38]
maintainability: "Use named constants for version codes in migration logic."
PR SummaryImplemented new settings for sticky scroll and quick line deletion, enhancing the editor's functionality. This PR also includes significant improvements to the settings management, such as proper ordering of settings, refined descriptions, and robust migration logic to handle updates across different app versions. Additionally, it addresses a bug where line spacing was dependent on the zoom factor, now making it a multiplier, and removes the redundant Changes
autogenerated by presubmit.ai |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚨 Pull request needs attention.
Review Summary
Commits Considered (13)
- 554049e: Merge branch 'main' into feat/add-settings
- a03d45e: fix(main): improve migration logic
- b66fd17: fix(main): improve migration logic
- 1c25a04: fix(main): improve migration logic
- e52a8d8: Merge remote-tracking branch 'origin/feat/add-settings' into feat/add-settings
- dd9df28: fix(main): use existing UpdateManager instead of duplicate implementation
- e85ae3b: Merge branch 'main' into feat/add-settings
- 09c5e5d: fix(main): remove unused setting and refactor names
- dcd8b5a: feat(main): implement MigrationManager for migrating old setting value
- 303229c: fix(main): improve setting description and fix line spacing issues
- 1ad69bf: feat(main): add sticky scroll and quick line deletion settings
- ef0169a: fix(main): reorder settings
- ee36f92: refactor(main): format
SettingsEditorScreen.kt
Files Processed (8)
- core/main/src/main/java/com/rk/App.kt (1 hunk)
- core/main/src/main/java/com/rk/UpdateManager.kt (1 hunk)
- core/main/src/main/java/com/rk/libcommons/editor/Editor.kt (5 hunks)
- core/main/src/main/java/com/rk/settings/Settings.kt (4 hunks)
- core/main/src/main/java/com/rk/tabs/EditorTab.kt (1 hunk)
- core/main/src/main/java/com/rk/xededitor/ui/screens/settings/editor/EditorFontScreen.kt (1 hunk)
- core/main/src/main/java/com/rk/xededitor/ui/screens/settings/editor/SettingsEditorScreen.kt (10 hunks)
- core/resources/src/main/res/values/strings.xml (3 hunks)
Actionable Comments (1)
-
core/main/src/main/java/com/rk/settings/Settings.kt [76-76]
possible bug: "Correct default value for line spacing."
Skipped Comments (5)
-
core/main/src/main/java/com/rk/UpdateManager.kt [14-16]
best practice: "Add defensive checks for directory existence."
-
core/main/src/main/java/com/rk/UpdateManager.kt [31-38]
enhancement: "Improve migration logic for version updates."
-
core/main/src/main/java/com/rk/libcommons/editor/Editor.kt [294-294]
possible bug: "Fix line spacing dependency on zoom factor."
-
core/main/src/main/java/com/rk/xededitor/ui/screens/settings/editor/SettingsEditorScreen.kt [283-284]
enhancement: "Improve line spacing input validation."
-
core/main/src/main/java/com/rk/xededitor/ui/screens/settings/editor/SettingsEditorScreen.kt [359-366]
maintainability: "Refactor editor settings application logic."
Features
Enhancements
Bug fixes