hide notification settings if FCM is not supported
This commit is contained in:
committed by
Dat H. Pham
parent
ce8f59dcf3
commit
7a27415295
@@ -2,6 +2,7 @@
|
||||
import 'package:back_button_interceptor/back_button_interceptor.dart';
|
||||
import 'package:core/core.dart';
|
||||
import 'package:dartz/dartz.dart';
|
||||
import 'package:fcm/model/firebase_capability.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:forward/forward/capability_forward.dart';
|
||||
import 'package:get/get.dart';
|
||||
@@ -229,6 +230,14 @@ class ManageAccountDashBoardController extends ReloadableController with UserSet
|
||||
}
|
||||
}
|
||||
|
||||
bool get isFcmCapabilitySupported {
|
||||
if (accountId.value != null && sessionCurrent != null) {
|
||||
return [FirebaseCapability.fcmIdentifier].isSupported(sessionCurrent!, accountId.value!);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool get isServerSettingsCapabilitySupported {
|
||||
if (accountId.value != null && sessionCurrent != null) {
|
||||
return [capabilityServerSettings].isSupported(sessionCurrent!, accountId.value!);
|
||||
|
||||
+20
-14
@@ -141,20 +141,26 @@ class SettingsFirstLevelView extends GetWidget<SettingsController> {
|
||||
AccountMenuItem.languageAndRegion.getIcon(controller.imagePaths),
|
||||
() => controller.selectSettings(AccountMenuItem.languageAndRegion)
|
||||
),
|
||||
if (PlatformInfo.isMobile) ...[
|
||||
Divider(
|
||||
color: AppColor.colorDividerHorizontal,
|
||||
height: 1,
|
||||
indent: SettingsUtils.getHorizontalPadding(context, controller.responsiveUtils),
|
||||
endIndent: SettingsUtils.getHorizontalPadding(context, controller.responsiveUtils)
|
||||
),
|
||||
SettingFirstLevelTileBuilder(
|
||||
AppLocalizations.of(context).notification,
|
||||
controller.imagePaths.icNotification,
|
||||
() => controller.selectSettings(AccountMenuItem.notification),
|
||||
subtitle: AppLocalizations.of(context).allowsTwakeMailToNotifyYouWhenANewMessageArrivesOnYourPhone,
|
||||
)
|
||||
],
|
||||
Obx(() {
|
||||
if (PlatformInfo.isMobile && controller.manageAccountDashboardController.isFcmCapabilitySupported) {
|
||||
return Column(children: [
|
||||
Divider(
|
||||
color: AppColor.colorDividerHorizontal,
|
||||
height: 1,
|
||||
indent: SettingsUtils.getHorizontalPadding(context, controller.responsiveUtils),
|
||||
endIndent: SettingsUtils.getHorizontalPadding(context, controller.responsiveUtils)
|
||||
),
|
||||
SettingFirstLevelTileBuilder(
|
||||
AppLocalizations.of(context).notification,
|
||||
controller.imagePaths.icNotification,
|
||||
() => controller.selectSettings(AccountMenuItem.notification),
|
||||
subtitle: AppLocalizations.of(context).allowsTwakeMailToNotifyYouWhenANewMessageArrivesOnYourPhone,
|
||||
)
|
||||
]);
|
||||
} else {
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
}),
|
||||
Obx(() {
|
||||
final accountId = controller
|
||||
.manageAccountDashboardController
|
||||
|
||||
Reference in New Issue
Block a user