Request notification permissions on edit_set

This commit is contained in:
Brandon Presley 2023-04-15 17:03:14 +12:00
parent 0f7d938ad7
commit e834499644
5 changed files with 47 additions and 0 deletions

View File

@ -4,6 +4,7 @@ import 'package:flutter/services.dart';
import 'package:fmassive/database.dart';
import 'package:fmassive/main.dart';
import 'package:moor_flutter/moor_flutter.dart';
import 'package:permission_handler/permission_handler.dart';
class EditGymSetPage extends StatefulWidget {
final GymSetsCompanion gymSet;
@ -121,6 +122,7 @@ class _EditGymSetPageState extends State<EditGymSetPage> {
if (gymSet.id.present)
await db.update(db.gymSets).write(gymSet);
else {
await Permission.notification.request();
await db.into(db.gymSets).insert(gymSet);
const platform = MethodChannel('com.massive/android');
platform.invokeMethod('timer', [3000]);

View File

@ -560,6 +560,46 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.1.5"
permission_handler:
dependency: "direct main"
description:
name: permission_handler
sha256: "33c6a1253d1f95fd06fa74b65b7ba907ae9811f9d5c1d3150e51417d04b8d6a8"
url: "https://pub.dev"
source: hosted
version: "10.2.0"
permission_handler_android:
dependency: transitive
description:
name: permission_handler_android
sha256: "8028362b40c4a45298f1cbfccd227c8dd6caf0e27088a69f2ba2ab15464159e2"
url: "https://pub.dev"
source: hosted
version: "10.2.0"
permission_handler_apple:
dependency: transitive
description:
name: permission_handler_apple
sha256: ee96ac32f5a8e6f80756e25b25b9f8e535816c8e6665a96b6d70681f8c4f7e85
url: "https://pub.dev"
source: hosted
version: "9.0.8"
permission_handler_platform_interface:
dependency: transitive
description:
name: permission_handler_platform_interface
sha256: "68abbc472002b5e6dfce47fe9898c6b7d8328d58b5d2524f75e277c07a97eb84"
url: "https://pub.dev"
source: hosted
version: "3.9.0"
permission_handler_windows:
dependency: transitive
description:
name: permission_handler_windows
sha256: f67cab14b4328574938ecea2db3475dad7af7ead6afab6338772c5f88963e38b
url: "https://pub.dev"
source: hosted
version: "0.1.2"
platform:
dependency: transitive
description:

View File

@ -45,6 +45,7 @@ dependencies:
file_picker: ^5.2.9
audioplayers: ^4.0.1
intl: ^0.18.0
permission_handler: ^10.2.0
dev_dependencies:
flutter_test:

View File

@ -7,11 +7,14 @@
#include "generated_plugin_registrant.h"
#include <audioplayers_windows/audioplayers_windows_plugin.h>
#include <permission_handler_windows/permission_handler_windows_plugin.h>
#include <sqlite3_flutter_libs/sqlite3_flutter_libs_plugin.h>
void RegisterPlugins(flutter::PluginRegistry* registry) {
AudioplayersWindowsPluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("AudioplayersWindowsPlugin"));
PermissionHandlerWindowsPluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("PermissionHandlerWindowsPlugin"));
Sqlite3FlutterLibsPluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("Sqlite3FlutterLibsPlugin"));
}

View File

@ -4,6 +4,7 @@
list(APPEND FLUTTER_PLUGIN_LIST
audioplayers_windows
permission_handler_windows
sqlite3_flutter_libs
)