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

Add alarm manager #1

Merged
merged 7 commits into from Mar 11, 2024
Merged

Conversation

josephnglynn
Copy link
Contributor

@josephnglynn josephnglynn commented Mar 9, 2024

8ca80ce Fixes gradle wanting signing certificates when building debug builds.

0dd37c1 Fixes Looking up a deactivated widget's ancestor is unsafe.. This can only be caught in debug builds as the check is removed for release builds. See here and here for more information. This commit also removes listeners and some state variables in exchange for context.watch<T>() as recommanded in Provider docs for reading values.

cf35307 Adds changes from https://gitea.presley.nz/brandon.presley/Massive/pulls/236 and adapts them to work with here.

ad72876 Makes TimerService send a timeStamp with any command to the App UI, to keep them in sync.

731ff63 Makes App UI send a timeStamp with any command to TimerService, to keep them in sync + cleans up permission checks and methods.

b294b55 Fixes a UI bug causing discrepancies in the notification and UI timer + stops TimerService sending timer information to App UI if the App UI triggered the timer.

7ea4ec1 Fixes if the previous commands in Runnable took long enough that (timeTaken + timer.getRemainingMillis() % 1000) > 1000 then we could miss a second where we should've updated the timer. Also fixes the vibrate timer not turning off sometimes.

I have left the getProgress method in MainActivity, and StopAlarm.kt which can both be safely removed if there are no future plans for them.

If you want me to squash these some commits together let me know.

@josephnglynn josephnglynn changed the title Add alarm manager WIP: Add alarm manager Mar 9, 2024
@josephnglynn josephnglynn force-pushed the add_alarm_manager branch 2 times, most recently from e88c964 to e8ad86d Compare March 10, 2024 16:48
@josephnglynn josephnglynn changed the title WIP: Add alarm manager Add alarm manager Mar 10, 2024
@josephnglynn josephnglynn changed the title Add alarm manager WIP: Add alarm manager Mar 10, 2024
@josephnglynn josephnglynn changed the title WIP: Add alarm manager Add alarm manager Mar 10, 2024
@josephnglynn josephnglynn changed the title Add alarm manager WIP: Add alarm manager Mar 10, 2024
@josephnglynn josephnglynn changed the title WIP: Add alarm manager Add alarm manager Mar 10, 2024
@josephnglynn josephnglynn force-pushed the add_alarm_manager branch 2 times, most recently from 5e05e85 to 629b954 Compare March 11, 2024 19:11
This keeps the timers in sync and gets rid of the backtracking seen on
flutter UI
Cleaned up notification permission check
Cleaned up android method
Switched to periodic timers
Switched back to TimerHandler from kotlin.concurrent.fixedRateTimer
Reduced number of broadcasts
Updated refresh rate to 20ms for both UI and Notification
Fixed TimerHandler Delay getDelay()
Fixed vibrate not stopping sometimes
Revert back to ~1000ms on notification when app not visible
@brandonp2412
Copy link
Owner

Seems to have an error when attempting to run:

PS C:\Users\brandon\flexify> flutter run
Resolving dependencies... (7.3s)
  _fe_analyzer_shared 64.0.0 (67.0.0 available)
  analyzer 6.2.0 (6.4.1 available)
  csv 5.1.1 (6.0.0 available)
  dart_style 2.3.4 (2.3.6 available)
  drift 2.15.0 (2.16.0 available)
  drift_dev 2.15.0 (2.16.0 available)
  ffi 2.1.0 (2.1.2 available)
  flutter_lints 2.0.3 (3.0.1 available)
  flutter_local_notifications 16.3.2 (17.0.0 available)
  js 0.6.7 (0.7.1 available)
  lints 2.1.1 (3.0.0 available)
  matcher 0.12.16 (0.12.16+1 available)
  material_color_utilities 0.5.0 (0.11.0 available)
  meta 1.10.0 (1.12.0 available)
  path 1.8.3 (1.9.0 available)
  provider 6.1.1 (6.1.2 available)
  sqlparser 0.34.0 (0.34.1 available)
  test_api 0.6.1 (0.7.0 available)
  web 0.3.0 (0.5.1 available)
  web_socket_channel 2.4.0 (2.4.4 available)
  win32 5.2.0 (5.3.0 available)
Got dependencies!
21 packages have newer versions incompatible with dependency constraints.
Try `flutter pub outdated` for more information.
Launching lib\main.dart on Pixel 5 in debug mode...

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:processDebugResources'.
> A failure occurred while executing com.android.build.gradle.internal.res.LinkApplicationAndroidResourcesTask$TaskAction
   > Android resource linking failed
     C:\Users\brandon\flexify\build\app\intermediates\packaged_manifests\debug\AndroidManifest.xml:71: error: 'specialUse' is incompatible with attribute foregroundServiceType (attr) flags [camera=64, connectedDevice=16, dataSync=1, location=8, mediaPlayback=2, mediaProjection=32, microphone=128, phoneCall=4].
     error: failed processing manifest.


* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 11s
Running Gradle task 'assembleDebug'...                             12.0s
Exception: Gradle task assembleDebug failed with exit code 1
PS C:\Users\brandon\flexify> 

@brandonp2412
Copy link
Owner

It was a local environment error. I needed to change:
C:\tools\flutter\packages\flutter_tools\gradle\src\main\groovy
static int compileSdkVersion = 33
to 34.

Great work as per usual King. Thanks a lot.

@brandonp2412 brandonp2412 merged commit 7ea4ec1 into brandonp2412:main Mar 11, 2024
@brandonp2412
Copy link
Owner

@josephnglynn any idea what I should do about this?
I had the debug build sign with the release config because flutter run will forcibly uninstall + reinstall the app and wipe all my data if i accidentally forget to export my sets before running it.

@brandonp2412
Copy link
Owner

@josephnglynn any idea what I should do about this? I had the debug build sign with the release config because flutter run will forcibly uninstall + reinstall the app and wipe all my data if i accidentally forget to export my sets before running it.

Scratch that I figured it out here:

1121f3d

@josephnglynn josephnglynn deleted the add_alarm_manager branch March 19, 2024 15:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants