Skip to content

Comments

Replaces preference storage#1977

Draft
SessionHero01 wants to merge 3 commits intodevfrom
update-pref-use
Draft

Replaces preference storage#1977
SessionHero01 wants to merge 3 commits intodevfrom
update-pref-use

Conversation

@SessionHero01
Copy link
Collaborator

  • Refactor preference system: migrate simple preferences to PreferenceStorage and logical modules
  • Make NotificationChannels an injectable singleton
  • Tidy up

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request refactors the preference system by migrating from the monolithic TextSecurePreferences to a new PreferenceStorage interface with preferences organized into logical modules. The PR also makes NotificationChannels an injectable singleton.

Changes:

  • Introduced PreferenceStorage interface with type-safe PreferenceKey definitions
  • Organized preferences into domain-specific modules (ThemingPreferences, SystemPreferences, SecurityPreferences, etc.)
  • Migrated preference access from static TextSecurePreferences methods to injected PreferenceStorage throughout the codebase
  • Refactored NotificationChannels from static utility to injectable singleton

Reviewed changes

Copilot reviewed 69 out of 69 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
ThemingPreferences.kt Defines theme-related preference keys (style, accent color, activity alias)
SystemPreferences.kt System-level preferences (APK updates, version codes, language, donation tracking)
SecurityPreferences.kt Security preferences (screen lock, password, timeout settings)
PushPreferences.kt Push notification enablement preference
ProPreferences.kt Pro subscription and debug preferences
PrivacyPreferences.kt Privacy-related preferences (read receipts, typing indicators, link previews)
NotificationPreferences.kt Notification configuration preferences
MessagingPreferences.kt Messaging behavior preferences (thread trim, send with enter, GIF layout)
BackupPreferences.kt Backup-related preference keys
PlayStoreSubscriptionManager.kt Migrated to use PreferenceStorage for pro preferences
CallMessageProcessor.kt Updated to use NotificationPreferences for call notifications
SaveAttachmentTask.kt Uses PreferenceStorage via EntryPoints for privacy preferences
DonationManager.kt Migrated donation tracking to SystemPreferences
Themes.kt Updated to use new preference structure for theming
ThemeFromPreferences.kt Refactored to use standalone function with PreferenceStorage
TokenPageNotificationManager.kt Migrated notification tracking to NotificationPreferences
TokenDropNotificationWorker.kt Updated to use NotificationPreferences
ReadReceiptManager.kt Migrated to use PrivacyPreferences for read receipts
PanicResponderListener.java Uses EntryPoints to access PreferenceStorage for security preferences
KeyCachingService.java Converted to use PreferenceStorage for security settings
ImageEditorFragment.java Added AndroidEntryPoint and injected PreferenceStorage
InAppReviewViewModel.kt Migrated review state to SystemPreferences
InAppReviewManager.kt Updated to use PreferenceStorage for review state
SubscriptionCoordinator.kt Migrated subscription provider preference
ProStatusManager.kt Extensive migration of Pro-related preferences
ProDetailsRepository.kt Updated to use ProPreferences
FetchProDetailsWorker.kt Uses EntryPoints to check Pro enablement
ProSettingsViewModel.kt Migrated Pro settings preferences
PrivacySettingsPreferenceViewModel.kt Complete migration to PreferenceStorage with proper watching
NotificationsPreferenceViewModel.kt Migrated notification preferences and injected NotificationChannels
ChatsPreferenceViewModel.kt Migrated messaging preferences
LoadAccountActivity.kt Updated configuration sync preference
LandingActivity.kt Migrated security preferences
SingleRecipientNotificationBuilder.java Injected NotificationChannels dependency
PushRegistrationHandler.kt Updated to watch PushPreferences changes
NotificationState.java Updated to use injected NotificationChannels
NotificationChannels.java Converted to injectable singleton with instance fields
MarkReadProcessor.kt Migrated to use PrivacyPreferences
LocaleChangedReceiver.java Uses EntryPoints to access NotificationChannels
GroupSummaryNotificationBuilder.kt Added NotificationChannels parameter
DefaultMessageNotifier.kt Injected NotificationChannels and PreferenceStorage
AbstractNotificationBuilder.java Added NotificationChannels as instance field
DatabaseMigrationManager.kt Migrated SQLCipher migration preferences
HomeViewModel.kt Migrated various preferences to PreferenceStorage
HomeActivity.kt Updated to use SystemPreferences and MessagingPreferences
GiphyFragment.kt Injected PreferenceStorage for GIF layout preference
GiphyActivityToolbarTextSecurePreferencesPersistence.java Uses EntryPoints for PreferenceStorage
AppDisguiseManager.kt Migrated theming preferences
AppModule.kt Updated AppComponent to expose PreferenceStorage and NotificationChannels
DebugMenuViewModel.kt Extensive migration of debug preferences
ThreadDatabase.java Injected PreferenceStorage for read receipts check
SmsDatabase.java Injected PreferenceStorage for read receipts
RecipientRepository.kt Migrated Pro debug preferences
MmsDatabase.kt Updated to use PreferenceStorage for read receipts
ControlMessageView.kt Migrated call notification preferences
InputBar.kt Updated incognito keyboard preference access
ConversationActivityV2.kt Migrated privacy and notification preferences
AvatarUploadManager.kt Migrated attachment encryption preferences
AvatarReuploadWorker.kt Updated schedule method to use PreferenceStorage
ScreenLockActivity.kt Converted to AndroidEntryPoint with injected PreferenceStorage
ScreenLockActionBarActivity.kt Made abstract with injected PreferenceStorage
ApplicationContext.kt Added NotificationChannels and PreferenceStorage lazy properties
TextSecurePreferences.kt Removed migrated preference methods and static fields
SnodeDirectory.kt Migrated snode pool refresh preferences
PathManager.kt Migrated path rotation preferences
ReceivedMessageProcessor.kt Updated typing indicators check
MessageParser.kt Migrated Pro enablement check
TrimThreadJob.kt Injected PreferenceStorage for thread trim setting
AttachmentUploadJob.kt Migrated file server and encryption preferences

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

if(!prefs.hasCheckedDozeWhitelist() // the user has not yet seen the dialog
&& !prefs.pushEnabled.value // the user is in slow mode
if(!prefStorage[SystemPreferences.HAS_CHECKED_DOZE_WHITELIST] // the user has not yet seen the dialog
&& !prefStorage[PushPreferences.isPushEnabled(TextSecurePreferences.pushSuffix)] // the user is in slow mode
Copy link

Copilot AI Feb 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reference to PushPreferences.isPushEnabled(TextSecurePreferences.pushSuffix) is incorrect. The isPushEnabled function doesn't exist in PushPreferences. This should use PushPreferences.IS_PUSH_ENABLED directly, as the suffix is already included in its definition.

Suggested change
&& !prefStorage[PushPreferences.isPushEnabled(TextSecurePreferences.pushSuffix)] // the user is in slow mode
&& !prefStorage[PushPreferences.IS_PUSH_ENABLED] // the user is in slow mode

Copilot uses AI. Check for mistakes.
@@ -124,6 +124,10 @@ import org.session.libsession.utilities.StringSubstitutionConstants.NAME_KEY
import org.session.libsession.utilities.Stub
import org.session.libsession.utilities.TextSecurePreferences
import org.session.libsession.utilities.TextSecurePreferences.Companion.CALL_NOTIFICATIONS_ENABLED
Copy link

Copilot AI Feb 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The import of CALL_NOTIFICATIONS_ENABLED from TextSecurePreferences.Companion is now unused and should be removed. The code on line 1733 (outside the diff) likely still uses this old constant and should be updated to use NotificationPreferences.CALL_NOTIFICATIONS_ENABLED.name instead.

Suggested change
import org.session.libsession.utilities.TextSecurePreferences.Companion.CALL_NOTIFICATIONS_ENABLED

Copilot uses AI. Check for mistakes.
@SessionHero01 SessionHero01 marked this pull request as draft February 19, 2026 23:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant