mirror of
https://github.com/go-vikunja/app
synced 2024-05-31 09:46:51 +00:00
added request for notification permission
This commit is contained in:
parent
6513a275f4
commit
01d586fd86
|
@ -2,6 +2,7 @@ import 'dart:io';
|
|||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
|
||||
import 'package:permission_handler/permission_handler.dart';
|
||||
import 'package:vikunja_app/api/task_implementation.dart';
|
||||
import 'package:vikunja_app/api/client.dart';
|
||||
import 'package:vikunja_app/service/services.dart';
|
||||
|
@ -12,8 +13,6 @@ import 'package:vikunja_app/pages/user/login.dart';
|
|||
import 'package:vikunja_app/theme/theme.dart';
|
||||
import 'package:timezone/data/latest_all.dart' as tz;
|
||||
|
||||
import 'package:http/http.dart' as httpl;
|
||||
|
||||
import 'managers/notifications.dart';
|
||||
|
||||
class IgnoreCertHttpOverrides extends HttpOverrides {
|
||||
|
@ -60,8 +59,13 @@ void callbackDispatcher() {
|
|||
});
|
||||
}
|
||||
|
||||
void main() {
|
||||
void main() async {
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
await Permission.notification.isDenied.then((value) {
|
||||
if (value) {
|
||||
Permission.notification.request();
|
||||
}
|
||||
});
|
||||
Workmanager().initialize(callbackDispatcher, isInDebugMode: false);
|
||||
runApp(VikunjaGlobal(
|
||||
child: new VikunjaApp(
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:permission_handler/permission_handler.dart';
|
||||
import 'package:vikunja_app/global.dart';
|
||||
import 'package:vikunja_app/models/list.dart';
|
||||
|
||||
|
@ -125,7 +126,12 @@ class SettingsPageState extends State<SettingsPage> {
|
|||
})
|
||||
: ListTile(title: Text("...")),
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
onPressed: () async {
|
||||
await Permission.notification.isDenied.then((value) {
|
||||
if (value) {
|
||||
Permission.notification.request();
|
||||
}
|
||||
});
|
||||
VikunjaGlobal.of(context).notifications.sendTestNotification();
|
||||
},
|
||||
child: Text("Send test notification")),
|
||||
|
|
40
pubspec.lock
40
pubspec.lock
|
@ -536,6 +536,46 @@ packages:
|
|||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.0.1"
|
||||
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"
|
||||
petitparser:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
|
|
|
@ -30,6 +30,7 @@ dependencies:
|
|||
package_info_plus: ^3.0.2
|
||||
url_launcher: ^6.1.7
|
||||
workmanager: ^0.5.1
|
||||
permission_handler: ^10.2.0
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
|
|
Loading…
Reference in New Issue
Block a user