Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Background process #70

Merged
merged 37 commits into from
Oct 25, 2023
Merged
Changes from 1 commit
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
3fa1079
background timer
a-mabe Aug 31, 2023
4559b22
iOS release
a-mabe Sep 12, 2023
05c380f
iOS release
a-mabe Sep 12, 2023
1e79c24
Use updated background timer package
a-mabe Sep 29, 2023
1f401a4
Use updated background timer package
a-mabe Sep 29, 2023
7881fc0
Use new timer version, add docs folder
a-mabe Oct 2, 2023
f0cd5ed
background timer
a-mabe Aug 31, 2023
403d5a4
iOS release
a-mabe Sep 12, 2023
64de968
iOS release
a-mabe Sep 12, 2023
09522c2
Use updated background timer package
a-mabe Sep 29, 2023
c82bbac
Use updated background timer package
a-mabe Sep 29, 2023
0ab3a88
Use new timer version, add docs folder
a-mabe Oct 2, 2023
9e3c0b9
Merge branch 'background-process' of github.com:a-mabe/workout-timer …
a-mabe Oct 2, 2023
0ec9849
Delete comments
a-mabe Oct 3, 2023
8f3b472
Update the UI list of intervals when coming back from a foreground pr…
a-mabe Oct 6, 2023
524435d
background timer
a-mabe Aug 31, 2023
6f636cb
iOS release
a-mabe Sep 12, 2023
6b9d67b
iOS release
a-mabe Sep 12, 2023
a6d2aeb
Use updated background timer package
a-mabe Sep 29, 2023
b7cd3ab
Use updated background timer package
a-mabe Sep 29, 2023
b609889
Use new timer version, add docs folder
a-mabe Oct 2, 2023
a122e1e
iOS release
a-mabe Sep 12, 2023
4d74327
iOS release
a-mabe Sep 12, 2023
740a5d2
Use updated background timer package
a-mabe Sep 29, 2023
b98cfb9
Use updated background timer package
a-mabe Sep 29, 2023
4cfa117
Delete comments
a-mabe Oct 3, 2023
7bf5b17
Update the UI list of intervals when coming back from a foreground pr…
a-mabe Oct 6, 2023
65742a9
Merge branch 'background-process' of github.com:a-mabe/workout-timer …
a-mabe Oct 6, 2023
9e86d4f
Merge remote-tracking branch 'origin/main' into background-process
a-mabe Oct 6, 2023
dc88d8f
Test not restarting the timer
a-mabe Oct 14, 2023
a8e81fd
Merge
a-mabe Oct 15, 2023
d382c2c
Regenerate ios icons
a-mabe Oct 15, 2023
8aec131
Deactivate audio session on workout start
a-mabe Oct 15, 2023
3793dc4
Update iOS identifier
a-mabe Oct 15, 2023
09d9ee7
Add new Android permission declerations and point background timer pa…
a-mabe Oct 16, 2023
ddd05fa
Use sound_pool for playing sample sounds
a-mabe Oct 25, 2023
5967632
Code cleanup
a-mabe Oct 25, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Use updated background timer package
a-mabe committed Oct 2, 2023
commit c82bbac0581e159c480154ea896a0c2be34916bf
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// Generated file.
//
// If you wish to remove Flutter's multidex support, delete this entire file.
//
// Modifications to this file should be done in a copy under a different name
// as this file may be regenerated.

package io.flutter.app;

import android.app.Application;
import android.content.Context;
import androidx.annotation.CallSuper;
import androidx.multidex.MultiDex;

/**
* Extension of {@link android.app.Application}, adding multidex support.
*/
public class FlutterMultiDexApplication extends Application {
@Override
@CallSuper
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
}
}
51 changes: 26 additions & 25 deletions lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'dart:async';
import 'dart:convert';

import 'package:audio_session/audio_session.dart';
// import 'package:audio_session/audio_session.dart';
import 'package:flutter/material.dart';
import 'create_workout/select_timer.dart';
import 'workout_data_type/workout_type.dart';
@@ -45,31 +45,31 @@ class _MyHomePageState extends State<MyHomePage> {
@override
initState() {
super.initState();
init();
// init();
}

void init() async {
// final session = await AudioSession.instance;
// await session.configure(const AudioSessionConfiguration.music());

final session = await AudioSession.instance;
await session.configure(
const AudioSessionConfiguration(
avAudioSessionCategory: AVAudioSessionCategory.playback,
avAudioSessionCategoryOptions: AVAudioSessionCategoryOptions.mixWithOthers,
avAudioSessionMode: AVAudioSessionMode.defaultMode,
avAudioSessionRouteSharingPolicy: AVAudioSessionRouteSharingPolicy.defaultPolicy,
avAudioSessionSetActiveOptions: AVAudioSessionSetActiveOptions.none,
androidAudioAttributes: AndroidAudioAttributes(
contentType: AndroidAudioContentType.speech,
flags: AndroidAudioFlags.none,
usage: AndroidAudioUsage.voiceCommunication,
),
androidAudioFocusGainType: AndroidAudioFocusGainType.gain,
androidWillPauseWhenDucked: true,
),
);
}
// void init() async {
// // final session = await AudioSession.instance;
// // await session.configure(const AudioSessionConfiguration.music());

// final session = await AudioSession.instance;
// await session.configure(const AudioSessionConfiguration(
// avAudioSessionCategory: AVAudioSessionCategory.ambient,
// avAudioSessionCategoryOptions:
// AVAudioSessionCategoryOptions.mixWithOthers,
// avAudioSessionMode: AVAudioSessionMode.defaultMode,
// avAudioSessionRouteSharingPolicy:
// AVAudioSessionRouteSharingPolicy.defaultPolicy,
// avAudioSessionSetActiveOptions: AVAudioSessionSetActiveOptions.none,
// androidAudioAttributes: AndroidAudioAttributes(
// contentType: AndroidAudioContentType.music,
// flags: AndroidAudioFlags.audibilityEnforced,
// usage: AndroidAudioUsage.media,
// ),
// androidAudioFocusGainType: AndroidAudioFocusGainType.gain,
// androidWillPauseWhenDucked: true,
// ));
// }

int calculateWorkoutTime(Workout workout) {
return (((workout.exerciseTime * workout.numExercises) +
@@ -200,7 +200,8 @@ Total: ${calculateWorkoutTime(snapshot.data![index])} minutes'''),
body: SafeArea(
child: FutureBuilder<List<Workout>>(
future: workouts,
builder: (BuildContext context, AsyncSnapshot<List<Workout>> snapshot) {
builder:
(BuildContext context, AsyncSnapshot<List<Workout>> snapshot) {
/// When [workouts] has successfully loaded.
if (snapshot.hasData) {
return workoutListView(snapshot);
Loading