Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
95e9134608 | ||
|
|
57a211a518 | ||
|
|
d432de170d | ||
|
|
720866f6b4 | ||
|
|
7c7b8e473c | ||
|
|
e7b5dd768c | ||
|
|
fb76a04c58 | ||
|
|
8060c0755a | ||
|
|
17d69fb3a7 | ||
|
|
b6ae6b1f10 | ||
|
|
b02ca20072 | ||
|
|
e04aa9f447 | ||
|
|
3bb3123a12 | ||
|
|
f0b723e158 | ||
|
|
8adaecbf7d | ||
|
|
f212f9927b | ||
|
|
08e9ff66b7 | ||
|
|
cfd0ca514d | ||
|
|
66f42a5141 | ||
|
|
e163a2e290 | ||
|
|
7eaa2dc3a4 | ||
|
|
f432e0b406 | ||
|
|
220df450c3 | ||
|
|
14c75e8331 | ||
|
|
eafa6ffa5f | ||
|
|
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 |
No files matched your search
@@ -57,6 +57,10 @@ unlinked_spec.ds
|
||||
**/android/**/GeneratedPluginRegistrant.java
|
||||
**/android/key.properties
|
||||
*.jks
|
||||
android/build
|
||||
android/app/build
|
||||
android/release
|
||||
android/app/release
|
||||
|
||||
# iOS/XCode related
|
||||
**/ios/**/*.mode1v3
|
||||
@@ -122,6 +126,9 @@ app.*.symbols
|
||||
# Gradle files
|
||||
.gradle/
|
||||
build/
|
||||
android/app/release/*
|
||||
android/build/*
|
||||
android/app/build/*
|
||||
|
||||
# Local configuration file (sdk path, etc)
|
||||
local.properties
|
||||
|
||||
@@ -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,70 @@
|
||||
# Changelog
|
||||
|
||||
## 1.2.0 (2026-11-11)
|
||||
|
||||
- Automatically enable next day's alarm when the current day's is activated.
|
||||
- Add the alarm's date to the SwitchTile text for confirming it's truly set.
|
||||
|
||||
## 1.1.0 (2026-11-01)
|
||||
|
||||
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.
|
||||
@@ -15,8 +15,6 @@ android {
|
||||
compileSdk = flutter.compileSdkVersion
|
||||
ndkVersion = flutter.ndkVersion
|
||||
|
||||
|
||||
|
||||
compileOptions {
|
||||
isCoreLibraryDesugaringEnabled = true
|
||||
targetCompatibility = JavaVersion.VERSION_17
|
||||
@@ -43,10 +41,6 @@ android {
|
||||
|
||||
buildTypes {
|
||||
getByName("release") {
|
||||
// TODO: Add your own signing config for the release build.
|
||||
// Signing with the debug keys for now, so `flutter run --release` works.
|
||||
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)
|
||||
@@ -57,7 +51,7 @@ android {
|
||||
isShrinkResources = true
|
||||
proguardFiles(
|
||||
getDefaultProguardFile("proguard-android-optimize.txt"),
|
||||
"proguard-rules.pro"
|
||||
"proguard-rules.pro",
|
||||
)
|
||||
|
||||
/// 20260928 - With minifying, helped some, but also used
|
||||
@@ -66,6 +60,12 @@ android {
|
||||
/// 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)
|
||||
|
||||
ndk {
|
||||
abiFilters.clear()
|
||||
//noinspection ChromeOsAbiSupport
|
||||
abiFilters += listOf("arm64-v8a")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -77,3 +77,27 @@ dependencies {
|
||||
flutter {
|
||||
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}")
|
||||
}
|
||||
}
|
||||
@@ -27,6 +27,9 @@
|
||||
<uses-permission android:name="android.permission.WAKE_LOCK"/>
|
||||
<uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM"/>
|
||||
|
||||
<!-- Allow internet to work. -->
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
|
||||
<application
|
||||
android:label="Sunset Alarm"
|
||||
android:name="${applicationName}"
|
||||
|
||||
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 451 B After Width: | Height: | Size: 431 B |
|
Before Width: | Height: | Size: 319 B After Width: | Height: | Size: 306 B |
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Modify this file to customize your launch splash screen -->
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="?android:colorBackground" />
|
||||
|
||||
<!-- You can insert your own image assets here -->
|
||||
<!-- <item>
|
||||
<bitmap
|
||||
android:gravity="center"
|
||||
android:src="@mipmap/launch_image" />
|
||||
</item> -->
|
||||
</layer-list>
|
||||
|
||||
|
Before Width: | Height: | Size: 635 B After Width: | Height: | Size: 574 B |
|
Before Width: | Height: | Size: 971 B After Width: | Height: | Size: 842 B |
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.2 KiB |
@@ -0,0 +1,74 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector
|
||||
android:height="108dp"
|
||||
android:width="108dp"
|
||||
android:viewportHeight="108"
|
||||
android:viewportWidth="108"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="#3DDC84"
|
||||
android:pathData="M0,0h108v108h-108z"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M9,0L9,108"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M19,0L19,108"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M29,0L29,108"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M39,0L39,108"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M49,0L49,108"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M59,0L59,108"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M69,0L69,108"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M79,0L79,108"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M89,0L89,108"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M99,0L99,108"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M0,9L108,9"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M0,19L108,19"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M0,29L108,29"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M0,39L108,39"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M0,49L108,49"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M0,59L108,59"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M0,69L108,69"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M0,79L108,79"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M0,89L108,89"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M0,99L108,99"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M19,29L89,29"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M19,39L89,39"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M19,49L89,49"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M19,59L89,59"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M19,69L89,69"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M19,79L89,79"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M29,19L29,89"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M39,19L39,89"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M49,19L49,89"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M59,19L59,89"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M69,19L69,89"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M79,19L79,89"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
</vector>
|
||||
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Modify this file to customize your launch splash screen -->
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@android:color/white" />
|
||||
|
||||
<!-- You can insert your own image assets here -->
|
||||
<!-- <item>
|
||||
<bitmap
|
||||
android:gravity="center"
|
||||
android:src="@mipmap/launch_image" />
|
||||
</item> -->
|
||||
</layer-list>
|
||||
|
||||
|
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 2.8 KiB |
|
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 3.3 KiB |
|
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.5 KiB |
|
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 2.8 KiB |
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 4.0 KiB |
|
Before Width: | Height: | Size: 3.9 KiB After Width: | Height: | Size: 5.0 KiB |
|
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 3.6 KiB |
|
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 4.0 KiB |
|
Before Width: | Height: | Size: 6.7 KiB After Width: | Height: | Size: 6.5 KiB |
|
Before Width: | Height: | Size: 7.1 KiB After Width: | Height: | Size: 9.1 KiB |
|
Before Width: | Height: | Size: 5.0 KiB After Width: | Height: | Size: 5.7 KiB |
|
Before Width: | Height: | Size: 6.7 KiB After Width: | Height: | Size: 6.5 KiB |
|
Before Width: | Height: | Size: 9.3 KiB After Width: | Height: | Size: 9.8 KiB |
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 7.4 KiB After Width: | Height: | Size: 7.6 KiB |
|
Before Width: | Height: | Size: 9.3 KiB After Width: | Height: | Size: 9.8 KiB |
@@ -1,7 +1,9 @@
|
||||
#Sat Sep 12 19:36:23 MST 2026
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-9.7.1-bin.zip
|
||||
#distributionUrl=https\://services.gradle.org/distributions/gradle-9.1.0-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-9.9.0-bin.zip
|
||||
networkTimeout=10000
|
||||
retries=0
|
||||
retryBackOffMs=500
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
@@ -19,12 +19,11 @@ pluginManagement {
|
||||
plugins {
|
||||
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.0.1" apply false
|
||||
id("com.android.application") version "9.5.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 otherwise:
|
||||
// "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")
|
||||
@@ -60,14 +60,29 @@ set -x
|
||||
flutter build linux ${BUILD_OPTIONS[@]}
|
||||
set +x
|
||||
|
||||
log "Saving Linux Bundle..."
|
||||
log "- zip"
|
||||
filename=$RELEASE.linux-bundle.zip
|
||||
contents="build/linux/x64/release/bundle/"
|
||||
if [[ -e $filename ]]; then
|
||||
rm -v $filename
|
||||
fi
|
||||
zip -r $filename build/linux/x64/release/bundle/*
|
||||
set -x
|
||||
zip -qr "$filename" "$contents"/*
|
||||
set +x
|
||||
ls -sh $filename
|
||||
|
||||
log "- tar"
|
||||
filename=$RELEASE.linux-bundle.tar
|
||||
if [[ -e "$filename"* ]]; then
|
||||
rm -v "$filename"*
|
||||
fi
|
||||
set -x
|
||||
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..."
|
||||
@@ -99,9 +114,8 @@ for apk in `ls build/app/outputs/flutter-apk/app*release.apk`; do
|
||||
filename=`basename $apk`
|
||||
filename=${filename//app/${RELEASE}}
|
||||
cp -v "$apk" "$filename"
|
||||
ls -sh "$filename"
|
||||
echo " "
|
||||
done
|
||||
ls -sh release/*.apk | sort -h
|
||||
|
||||
# Finish
|
||||
|
||||
|
||||
@@ -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:
|
||||
@@ -1,6 +1,7 @@
|
||||
import 'dart:io';
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:alarm/utils/alarm_set.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:geolocator/geolocator.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
@@ -12,18 +13,24 @@ import 'package:alarm/alarm.dart';
|
||||
|
||||
import 'dart:convert';
|
||||
|
||||
/// TBD:
|
||||
/// - Add other languages (Spanish, Croatian)
|
||||
/// v1.1.0
|
||||
/// - Change sunset grabber to checkbox and retrieve it each alarm or open.
|
||||
/// v2.0.0
|
||||
/// - Add sunrise section and change app name to Sunshine Alarm?
|
||||
/// :TBD
|
||||
// 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 {
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
|
||||
final certData = await rootBundle.load(
|
||||
'media/certs/open-meteo-com_isrg-root-x1.pem',
|
||||
);
|
||||
SecurityContext.defaultContext.setTrustedCertificatesBytes(
|
||||
certData.buffer.asUint8List(),
|
||||
);
|
||||
|
||||
tz.initializeTimeZones();
|
||||
await Alarm.init();
|
||||
|
||||
runApp(const SunsetAlarmApp());
|
||||
}
|
||||
|
||||
@@ -56,6 +63,11 @@ class SunsetAlarmApp extends StatelessWidget {
|
||||
}
|
||||
}
|
||||
|
||||
int dateAsId(DateTime d) => d.year * 10000 + d.month * 100 + d.day;
|
||||
int todayAsId() {
|
||||
return dateAsId(DateTime.now());
|
||||
}
|
||||
|
||||
class HomeScreen extends StatefulWidget {
|
||||
const HomeScreen({super.key});
|
||||
|
||||
@@ -66,8 +78,8 @@ class HomeScreen extends StatefulWidget {
|
||||
class _HomeScreenState extends State<HomeScreen> {
|
||||
final _latController = TextEditingController();
|
||||
final _lngController = TextEditingController();
|
||||
final _sunsetController = TextEditingController();
|
||||
final _minutesController = TextEditingController(text: '30');
|
||||
final _sunsetController = TextEditingController(text: "18:00");
|
||||
final _minutesController = TextEditingController(text: "30");
|
||||
|
||||
final FlutterLocalNotificationsPlugin _notifications =
|
||||
FlutterLocalNotificationsPlugin();
|
||||
@@ -79,14 +91,25 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
|
||||
String? _sunsetErrorText;
|
||||
String? _minuteErrorText;
|
||||
bool _validTime = false;
|
||||
|
||||
static const _alarmId = 1001;
|
||||
int _alarmId = 20260000;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_initNotifications();
|
||||
_loadPrefs();
|
||||
|
||||
// Reschedule alarm any time one goes off.
|
||||
Alarm.ringing.listen((AlarmSet alarmSet) {
|
||||
for (final alarm in alarmSet.alarms) {
|
||||
if (alarm.id == todayAsId()) {
|
||||
_scheduleAlarm();
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Future<void> _initNotifications() async {
|
||||
@@ -107,15 +130,20 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
Future<void> _loadPrefs() async {
|
||||
final prefs = await SharedPreferences.getInstance();
|
||||
setState(() {
|
||||
final lat = prefs.getDouble('lat');
|
||||
final lng = prefs.getDouble('lng');
|
||||
final sunset = prefs.getString('sunset_time');
|
||||
_alarmEnabled = prefs.getBool('alarm_enabled') ?? false;
|
||||
final lat = prefs.getDouble('lat').toString();
|
||||
final lng = prefs.getDouble('lng').toString();
|
||||
final sun = prefs.getString('sunset_time');
|
||||
_latController.text = (lat == "null") ? "" : lat;
|
||||
_lngController.text = (lng == "null") ? "" : lng;
|
||||
_sunsetController.text = sun ?? "";
|
||||
|
||||
_minutesBefore = prefs.getInt('minutes_before') ?? 30;
|
||||
if (lat != null) _latController.text = lat.toString();
|
||||
if (lng != null) _lngController.text = lng.toString();
|
||||
if (sunset != null) _sunsetController.text = sunset;
|
||||
_minutesController.text = '$_minutesBefore';
|
||||
_minutesController.text = _minutesBefore.toString();
|
||||
|
||||
_alarmEnabled = prefs.getBool('alarm_enabled') ?? false;
|
||||
_validTime = prefs.getBool('valid_time') ?? false;
|
||||
|
||||
_calcPlural();
|
||||
});
|
||||
if (_alarmEnabled && _sunsetController.text.isNotEmpty) {
|
||||
_scheduleAlarm();
|
||||
@@ -133,6 +161,7 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
}
|
||||
await prefs.setBool('alarm_enabled', _alarmEnabled);
|
||||
await prefs.setInt('minutes_before', _minutesBefore);
|
||||
await prefs.setBool('valid_time', _validTime);
|
||||
}
|
||||
|
||||
Future<void> _getGpsLocation() async {
|
||||
@@ -193,7 +222,10 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
} catch (e) {
|
||||
_showSnack('Network Error: $e');
|
||||
} finally {
|
||||
setState(() => _loading = false);
|
||||
setState(() {
|
||||
_loading = false;
|
||||
_validTime = true;
|
||||
});
|
||||
}
|
||||
|
||||
if (_alarmEnabled) {
|
||||
@@ -225,6 +257,10 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
alarmTime = alarmTime.add(const Duration(days: 1));
|
||||
}
|
||||
|
||||
_debug("_scheduleAlarm, alarmTime=${alarmTime.toIso8601String()}");
|
||||
_alarmId = dateAsId(alarmTime);
|
||||
_debug("_alarmId=$_alarmId");
|
||||
|
||||
if (Platform.isLinux) {
|
||||
// Linux: use a Timer (app must stay open)
|
||||
_alarmTimer?.cancel();
|
||||
@@ -285,9 +321,9 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
androidScheduleMode: AndroidScheduleMode.alarmClock,
|
||||
);
|
||||
_showSnack('Alarm scheduled!');
|
||||
debugPrint('DEBUG: Alarm time: ${tzAlarm.toString()}');
|
||||
debugPrint('DEBUG: Current time: ${DateTime.now().toUtc().toString()}');
|
||||
debugPrint('DEBUG: ${_notifications.toString()}');
|
||||
_debug('Alarm time: ${tzAlarm.toString()}');
|
||||
_debug('Current time: ${DateTime.now().toUtc().toString()}');
|
||||
_debug('${_notifications.toString()}');
|
||||
}
|
||||
// End Notification Method ***/
|
||||
|
||||
@@ -311,7 +347,18 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
stopButton: 'Dismiss',
|
||||
icon: 'ic_notification',
|
||||
),
|
||||
androidStopAlarmOnTermination: false,
|
||||
);
|
||||
|
||||
// Skip if tomorrow's alarm already exists.
|
||||
final existing = await Alarm.getAlarm(_alarmId);
|
||||
if (existing == settings) {
|
||||
_debug(
|
||||
"Alarm already exists, skipping schedule. ${settings.toString()}",
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
await Alarm.set(alarmSettings: settings);
|
||||
}
|
||||
// End Alarm Method ***/
|
||||
@@ -319,6 +366,10 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
} else {
|
||||
_showSnack('Platform Not Detected - Contact Developer');
|
||||
}
|
||||
// If we made it this far, refresh the alarm ID on the screen.
|
||||
setState(() {
|
||||
_alarmId = _alarmId;
|
||||
});
|
||||
}
|
||||
|
||||
Future<void> _toggleAlarm(bool value) async {
|
||||
@@ -327,22 +378,40 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
if (value) {
|
||||
await _scheduleAlarm();
|
||||
} else {
|
||||
_alarmTimer?.cancel();
|
||||
if (!Platform.isLinux) {
|
||||
// Notification Method
|
||||
if (ANDROID_USE_NOTIF) await _notifications.cancel(id: _alarmId);
|
||||
|
||||
// Alarm Method
|
||||
if (ANDROID_USE_ALARM) await Alarm.stop(_alarmId);
|
||||
}
|
||||
_showSnack('Alarm Cancelled');
|
||||
_stopAlarm();
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _stopAlarm() async {
|
||||
if (Platform.isLinux) {
|
||||
_alarmTimer?.cancel();
|
||||
} else if (Platform.isAndroid) {
|
||||
// Notification Method
|
||||
if (ANDROID_USE_NOTIF) {
|
||||
//await _notifications.cancel(id: _alarmId);
|
||||
await _notifications.cancelAll();
|
||||
}
|
||||
// Alarm Method
|
||||
if (ANDROID_USE_ALARM) {
|
||||
//await Alarm.stop(_alarmId);
|
||||
await Alarm.stopAll();
|
||||
}
|
||||
}
|
||||
_showSnack('Alarm Cancelled');
|
||||
}
|
||||
|
||||
void _showSnack(String msg) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text(msg)));
|
||||
}
|
||||
|
||||
void _log(String tag, String msg) {
|
||||
debugPrint(tag + ": " + msg);
|
||||
}
|
||||
|
||||
void _debug(String msg) {
|
||||
_log("DEBUG", msg);
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_savePrefs();
|
||||
@@ -354,6 +423,9 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
}
|
||||
|
||||
String? _validateTime(String? value) {
|
||||
setState(() {
|
||||
_validTime = false;
|
||||
});
|
||||
if (value == null || !RegExp(r'^\d{2}:\d{2}$').hasMatch(value)) {
|
||||
return 'Use HH:MM Format';
|
||||
}
|
||||
@@ -361,9 +433,18 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
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
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
@@ -462,6 +543,9 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
),
|
||||
),
|
||||
onChanged: (v) {
|
||||
if (v == "") {
|
||||
_stopAlarm();
|
||||
}
|
||||
final val = _validateTime(v);
|
||||
if (val == null) {
|
||||
_savePrefs();
|
||||
@@ -503,48 +587,51 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
const SizedBox(height: 8),
|
||||
|
||||
// --- Minutes before ---
|
||||
Row(
|
||||
children: [
|
||||
if (!_alarmEnabled)
|
||||
Expanded(
|
||||
child: TextField(
|
||||
controller: _minutesController,
|
||||
keyboardType: TextInputType.number,
|
||||
decoration: InputDecoration(
|
||||
border: OutlineInputBorder(),
|
||||
labelText: 'Minutes Before Sunset',
|
||||
errorText: _minuteErrorText,
|
||||
),
|
||||
onChanged: (v) {
|
||||
final val = int.tryParse(v);
|
||||
setState(() {
|
||||
if (val != null) {
|
||||
_minuteErrorText = null;
|
||||
_minutesBefore = val;
|
||||
} else {
|
||||
_minuteErrorText = 'Invalid Minute Value';
|
||||
}
|
||||
_plural = (_minutesBefore == 1) ? '' : 's';
|
||||
});
|
||||
},
|
||||
),
|
||||
),
|
||||
TextField(
|
||||
controller: _minutesController,
|
||||
keyboardType: TextInputType.number,
|
||||
decoration: InputDecoration(
|
||||
border: OutlineInputBorder(),
|
||||
labelText: 'Minutes Before Sunset',
|
||||
errorText: _minuteErrorText,
|
||||
),
|
||||
onChanged: (v) {
|
||||
final val = int.tryParse(v);
|
||||
setState(() {
|
||||
if (val != null) {
|
||||
_minuteErrorText = null;
|
||||
_minutesBefore = val;
|
||||
} else {
|
||||
_minuteErrorText = 'Invalid Minute Value';
|
||||
}
|
||||
_calcPlural();
|
||||
});
|
||||
},
|
||||
),
|
||||
|
||||
// --- Toggle ---
|
||||
Expanded(
|
||||
child: SwitchListTile(
|
||||
//title: const Text('Enable Sunset Alarm'),
|
||||
title: Text(_alarmEnabled ? 'Sunset Alarm Enabled' : ''),
|
||||
subtitle: Text(
|
||||
_alarmEnabled
|
||||
? '${_minutesBefore} Minute${_plural} Before @ $_alarmDisplayTime'
|
||||
: '',
|
||||
),
|
||||
value: _alarmEnabled,
|
||||
onChanged: _toggleAlarm,
|
||||
),
|
||||
// --- Toggle ---
|
||||
SwitchListTile(
|
||||
title: Center(
|
||||
child: Text(
|
||||
_validTime
|
||||
? _alarmEnabled
|
||||
? "Sunset Alarm Enabled"
|
||||
: "Enable"
|
||||
: "Disabled",
|
||||
),
|
||||
],
|
||||
),
|
||||
subtitle: Center(
|
||||
child: Text(
|
||||
_validTime
|
||||
? _alarmEnabled
|
||||
? "Scheduled @ ${_alarmId.toString().replaceRange(4, 4, '-').replaceRange(7, 7, '-')} $_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-----
|
||||
|
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 3.6 KiB |
@@ -1,7 +1,7 @@
|
||||
name: sunset_alarm
|
||||
description: "Set an alarm to go off a specified time before sunset."
|
||||
publish_to: 'none'
|
||||
version: 1.0.1
|
||||
version: 1.2.0
|
||||
|
||||
environment:
|
||||
sdk: ^3.7.2
|
||||
@@ -23,3 +23,5 @@ dev_dependencies:
|
||||
|
||||
flutter:
|
||||
uses-material-design: true
|
||||
assets:
|
||||
- media/certs/
|
||||