Skip to content

Commit 303fe1c

Browse files
committed
Sift v1.0.4 — fixes and schedule correction
- Fix Android 14 crash (foreground service type now passed to startForeground) - Fix white launch screen flash on iOS and Android - Remove notifications — alarm rings directly at phase boundaries - Fix work block durations: 2h/1h45m alternating (was equal 1h52m30s) - Harden DateTime.parse with tryParse to prevent streak data crashes - Add audio interruption restart on iOS (phone calls etc) - Background ticker precision: fires 1s after phase boundary instead of 5s polling - Remove unused packages: flutter_local_notifications, timezone, flutter_timezone, path_provider - Use app icon in Android foreground service notification - Bump version to 1.0.4+5
1 parent 6c8288c commit 303fe1c

20 files changed

Lines changed: 76 additions & 322 deletions

File tree

work_timer/android/app/build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ val keyPropertiesFile = rootProject.file("key.properties")
1212
if (keyPropertiesFile.exists()) keyProperties.load(keyPropertiesFile.inputStream())
1313

1414
android {
15-
namespace = "com.example.work_timer"
15+
namespace = "com.utsapoddar.sift"
1616
compileSdk = flutter.compileSdkVersion
1717
ndkVersion = flutter.ndkVersion
1818

@@ -28,7 +28,7 @@ android {
2828

2929
defaultConfig {
3030
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
31-
applicationId = "com.example.work_timer"
31+
applicationId = "com.utsapoddar.sift"
3232
// You can update the following values to match your application needs.
3333
// For more information, see: https://flutter.dev/to/review-gradle-config.
3434
minSdk = flutter.minSdkVersion

work_timer/android/app/src/main/AndroidManifest.xml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
2-
<!-- Permissions for local notifications and exact alarms -->
3-
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
42
<uses-permission android:name="android.permission.VIBRATE"/>
5-
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
6-
<uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM"/>
7-
<uses-permission android:name="android.permission.USE_EXACT_ALARM"/>
83
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
94
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PLAYBACK"/>
105
<application

work_timer/android/app/src/main/kotlin/com/example/work_timer/MainActivity.kt

Lines changed: 0 additions & 72 deletions
This file was deleted.

work_timer/android/app/src/main/kotlin/com/example/work_timer/TimerService.kt

Lines changed: 0 additions & 77 deletions
This file was deleted.

work_timer/android/app/src/main/kotlin/com/utsapoddar/sift/TimerService.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ class TimerService : Service() {
6161
return NotificationCompat.Builder(this, CHANNEL_ID)
6262
.setContentTitle("Sift")
6363
.setContentText("Timer running")
64-
.setSmallIcon(android.R.drawable.ic_lock_idle_alarm)
64+
.setSmallIcon(R.mipmap.ic_launcher)
6565
.setOngoing(true)
6666
.addAction(0, "Stop", stopPi)
6767
.addAction(0, "Silence", silencePi)

work_timer/android/app/src/main/res/drawable/launch_background.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<!-- Modify this file to customize your launch splash screen -->
33
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
4-
<item android:drawable="@android:color/white" />
4+
<item android:drawable="#0A0A0A" />
55

66
<!-- You can insert your own image assets here -->
77
<!-- <item>

work_timer/android/app/src/main/res/values/styles.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<resources>
33
<!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is off -->
4-
<style name="LaunchTheme" parent="@android:style/Theme.Light.NoTitleBar">
4+
<style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
55
<!-- Show a splash screen on the activity. Automatically removed when
66
the Flutter engine draws its first frame -->
77
<item name="android:windowBackground">@drawable/launch_background</item>
@@ -12,7 +12,7 @@
1212
running.
1313
1414
This Theme is only used starting with V2 of Flutter's Android embedding. -->
15-
<style name="NormalTheme" parent="@android:style/Theme.Light.NoTitleBar">
15+
<style name="NormalTheme" parent="@android:style/Theme.Black.NoTitleBar">
1616
<item name="android:windowBackground">?android:colorBackground</item>
1717
</style>
1818
</resources>

work_timer/ios/Podfile.lock

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,6 @@ PODS:
3737
- DKImagePickerController/PhotoGallery
3838
- Flutter
3939
- Flutter (1.0.0)
40-
- flutter_local_notifications (0.0.1):
41-
- Flutter
42-
- flutter_timezone (0.0.1):
43-
- Flutter
4440
- SDWebImage (5.21.7):
4541
- SDWebImage/Core (= 5.21.7)
4642
- SDWebImage/Core (5.21.7)
@@ -53,8 +49,6 @@ DEPENDENCIES:
5349
- audioplayers_darwin (from `.symlinks/plugins/audioplayers_darwin/darwin`)
5450
- file_picker (from `.symlinks/plugins/file_picker/ios`)
5551
- Flutter (from `Flutter`)
56-
- flutter_local_notifications (from `.symlinks/plugins/flutter_local_notifications/ios`)
57-
- flutter_timezone (from `.symlinks/plugins/flutter_timezone/ios`)
5852
- shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/darwin`)
5953

6054
SPEC REPOS:
@@ -71,10 +65,6 @@ EXTERNAL SOURCES:
7165
:path: ".symlinks/plugins/file_picker/ios"
7266
Flutter:
7367
:path: Flutter
74-
flutter_local_notifications:
75-
:path: ".symlinks/plugins/flutter_local_notifications/ios"
76-
flutter_timezone:
77-
:path: ".symlinks/plugins/flutter_timezone/ios"
7868
shared_preferences_foundation:
7969
:path: ".symlinks/plugins/shared_preferences_foundation/darwin"
8070

@@ -84,8 +74,6 @@ SPEC CHECKSUMS:
8474
DKPhotoGallery: b3834fecb755ee09a593d7c9e389d8b5d6deed60
8575
file_picker: a0560bc09d61de87f12d246fc47d2119e6ef37be
8676
Flutter: cabc95a1d2626b1b06e7179b784ebcf0c0cde467
87-
flutter_local_notifications: 395056b3175ba4f08480a7c5de30cd36d69827e4
88-
flutter_timezone: 7c838e17ffd4645d261e87037e5bebf6d38fe544
8977
SDWebImage: e9fc87c1aab89a8ab1bbd74eba378c6f53be8abf
9078
shared_preferences_foundation: 7036424c3d8ec98dfe75ff1667cb0cd531ec82bb
9179
SwiftyGif: 706c60cf65fa2bc5ee0313beece843c8eb8194d4

work_timer/ios/Runner/AppDelegate.swift

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,28 @@ struct SiftActivityAttributes: ActivityAttributes {
3434
// .playback category bypasses the silent switch so alarms always make noise
3535
try? AVAudioSession.sharedInstance().setCategory(.playback, mode: .default, options: [])
3636
try? AVAudioSession.sharedInstance().setActive(true)
37+
NotificationCenter.default.addObserver(
38+
self,
39+
selector: #selector(handleAudioInterruption(_:)),
40+
name: AVAudioSession.interruptionNotification,
41+
object: AVAudioSession.sharedInstance()
42+
)
3743
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
3844
}
3945

46+
// Restart silent keep-alive loop after phone calls / Siri / other audio interruptions
47+
@objc private func handleAudioInterruption(_ notification: Notification) {
48+
guard let userInfo = notification.userInfo,
49+
let typeValue = userInfo[AVAudioSessionInterruptionTypeKey] as? UInt,
50+
let type = AVAudioSession.InterruptionType(rawValue: typeValue) else { return }
51+
if type == .ended {
52+
try? AVAudioSession.sharedInstance().setActive(true)
53+
guard !audioEngine.isRunning else { return }
54+
try? audioEngine.start()
55+
silentNode.play()
56+
}
57+
}
58+
4059
func didInitializeImplicitFlutterEngine(_ engineBridge: FlutterImplicitEngineBridge) {
4160
GeneratedPluginRegistrant.register(with: engineBridge.pluginRegistry)
4261
setupChannel(registry: engineBridge.pluginRegistry)

work_timer/ios/Runner/Base.lproj/LaunchScreen.storyboard

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<imageView opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" image="LaunchImage" translatesAutoresizingMaskIntoConstraints="NO" id="YRO-k0-Ey4">
2020
</imageView>
2121
</subviews>
22-
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
22+
<color key="backgroundColor" red="0.039215686" green="0.039215686" blue="0.039215686" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
2323
<constraints>
2424
<constraint firstItem="YRO-k0-Ey4" firstAttribute="centerX" secondItem="Ze5-6b-2t3" secondAttribute="centerX" id="1a2-6s-vTC"/>
2525
<constraint firstItem="YRO-k0-Ey4" firstAttribute="centerY" secondItem="Ze5-6b-2t3" secondAttribute="centerY" id="4X2-HB-R7a"/>

0 commit comments

Comments
 (0)