diff --git a/lib/blocs/auth_cubit.dart b/lib/blocs/auth_cubit.dart index 9d543800f..1a3b1c9f0 100644 --- a/lib/blocs/auth_cubit.dart +++ b/lib/blocs/auth_cubit.dart @@ -2,8 +2,6 @@ import 'dart:async'; import 'dart:io'; import 'package:equatable/equatable.dart'; -import 'package:firebase_core/firebase_core.dart'; -import 'package:firebase_messaging/firebase_messaging.dart'; import 'package:flutter/services.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_secure_storage/flutter_secure_storage.dart'; @@ -11,10 +9,8 @@ import 'package:flutter_web_auth_2/flutter_web_auth_2.dart'; import 'package:oauth2/oauth2.dart'; import 'package:reaxit/api/api_repository.dart'; import 'package:reaxit/api/concrexit_api_repository.dart'; -import 'package:reaxit/api/exceptions.dart'; import 'package:reaxit/config.dart'; import 'package:sentry_flutter/sentry_flutter.dart'; -import 'package:shared_preferences/shared_preferences.dart'; final _redirectUrl = Uri.parse( 'nu.thalia://callback', @@ -87,9 +83,6 @@ class FailureAuthState extends AuthState { class AuthCubit extends Cubit { AuthCubit() : super(LoadingAuthState()); - /// A listener for refreshing push notification tokens. - StreamSubscription? _fmTokenSubscription; - /// Restore the authentication state from storage. /// /// Looks for existing credentials and, if available, @@ -154,12 +147,6 @@ class AuthCubit extends Cubit { onLogOut: logOut, ); - try { - _setupPushNotifications(apiRepository); - } on FirebaseException { - // Ignore. - } - emit(LoggedInAuthState(apiRepository: apiRepository)); } else { logOut(); @@ -254,8 +241,6 @@ class AuthCubit extends Cubit { onLogOut: logOut, ); - await _setupPushNotifications(apiRepository); - emit(LoggedInAuthState(apiRepository: apiRepository)); } on PlatformException catch (exception) { // Forward exceptions from the authentication flow. @@ -310,33 +295,4 @@ class AuthCubit extends Cubit { )); } } - - /// Set up push notifications. - /// - /// Requests permission to display notifications, and registers - /// or updates a [Device] for push notifications on the backend. - /// - /// Returns whether push notifications have been set up successfully or not. - Future _setupPushNotifications(ApiRepository api) async { - try { - // Request permissions for push notifications. - // We set up push notifications regardless of whether the user gives - // permission, so we don't need to keep track of the permission state, - // and the user can simply get push notifications working by enabling - // the permissions in the phone's settings. - FirebaseMessaging.instance.requestPermission( - alert: true, - announcement: true, - badge: true, - carPlay: false, - criticalAlert: false, - provisional: false, - sound: true, - ); - - return true; - } catch (_) { - return false; - } - } } diff --git a/pubspec.lock b/pubspec.lock index 24cafdc74..004056ff2 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -9,14 +9,6 @@ packages: url: "https://pub.dev" source: hosted version: "61.0.0" - _flutterfire_internals: - dependency: transitive - description: - name: _flutterfire_internals - sha256: "1a52f1afae8ab7ac4741425114713bdbba802f1ce1e0648e167ffcc6e05e96cf" - url: "https://pub.dev" - source: hosted - version: "1.3.21" add_2_calendar: dependency: "direct main" description: @@ -353,30 +345,6 @@ packages: url: "https://pub.dev" source: hosted version: "2.11.4" - firebase_messaging: - dependency: "direct main" - description: - name: firebase_messaging - sha256: "9c97b20c012542252a8853f11334efd833ddae83551fe37d27f87d885c655038" - url: "https://pub.dev" - source: hosted - version: "14.7.15" - firebase_messaging_platform_interface: - dependency: transitive - description: - name: firebase_messaging_platform_interface - sha256: d464b255e922c7915dc4b0ebc305ebad4e1f130519bee3d6e568ef2ea1613a4b - url: "https://pub.dev" - source: hosted - version: "4.5.23" - firebase_messaging_web: - dependency: transitive - description: - name: firebase_messaging_web - sha256: f3f71aeec719ec1fe2c99f75cd74d00d33f1c240cf1e402cc9d43883e84f935a - url: "https://pub.dev" - source: hosted - version: "3.6.4" fixnum: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index c616cfb71..10f332e1b 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -90,7 +90,6 @@ dependencies: # Firebase for push notifications. firebase_core: ^2.16.0 - firebase_messaging: ^14.6.8 # Push notifications in app. overlay_support: ^2.1.0