CCExtractor / CCExtractor/ultimate_alarm_clock
Bug: Timer native channel contract is incomplete and TimerRing uses the wrong channel for foreground restore
- Langage dominant
- Dart
- Étoiles
- 112
- Forks
- 227
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Description
## Description
The timer feature has a native-channel contract mismatch.
Flutter invokes timer methods that are not fully implemented on the Android side, and `TimerRingController` also sends one foregrounding call over the wrong channel.
## Affected Code
- `lib/app/modules/timer/controllers/timer_controller.dart`
- `lib/app/modules/timerRing/controllers/timer_ring_controller.dart`
- `android/app/src/main/kotlin/com/ccextractor/ultimate_alarm_clock/ultimate_alarm_clock/MainActivity.kt`
## Observed Problems
### 1. `cancelTimer` is called from Flutter but not implemented on the `timer` channel
Flutter code calls:
- `timerChannel.invokeMethod('cancelTimer')`
but the Android `timer` channel handler in `MainActivity.kt` only implements:
- `playDefaultAlarm`
- `stopDefaultAlarm`
- `runtimerNotif`
- `clearTimerNotif`
So `cancelTimer` currently falls through to `notImplemented`.
### 2. `TimerRingController` calls `bringAppToForeground` on the wrong channel
`TimerRingController` uses:
- `MethodChannel('timer')`
and then invokes:
- `bringAppToForeground`
But `bringAppToForeground` is implemented on the alarm channel, not the timer channel.
That means the timer ring flow depends on a method that is not exposed on the channel it actually uses.
## Why this matters
This creates silent timer-flow breakage:
- timer cleanup may not actually happen natively
- timer ring foreground recovery is fragile
- background/foreground timer behavior becomes inconsistent
## Expected Behavior
- every Flutter timer-channel method must exist on the Android `timer` channel
- timer ring foreground recovery must use the correct method/channel contract
- unsupported timer methods should not silently fail
## Suggested Fix
- define the timer channel contract explicitly
- add `cancelTimer` support on the Android `timer` channel, or remove the Flutter call if it is obsolete
- route `bringAppToForeground` through the correct channel, or expose it on the timer channel if that is the intended contract
- add a small contract test or integration check for the timer method names
## Acceptance Criteria
- `cancelTimer` from Flutter does not hit `notImplemented`
- timer ring background-to-foreground recovery uses a valid native method path
- timer channel method names are documented and aligned between Flutter and Android
- regression coverage exists for the timer channel contract
Guide de contribution
Ouvrir le guide de contribution
Évaluation
Cette issue n'a pas encore été évaluée.