4 Commits
4 changed files with 96 additions and 15 deletions

No files matched your search

+3 -1
View File
@@ -153,4 +153,6 @@ google-services.json
# Android Profiling
*.hprof
linux-bundle.zip
# Staged build files for distribution.
*.linux-bundle.zip
release/*
+1 -1
View File
@@ -19,7 +19,7 @@ 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. JK - needs to exist otherwiese:
+60 -13
View File
@@ -1,23 +1,70 @@
#!/usr/bin/env bash
# 20260913 - Hyperling
# Build the project and add them to a releases folder.
# Build the project and add the output to a releases folder.
# TODO
# create dir name release-${version} to store these in,
## Setup ##
echo -e "\nCleaning..."
flutter clean
DIR="$(cd "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)"
echo -e "\nBuilding Linux..."
## Functions ##
function log {
echo -e "\n $@ \n"
}
function clean_flutter {
log "Cleaning..."
flutter clean
}
## 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'."
## Main ##
clean_flutter
log "Building Linux Bundle..."
flutter build linux
zip -r release/linux-bundle.zip build/linux/x64/release/bundle/*
echo -e "\nCleaning..."
flutter clean
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
echo -e "\nBuilding APK..."
clean_flutter
log "Building APK..."
flutter build apk
cp -v build/app/outputs/flutter-apk/app-release.apk release/
echo -e "\nCleaning..."
flutter clean
log "Saving APK..."
filename=$RELEASE.apk
if [[ -e $filename ]]; then
rm -v $filename
fi
cp -v build/app/outputs/flutter-apk/app-release.apk $filename
ls -sh $filename
+32
View File
@@ -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,6 +8,7 @@ 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 'dart:convert';
void main() async {
@@ -171,6 +173,12 @@ class _HomeScreenState extends State<HomeScreen> {
Timer? _alarmTimer;
Future<void> _scheduleAlarm() async {
final canSchedule = await android?.canScheduleExactNotifications();
if (canSchedule != true) {
_showSnack('Permissions not yet granted, requesting...');
await android?.requestExactAlarmsPermission();
}
final sunsetText = _sunsetController.text.trim();
if (sunsetText.isEmpty) return;
@@ -417,3 +425,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
>();