Skip to content

[REFACTOR] Improve Local Major Subscription Management#105

Merged
doyoonkim3312 merged 4 commits into
developmentfrom
FEATURE/1.7.3/improve-local-subscription-management
Jun 10, 2026
Merged

[REFACTOR] Improve Local Major Subscription Management#105
doyoonkim3312 merged 4 commits into
developmentfrom
FEATURE/1.7.3/improve-local-subscription-management

Conversation

@doyoonkim3312

@doyoonkim3312 doyoonkim3312 commented Jun 9, 2026

Copy link
Copy Markdown
Member

πŸ“ Summary (κ°œμš”)

  • Improve local major subscription management to resolve identified issue caused by fragmented data source.

πŸ”— Related Issue (κ΄€λ ¨ 이슈)

  • Resolves (if applicable) #
  • Jira Ticket: KAN-111

πŸ›  Type of Change (λ³€κ²½ 사항)

  • FEAT: New feature (μƒˆλ‘œμš΄ κΈ°λŠ₯)
  • FIX: Bug fix (버그 μˆ˜μ •)
  • REFACTOR: Code refactoring (no functional change) (μ½”λ“œ λ¦¬νŒ©ν† λ§)
  • DESIGN: UI/UX changes (λ””μžμΈ λ³€κ²½)
  • !HOTFIX: Critical fix (치λͺ…적인 버그 μˆ˜μ •)
  • CHORE: Build/Config/CI (λΉŒλ“œ/μ„€μ •/CI)

✨ Key Changes (핡심 λ³€κ²½ 사항)

  • Local Major Subscription management has been migrated from SharedPreference to PreferenceDataStore.
    • Modifications have been made on necessary consumers to safely take value over Flow<T> and process it.
  • Server-side synchronization process has been isolated and would be performed in background to ensure server-side synchronization to be completed although user leave the specific screen or close/kill the application process.
  • Improved AppSubscriptionPreferenceRepository is architected with consideration of future scalability.

πŸ“Έ Screenshots / Video (μŠ€ν¬λ¦°μƒ· λ˜λŠ” λ™μ˜μƒ)

  • Not Applicable.

πŸ§ͺ Test Plan (ν…ŒμŠ€νŠΈ κ³„νš)

  • Device: Android Emulator (Google Pixel 9 Pro, SDK 36)
  • Scenario: Launch application -> navigate to NoticeByMajorScreen -> Select Major -> Check selected major is applied -> Check server-side synchronization is performed.
  • Scenario: Change Major -> Check selected major is applied -> Check server-side synchronization is performed.

βœ… Checklist (체크리슀트)

  • My code follows the style guidelines of this project (μ½”λ“œ μŠ€νƒ€μΌμ„ μ€€μˆ˜ν–ˆμŠ΅λ‹ˆλ‹€).
  • I have performed a self-review of my own code (슀슀둜 μ½”λ“œλ₯Ό κ²€ν† ν–ˆμŠ΅λ‹ˆλ‹€).
  • I have commented my code, particularly in hard-to-understand areas (μ΄ν•΄ν•˜κΈ° μ–΄λ €μš΄ 뢀뢄에 주석을 μž‘μ„±ν–ˆμŠ΅λ‹ˆλ‹€).

  * Migrate SharedPreference to DataStore to manage local-side major subscription status

    - Define DataStore (PreferenceDataStore) with SharedPreference Migration configuration, and register it to dependency graph.
  * Improve Local-side management of Major Subscription status, as well as its method to perform server-side synchronization.

    - Utilize DataStore and expose stored value(s) via Flow<T>. (Full migration would be performed as a next ticket.)
    - Separate Local-side subscription management and server-side synchronization.
      > Server-side synchronization would be performed on background, managed by WorkManager.
      > Introduce new local values (SubscriptionPending and UnsubscriptionPending) to be accessed and used to perform server-side synchronization.
      > Necessary CoroutineWorker and WorkManager job request (OneTimeWork) have been defined and declared.
   - Appropriate modifications have been made on consumer-side to receive and process subscription status over Flow.
  * Update dependency graph to provide new PreferenceDataStore and MajorSubscriptionUpdate CoroutineWorker to necessary consumers.
  * (CHORE) Update Build gradle to provide necessary library dependency (DataStore.)
@doyoonkim3312 doyoonkim3312 requested a review from jeongHunE June 9, 2026 21:33
@doyoonkim3312 doyoonkim3312 added the Improvement Structural or Functional Improvement label Jun 9, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request migrates the application's subscription preferences from SharedPreferences to PreferenceDataStore and introduces a background worker (MajorSubscriptionUpdate) to synchronize major topic subscriptions with the server. Feedback on these changes highlights a critical early return bug in the worker that skips unsubscription logic when there are no new subscriptions, as well as a lack of exception handling. Additionally, the migration implementation in AppSubscriptionPreferenceRepositoryImpl lacks a fallback for the old preference key, which would cause existing users to lose their subscribed major. Finally, a guard check is recommended in NoticeByMajorViewModel to prevent redundant synchronization tasks when a user selects their already subscribed major.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread app/src/main/java/com/doyoonkim/knutice/task/MajorSubscriptionUpdate.kt Outdated
  - `MajorSubscriptionUpdate`: Worker has lack of exception handling, which could ignore background work completely in certain edge case (unexpected Exception thrown). Also, early return condition might skip the unsubscribing the pending majors, if SubscriptionPending list is empty.
  - `RemoteSubscriptionPreferenceRepositoryImpl`: SharedPreference migration logic applied to PreferenceDataStore is a `String` type value while up-to-date value for managing local-side Major Subscription status is Set<String> (updated with consideration of future business rule updates). Therefore, additional self-healing logic is applied to safely take pre-existing subscription value.
@doyoonkim3312 doyoonkim3312 self-assigned this Jun 9, 2026
@doyoonkim3312 doyoonkim3312 merged commit de6f1e6 into development Jun 10, 2026
1 check passed
@doyoonkim3312 doyoonkim3312 deleted the FEATURE/1.7.3/improve-local-subscription-management branch June 10, 2026 01:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Improvement Structural or Functional Improvement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants