Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
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 | ||
|
|
bf1c4614a1 | ||
|
|
9c681094c1 | ||
|
|
a44d4b1574 | ||
|
|
ee9821f30f | ||
|
|
efde9624ff | ||
|
|
b9bc2ca77d | ||
|
|
105591910c | ||
|
|
6030da178c | ||
|
|
dad8fff6d2 | ||
|
|
3d89661b37 | ||
|
|
6de5fbe991 | ||
|
|
9ac5fdd4f6 | ||
|
|
5f14dbbc5b | ||
|
|
aade4fd7f2 | ||
|
|
dfca094c95 | ||
|
|
e643e797c9 | ||
|
|
280e748bb7 | ||
|
|
a19447b8a0 | ||
|
|
0ef88ba978 | ||
|
|
00566d9cc0 | ||
|
|
b0f59e2296 | ||
|
|
7fe2af8058 | ||
|
|
09fdcea0f9 | ||
|
|
6586398db6 | ||
|
|
46eeaca422 | ||
|
|
657b41d63c | ||
|
|
d6c0c79f8a |
No files matched your search
@@ -153,3 +153,6 @@ google-services.json
|
||||
# Android Profiling
|
||||
*.hprof
|
||||
|
||||
# Staged build files for distribution.
|
||||
*.linux-bundle.zip
|
||||
release/*
|
||||
@@ -1,27 +1,29 @@
|
||||
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
|
||||
|
||||
plugins {
|
||||
id("com.android.application")
|
||||
|
||||
// This will need removed in Gradle/AGP 9.
|
||||
// This supposedly needs removed in Gradle/AGP 9 but works fine.
|
||||
id("org.jetbrains.kotlin.android") // id("kotlin-android")
|
||||
|
||||
// The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins.
|
||||
id("dev.flutter.flutter-gradle-plugin")
|
||||
}
|
||||
|
||||
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
|
||||
|
||||
android {
|
||||
namespace = "com.hyperling.sunset_alarm"
|
||||
compileSdk = flutter.compileSdkVersion
|
||||
ndkVersion = flutter.ndkVersion
|
||||
|
||||
|
||||
|
||||
compileOptions {
|
||||
isCoreLibraryDesugaringEnabled = true
|
||||
targetCompatibility = JavaVersion.VERSION_17
|
||||
sourceCompatibility = JavaVersion.VERSION_17
|
||||
}
|
||||
|
||||
// This will need removed in Gradle/AGP 9.
|
||||
// This supposedly needs removed in Gradle/AGP 9, but then uses 21 and fails to build.
|
||||
kotlin {
|
||||
compilerOptions {
|
||||
jvmTarget.set(JvmTarget.JVM_17)
|
||||
@@ -40,16 +42,36 @@ android {
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
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)
|
||||
/// 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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:2.1.4")
|
||||
coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:2.1.5")
|
||||
}
|
||||
|
||||
flutter {
|
||||
|
||||
@@ -1,6 +1,34 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<manifest
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
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_COARSE_LOCATION"/>
|
||||
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
|
||||
<uses-permission android:name="android.permission.SCHEDULE_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.WAKE_LOCK"/>
|
||||
<uses-permission android:name="android.permission.VIBRATE"/>
|
||||
<uses-permission android:name="android.permission.USE_FULL_SCREEN_INTENT"/>
|
||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
|
||||
<uses-permission android:name="android.permission.ACCESS_NOTIFICATION_POLICY"/>
|
||||
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
|
||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PLAYBACK"/>
|
||||
<uses-permission android:name="android.permission.USE_EXACT_ALARM"/>
|
||||
<uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM"/>
|
||||
|
||||
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
|
||||
<uses-permission android:name="android.permission.WAKE_LOCK"/>
|
||||
<uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM"/>
|
||||
|
||||
<application
|
||||
android:label="sunset_alarm"
|
||||
android:label="Sunset Alarm"
|
||||
android:name="${applicationName}"
|
||||
android:icon="@mipmap/ic_launcher">
|
||||
<activity
|
||||
@@ -30,6 +58,58 @@
|
||||
<meta-data
|
||||
android:name="flutterEmbedding"
|
||||
android:value="2" />
|
||||
|
||||
<!-- Allow notifications to work. -->
|
||||
<receiver
|
||||
android:name="com.dexterous.flutterlocalnotifications.ScheduledNotificationReceiver"
|
||||
android:enabled="true" />
|
||||
<receiver
|
||||
android:name="com.dexterous.flutterlocalnotifications.ScheduledNotificationBootReceiver"
|
||||
android:enabled="true"
|
||||
android:exported="false">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.BOOT_COMPLETED" />
|
||||
<action android:name="android.intent.action.MY_PACKAGE_REPLACED" />
|
||||
<action android:name="android.intent.action.QUICKBOOT_POWERON" />
|
||||
<action android:name="com.htc.intent.action.QUICKBOOT_POWERON" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
|
||||
<!-- Allow alarms to work. -->
|
||||
<service
|
||||
android:name="com.gdelataillade.alarm.AlarmService"
|
||||
android:foregroundServiceType="mediaPlayback"
|
||||
android:exported="false" />
|
||||
<receiver
|
||||
android:name="com.gdelataillade.alarm.AlarmBroadcastReceiver"
|
||||
android:exported="false" />
|
||||
<receiver
|
||||
android:name="com.gdelataillade.alarm.BootBroadcastReceiver"
|
||||
android:enabled="false"
|
||||
android:exported="false">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.BOOT_COMPLETED" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
<service
|
||||
android:name="dev.fluttercommunity.plus.androidalarmmanager.AlarmService"
|
||||
android:permission="android.permission.BIND_JOB_SERVICE"
|
||||
android:exported="false"
|
||||
tools:ignore="MissingClass"/>
|
||||
<receiver
|
||||
android:name="dev.fluttercommunity.plus.androidalarmmanager.AlarmBroadcastReceiver"
|
||||
android:exported="false"
|
||||
tools:ignore="MissingClass"/>
|
||||
<receiver
|
||||
android:name="dev.fluttercommunity.plus.androidalarmmanager.RebootBroadcastReceiver"
|
||||
android:enabled="false"
|
||||
android:exported="false"
|
||||
tools:ignore="MissingClass">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.BOOT_COMPLETED" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
|
||||
</application>
|
||||
<!-- Required to query activities that can process text, see:
|
||||
https://developer.android.com/training/package-visibility and
|
||||
@@ -42,9 +122,4 @@
|
||||
<data android:mimeType="text/plain"/>
|
||||
</intent>
|
||||
</queries>
|
||||
|
||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
|
||||
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
|
||||
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
|
||||
<uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM"/>
|
||||
</manifest>
|
||||
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 216 B |
|
After Width: | Height: | Size: 173 B |
|
After Width: | Height: | Size: 284 B |
|
After Width: | Height: | Size: 443 B |
|
After Width: | Height: | Size: 565 B |
@@ -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,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/ic_launcher_background"/>
|
||||
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
|
||||
<monochrome android:drawable="@mipmap/ic_launcher_foreground"/>
|
||||
</adaptive-icon>
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/ic_launcher_background"/>
|
||||
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
|
||||
<monochrome android:drawable="@mipmap/ic_launcher_foreground"/>
|
||||
</adaptive-icon>
|
||||
|
Before Width: | Height: | Size: 544 B |
|
After Width: | Height: | Size: 816 B |
|
After Width: | Height: | Size: 456 B |
|
After Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 442 B |
|
After Width: | Height: | Size: 626 B |
|
After Width: | Height: | Size: 334 B |
|
After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 721 B |
|
After Width: | Height: | Size: 1022 B |
|
After Width: | Height: | Size: 586 B |
|
After Width: | Height: | Size: 3.0 KiB |
|
Before Width: | Height: | Size: 1.0 KiB |
|
After Width: | Height: | Size: 1.6 KiB |
|
After Width: | Height: | Size: 946 B |
|
After Width: | Height: | Size: 4.8 KiB |
|
Before Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 2.1 KiB |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 6.8 KiB |
@@ -1,7 +1,7 @@
|
||||
#Sat Sep 12 19:36:23 MST 2026
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-9.6.0-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-9.7.1-bin.zip
|
||||
#distributionUrl=https\://services.gradle.org/distributions/gradle-9.1.0-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
@@ -19,10 +19,11 @@ pluginManagement {
|
||||
plugins {
|
||||
id("dev.flutter.flutter-plugin-loader") version "1.0.0"
|
||||
|
||||
id("com.android.application") version "9.4.0" apply false
|
||||
id("com.android.application") version "9.4.1" apply false
|
||||
//id("com.android.application") version "9.0.1" apply false
|
||||
|
||||
// This will need removed in Gradle/AGP 9.
|
||||
// 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."
|
||||
id("org.jetbrains.kotlin.android") version "2.4.20" apply false
|
||||
}
|
||||
|
||||
|
||||
@@ -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'
|
||||
@@ -0,0 +1,108 @@
|
||||
#!/usr/bin/env bash
|
||||
# 20260913 - Hyperling
|
||||
# Build the project and add the output to a releases folder.
|
||||
|
||||
## Setup ##
|
||||
|
||||
DIR="$(cd "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)"
|
||||
|
||||
## Functions ##
|
||||
|
||||
function log {
|
||||
echo -e "\n $@ \n"
|
||||
}
|
||||
|
||||
function clean_flutter {
|
||||
log "Cleaning..."
|
||||
flutter clean
|
||||
echo "Done!"
|
||||
}
|
||||
|
||||
## Variables ##
|
||||
|
||||
app_details="$DIR/pubspec.yaml"
|
||||
|
||||
name=""
|
||||
for i in `grep name $app_details`; do
|
||||
name="$i"
|
||||
done
|
||||
name="${name// /_}"
|
||||
|
||||
version=""
|
||||
for i in `grep version $app_details`; do
|
||||
version="$i"
|
||||
done
|
||||
version="v${version// /_}"
|
||||
|
||||
if [[ -z $name || -z $version ]]; then
|
||||
echo "ERROR: Could not retrieve name or version. name='$name' version='$version'"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
RELEASE="release/$name-$version"
|
||||
echo "Running for '$RELEASE'."
|
||||
|
||||
BUILD_OPTIONS=(
|
||||
--release
|
||||
--obfuscate
|
||||
--split-debug-info=./debug-info/
|
||||
--extra-gen-snapshot-options="--strip"
|
||||
)
|
||||
|
||||
## Main ##
|
||||
|
||||
clean_flutter
|
||||
|
||||
# Linux
|
||||
|
||||
log "Building Linux Bundle..."
|
||||
set -x
|
||||
flutter build linux ${BUILD_OPTIONS[@]}
|
||||
set +x
|
||||
|
||||
log "Saving Linux Bundle..."
|
||||
filename=$RELEASE.linux-bundle.zip
|
||||
if [[ -e $filename ]]; then
|
||||
rm -v $filename
|
||||
fi
|
||||
zip -r $filename build/linux/x64/release/bundle/*
|
||||
ls -sh $filename
|
||||
|
||||
# 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"
|
||||
ls -sh "$filename"
|
||||
echo " "
|
||||
done
|
||||
|
||||
# Finish
|
||||
|
||||
exit 0
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'dart:io';
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:geolocator/geolocator.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
@@ -7,25 +8,49 @@ import 'package:flutter_local_notifications/flutter_local_notifications.dart';
|
||||
import 'package:timezone/data/latest_all.dart' as tz;
|
||||
import 'package:timezone/timezone.dart' as tz;
|
||||
import 'package:http/http.dart' as http;
|
||||
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
|
||||
|
||||
void main() async {
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
tz.initializeTimeZones();
|
||||
await Alarm.init();
|
||||
runApp(const SunsetAlarmApp());
|
||||
}
|
||||
|
||||
const ANDROID_USE_NOTIF = false;
|
||||
const ANDROID_USE_ALARM = !ANDROID_USE_NOTIF;
|
||||
|
||||
class SunsetAlarmApp extends StatelessWidget {
|
||||
const SunsetAlarmApp({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
const seedColor = Colors.deepOrange;
|
||||
return MaterialApp(
|
||||
title: 'Sunset Alarm',
|
||||
theme: ThemeData(
|
||||
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepOrange),
|
||||
useMaterial3: true,
|
||||
colorScheme: ColorScheme.fromSeed(
|
||||
seedColor: seedColor,
|
||||
brightness: Brightness.light,
|
||||
),
|
||||
),
|
||||
darkTheme: ThemeData(
|
||||
colorScheme: ColorScheme.fromSeed(
|
||||
seedColor: seedColor,
|
||||
brightness: Brightness.dark,
|
||||
),
|
||||
),
|
||||
themeMode: ThemeMode.system,
|
||||
home: const HomeScreen(),
|
||||
);
|
||||
}
|
||||
@@ -47,9 +72,13 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
final FlutterLocalNotificationsPlugin _notifications =
|
||||
FlutterLocalNotificationsPlugin();
|
||||
|
||||
bool _loading = false;
|
||||
bool _alarmEnabled = false;
|
||||
int _minutesBefore = 30;
|
||||
bool _loading = false;
|
||||
String _plural = 's';
|
||||
|
||||
String? _sunsetErrorText;
|
||||
String? _minuteErrorText;
|
||||
|
||||
static const _alarmId = 1001;
|
||||
|
||||
@@ -67,7 +96,7 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
defaultActionName: 'Sunset Alarm',
|
||||
);
|
||||
await _notifications.initialize(
|
||||
const InitializationSettings(
|
||||
settings: const InitializationSettings(
|
||||
android: androidInit,
|
||||
iOS: iosInit,
|
||||
linux: linuxInit,
|
||||
@@ -110,14 +139,14 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
try {
|
||||
bool serviceEnabled = await Geolocator.isLocationServiceEnabled();
|
||||
if (!serviceEnabled) {
|
||||
_showSnack('Location services are disabled.');
|
||||
_showSnack('Location Services Disabled');
|
||||
return;
|
||||
}
|
||||
LocationPermission permission = await Geolocator.checkPermission();
|
||||
if (permission == LocationPermission.denied) {
|
||||
permission = await Geolocator.requestPermission();
|
||||
if (permission == LocationPermission.denied) {
|
||||
_showSnack('Location permission denied.');
|
||||
_showSnack('Location Permission Denied');
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -129,9 +158,9 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
_lngController.text = position.longitude.toString();
|
||||
});
|
||||
await _savePrefs();
|
||||
_showSnack('Location updated.');
|
||||
_showSnack('Location Updated.');
|
||||
} catch (e) {
|
||||
_showSnack('GPS error: $e');
|
||||
_showSnack('GPS Error: $e');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -139,7 +168,7 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
final lat = double.tryParse(_latController.text);
|
||||
final lng = double.tryParse(_lngController.text);
|
||||
if (lat == null || lng == null) {
|
||||
_showSnack('Enter valid latitude and longitude first.');
|
||||
_showSnack('Enter Valid Latitude & Longitude');
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -157,15 +186,19 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
final timePart = sunsetStr.split('T')[1];
|
||||
setState(() => _sunsetController.text = timePart);
|
||||
await _savePrefs();
|
||||
_showSnack('Sunset: $timePart');
|
||||
_showSnack('Sunset Time Retrieved: $timePart');
|
||||
} else {
|
||||
_showSnack('API error: ${response.statusCode}');
|
||||
_showSnack('API Error: ${response.statusCode}');
|
||||
}
|
||||
} catch (e) {
|
||||
_showSnack('Network error: $e');
|
||||
_showSnack('Network Error: $e');
|
||||
} finally {
|
||||
setState(() => _loading = false);
|
||||
}
|
||||
|
||||
if (_alarmEnabled) {
|
||||
_scheduleAlarm();
|
||||
}
|
||||
}
|
||||
|
||||
Timer? _alarmTimer;
|
||||
@@ -188,7 +221,7 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
alarmTime = alarmTime.subtract(Duration(minutes: _minutesBefore));
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
@@ -203,16 +236,33 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
timeout: LinuxNotificationTimeout.expiresNever(),
|
||||
);
|
||||
_notifications.show(
|
||||
_alarmId,
|
||||
'Sunset in ${_minutesBefore} min',
|
||||
'The sun sets at $sunsetText. Time to get ready!',
|
||||
const NotificationDetails(linux: linuxDetails),
|
||||
id: _alarmId,
|
||||
title: 'Sunset in ${_minutesBefore} min!',
|
||||
body: 'The sun sets at $sunsetText.',
|
||||
notificationDetails: const NotificationDetails(linux: linuxDetails),
|
||||
);
|
||||
});
|
||||
_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 {
|
||||
} else if (Platform.isAndroid) {
|
||||
// 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)
|
||||
final tzAlarm = tz.TZDateTime.from(alarmTime, tz.local);
|
||||
const androidDetails = AndroidNotificationDetails(
|
||||
@@ -225,16 +275,49 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
category: AndroidNotificationCategory.alarm,
|
||||
);
|
||||
await _notifications.zonedSchedule(
|
||||
_alarmId,
|
||||
'Sunset in ${_minutesBefore} min',
|
||||
'The sun sets at $sunsetText. Time to get ready!',
|
||||
tzAlarm,
|
||||
const NotificationDetails(android: androidDetails),
|
||||
id: _alarmId,
|
||||
title: 'Sunset in ${_minutesBefore} min',
|
||||
body: 'The sun sets at $sunsetText. Time to get ready!',
|
||||
scheduledDate: tzAlarm,
|
||||
notificationDetails: const NotificationDetails(
|
||||
android: androidDetails,
|
||||
),
|
||||
androidScheduleMode: AndroidScheduleMode.alarmClock,
|
||||
uiLocalNotificationDateInterpretation:
|
||||
UILocalNotificationDateInterpretation.absoluteTime,
|
||||
);
|
||||
_showSnack('Alarm scheduled.');
|
||||
_showSnack('Alarm scheduled!');
|
||||
debugPrint('DEBUG: Alarm time: ${tzAlarm.toString()}');
|
||||
debugPrint('DEBUG: Current time: ${DateTime.now().toUtc().toString()}');
|
||||
debugPrint('DEBUG: ${_notifications.toString()}');
|
||||
}
|
||||
// End Notification Method ***/
|
||||
|
||||
/*** Alarm Method - Works ***/
|
||||
if (ANDROID_USE_ALARM) {
|
||||
// Schedule:
|
||||
final settings = AlarmSettings(
|
||||
id: _alarmId,
|
||||
dateTime: alarmTime,
|
||||
//assetAudioPath: 'assets/alarm.mp3', // use default rather than custom
|
||||
loopAudio: true, // keeps ringing until dismissed
|
||||
vibrate: true,
|
||||
androidFullScreenIntent: true, // wakes screen like clock app
|
||||
volumeSettings: VolumeSettings.fade(
|
||||
//volume: 0.8, // use default rather than custom
|
||||
fadeDuration: Duration(seconds: 60),
|
||||
),
|
||||
notificationSettings: NotificationSettings(
|
||||
title: 'Sunset Alarm',
|
||||
body: 'Sun is setting in ${_minutesBefore} minute${_plural}!',
|
||||
stopButton: 'Dismiss',
|
||||
icon: 'ic_notification',
|
||||
),
|
||||
);
|
||||
await Alarm.set(alarmSettings: settings);
|
||||
}
|
||||
// End Alarm Method ***/
|
||||
_showSnack('Alarm Scheduled @ ${alarmTime}');
|
||||
} else {
|
||||
_showSnack('Platform Not Detected - Contact Developer');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -246,9 +329,13 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
} else {
|
||||
_alarmTimer?.cancel();
|
||||
if (!Platform.isLinux) {
|
||||
await _notifications.cancel(_alarmId);
|
||||
// Notification Method
|
||||
if (ANDROID_USE_NOTIF) await _notifications.cancel(id: _alarmId);
|
||||
|
||||
// Alarm Method
|
||||
if (ANDROID_USE_ALARM) await Alarm.stop(_alarmId);
|
||||
}
|
||||
_showSnack('Alarm cancelled.');
|
||||
_showSnack('Alarm Cancelled');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -258,6 +345,7 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_savePrefs();
|
||||
_latController.dispose();
|
||||
_lngController.dispose();
|
||||
_sunsetController.dispose();
|
||||
@@ -265,11 +353,24 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
String? _validateTime(String? value) {
|
||||
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';
|
||||
return null; // valid
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(title: const Text('Sunset Alarm')),
|
||||
body: Padding(
|
||||
resizeToAvoidBottomInset: true, // default, but be explicit
|
||||
body: SingleChildScrollView(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
@@ -314,7 +415,7 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
const SizedBox(width: 8),
|
||||
IconButton.filledTonal(
|
||||
icon: const Icon(Icons.my_location),
|
||||
tooltip: 'Get GPS location',
|
||||
tooltip: 'Get GPS Location',
|
||||
onPressed: _getGpsLocation,
|
||||
),
|
||||
],
|
||||
@@ -332,11 +433,46 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
Expanded(
|
||||
child: TextField(
|
||||
controller: _sunsetController,
|
||||
decoration: const InputDecoration(
|
||||
labelText: 'Sunset time (HH:MM)',
|
||||
decoration: InputDecoration(
|
||||
labelText: 'Sunset Time (HH:MM)',
|
||||
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) {
|
||||
final val = _validateTime(v);
|
||||
if (val == null) {
|
||||
_savePrefs();
|
||||
if (_alarmEnabled) {
|
||||
_scheduleAlarm();
|
||||
}
|
||||
}
|
||||
setState(() {
|
||||
_sunsetErrorText = val;
|
||||
});
|
||||
},
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
@@ -349,55 +485,70 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
child: CircularProgressIndicator(strokeWidth: 2),
|
||||
)
|
||||
: const Icon(Icons.cloud_done_outlined),
|
||||
tooltip: 'Fetch sunset from Open-Meteo',
|
||||
onPressed: _loading ? null : _fetchSunset,
|
||||
tooltip: 'Fetch Open-Meteo Sunset Data',
|
||||
onPressed: () {
|
||||
if (!_loading) {
|
||||
_fetchSunset();
|
||||
}
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
|
||||
// --- Minutes before ---
|
||||
const Text(
|
||||
'Alert Before Sunset',
|
||||
'Alert',
|
||||
style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
|
||||
// --- Minutes before ---
|
||||
Row(
|
||||
children: [
|
||||
const Text('Minutes before: '),
|
||||
SizedBox(
|
||||
width: 80,
|
||||
if (!_alarmEnabled)
|
||||
Expanded(
|
||||
child: TextField(
|
||||
controller: _minutesController,
|
||||
keyboardType: TextInputType.number,
|
||||
decoration: const InputDecoration(
|
||||
decoration: InputDecoration(
|
||||
border: OutlineInputBorder(),
|
||||
labelText: 'Minutes Before Sunset',
|
||||
errorText: _minuteErrorText,
|
||||
),
|
||||
onChanged: (v) {
|
||||
final val = int.tryParse(v);
|
||||
if (val != null && val > 0) {
|
||||
setState(() {
|
||||
if (val != null) {
|
||||
_minuteErrorText = null;
|
||||
_minutesBefore = val;
|
||||
} else {
|
||||
_minuteErrorText = 'Invalid Minute Value';
|
||||
}
|
||||
_plural = (_minutesBefore == 1) ? '' : 's';
|
||||
});
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
|
||||
// --- Toggle ---
|
||||
SwitchListTile(
|
||||
title: const Text('Enable Sunset Alarm'),
|
||||
Expanded(
|
||||
child: SwitchListTile(
|
||||
//title: const Text('Enable Sunset Alarm'),
|
||||
title: Text(_alarmEnabled ? 'Sunset Alarm Enabled' : ''),
|
||||
subtitle: Text(
|
||||
_alarmEnabled
|
||||
? 'Will alert ${_minutesBefore} min before sunset. ($_alarmDisplayTime)'
|
||||
: 'Alarm is off',
|
||||
? '${_minutesBefore} Minute${_plural} Before @ $_alarmDisplayTime'
|
||||
: '',
|
||||
),
|
||||
value: _alarmEnabled,
|
||||
onChanged: _toggleAlarm,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -417,3 +568,27 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
return '${dh.toString().padLeft(2, '0')}:${dm.toString().padLeft(2, '0')}';
|
||||
}
|
||||
}
|
||||
|
||||
final _plugin = FlutterLocalNotificationsPlugin();
|
||||
|
||||
Future<void> requestPermissions() async {
|
||||
if (Platform.isAndroid) {
|
||||
final android =
|
||||
_plugin
|
||||
.resolvePlatformSpecificImplementation<
|
||||
AndroidFlutterLocalNotificationsPlugin
|
||||
>();
|
||||
|
||||
// Android 13+ — standard notification permission (shows a dialog)
|
||||
await android?.requestNotificationsPermission();
|
||||
|
||||
// Android 12+ — exact alarm special access (opens system settings page)
|
||||
await android?.requestExactAlarmsPermission();
|
||||
}
|
||||
}
|
||||
|
||||
final android =
|
||||
_plugin
|
||||
.resolvePlatformSpecificImplementation<
|
||||
AndroidFlutterLocalNotificationsPlugin
|
||||
>();
|
||||
@@ -0,0 +1 @@
|
||||
Images, audio, and anything else used to support the app.
|
||||
@@ -0,0 +1 @@
|
||||
Images for use as app icons.
|
||||
|
After Width: | Height: | Size: 3.6 KiB |
|
After Width: | Height: | Size: 4.6 KiB |
|
After Width: | Height: | Size: 2.0 KiB |
@@ -0,0 +1 @@
|
||||
Images for use in app stores.
|
||||
@@ -1,7 +1,7 @@
|
||||
name: sunset_alarm
|
||||
description: "Set an alarm to go off a specified time before sunset."
|
||||
publish_to: 'none'
|
||||
version: 0.1.1
|
||||
version: 1.0.0
|
||||
|
||||
environment:
|
||||
sdk: ^3.7.2
|
||||
@@ -9,16 +9,17 @@ environment:
|
||||
dependencies:
|
||||
flutter:
|
||||
sdk: flutter
|
||||
geolocator: ^13.0.0
|
||||
shared_preferences: ^2.3.0
|
||||
flutter_local_notifications: ^18.0.0
|
||||
timezone: ^0.9.0
|
||||
http: ^1.2.0
|
||||
geolocator: ^14.1.1
|
||||
shared_preferences: ^2.5.5
|
||||
flutter_local_notifications: ^22.3.1
|
||||
timezone: ^0.11.1
|
||||
http: ^1.6.0
|
||||
alarm: ^5.13.2
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
sdk: flutter
|
||||
flutter_lints: ^5.0.0
|
||||
flutter_lints: ^6.0.0
|
||||
|
||||
flutter:
|
||||
uses-material-design: true
|
||||