Skip to content

Commit

Permalink
Merge pull request #155 from a-mabe/1.4.1
Browse files Browse the repository at this point in the history
Remove use_exact_alarm, request schedule_exact_alarm
  • Loading branch information
a-mabe committed Jun 30, 2024
2 parents 7c21d5a + 2495ab4 commit 6ecbb41
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 14 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.4.0
1.4.1
1 change: 0 additions & 1 deletion android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.codepup.workout_timer">
<uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM" />
<uses-permission android:name="android.permission.USE_EXACT_ALARM" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
Expand Down
10 changes: 10 additions & 0 deletions lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'dart:async';
import 'dart:io';
import 'dart:ui';

import 'package:flutter/foundation.dart';
Expand All @@ -9,6 +10,7 @@ import 'package:logger/logger.dart';
import 'package:openhiit/helper_widgets/fab_column.dart';
import 'package:openhiit/import_export/local_file_util.dart';
import 'package:openhiit/utils/functions.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:share_plus/share_plus.dart';
import 'package:sqflite/sqflite.dart';
import 'constants/snackbars.dart';
Expand All @@ -31,6 +33,14 @@ bool exporting = false;
void main() async {
WidgetsFlutterBinding.ensureInitialized();

if (Platform.isAndroid) {
await Permission.scheduleExactAlarm.isDenied.then((value) {
if (value) {
Permission.scheduleExactAlarm.request();
}
});
}

GoogleFonts.config.allowRuntimeFetching = false;

/// Monospaced font licensing.
Expand Down
38 changes: 27 additions & 11 deletions lib/start_workout/view_workout.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import 'dart:convert';
import 'dart:io';
import 'package:permission_handler/permission_handler.dart';
import 'package:uuid/uuid.dart';
import 'package:flutter/material.dart';
import '../utils/functions.dart';
Expand Down Expand Up @@ -92,18 +94,32 @@ class ViewWorkoutState extends State<ViewWorkout> {
? MediaQuery.of(context).size.height / 8
: MediaQuery.of(context).size.height / 5,
child: StartButton(
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const CountDownTimer(),
settings: RouteSettings(
arguments: workout,
onTap: () async {
if (Platform.isAndroid) {
await Permission.scheduleExactAlarm.isDenied.then((value) {
if (value) {
Permission.scheduleExactAlarm.request();
}
});

if (await Permission.scheduleExactAlarm.isDenied) {
return;
}
}

if (context.mounted) {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const CountDownTimer(),
settings: RouteSettings(
arguments: workout,
),
),
),
).then((value) {
setStatusBarBrightness(context);
});
).then((value) {
setStatusBarBrightness(context);
});
}
},
)),
appBar: ViewWorkoutAppBar(
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix.

version: 1.4.0+25
version: 1.4.1+26

environment:
sdk: '>=3.3.0 <4.0.0'
Expand Down

0 comments on commit 6ecbb41

Please sign in to comment.