|
|
@@ -6,8 +6,10 @@ import 'package:injectable/injectable.dart';
|
|
|
import 'package:location/base/base_controller.dart';
|
|
|
import 'package:location/data/repositories/phone_event_repository.dart';
|
|
|
import 'package:location/resource/string.gen.dart';
|
|
|
+import 'package:location/utils/notification_util.dart';
|
|
|
import 'package:location/utils/toast_util.dart';
|
|
|
import 'package:mobile_use_statistics/flutter_mobile_statistics.dart';
|
|
|
+import 'package:permission_handler/permission_handler.dart';
|
|
|
import '../../utils/permission_util.dart';
|
|
|
|
|
|
@injectable
|
|
|
@@ -82,4 +84,18 @@ class PermissionSettingController extends BaseController {
|
|
|
ToastUtil.show(StringName.permissionRequestFail);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ void openNotificationSetting() async {
|
|
|
+ bool hasPermission = await NotificationUtil.hasNotificationPermission();
|
|
|
+ if (hasPermission) {
|
|
|
+ ToastUtil.show(StringName.permissionSettingSuccess);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ hasPermission = await NotificationUtil.requestNotificationPermission();
|
|
|
+ if (hasPermission) {
|
|
|
+ ToastUtil.show(StringName.permissionSettingSuccess);
|
|
|
+ } else {
|
|
|
+ ToastUtil.show(StringName.permissionRequestFail);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|