|
...
|
...
|
@@ -140,8 +140,6 @@ class TodayController extends GetMaterialController { |
|
|
|
'enter_doublefeel_today_status',
|
|
|
|
properties: {'user_role': isFriend ? '好友的' : '我的'},
|
|
|
|
);
|
|
|
|
// 如果没有通知权限, 这里请求一下权限
|
|
|
|
_requestNotificationAuthorizationIfNeeded();
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
...
|
...
|
@@ -186,31 +184,6 @@ class TodayController extends GetMaterialController { |
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
Future<void> _requestNotificationAuthorizationIfNeeded() async {
|
|
|
|
try {
|
|
|
|
final status = await Permission.notification.status;
|
|
|
|
|
|
|
|
if (status.isGranted) {
|
|
|
|
// 已授权,无需再请求
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (status.isPermanentlyDenied) {
|
|
|
|
// 用户永久拒绝(Android),引导去设置
|
|
|
|
await openAppSettings();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// 未决定 → 弹出系统授权弹窗
|
|
|
|
final result = await Permission.notification.request();
|
|
|
|
AppLogger.d(result.isGranted
|
|
|
|
? 'Notification authorization granted'
|
|
|
|
: 'Notification authorization skipped');
|
|
|
|
} catch (error) {
|
|
|
|
AppLogger.e('Notification authorization failed: $error');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Future<void> checkHrvAdBannerVisible() async {
|
|
|
|
if (isFriend) {
|
|
|
|
showHrvAdBanner.value = false;
|
...
|
...
|
|