chore: block notification permission request on app launch
This commit is contained in:
parent
902428f8e6
commit
4ea559b027
1 changed files with 17 additions and 30 deletions
|
|
@ -84,9 +84,15 @@ class BackgroundPush {
|
|||
const InitializationSettings(
|
||||
// #Pangea
|
||||
// android: AndroidInitializationSettings('notifications_icon'),
|
||||
// iOS: DarwinInitializationSettings(),
|
||||
android: AndroidInitializationSettings('@mipmap/ic_launcher'),
|
||||
iOS: DarwinInitializationSettings(
|
||||
requestAlertPermission: false,
|
||||
requestBadgePermission: false,
|
||||
requestSoundPermission: false,
|
||||
requestProvisionalPermission: false,
|
||||
),
|
||||
// Pangea#
|
||||
iOS: DarwinInitializationSettings(),
|
||||
),
|
||||
onDidReceiveNotificationResponse: goToRoom,
|
||||
);
|
||||
|
|
@ -229,19 +235,9 @@ class BackgroundPush {
|
|||
instance.matrix = matrix;
|
||||
// ignore: prefer_initializing_formals
|
||||
instance.onFcmError = onFcmError;
|
||||
// #Pangea
|
||||
instance.fullInit();
|
||||
// Pangea#
|
||||
return instance;
|
||||
}
|
||||
|
||||
// #Pangea
|
||||
Future<void> fullInit() => setupPush();
|
||||
|
||||
void handleLoginStateChanged(_) => setupPush();
|
||||
|
||||
StreamSubscription<LoginState>? onLogin;
|
||||
|
||||
Future<void> cancelNotification(String roomId) async {
|
||||
Logs().v('Cancel notification for room', roomId);
|
||||
await _flutterLocalNotificationsPlugin.cancel(roomId.hashCode);
|
||||
|
|
@ -275,25 +271,16 @@ class BackgroundPush {
|
|||
bool useDeviceSpecificAppId = false,
|
||||
}) async {
|
||||
// #Pangea
|
||||
try {
|
||||
// Pangea#
|
||||
if (PlatformInfos.isIOS) {
|
||||
//<GOOGLE_SERVICES>await firebase?.requestPermission();
|
||||
}
|
||||
if (PlatformInfos.isAndroid) {
|
||||
_flutterLocalNotificationsPlugin
|
||||
.resolvePlatformSpecificImplementation<
|
||||
AndroidFlutterLocalNotificationsPlugin>()
|
||||
?.requestNotificationsPermission();
|
||||
}
|
||||
// #Pangea
|
||||
} catch (err, s) {
|
||||
ErrorHandler.logError(
|
||||
e: "Error requesting notifications permission: $err",
|
||||
s: s,
|
||||
data: {},
|
||||
);
|
||||
}
|
||||
// if (PlatformInfos.isIOS) {
|
||||
// await firebase.requestPermission();
|
||||
// }
|
||||
// if (PlatformInfos.isAndroid) {
|
||||
// _flutterLocalNotificationsPlugin
|
||||
// .resolvePlatformSpecificImplementation<
|
||||
// AndroidFlutterLocalNotificationsPlugin
|
||||
// >()
|
||||
// ?.requestNotificationsPermission();
|
||||
// }
|
||||
// Pangea#
|
||||
final clientName = PlatformInfos.clientName;
|
||||
oldTokens ??= <String>{};
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue