Skip to content

Conversation

@jvsena42
Copy link
Member

@jvsena42 jvsena42 commented Dec 23, 2025

Closes #448
Closes #497

Description

This PR extract the timed sheets logic to a manager class, removes the trigger on balance change (like iOS) and build a robust Unit test flow

Preview

basic_flow.webm
iOS.mp4
after_two_days.webm
critical.update.webm

QA Notes

  • Compare with iOS basic flow
  • Mock critical update screen
    • Should block back navigation
  • Mock sheet repetition
  • Sheet dismiss
    • Swipe down
    • Back button
    • Internal button
  • Check if new Unit test passes

@jvsena42 jvsena42 self-assigned this Dec 23, 2025
@jvsena42
Copy link
Member Author

@piotr-iohk cc

@jvsena42 jvsena42 changed the base branch from master to feat/nav3 December 24, 2025 13:05
jvsena42 and others added 3 commits December 24, 2025 10:14
… into fix/uniffy-timed-sheet-behavior

# Conflicts:
#	app/src/main/java/to/bitkit/viewmodels/AppViewModel.kt
# Conflicts:
#	app/src/main/java/to/bitkit/ui/ContentView.kt
#	app/src/main/java/to/bitkit/ui/nav/Navigator.kt
Copy link

@github-advanced-security github-advanced-security bot left a comment

Choose a reason for hiding this comment

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

detekt found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.

@jvsena42
Copy link
Member Author

Waiting for #554

@jvsena42 jvsena42 marked this pull request as ready for review December 26, 2025 09:44
@jvsena42
Copy link
Member Author

found a navigation transition inconsistency not related to this branch

Screen_recording_20251226_064504.webm

@jvsena42 jvsena42 requested a review from Copilot December 26, 2025 09:47
Copy link
Contributor

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 PR refactors the timed sheets system by extracting logic into a dedicated TimedSheetManager class and individual sheet implementations. The changes remove the balance-based trigger mechanism (aligning with iOS behavior), introduce proper separation of concerns through individual sheet classes, and add comprehensive unit test coverage.

Key changes:

  • Introduced TimedSheetManager to centralize sheet display logic and queue management
  • Created individual sheet implementations (AppUpdateTimedSheet, BackupTimedSheet, etc.) following the TimedSheetItem interface
  • Removed balance change observer trigger, replacing with manual check on home screen entry
  • Added comprehensive unit tests for all sheet types and the manager

Reviewed changes

Copilot reviewed 20 out of 20 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
app/src/test/java/to/bitkit/utils/timedsheets/sheets/QuickPayTimedSheetTest.kt Unit tests for QuickPay sheet logic covering display conditions and dismissal behavior
app/src/test/java/to/bitkit/utils/timedsheets/sheets/NotificationsTimedSheetTest.kt Unit tests for Notifications sheet including timeout logic and balance requirements
app/src/test/java/to/bitkit/utils/timedsheets/sheets/HighBalanceTimedSheetTest.kt Unit tests for HighBalance sheet covering USD threshold checks, warning limits, and timeout behavior
app/src/test/java/to/bitkit/utils/timedsheets/sheets/BackupTimedSheetTest.kt Unit tests for Backup sheet verification and timeout logic
app/src/test/java/to/bitkit/utils/timedsheets/sheets/AppUpdateTimedSheetTest.kt Unit tests for AppUpdate sheet covering version checking and critical update filtering
app/src/test/java/to/bitkit/utils/timedsheets/TimedSheetManagerTest.kt Unit tests for TimedSheetManager covering queue management, priority sorting, and lifecycle
app/src/main/java/to/bitkit/viewmodels/AppViewModel.kt Refactored to use TimedSheetManager, removed inline sheet logic, extracted critical update check
app/src/main/java/to/bitkit/utils/timedsheets/sheets/QuickPayTimedSheet.kt Implementation of QuickPay sheet display and dismissal logic
app/src/main/java/to/bitkit/utils/timedsheets/sheets/NotificationsTimedSheet.kt Implementation of Notifications sheet with timeout and balance checks
app/src/main/java/to/bitkit/utils/timedsheets/sheets/HighBalanceTimedSheet.kt Implementation of HighBalance sheet with USD conversion and warning limits
app/src/main/java/to/bitkit/utils/timedsheets/sheets/BackupTimedSheet.kt Implementation of Backup sheet with verification and timeout logic
app/src/main/java/to/bitkit/utils/timedsheets/sheets/AppUpdateTimedSheet.kt Implementation of AppUpdate sheet with version checking and critical filtering
app/src/main/java/to/bitkit/utils/timedsheets/TimedSheetUtils.kt Utility functions for timeout checking and interval constants
app/src/main/java/to/bitkit/utils/timedsheets/TimedSheetManager.kt Manager class for sheet registration, queue management, and display logic
app/src/main/java/to/bitkit/utils/timedsheets/TimedSheetItem.kt Interface defining the contract for timed sheet implementations
app/src/main/java/to/bitkit/ui/nav/entries/SheetEntries.kt Updated sheet entries to use DisposableEffect for dismissal handling
app/src/main/java/to/bitkit/ui/nav/SheetSceneStrategy.kt Added automatic dismissal on swipe-down gesture detection
app/src/main/java/to/bitkit/ui/nav/Navigator.kt Added navigateToCriticalUpdate method for clearing backstack
app/src/main/java/to/bitkit/ui/ContentView.kt Added special routing logic for critical update navigation
app/src/main/java/to/bitkit/di/TimedSheetModule.kt Dependency injection module for TimedSheetManager provider

Comment on lines +56 to +57
delay(CHECK_DELAY_MILLIS)
checkAndShowNextSheet()
Copy link

Copilot AI Dec 26, 2025

Choose a reason for hiding this comment

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

The delay before showing the next sheet in queue creates a 2-second gap between sheets. Consider making this configurable or using a smaller delay for queued sheets to improve user experience, as the initial delay already occurred when entering the home screen.

Copilot uses AI. Check for mistakes.
Copy link
Member Author

Choose a reason for hiding this comment

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

This delay helps the user don't be overwhelmed when there is multiple sheets

currentTimedSheet = sheet
_currentSheet.value = sheet.type
sheet.onShown()
registeredSheets.remove(sheet)
Copy link

Copilot AI Dec 26, 2025

Choose a reason for hiding this comment

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

Removing sheets from registeredSheets after showing means they cannot be shown again even if the user re-enters the home screen and conditions change. If sheets should be eligible to show again on subsequent home screen visits, this removal should be reconsidered. Consider tracking shown sheets separately or allowing sheets to reset their eligibility.

Suggested change
registeredSheets.remove(sheet)

Copilot uses AI. Check for mistakes.
Copy link
Member Author

Choose a reason for hiding this comment

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

None of the sheets has a logic to be re-triggered on a short time. removing the registered sheet helps not repeating the checks

@jvsena42 jvsena42 requested a review from ovitrif December 26, 2025 10:12
@ovitrif ovitrif force-pushed the feat/nav3 branch 3 times, most recently from e57eef3 to 1eb159f Compare December 26, 2025 19:08
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.

Unify timesheets behavior on Android to match iOS HighBalance timedsheet not displayed when expected.

3 participants