Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f432e0b406 | ||
|
|
220df450c3 | ||
|
|
4b877f3807 | ||
|
|
4591dc591d | ||
|
|
86069dce2f | ||
|
|
6b7b91daac | ||
|
|
c61521c4d7 | ||
|
|
9b5162216e | ||
|
|
7078dcd560 | ||
|
|
86ffb773df | ||
|
|
2b1d382069 | ||
|
|
8455f14ed8 | ||
|
|
7d5667d253 | ||
|
|
4c3c087e98 | ||
|
|
c8f314dcc7 | ||
|
|
2770c13a94 | ||
|
|
b33218fa60 | ||
|
|
c629162c44 | ||
|
|
41041e9105 | ||
|
|
1ac28bb8e5 | ||
|
|
b42ead1771 | ||
|
|
c0f9b58569 | ||
|
|
77e964a4c7 | ||
|
|
21f7236957 | ||
|
|
ea5a64ccdd | ||
|
|
e51239ab1c | ||
|
|
af32c1e313 | ||
|
|
4f15f94629 | ||
|
|
b02a6ff80a | ||
|
|
b649c9c1e7 | ||
|
|
23ca37c671 | ||
|
|
11616841b3 | ||
|
|
085031bc26 | ||
|
|
05f1b68d3f | ||
|
|
0bc20a6e08 | ||
|
|
a661cfabbb | ||
|
|
0e481f13cc | ||
|
|
436c96285c | ||
|
|
dd9d15172c | ||
|
|
42d4992b6b | ||
|
|
f20bd99da4 | ||
|
|
79578de1f7 | ||
|
|
183634dee5 | ||
|
|
2606116c62 | ||
|
|
424176a529 | ||
|
|
13a00917f9 | ||
|
|
76ef8a7131 | ||
|
|
8b466229e1 | ||
|
|
b62eff80c9 | ||
|
|
07447a2ffe | ||
|
|
6627ab46e8 | ||
|
|
79d9da8285 | ||
|
|
03f9e2fa56 | ||
|
|
7ab13dd4de | ||
|
|
f5e368a902 | ||
|
|
251e03db5b | ||
|
|
3f0b69d6cf | ||
|
|
dc97081517 | ||
|
|
8167c748ff | ||
|
|
4926c869b9 | ||
|
|
7f908a7fab | ||
|
|
65ce0f8135 | ||
|
|
75b0a6b875 | ||
|
|
aed58f56dc | ||
|
|
db94f3bea1 | ||
|
|
39792270f1 | ||
|
|
77320b05d6 | ||
|
|
4788cdd220 | ||
|
|
0659262e61 | ||
|
|
287c2f0cd0 | ||
|
|
b4f8f37c79 | ||
|
|
b4acaa308d | ||
|
|
14372df628 | ||
|
|
c32373173b | ||
|
|
64a070fb4e | ||
|
|
bb1118d071 |
No files matched your search
@@ -57,6 +57,10 @@ unlinked_spec.ds
|
|||||||
**/android/**/GeneratedPluginRegistrant.java
|
**/android/**/GeneratedPluginRegistrant.java
|
||||||
**/android/key.properties
|
**/android/key.properties
|
||||||
*.jks
|
*.jks
|
||||||
|
android/build
|
||||||
|
android/app/build
|
||||||
|
android/release
|
||||||
|
android/app/release
|
||||||
|
|
||||||
# iOS/XCode related
|
# iOS/XCode related
|
||||||
**/ios/**/*.mode1v3
|
**/ios/**/*.mode1v3
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
1. Install Flutter SDK
|
||||||
|
2. Install Android SDK
|
||||||
|
3. Clone Repo
|
||||||
|
4. Run `compile.sh`
|
||||||
|
5. Check `releases/` Folder
|
||||||
@@ -0,0 +1,65 @@
|
|||||||
|
# Changelog
|
||||||
|
|
||||||
|
## 1.1.0 (In Development)
|
||||||
|
|
||||||
|
Usability improvements.
|
||||||
|
|
||||||
|
- move switchtile back to its own row
|
||||||
|
- allows showing text without crowding out or hiding minutes field
|
||||||
|
- fix monochrome icons, source was not white which may have been causing issues
|
||||||
|
- begin creating tar files for Linux rather than zips to use on release
|
||||||
|
- begin using a proper release signature rather that flutter's debug
|
||||||
|
- update internal plugin versions
|
||||||
|
|
||||||
|
This version may require uninstalling any previous versions before updating due to the signature change. It is a one-time event.
|
||||||
|
|
||||||
|
## 1.0.1 (2026-09-29)
|
||||||
|
|
||||||
|
Fixes for issues on hardware devices.
|
||||||
|
|
||||||
|
- fix internet access on some devices
|
||||||
|
- fix SSL certificate issues on older devices
|
||||||
|
- fix null minutes making a null alarm time
|
||||||
|
- fix enabling alarm with no time set yet
|
||||||
|
- enhance the icon for older devices
|
||||||
|
- upgrade SDKs and compilers
|
||||||
|
|
||||||
|
## 1.0.0 (2026-09-28)
|
||||||
|
|
||||||
|
Completed the app for Android which also brings many benefits to the Linux version.
|
||||||
|
|
||||||
|
**Android**
|
||||||
|
|
||||||
|
- upgraded from single notification to alarm
|
||||||
|
- platform specific APK to help reduce file size
|
||||||
|
|
||||||
|
**Both**
|
||||||
|
|
||||||
|
- automatic dark theme if system is set to dark
|
||||||
|
- input validation on sunset time and minutes
|
||||||
|
- alarm now properly resets if time is changed
|
||||||
|
- add optional time picker for sunset time field
|
||||||
|
- only do the permission request on Android
|
||||||
|
- more consistent verbiage and text styling
|
||||||
|
- enhanced icon and added monochrome
|
||||||
|
- added file necessary for F-Droid repo
|
||||||
|
- updated flutter package versions
|
||||||
|
|
||||||
|
This release has been tested tested tested, but only on emulators (x86_64). If you have any issues, please reach out.
|
||||||
|
|
||||||
|
From now on only the arm64-v8a APK will be provided.
|
||||||
|
|
||||||
|
## 0.1.2 (2026-09-28)
|
||||||
|
|
||||||
|
- add icon
|
||||||
|
- fix notification on Android
|
||||||
|
- allow minutes to be 0
|
||||||
|
- show toast if invalid minute value is provided
|
||||||
|
- enhance compile.sh to allow easier publications
|
||||||
|
- other small fixes and enhancements
|
||||||
|
|
||||||
|
## 0.1.1 (2026-09-13)
|
||||||
|
|
||||||
|
Linux version tested and now has alarm notification working.
|
||||||
|
|
||||||
|
Android still needs testing and fixes.
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
# To Be Done
|
||||||
|
|
||||||
|
Upcoming feature list. All notes subject to change.
|
||||||
|
|
||||||
|
## Patch
|
||||||
|
|
||||||
|
- Change time grabber to a checkbox so that it stays up to date.
|
||||||
|
|
||||||
|
## Minor
|
||||||
|
|
||||||
|
- Cancel and reschedule alarm when minutes are changed.
|
||||||
|
- Add languages (Spanish, Croatian).
|
||||||
|
|
||||||
|
## Major
|
||||||
|
|
||||||
|
- Add sunrise section and retitle app to Sunshine Alarm.
|
||||||
@@ -40,10 +40,30 @@ android {
|
|||||||
}
|
}
|
||||||
|
|
||||||
buildTypes {
|
buildTypes {
|
||||||
release {
|
getByName("release") {
|
||||||
// TODO: Add your own signing config for the release build.
|
// TODO: Add your own signing config for the release build.
|
||||||
// Signing with the debug keys for now, so `flutter run --release` works.
|
// Signing with the debug keys for now, so `flutter run --release` works.
|
||||||
signingConfig = signingConfigs.getByName("debug")
|
signingConfig = signingConfigs.getByName("debug")
|
||||||
|
|
||||||
|
/// 20260928 - Without minifying.
|
||||||
|
/// Built build/app/outputs/flutter-apk/app-release.apk (54.3MB)
|
||||||
|
/// Built build/app/outputs/flutter-apk/app-armeabi-v7a-release.apk (17.2MB)
|
||||||
|
/// Built build/app/outputs/flutter-apk/app-arm64-v8a-release.apk (19.8MB)
|
||||||
|
/// Built build/app/outputs/flutter-apk/app-x86_64-release.apk (21.2MB)
|
||||||
|
|
||||||
|
isMinifyEnabled = true
|
||||||
|
isShrinkResources = true
|
||||||
|
proguardFiles(
|
||||||
|
getDefaultProguardFile("proguard-android-optimize.txt"),
|
||||||
|
"proguard-rules.pro"
|
||||||
|
)
|
||||||
|
|
||||||
|
/// 20260928 - With minifying, helped some, but also used
|
||||||
|
/// in combination with `--obfuscate --split-debug-info=./debug-info/`
|
||||||
|
/// Built build/app/outputs/flutter-apk/app-release.apk (54.3MB)
|
||||||
|
/// Built build/app/outputs/flutter-apk/app-armeabi-v7a-release.apk (16.1MB)
|
||||||
|
/// Built build/app/outputs/flutter-apk/app-arm64-v8a-release.apk (18.8MB)
|
||||||
|
/// Built build/app/outputs/flutter-apk/app-x86_64-release.apk (20.3MB)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -55,3 +75,27 @@ dependencies {
|
|||||||
flutter {
|
flutter {
|
||||||
source = "../.."
|
source = "../.."
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// To use this, first be in $PROJ/android/, then run: ./gradlew printFlutterVariables
|
||||||
|
tasks.register("printFlutterVariables") {
|
||||||
|
description = "Print Local Flutter Variables"
|
||||||
|
doLast {
|
||||||
|
// android //
|
||||||
|
// compileSdk = flutter.compileSdkVersion
|
||||||
|
println("compileSdk: ${android.compileSdk}")
|
||||||
|
println("compileSdkVersion: ${android.compileSdkVersion}")
|
||||||
|
// ndkVersion = flutter.ndkVersion
|
||||||
|
println("ndkVersion: ${android.ndkVersion}")
|
||||||
|
|
||||||
|
// android.defaultConfig //
|
||||||
|
// minSdk = flutter.minSdkVersion
|
||||||
|
println("minSdk: ${android.defaultConfig.minSdk}")
|
||||||
|
// targetSdk = flutter.targetSdkVersion
|
||||||
|
println("targetSdk: ${android.defaultConfig.targetSdk}")
|
||||||
|
println("targetSdkVersion: ${android.defaultConfig.targetSdkVersion}")
|
||||||
|
// versionCode = flutter.versionCode
|
||||||
|
println("versionCode: ${android.defaultConfig.versionCode}")
|
||||||
|
// versionName = flutter.versionName
|
||||||
|
println("versionName: ${android.defaultConfig.versionName}")
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,13 +3,14 @@
|
|||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
>
|
>
|
||||||
|
|
||||||
|
<!-- Allow notifications to work. -->
|
||||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
|
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
|
||||||
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
|
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
|
||||||
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
|
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
|
||||||
<uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM"/>
|
<uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM"/>
|
||||||
<uses-permission android:name="android.permission.USE_EXACT_ALARM"/>
|
<uses-permission android:name="android.permission.USE_EXACT_ALARM"/>
|
||||||
|
|
||||||
<!--
|
<!-- Allow alarms to work. -->
|
||||||
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
|
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
|
||||||
<uses-permission android:name="android.permission.WAKE_LOCK"/>
|
<uses-permission android:name="android.permission.WAKE_LOCK"/>
|
||||||
<uses-permission android:name="android.permission.VIBRATE"/>
|
<uses-permission android:name="android.permission.VIBRATE"/>
|
||||||
@@ -25,10 +26,12 @@
|
|||||||
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
|
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
|
||||||
<uses-permission android:name="android.permission.WAKE_LOCK"/>
|
<uses-permission android:name="android.permission.WAKE_LOCK"/>
|
||||||
<uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM"/>
|
<uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM"/>
|
||||||
-->
|
|
||||||
|
<!-- Allow internet to work. -->
|
||||||
|
<uses-permission android:name="android.permission.INTERNET"/>
|
||||||
|
|
||||||
<application
|
<application
|
||||||
android:label="sunset_alarm"
|
android:label="Sunset Alarm"
|
||||||
android:name="${applicationName}"
|
android:name="${applicationName}"
|
||||||
android:icon="@mipmap/ic_launcher">
|
android:icon="@mipmap/ic_launcher">
|
||||||
<activity
|
<activity
|
||||||
@@ -59,6 +62,7 @@
|
|||||||
android:name="flutterEmbedding"
|
android:name="flutterEmbedding"
|
||||||
android:value="2" />
|
android:value="2" />
|
||||||
|
|
||||||
|
<!-- Allow notifications to work. -->
|
||||||
<receiver
|
<receiver
|
||||||
android:name="com.dexterous.flutterlocalnotifications.ScheduledNotificationReceiver"
|
android:name="com.dexterous.flutterlocalnotifications.ScheduledNotificationReceiver"
|
||||||
android:enabled="true" />
|
android:enabled="true" />
|
||||||
@@ -74,16 +78,14 @@
|
|||||||
</intent-filter>
|
</intent-filter>
|
||||||
</receiver>
|
</receiver>
|
||||||
|
|
||||||
<!--
|
<!-- Allow alarms to work. -->
|
||||||
<service
|
<service
|
||||||
android:name="com.gdelataillade.alarm.AlarmService"
|
android:name="com.gdelataillade.alarm.AlarmService"
|
||||||
android:foregroundServiceType="mediaPlayback"
|
android:foregroundServiceType="mediaPlayback"
|
||||||
android:exported="false" />
|
android:exported="false" />
|
||||||
|
|
||||||
<receiver
|
<receiver
|
||||||
android:name="com.gdelataillade.alarm.AlarmBroadcastReceiver"
|
android:name="com.gdelataillade.alarm.AlarmBroadcastReceiver"
|
||||||
android:exported="false" />
|
android:exported="false" />
|
||||||
|
|
||||||
<receiver
|
<receiver
|
||||||
android:name="com.gdelataillade.alarm.BootBroadcastReceiver"
|
android:name="com.gdelataillade.alarm.BootBroadcastReceiver"
|
||||||
android:enabled="false"
|
android:enabled="false"
|
||||||
@@ -92,7 +94,6 @@
|
|||||||
<action android:name="android.intent.action.BOOT_COMPLETED" />
|
<action android:name="android.intent.action.BOOT_COMPLETED" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</receiver>
|
</receiver>
|
||||||
|
|
||||||
<service
|
<service
|
||||||
android:name="dev.fluttercommunity.plus.androidalarmmanager.AlarmService"
|
android:name="dev.fluttercommunity.plus.androidalarmmanager.AlarmService"
|
||||||
android:permission="android.permission.BIND_JOB_SERVICE"
|
android:permission="android.permission.BIND_JOB_SERVICE"
|
||||||
@@ -111,7 +112,7 @@
|
|||||||
<action android:name="android.intent.action.BOOT_COMPLETED" />
|
<action android:name="android.intent.action.BOOT_COMPLETED" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</receiver>
|
</receiver>
|
||||||
-->
|
|
||||||
</application>
|
</application>
|
||||||
<!-- Required to query activities that can process text, see:
|
<!-- Required to query activities that can process text, see:
|
||||||
https://developer.android.com/training/package-visibility and
|
https://developer.android.com/training/package-visibility and
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 431 B |
|
After Width: | Height: | Size: 306 B |
@@ -10,3 +10,4 @@
|
|||||||
android:src="@mipmap/launch_image" />
|
android:src="@mipmap/launch_image" />
|
||||||
</item> -->
|
</item> -->
|
||||||
</layer-list>
|
</layer-list>
|
||||||
|
|
||||||
|
After Width: | Height: | Size: 574 B |
|
After Width: | Height: | Size: 842 B |
|
After Width: | Height: | Size: 1.2 KiB |
@@ -10,3 +10,4 @@
|
|||||||
android:src="@mipmap/launch_image" />
|
android:src="@mipmap/launch_image" />
|
||||||
</item> -->
|
</item> -->
|
||||||
</layer-list>
|
</layer-list>
|
||||||
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
<background android:drawable="@drawable/ic_launcher_background"/>
|
<background android:drawable="@color/ic_launcher_background"/>
|
||||||
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
|
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
|
||||||
<monochrome android:drawable="@mipmap/ic_launcher_foreground"/>
|
<monochrome android:drawable="@mipmap/ic_launcher_monochrome"/>
|
||||||
</adaptive-icon>
|
</adaptive-icon>
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
<background android:drawable="@drawable/ic_launcher_background"/>
|
<background android:drawable="@color/ic_launcher_background"/>
|
||||||
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
|
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
|
||||||
<monochrome android:drawable="@mipmap/ic_launcher_foreground"/>
|
<monochrome android:drawable="@mipmap/ic_launcher_monochrome"/>
|
||||||
</adaptive-icon>
|
</adaptive-icon>
|
||||||
|
After Width: | Height: | Size: 2.8 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 3.3 KiB |
|
Before Width: | Height: | Size: 910 B |
|
After Width: | Height: | Size: 2.5 KiB |
|
After Width: | Height: | Size: 2.8 KiB |
|
Before Width: | Height: | Size: 2.5 KiB |
|
After Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 818 B |
|
After Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 602 B |
|
After Width: | Height: | Size: 1.6 KiB |
|
After Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 4.0 KiB |
|
Before Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 5.0 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 3.6 KiB |
|
After Width: | Height: | Size: 4.0 KiB |
|
Before Width: | Height: | Size: 3.5 KiB |
|
After Width: | Height: | Size: 6.5 KiB |
|
Before Width: | Height: | Size: 2.2 KiB |
|
After Width: | Height: | Size: 9.1 KiB |
|
Before Width: | Height: | Size: 2.1 KiB |
|
After Width: | Height: | Size: 5.7 KiB |
|
After Width: | Height: | Size: 6.5 KiB |
|
Before Width: | Height: | Size: 5.7 KiB |
|
After Width: | Height: | Size: 9.8 KiB |
|
Before Width: | Height: | Size: 3.0 KiB |
|
After Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 3.0 KiB |
|
After Width: | Height: | Size: 7.6 KiB |
|
After Width: | Height: | Size: 9.8 KiB |
|
Before Width: | Height: | Size: 8.0 KiB |
@@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<color name="ic_launcher_background">#FFFFFF</color>
|
||||||
|
</resources>
|
||||||
@@ -1,7 +1,6 @@
|
|||||||
#Sat Sep 12 19:36:23 MST 2026
|
#Sat Sep 12 19:36:23 MST 2026
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-9.7.1-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-9.8.2-bin.zip
|
||||||
#distributionUrl=https\://services.gradle.org/distributions/gradle-9.1.0-bin.zip
|
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
@@ -19,12 +19,11 @@ pluginManagement {
|
|||||||
plugins {
|
plugins {
|
||||||
id("dev.flutter.flutter-plugin-loader") version "1.0.0"
|
id("dev.flutter.flutter-plugin-loader") version "1.0.0"
|
||||||
|
|
||||||
id("com.android.application") version "9.4.1" apply false
|
id("com.android.application") version "9.5.0" apply false
|
||||||
//id("com.android.application") version "9.0.1" apply false
|
|
||||||
|
|
||||||
// This will need removed in Gradle/AGP 9. JK - needs to exist otherwiese:
|
// This will need removed in Gradle/AGP 9. JK - needs to exist otherwiese:
|
||||||
// "Error: Your project's Kotlin version (2.2.10) is lower than Flutter's minimum supported version of 2.2.20."
|
// "Error: Your project's Kotlin version (2.2.10) is lower than Flutter's minimum supported version of 2.2.20."
|
||||||
id("org.jetbrains.kotlin.android") version "2.4.20" apply false
|
id("org.jetbrains.kotlin.android") version "2.4.21" apply false
|
||||||
}
|
}
|
||||||
|
|
||||||
include(":app")
|
include(":app")
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
AuthorName: 'Chad Michael "Hyperling" Greenwood'
|
||||||
|
AuthorEmail: 'me+sunset@hyperling.com'
|
||||||
|
AuthorWebSite: 'https://hyperling.com/about/'
|
||||||
|
Donate: 'https://hyperling.com/donate/'
|
||||||
|
Liberapay: 'HyperVegan'
|
||||||
|
Bitcoin: 'bc1qsfe8dkvry3d34kztz449gkq67wq8fu2nkgfkh0'
|
||||||
|
Litecoin: 'ltc1qavmpu5d6ljntxsd6jj548m4yys83zwscl0dzkx'
|
||||||
|
IssueTracker: 'https://hyperling.com/contact/'
|
||||||
|
Categories:
|
||||||
|
- fdroid
|
||||||
|
- hyperling
|
||||||
|
- utilities
|
||||||
|
Name: Sunset Timer
|
||||||
|
Summary: 'Play a notification at your chosen time before sunset.'
|
||||||
|
SourceCode: 'https://git.hyperling.com/me/flutter-sunset-alarm/'
|
||||||
|
WebSite: 'https://hyperling.com/apps/#sunset'
|
||||||
@@ -15,6 +15,7 @@ function log {
|
|||||||
function clean_flutter {
|
function clean_flutter {
|
||||||
log "Cleaning..."
|
log "Cleaning..."
|
||||||
flutter clean
|
flutter clean
|
||||||
|
echo "Done!"
|
||||||
}
|
}
|
||||||
|
|
||||||
## Variables ##
|
## Variables ##
|
||||||
@@ -31,7 +32,7 @@ version=""
|
|||||||
for i in `grep version $app_details`; do
|
for i in `grep version $app_details`; do
|
||||||
version="$i"
|
version="$i"
|
||||||
done
|
done
|
||||||
version="v${version// /_}"
|
version="${version// /_}"
|
||||||
|
|
||||||
if [[ -z $name || -z $version ]]; then
|
if [[ -z $name || -z $version ]]; then
|
||||||
echo "ERROR: Could not retrieve name or version. name='$name' version='$version'"
|
echo "ERROR: Could not retrieve name or version. name='$name' version='$version'"
|
||||||
@@ -41,30 +42,81 @@ fi
|
|||||||
RELEASE="release/$name-$version"
|
RELEASE="release/$name-$version"
|
||||||
echo "Running for '$RELEASE'."
|
echo "Running for '$RELEASE'."
|
||||||
|
|
||||||
|
BUILD_OPTIONS=(
|
||||||
|
--release
|
||||||
|
--obfuscate
|
||||||
|
--split-debug-info=./debug-info/
|
||||||
|
--extra-gen-snapshot-options="--strip"
|
||||||
|
)
|
||||||
|
|
||||||
## Main ##
|
## Main ##
|
||||||
|
|
||||||
clean_flutter
|
clean_flutter
|
||||||
|
|
||||||
|
# Linux
|
||||||
|
|
||||||
log "Building Linux Bundle..."
|
log "Building Linux Bundle..."
|
||||||
flutter build linux
|
set -x
|
||||||
|
flutter build linux ${BUILD_OPTIONS[@]}
|
||||||
|
set +x
|
||||||
|
|
||||||
log "Saving Linux Bundle..."
|
log "- zip"
|
||||||
filename=$RELEASE.linux-bundle.zip
|
filename=$RELEASE.linux-bundle.zip
|
||||||
|
contents="build/linux/x64/release/bundle/"
|
||||||
if [[ -e $filename ]]; then
|
if [[ -e $filename ]]; then
|
||||||
rm -v $filename
|
rm -v $filename
|
||||||
fi
|
fi
|
||||||
zip -r $filename build/linux/x64/release/bundle/*
|
set -x
|
||||||
|
zip -qr "$filename" "$contents"/*
|
||||||
|
set +x
|
||||||
ls -sh $filename
|
ls -sh $filename
|
||||||
|
|
||||||
clean_flutter
|
log "- tar"
|
||||||
|
filename=$RELEASE.linux-bundle.tar
|
||||||
log "Building APK..."
|
if [[ -e "$filename"* ]]; then
|
||||||
flutter build apk
|
rm -v "$filename"*
|
||||||
|
|
||||||
log "Saving APK..."
|
|
||||||
filename=$RELEASE.apk
|
|
||||||
if [[ -e $filename ]]; then
|
|
||||||
rm -v $filename
|
|
||||||
fi
|
fi
|
||||||
cp -v build/app/outputs/flutter-apk/app-release.apk $filename
|
set -x
|
||||||
ls -sh $filename
|
tar -c --zstd -f "${filename}.zst" -C "$contents" .
|
||||||
|
tar -cz -f "${filename}.gz" -C "$contents" .
|
||||||
|
tar -cJ -f "${filename}.xz" -C "$contents" .
|
||||||
|
set +x
|
||||||
|
ls -sh "$filename"* | sort -h
|
||||||
|
|
||||||
|
# Android
|
||||||
|
|
||||||
|
log "Building Universal APK..."
|
||||||
|
# Creates a generic (and large) app-release.apk
|
||||||
|
set -x
|
||||||
|
flutter build apk ${BUILD_OPTIONS[@]}
|
||||||
|
set +x
|
||||||
|
|
||||||
|
#log "Saving Universal APK..."
|
||||||
|
#apk="build/app/outputs/flutter-apk/app-release.apk"
|
||||||
|
#filename=`basename $apk`
|
||||||
|
#filename=${filename//app/${RELEASE}}
|
||||||
|
#if [[ -e $filename ]]; then
|
||||||
|
# rm -v $filename
|
||||||
|
#fi
|
||||||
|
#cp -v "$apk" "$filename"
|
||||||
|
#ls -sh "$filename"
|
||||||
|
|
||||||
|
log "Building Individual APKs..."
|
||||||
|
# Creates files such as build/app/outputs/flutter-apk/app-arm64-v8a-release.apk
|
||||||
|
set -x
|
||||||
|
flutter build apk ${BUILD_OPTIONS[@]} --split-per-abi
|
||||||
|
set +x
|
||||||
|
|
||||||
|
log "Saving APKs..."
|
||||||
|
for apk in `ls build/app/outputs/flutter-apk/app*release.apk`; do
|
||||||
|
#if [[ "$apk" == *"x86"* ]]; then echo "Skipping $apk" continue; fi
|
||||||
|
#log "APK: $apk"
|
||||||
|
filename=`basename $apk`
|
||||||
|
filename=${filename//app/${RELEASE}}
|
||||||
|
cp -v "$apk" "$filename"
|
||||||
|
done
|
||||||
|
ls -sh release/*.apk | sort -h
|
||||||
|
|
||||||
|
# Finish
|
||||||
|
|
||||||
|
exit 0
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
description: This file stores settings for Dart & Flutter DevTools.
|
||||||
|
documentation: https://docs.flutter.dev/tools/devtools/extensions#configure-extension-enablement-states
|
||||||
|
extensions:
|
||||||
@@ -8,28 +8,54 @@ import 'package:flutter_local_notifications/flutter_local_notifications.dart';
|
|||||||
import 'package:timezone/data/latest_all.dart' as tz;
|
import 'package:timezone/data/latest_all.dart' as tz;
|
||||||
import 'package:timezone/timezone.dart' as tz;
|
import 'package:timezone/timezone.dart' as tz;
|
||||||
import 'package:http/http.dart' as http;
|
import 'package:http/http.dart' as http;
|
||||||
//import 'package:alarm/alarm.dart';
|
import 'package:alarm/alarm.dart';
|
||||||
|
|
||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
|
|
||||||
|
// For trusting Let's Encrypt on older devices (SDK 24, Android 7)
|
||||||
|
//import 'dart:io';
|
||||||
|
//import 'package:http/http.dart' as http;
|
||||||
|
import 'package:flutter/services.dart' show rootBundle;
|
||||||
|
|
||||||
void main() async {
|
void main() async {
|
||||||
WidgetsFlutterBinding.ensureInitialized();
|
WidgetsFlutterBinding.ensureInitialized();
|
||||||
|
|
||||||
|
final certData = await rootBundle.load(
|
||||||
|
'media/certs/open-meteo-com_isrg-root-x1.pem',
|
||||||
|
);
|
||||||
|
SecurityContext.defaultContext.setTrustedCertificatesBytes(
|
||||||
|
certData.buffer.asUint8List(),
|
||||||
|
);
|
||||||
|
|
||||||
tz.initializeTimeZones();
|
tz.initializeTimeZones();
|
||||||
//await Alarm.init();
|
await Alarm.init();
|
||||||
runApp(const SunsetAlarmApp());
|
runApp(const SunsetAlarmApp());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const ANDROID_USE_NOTIF = false;
|
||||||
|
const ANDROID_USE_ALARM = !ANDROID_USE_NOTIF;
|
||||||
|
|
||||||
class SunsetAlarmApp extends StatelessWidget {
|
class SunsetAlarmApp extends StatelessWidget {
|
||||||
const SunsetAlarmApp({super.key});
|
const SunsetAlarmApp({super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
const seedColor = Colors.deepOrange;
|
||||||
return MaterialApp(
|
return MaterialApp(
|
||||||
title: 'Sunset Alarm',
|
title: 'Sunset Alarm',
|
||||||
theme: ThemeData(
|
theme: ThemeData(
|
||||||
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepOrange),
|
colorScheme: ColorScheme.fromSeed(
|
||||||
useMaterial3: true,
|
seedColor: seedColor,
|
||||||
|
brightness: Brightness.light,
|
||||||
),
|
),
|
||||||
|
),
|
||||||
|
darkTheme: ThemeData(
|
||||||
|
colorScheme: ColorScheme.fromSeed(
|
||||||
|
seedColor: seedColor,
|
||||||
|
brightness: Brightness.dark,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
themeMode: ThemeMode.system,
|
||||||
home: const HomeScreen(),
|
home: const HomeScreen(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -45,15 +71,20 @@ class HomeScreen extends StatefulWidget {
|
|||||||
class _HomeScreenState extends State<HomeScreen> {
|
class _HomeScreenState extends State<HomeScreen> {
|
||||||
final _latController = TextEditingController();
|
final _latController = TextEditingController();
|
||||||
final _lngController = TextEditingController();
|
final _lngController = TextEditingController();
|
||||||
final _sunsetController = TextEditingController();
|
final _sunsetController = TextEditingController(text: "18:00");
|
||||||
final _minutesController = TextEditingController(text: '30');
|
final _minutesController = TextEditingController(text: "30");
|
||||||
|
|
||||||
final FlutterLocalNotificationsPlugin _notifications =
|
final FlutterLocalNotificationsPlugin _notifications =
|
||||||
FlutterLocalNotificationsPlugin();
|
FlutterLocalNotificationsPlugin();
|
||||||
|
|
||||||
|
bool _loading = false;
|
||||||
bool _alarmEnabled = false;
|
bool _alarmEnabled = false;
|
||||||
int _minutesBefore = 30;
|
int _minutesBefore = 30;
|
||||||
bool _loading = false;
|
String _plural = 's';
|
||||||
|
|
||||||
|
String? _sunsetErrorText;
|
||||||
|
String? _minuteErrorText;
|
||||||
|
bool _validTime = false;
|
||||||
|
|
||||||
static const _alarmId = 1001;
|
static const _alarmId = 1001;
|
||||||
|
|
||||||
@@ -82,15 +113,20 @@ class _HomeScreenState extends State<HomeScreen> {
|
|||||||
Future<void> _loadPrefs() async {
|
Future<void> _loadPrefs() async {
|
||||||
final prefs = await SharedPreferences.getInstance();
|
final prefs = await SharedPreferences.getInstance();
|
||||||
setState(() {
|
setState(() {
|
||||||
final lat = prefs.getDouble('lat');
|
final lat = prefs.getDouble('lat').toString();
|
||||||
final lng = prefs.getDouble('lng');
|
final lng = prefs.getDouble('lng').toString();
|
||||||
final sunset = prefs.getString('sunset_time');
|
final sun = prefs.getString('sunset_time');
|
||||||
_alarmEnabled = prefs.getBool('alarm_enabled') ?? false;
|
_latController.text = (lat == "null") ? "" : lat;
|
||||||
|
_lngController.text = (lng == "null") ? "" : lng;
|
||||||
|
_sunsetController.text = sun ?? "";
|
||||||
|
|
||||||
_minutesBefore = prefs.getInt('minutes_before') ?? 30;
|
_minutesBefore = prefs.getInt('minutes_before') ?? 30;
|
||||||
if (lat != null) _latController.text = lat.toString();
|
_minutesController.text = _minutesBefore.toString();
|
||||||
if (lng != null) _lngController.text = lng.toString();
|
|
||||||
if (sunset != null) _sunsetController.text = sunset;
|
_alarmEnabled = prefs.getBool('alarm_enabled') ?? false;
|
||||||
_minutesController.text = '$_minutesBefore';
|
_validTime = prefs.getBool('valid_time') ?? false;
|
||||||
|
|
||||||
|
_calcPlural();
|
||||||
});
|
});
|
||||||
if (_alarmEnabled && _sunsetController.text.isNotEmpty) {
|
if (_alarmEnabled && _sunsetController.text.isNotEmpty) {
|
||||||
_scheduleAlarm();
|
_scheduleAlarm();
|
||||||
@@ -108,20 +144,21 @@ class _HomeScreenState extends State<HomeScreen> {
|
|||||||
}
|
}
|
||||||
await prefs.setBool('alarm_enabled', _alarmEnabled);
|
await prefs.setBool('alarm_enabled', _alarmEnabled);
|
||||||
await prefs.setInt('minutes_before', _minutesBefore);
|
await prefs.setInt('minutes_before', _minutesBefore);
|
||||||
|
await prefs.setBool('valid_time', _validTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _getGpsLocation() async {
|
Future<void> _getGpsLocation() async {
|
||||||
try {
|
try {
|
||||||
bool serviceEnabled = await Geolocator.isLocationServiceEnabled();
|
bool serviceEnabled = await Geolocator.isLocationServiceEnabled();
|
||||||
if (!serviceEnabled) {
|
if (!serviceEnabled) {
|
||||||
_showSnack('Location services are disabled.');
|
_showSnack('Location Services Disabled');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
LocationPermission permission = await Geolocator.checkPermission();
|
LocationPermission permission = await Geolocator.checkPermission();
|
||||||
if (permission == LocationPermission.denied) {
|
if (permission == LocationPermission.denied) {
|
||||||
permission = await Geolocator.requestPermission();
|
permission = await Geolocator.requestPermission();
|
||||||
if (permission == LocationPermission.denied) {
|
if (permission == LocationPermission.denied) {
|
||||||
_showSnack('Location permission denied.');
|
_showSnack('Location Permission Denied');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -133,9 +170,9 @@ class _HomeScreenState extends State<HomeScreen> {
|
|||||||
_lngController.text = position.longitude.toString();
|
_lngController.text = position.longitude.toString();
|
||||||
});
|
});
|
||||||
await _savePrefs();
|
await _savePrefs();
|
||||||
_showSnack('Location updated.');
|
_showSnack('Location Updated.');
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
_showSnack('GPS error: $e');
|
_showSnack('GPS Error: $e');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -143,7 +180,7 @@ class _HomeScreenState extends State<HomeScreen> {
|
|||||||
final lat = double.tryParse(_latController.text);
|
final lat = double.tryParse(_latController.text);
|
||||||
final lng = double.tryParse(_lngController.text);
|
final lng = double.tryParse(_lngController.text);
|
||||||
if (lat == null || lng == null) {
|
if (lat == null || lng == null) {
|
||||||
_showSnack('Enter valid latitude and longitude first.');
|
_showSnack('Enter Valid Latitude & Longitude');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -161,35 +198,27 @@ class _HomeScreenState extends State<HomeScreen> {
|
|||||||
final timePart = sunsetStr.split('T')[1];
|
final timePart = sunsetStr.split('T')[1];
|
||||||
setState(() => _sunsetController.text = timePart);
|
setState(() => _sunsetController.text = timePart);
|
||||||
await _savePrefs();
|
await _savePrefs();
|
||||||
_showSnack('Sunset: $timePart');
|
_showSnack('Sunset Time Retrieved: $timePart');
|
||||||
} else {
|
} else {
|
||||||
_showSnack('API error: ${response.statusCode}');
|
_showSnack('API Error: ${response.statusCode}');
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
_showSnack('Network error: $e');
|
_showSnack('Network Error: $e');
|
||||||
} finally {
|
} finally {
|
||||||
setState(() => _loading = false);
|
setState(() {
|
||||||
|
_loading = false;
|
||||||
|
_validTime = true;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_alarmEnabled) {
|
||||||
|
_scheduleAlarm();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Timer? _alarmTimer;
|
Timer? _alarmTimer;
|
||||||
|
|
||||||
Future<void> _scheduleAlarm() async {
|
Future<void> _scheduleAlarm() async {
|
||||||
// Get the Notifications permission:
|
|
||||||
final android =
|
|
||||||
_notifications
|
|
||||||
.resolvePlatformSpecificImplementation<
|
|
||||||
AndroidFlutterLocalNotificationsPlugin
|
|
||||||
>();
|
|
||||||
await android?.requestNotificationsPermission();
|
|
||||||
|
|
||||||
// Ensure that Android has the correct alarm permissions.
|
|
||||||
final canSchedule = await android?.canScheduleExactNotifications();
|
|
||||||
if (canSchedule != true) {
|
|
||||||
_showSnack('Permissions not yet granted, requesting...');
|
|
||||||
await android?.requestExactAlarmsPermission();
|
|
||||||
}
|
|
||||||
|
|
||||||
final sunsetText = _sunsetController.text.trim();
|
final sunsetText = _sunsetController.text.trim();
|
||||||
if (sunsetText.isEmpty) return;
|
if (sunsetText.isEmpty) return;
|
||||||
|
|
||||||
@@ -207,7 +236,7 @@ class _HomeScreenState extends State<HomeScreen> {
|
|||||||
alarmTime = alarmTime.subtract(Duration(minutes: _minutesBefore));
|
alarmTime = alarmTime.subtract(Duration(minutes: _minutesBefore));
|
||||||
|
|
||||||
if (alarmTime.isBefore(now)) {
|
if (alarmTime.isBefore(now)) {
|
||||||
_showSnack('Alarm time is in the past. Will fire tomorrow.');
|
_showSnack('Alarm Time In Past - Will Start Tomorrow');
|
||||||
alarmTime = alarmTime.add(const Duration(days: 1));
|
alarmTime = alarmTime.add(const Duration(days: 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -223,16 +252,32 @@ class _HomeScreenState extends State<HomeScreen> {
|
|||||||
);
|
);
|
||||||
_notifications.show(
|
_notifications.show(
|
||||||
id: _alarmId,
|
id: _alarmId,
|
||||||
title: 'Sunset in ${_minutesBefore} min',
|
title: 'Sunset in ${_minutesBefore} min!',
|
||||||
body: 'The sun sets at $sunsetText. Time to get ready!',
|
body: 'The sun sets at $sunsetText.',
|
||||||
notificationDetails: const NotificationDetails(linux: linuxDetails),
|
notificationDetails: const NotificationDetails(linux: linuxDetails),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
_showSnack(
|
_showSnack(
|
||||||
'Alarm set for ${alarmTime.hour.toString().padLeft(2, '0')}:${alarmTime.minute.toString().padLeft(2, '0')} (app must stay open)',
|
'Alarm Enabled @ ${alarmTime.hour.toString().padLeft(2, '0')}:${alarmTime.minute.toString().padLeft(2, '0')} (App Must Stay Open!)',
|
||||||
);
|
);
|
||||||
} else if (Platform.isAndroid) {
|
} else if (Platform.isAndroid) {
|
||||||
/*** Notifcation Method - Works ***/
|
// Get the Notifications permission:
|
||||||
|
final android =
|
||||||
|
_notifications
|
||||||
|
.resolvePlatformSpecificImplementation<
|
||||||
|
AndroidFlutterLocalNotificationsPlugin
|
||||||
|
>();
|
||||||
|
await android?.requestNotificationsPermission();
|
||||||
|
|
||||||
|
// Ensure that Android has the correct alarm permissions.
|
||||||
|
final canSchedule = await android?.canScheduleExactNotifications();
|
||||||
|
if (canSchedule != true) {
|
||||||
|
_showSnack('Permissions Need Granted, Requesting...');
|
||||||
|
await android?.requestExactAlarmsPermission();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*** Notification Method - Works ***/
|
||||||
|
if (ANDROID_USE_NOTIF) {
|
||||||
// Android: use zonedSchedule (works in background)
|
// Android: use zonedSchedule (works in background)
|
||||||
final tzAlarm = tz.TZDateTime.from(alarmTime, tz.local);
|
final tzAlarm = tz.TZDateTime.from(alarmTime, tz.local);
|
||||||
const androidDetails = AndroidNotificationDetails(
|
const androidDetails = AndroidNotificationDetails(
|
||||||
@@ -249,38 +294,45 @@ class _HomeScreenState extends State<HomeScreen> {
|
|||||||
title: 'Sunset in ${_minutesBefore} min',
|
title: 'Sunset in ${_minutesBefore} min',
|
||||||
body: 'The sun sets at $sunsetText. Time to get ready!',
|
body: 'The sun sets at $sunsetText. Time to get ready!',
|
||||||
scheduledDate: tzAlarm,
|
scheduledDate: tzAlarm,
|
||||||
notificationDetails: const NotificationDetails(android: androidDetails),
|
notificationDetails: const NotificationDetails(
|
||||||
|
android: androidDetails,
|
||||||
|
),
|
||||||
androidScheduleMode: AndroidScheduleMode.alarmClock,
|
androidScheduleMode: AndroidScheduleMode.alarmClock,
|
||||||
);
|
);
|
||||||
_showSnack('Alarm scheduled!');
|
_showSnack('Alarm scheduled!');
|
||||||
debugPrint('DEBUG: Alarm time: ${tzAlarm.toString()}');
|
debugPrint('DEBUG: Alarm time: ${tzAlarm.toString()}');
|
||||||
debugPrint('DEBUG: Current time: ${DateTime.now().toUtc().toString()}');
|
debugPrint('DEBUG: Current time: ${DateTime.now().toUtc().toString()}');
|
||||||
debugPrint('DEBUG: ${_notifications.toString()}');
|
debugPrint('DEBUG: ${_notifications.toString()}');
|
||||||
|
}
|
||||||
// End Notification Method ***/
|
// End Notification Method ***/
|
||||||
|
|
||||||
/*** Alarm Method - WIP *** /
|
/*** Alarm Method - Works ***/
|
||||||
|
if (ANDROID_USE_ALARM) {
|
||||||
// Schedule:
|
// Schedule:
|
||||||
final settings = AlarmSettings(
|
final settings = AlarmSettings(
|
||||||
id: 42,
|
id: _alarmId,
|
||||||
dateTime: alarmTime, // your computed sunset time
|
dateTime: alarmTime,
|
||||||
assetAudioPath: 'assets/alarm.mp3', // put an alarm sound in assets/
|
//assetAudioPath: 'assets/alarm.mp3', // use default rather than custom
|
||||||
loopAudio: true, // keeps ringing until dismissed
|
loopAudio: true, // keeps ringing until dismissed
|
||||||
vibrate: true,
|
vibrate: true,
|
||||||
androidFullScreenIntent: true, // wakes screen like clock app
|
androidFullScreenIntent: true, // wakes screen like clock app
|
||||||
volumeSettings: VolumeSettings.fade(
|
volumeSettings: VolumeSettings.fade(
|
||||||
volume: 0.8,
|
//volume: 0.8, // use default rather than custom
|
||||||
fadeDuration: Duration(seconds: 5),
|
fadeDuration: Duration(seconds: 60),
|
||||||
),
|
),
|
||||||
notificationSettings: const NotificationSettings(
|
notificationSettings: NotificationSettings(
|
||||||
title: 'Sunset Alarm',
|
title: 'Sunset Alarm',
|
||||||
body: 'The sun sets now. Time to get ready!',
|
body: 'Sun is setting in ${_minutesBefore} minute${_plural}!',
|
||||||
stopButton: 'Dismiss',
|
stopButton: 'Dismiss',
|
||||||
|
icon: 'ic_notification',
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
await Alarm.set(alarmSettings: settings);
|
await Alarm.set(alarmSettings: settings);
|
||||||
|
}
|
||||||
// End Alarm Method ***/
|
// End Alarm Method ***/
|
||||||
|
_showSnack('Alarm Scheduled @ ${alarmTime}');
|
||||||
} else {
|
} else {
|
||||||
_showSnack('Platform not detected, unsure how to show alarm.');
|
_showSnack('Platform Not Detected - Contact Developer');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -290,13 +342,25 @@ class _HomeScreenState extends State<HomeScreen> {
|
|||||||
if (value) {
|
if (value) {
|
||||||
await _scheduleAlarm();
|
await _scheduleAlarm();
|
||||||
} else {
|
} else {
|
||||||
|
_stopAlarm();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> _stopAlarm() async {
|
||||||
|
if (Platform.isLinux) {
|
||||||
_alarmTimer?.cancel();
|
_alarmTimer?.cancel();
|
||||||
if (!Platform.isLinux) {
|
} else if (Platform.isAndroid) {
|
||||||
|
// Notification Method
|
||||||
|
if (ANDROID_USE_NOTIF) {
|
||||||
await _notifications.cancel(id: _alarmId);
|
await _notifications.cancel(id: _alarmId);
|
||||||
}
|
}
|
||||||
_showSnack('Alarm cancelled.');
|
// Alarm Method
|
||||||
|
if (ANDROID_USE_ALARM) {
|
||||||
|
await Alarm.stop(_alarmId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
_showSnack('Alarm Cancelled');
|
||||||
|
}
|
||||||
|
|
||||||
void _showSnack(String msg) {
|
void _showSnack(String msg) {
|
||||||
ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text(msg)));
|
ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text(msg)));
|
||||||
@@ -304,6 +368,7 @@ class _HomeScreenState extends State<HomeScreen> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
|
_savePrefs();
|
||||||
_latController.dispose();
|
_latController.dispose();
|
||||||
_lngController.dispose();
|
_lngController.dispose();
|
||||||
_sunsetController.dispose();
|
_sunsetController.dispose();
|
||||||
@@ -311,11 +376,36 @@ class _HomeScreenState extends State<HomeScreen> {
|
|||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String? _validateTime(String? value) {
|
||||||
|
setState(() {
|
||||||
|
_validTime = false;
|
||||||
|
});
|
||||||
|
if (value == null || !RegExp(r'^\d{2}:\d{2}$').hasMatch(value)) {
|
||||||
|
return 'Use HH:MM Format';
|
||||||
|
}
|
||||||
|
final h = int.parse(value.substring(0, 2));
|
||||||
|
final m = int.parse(value.substring(3, 5));
|
||||||
|
if (h > 23) return 'Hour Must Be 0–23';
|
||||||
|
if (m > 59) return 'Minute Must Be 0–59';
|
||||||
|
setState(() {
|
||||||
|
_validTime = true;
|
||||||
|
});
|
||||||
|
return null; // valid
|
||||||
|
}
|
||||||
|
|
||||||
|
void _calcPlural() {
|
||||||
|
setState(() {
|
||||||
|
_plural = (_minutesBefore == 1) ? '' : 's';
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(title: const Text('Sunset Alarm')),
|
appBar: AppBar(title: const Text('Sunset Alarm')),
|
||||||
body: Padding(
|
resizeToAvoidBottomInset: true, // default, but be explicit
|
||||||
|
body: SingleChildScrollView(
|
||||||
|
child: Padding(
|
||||||
padding: const EdgeInsets.all(16),
|
padding: const EdgeInsets.all(16),
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
@@ -360,7 +450,7 @@ class _HomeScreenState extends State<HomeScreen> {
|
|||||||
const SizedBox(width: 8),
|
const SizedBox(width: 8),
|
||||||
IconButton.filledTonal(
|
IconButton.filledTonal(
|
||||||
icon: const Icon(Icons.my_location),
|
icon: const Icon(Icons.my_location),
|
||||||
tooltip: 'Get GPS location',
|
tooltip: 'Get GPS Location',
|
||||||
onPressed: _getGpsLocation,
|
onPressed: _getGpsLocation,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@@ -378,11 +468,49 @@ class _HomeScreenState extends State<HomeScreen> {
|
|||||||
Expanded(
|
Expanded(
|
||||||
child: TextField(
|
child: TextField(
|
||||||
controller: _sunsetController,
|
controller: _sunsetController,
|
||||||
decoration: const InputDecoration(
|
decoration: InputDecoration(
|
||||||
labelText: 'Sunset time (HH:MM)',
|
labelText: 'Sunset Time (HH:MM)',
|
||||||
border: OutlineInputBorder(),
|
border: OutlineInputBorder(),
|
||||||
|
errorText: _sunsetErrorText,
|
||||||
|
suffixIcon: IconButton(
|
||||||
|
icon: Icon(Icons.access_time),
|
||||||
|
onPressed: () async {
|
||||||
|
final picked = await showTimePicker(
|
||||||
|
context: context,
|
||||||
|
initialTime: TimeOfDay.now(),
|
||||||
|
);
|
||||||
|
if (picked != null) {
|
||||||
|
_sunsetController.text =
|
||||||
|
'${picked.hour.toString().padLeft(2, '0')}:'
|
||||||
|
'${picked.minute.toString().padLeft(2, '0')}';
|
||||||
|
setState(
|
||||||
|
() =>
|
||||||
|
_sunsetErrorText = _validateTime(
|
||||||
|
_sunsetController.text,
|
||||||
),
|
),
|
||||||
onChanged: (_) => _savePrefs(),
|
);
|
||||||
|
if (_alarmEnabled) {
|
||||||
|
_scheduleAlarm();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
onChanged: (v) {
|
||||||
|
if (v == "") {
|
||||||
|
_stopAlarm();
|
||||||
|
}
|
||||||
|
final val = _validateTime(v);
|
||||||
|
if (val == null) {
|
||||||
|
_savePrefs();
|
||||||
|
if (_alarmEnabled) {
|
||||||
|
_scheduleAlarm();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
setState(() {
|
||||||
|
_sunsetErrorText = val;
|
||||||
|
});
|
||||||
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(width: 8),
|
const SizedBox(width: 8),
|
||||||
@@ -395,58 +523,73 @@ class _HomeScreenState extends State<HomeScreen> {
|
|||||||
child: CircularProgressIndicator(strokeWidth: 2),
|
child: CircularProgressIndicator(strokeWidth: 2),
|
||||||
)
|
)
|
||||||
: const Icon(Icons.cloud_done_outlined),
|
: const Icon(Icons.cloud_done_outlined),
|
||||||
tooltip: 'Fetch sunset from Open-Meteo',
|
tooltip: 'Fetch Open-Meteo Sunset Data',
|
||||||
onPressed: _loading ? null : _fetchSunset,
|
onPressed: () {
|
||||||
|
if (!_loading) {
|
||||||
|
_fetchSunset();
|
||||||
|
}
|
||||||
|
},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
const SizedBox(height: 16),
|
const SizedBox(height: 16),
|
||||||
|
|
||||||
// --- Minutes before ---
|
|
||||||
const Text(
|
const Text(
|
||||||
'Alert Before Sunset',
|
'Alert',
|
||||||
style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
|
style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 8),
|
const SizedBox(height: 8),
|
||||||
Row(
|
|
||||||
children: [
|
// --- Minutes before ---
|
||||||
const Text('Minutes before: '),
|
TextField(
|
||||||
SizedBox(
|
|
||||||
width: 80,
|
|
||||||
child: TextField(
|
|
||||||
controller: _minutesController,
|
controller: _minutesController,
|
||||||
keyboardType: TextInputType.number,
|
keyboardType: TextInputType.number,
|
||||||
decoration: const InputDecoration(
|
decoration: InputDecoration(
|
||||||
border: OutlineInputBorder(),
|
border: OutlineInputBorder(),
|
||||||
|
labelText: 'Minutes Before Sunset',
|
||||||
|
errorText: _minuteErrorText,
|
||||||
),
|
),
|
||||||
onChanged: (v) {
|
onChanged: (v) {
|
||||||
final val = int.tryParse(v);
|
final val = int.tryParse(v);
|
||||||
if (val != null && val >= 0) {
|
setState(() {
|
||||||
|
if (val != null) {
|
||||||
|
_minuteErrorText = null;
|
||||||
_minutesBefore = val;
|
_minutesBefore = val;
|
||||||
} else {
|
} else {
|
||||||
_showSnack('Invalid Minute Value');
|
_minuteErrorText = 'Invalid Minute Value';
|
||||||
}
|
}
|
||||||
|
_calcPlural();
|
||||||
|
});
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
const SizedBox(height: 24),
|
|
||||||
|
|
||||||
// --- Toggle ---
|
// --- Toggle ---
|
||||||
SwitchListTile(
|
SwitchListTile(
|
||||||
title: const Text('Enable Sunset Alarm'),
|
title: Center(
|
||||||
subtitle: Text(
|
child: Text(
|
||||||
_alarmEnabled
|
_validTime
|
||||||
? 'Will alert ${_minutesBefore} min before sunset. ($_alarmDisplayTime)'
|
? _alarmEnabled
|
||||||
: 'Alarm is off',
|
? "Sunset Alarm Enabled"
|
||||||
|
: "Enable"
|
||||||
|
: "Disabled",
|
||||||
),
|
),
|
||||||
value: _alarmEnabled,
|
),
|
||||||
onChanged: _toggleAlarm,
|
subtitle: Center(
|
||||||
|
child: Text(
|
||||||
|
_validTime
|
||||||
|
? _alarmEnabled
|
||||||
|
? "${_minutesBefore} Minute${_plural} Before @ $_alarmDisplayTime"
|
||||||
|
: "Sunset Alarm"
|
||||||
|
: "Enter Valid Time",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
value: _validTime ? _alarmEnabled : false,
|
||||||
|
onChanged: _validTime ? _toggleAlarm : null,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,31 @@
|
|||||||
|
-----BEGIN CERTIFICATE-----
|
||||||
|
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
|
||||||
|
-----END CERTIFICATE-----
|
||||||
|
After Width: | Height: | Size: 4.6 KiB |
|
After Width: | Height: | Size: 2.0 KiB |
|
After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 3.6 KiB |
|
After Width: | Height: | Size: 3.5 KiB |
@@ -1,7 +1,7 @@
|
|||||||
name: sunset_alarm
|
name: sunset_alarm
|
||||||
description: "Set an alarm to go off a specified time before sunset."
|
description: "Set an alarm to go off a specified time before sunset."
|
||||||
publish_to: 'none'
|
publish_to: 'none'
|
||||||
version: 0.1.2
|
version: 1.1.0
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ^3.7.2
|
sdk: ^3.7.2
|
||||||
@@ -23,3 +23,5 @@ dev_dependencies:
|
|||||||
|
|
||||||
flutter:
|
flutter:
|
||||||
uses-material-design: true
|
uses-material-design: true
|
||||||
|
assets:
|
||||||
|
- media/certs/
|
||||||