From 01f304259b94c8064faeb1176c17b103c4ccc337 Mon Sep 17 00:00:00 2001 From: Abhishek Saini <78199221+Abhisheksainii@users.noreply.github.com> Date: Mon, 18 Dec 2023 13:28:52 +0530 Subject: [PATCH 01/11] feature: Removed all references to Google firebase --- android/app/src/main/AndroidManifest.xml | 4 +- lib/firebase_options.dart | 178 ++++---- lib/main.dart | 155 ------- lib/services/database_mutation_functions.dart | 24 +- lib/utils/queries.dart | 32 +- .../profile_page_view_model.dart | 41 +- .../login_view_model.dart | 35 +- pubspec.lock | 82 +--- pubspec.yaml | 4 - test/helpers/setup_firebase_mocks.dart | 402 +++++++++--------- test/utils_tests/queries_test.dart | 20 +- .../login_view_model_test.dart | 23 - .../events/edit_event_page_test.dart | 5 - .../pre_auth_screens/splash_screen_test.dart | 6 - 14 files changed, 369 insertions(+), 642 deletions(-) diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 061b52373..1d9989c3f 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -57,9 +57,9 @@ - + android:value="high_importance_channel" /> --> androidFirebaseOptions, - Map iosFirebaseOptions, - ) { - if (kIsWeb) { - throw UnsupportedError( - 'DefaultFirebaseOptions have not been configured for web - ' - 'you can reconfigure this by running the FlutterFire CLI again.', - ); - } - switch (defaultTargetPlatform) { - case TargetPlatform.android: - return android(androidFirebaseOptions); - case TargetPlatform.iOS: - return ios(iosFirebaseOptions); - case TargetPlatform.macOS: - throw UnsupportedError( - 'DefaultFirebaseOptions have not been configured for macos - ' - 'you can reconfigure this by running the FlutterFire CLI again.', - ); - default: - throw UnsupportedError( - 'DefaultFirebaseOptions are not supported for this platform.', - ); - } - } +// /// Default [FirebaseOptions] for use with your Firebase apps. +// /// +// /// Example: +// /// ```dart +// /// import 'firebase_options.dart'; +// /// // ... +// /// await Firebase.initializeApp( +// /// options: DefaultFirebaseOptions.currentPlatform, +// /// ); +// /// ``` +// class DefaultFirebaseOptions { +// /// Builds and returns [FirebaseOptions] based on the current platform. +// /// +// /// Switches on the current platform and calls [android] or [iOS] +// /// methods accordingly to build the [FirebaseOptions]. Throws +// /// [UnsupportedError] if the platform is other than these two. +// /// +// /// **params**: +// /// * `androidFirebaseOptions`: Firebase Options for Android +// /// * `iosFirebaseOptions`: Firebase Options for iOS +// /// +// /// **returns**: +// /// * `FirebaseOptions`: The [FirebaseOptions] built according to the platform. +// static FirebaseOptions currentPlatform( +// Map androidFirebaseOptions, +// Map iosFirebaseOptions, +// ) { +// if (kIsWeb) { +// throw UnsupportedError( +// 'DefaultFirebaseOptions have not been configured for web - ' +// 'you can reconfigure this by running the FlutterFire CLI again.', +// ); +// } +// switch (defaultTargetPlatform) { +// case TargetPlatform.android: +// return android(androidFirebaseOptions); +// case TargetPlatform.iOS: +// return ios(iosFirebaseOptions); +// case TargetPlatform.macOS: +// throw UnsupportedError( +// 'DefaultFirebaseOptions have not been configured for macos - ' +// 'you can reconfigure this by running the FlutterFire CLI again.', +// ); +// default: +// throw UnsupportedError( +// 'DefaultFirebaseOptions are not supported for this platform.', +// ); +// } +// } - /// Scaffolds androidFirebaseOptions around FirebaseOptions. - /// - /// **params**: - /// * `androidFirebaseOptions`: The options which we want to scaffold - /// - /// **returns**: - /// * `FirebaseOptions`: Scaffolded FirebaseOptions - static FirebaseOptions android(Map androidFirebaseOptions) => - FirebaseOptions( - apiKey: androidFirebaseOptions['apiKey'] as String, - appId: androidFirebaseOptions['appId'] as String, - messagingSenderId: - androidFirebaseOptions['messagingSenderId'] as String, - projectId: androidFirebaseOptions['projectId'] as String, - storageBucket: androidFirebaseOptions['storageBucket'] as String, - ); +// /// Scaffolds androidFirebaseOptions around FirebaseOptions. +// /// +// /// **params**: +// /// * `androidFirebaseOptions`: The options which we want to scaffold +// /// +// /// **returns**: +// /// * `FirebaseOptions`: Scaffolded FirebaseOptions +// static FirebaseOptions android(Map androidFirebaseOptions) => +// FirebaseOptions( +// apiKey: androidFirebaseOptions['apiKey'] as String, +// appId: androidFirebaseOptions['appId'] as String, +// messagingSenderId: +// androidFirebaseOptions['messagingSenderId'] as String, +// projectId: androidFirebaseOptions['projectId'] as String, +// storageBucket: androidFirebaseOptions['storageBucket'] as String, +// ); - /// Scaffolds iosFirebaseOptions around FirebaseOptions. - /// - /// more_info_if_required - /// - /// **params**: - /// * `iosFirebaseOptions`: The options which we want to scaffold - /// - /// **returns**: - /// * `FirebaseOptions`: Scaffolded FirebaseOptions - static FirebaseOptions ios(Map iosFirebaseOptions) => - FirebaseOptions( - apiKey: iosFirebaseOptions['apiKey'] as String, - appId: iosFirebaseOptions['appId'] as String, - messagingSenderId: iosFirebaseOptions['messagingSenderId'] as String, - projectId: iosFirebaseOptions['projectId'] as String, - storageBucket: iosFirebaseOptions['storageBucket'] as String, - iosClientId: iosFirebaseOptions['iosClientId'] as String, - iosBundleId: iosFirebaseOptions['iosBundleId'] as String, - ); -} +// /// Scaffolds iosFirebaseOptions around FirebaseOptions. +// /// +// /// more_info_if_required +// /// +// /// **params**: +// /// * `iosFirebaseOptions`: The options which we want to scaffold +// /// +// /// **returns**: +// /// * `FirebaseOptions`: Scaffolded FirebaseOptions +// static FirebaseOptions ios(Map iosFirebaseOptions) => +// FirebaseOptions( +// apiKey: iosFirebaseOptions['apiKey'] as String, +// appId: iosFirebaseOptions['appId'] as String, +// messagingSenderId: iosFirebaseOptions['messagingSenderId'] as String, +// projectId: iosFirebaseOptions['projectId'] as String, +// storageBucket: iosFirebaseOptions['storageBucket'] as String, +// iosClientId: iosFirebaseOptions['iosClientId'] as String, +// iosBundleId: iosFirebaseOptions['iosBundleId'] as String, +// ); +// } diff --git a/lib/main.dart b/lib/main.dart index 7ec3b1890..d8931789d 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,11 +1,8 @@ import 'dart:io'; -import 'package:firebase_core/firebase_core.dart'; -import 'package:firebase_messaging/firebase_messaging.dart'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart' as fs; -import 'package:flutter_local_notifications/flutter_local_notifications.dart'; import 'package:flutter_localizations/flutter_localizations.dart'; import 'package:hive/hive.dart'; import 'package:path_provider/path_provider.dart' as path; @@ -13,7 +10,6 @@ import 'package:provider/provider.dart'; import 'package:quick_actions/quick_actions.dart'; import 'package:talawa/constants/custom_theme.dart'; import 'package:talawa/constants/quick_actions.dart'; -import 'package:talawa/firebase_options.dart'; import 'package:talawa/locator.dart'; import 'package:talawa/models/asymetric_keys/asymetric_keys.dart'; import 'package:talawa/models/organization/org_info.dart'; @@ -26,51 +22,6 @@ import 'package:talawa/view_model/lang_view_model.dart'; import 'package:talawa/view_model/theme_view_model.dart'; import 'package:talawa/views/base_view.dart'; -/// Define a top-level named handler which background/terminated messages will call. -/// -/// To verify things are working, check out the native platform logs. -/// **params**: -/// * `message`: incoming messsage. -/// -/// **returns**: -/// * `Future`: promise that will be fulfilled message background activities are successful. -Future _firebaseMessagingBackgroundHandler(RemoteMessage message) async { - // If you're going to use other Firebase services in the background, such as Firestore, - // make sure you call `initializeApp` before using other Firebase services. - final Directory dir = await path.getApplicationDocumentsDirectory(); - Hive.init(dir.path); - await setUpFirebaseKeys(); - await setUpFirebase(); -} - -/// Initializes the firebase in the app according to the userplatform (android/iOS). -/// -/// **params**: -/// None -/// -/// **returns**: -/// * `Future`: promise that will be fulfilled Firebase is setted up in app. -Future setUpFirebase() async { - await Firebase.initializeApp( - options: DefaultFirebaseOptions.currentPlatform( - androidFirebaseOptions, - iosFirebaseOptions, - ), - ); -} - -/// HashMap of Firebase options for android. -late Map androidFirebaseOptions; - -/// HashMap of Firebase options for android. -late Map iosFirebaseOptions; - -/// Create a [AndroidNotificationChannel] for heads up notifications. -late AndroidNotificationChannel channel; - -/// Initialize the [FlutterLocalNotificationsPlugin] package. -late FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin; - /// First function to initialize the application, invoked automatically. /// /// **params**: @@ -82,26 +33,6 @@ Future main() async { // Returns an instance of the binding that implements WidgetsBinding. WidgetsFlutterBinding.ensureInitialized(); - if (!kIsWeb) { - channel = const AndroidNotificationChannel( - 'high_importance_channel', // id - 'High Importance Notifications', // title - description: - 'This channel is used for important notifications.', // description - importance: Importance.high, - ); - - flutterLocalNotificationsPlugin = FlutterLocalNotificationsPlugin(); - - // Create an Android Notification Channel. - // We use this channel in the `AndroidManifest.xml` file to override the - // default FCM channel to enable heads up notifications. - await flutterLocalNotificationsPlugin - .resolvePlatformSpecificImplementation< - AndroidFlutterLocalNotificationsPlugin>() - ?.createNotificationChannel(channel); - } - final Directory dir = await path.getApplicationDocumentsDirectory(); Hive ..init(dir.path) @@ -115,52 +46,11 @@ Future main() async { await Hive.openBox('pluginBox'); await Hive.openBox('url'); - final urlBox = await Hive.openBox('url'); - - try { - if (urlBox.get('url') != null) { - await setUpFirebaseKeys(); - - await setUpFirebase(); - await setUpFirebaseMessaging(); - } - } catch (e) { - print("Firebase not working"); - } - setupLocator(); // The runApp() function takes the given Widget and makes it the root of the widget tree. runApp(MyApp()); } -/// Initializes the firebase keys in the app according to the userplatform (android/iOS). -/// -/// **params**: -/// None -/// -/// **returns**: -/// * `Future`: promise that will be fulfilled Firebase keys are setted up. -Future setUpFirebaseKeys() async { - final androidFirebaseOptionsBox = - await Hive.openBox('androidFirebaseOptions'); - final androidFirebaseOptionsMap = androidFirebaseOptionsBox - .get('androidFirebaseOptions') as Map?; - - final iosFirebaseOptionsBox = await Hive.openBox('iosFirebaseOptions'); - final iosFirebaseOptionsMap = - iosFirebaseOptionsBox.get('iosFirebaseOptions') as Map?; - if (androidFirebaseOptionsMap != null) { - androidFirebaseOptions = androidFirebaseOptionsMap.map((key, value) { - return MapEntry(key.toString(), value); - }); - } - if (iosFirebaseOptionsMap != null) { - iosFirebaseOptions = iosFirebaseOptionsMap.map((key, value) { - return MapEntry(key.toString(), value); - }); - } -} - /// Main widget that sets up the quick actions, internationalization, routing , notifications. class MyApp extends StatefulWidget { // This widget is the root of your application. @@ -331,48 +221,3 @@ class DemoViewModel extends BaseModel { /// * `String`: title of the model String get title => _title; } - -/// Set up firebase instance, enbables messaging,listens to icoming messages. -/// -/// **params**: -/// None -/// -/// **returns**: -/// * `Future`: promise that will be fulfilled Firebase is setted up. -Future setUpFirebaseMessaging() async { - /// Set the background messaging handler early on, as a named top-level function - FirebaseMessaging.onBackgroundMessage(_firebaseMessagingBackgroundHandler); - - // Update the iOS foreground notification presentation options to allow heads up notifications. - await FirebaseMessaging.instance.setForegroundNotificationPresentationOptions( - alert: true, - badge: true, - sound: true, - ); - - FirebaseMessaging.instance - .getInitialMessage() - .then((RemoteMessage? message) {}); - - FirebaseMessaging.onMessage.listen((RemoteMessage message) { - final RemoteNotification? notification = message.notification; - final AndroidNotification? android = message.notification?.android; - if (notification != null && android != null && !kIsWeb) { - flutterLocalNotificationsPlugin.show( - notification.hashCode, - notification.title, - notification.body, - NotificationDetails( - android: AndroidNotificationDetails( - channel.id, - channel.name, - channelDescription: channel.description, - icon: 'launch_background', - ), - ), - ); - } - }); - - FirebaseMessaging.onMessageOpenedApp.listen((RemoteMessage message) {}); -} diff --git a/lib/services/database_mutation_functions.dart b/lib/services/database_mutation_functions.dart index f026498c5..ccf176ba7 100644 --- a/lib/services/database_mutation_functions.dart +++ b/lib/services/database_mutation_functions.dart @@ -191,18 +191,18 @@ class DataBaseMutationFunctions { } return false; } - if (exception.graphqlErrors[i].message == - notifFeatureNotInstalled.message) { - if (showSnackBar) { - WidgetsBinding.instance.addPostFrameCallback( - (_) => navigationService.showTalawaErrorDialog( - "Notification Feature is not installed", - MessageType.error, - ), - ); - } - return false; - } + // if (exception.graphqlErrors[i].message == + // notifFeatureNotInstalled.message) { + // if (showSnackBar) { + // WidgetsBinding.instance.addPostFrameCallback( + // (_) => navigationService.showTalawaErrorDialog( + // "Notification Feature is not installed", + // MessageType.error, + // ), + // ); + // } + // return false; + // } } // if the error is unknown diff --git a/lib/utils/queries.dart b/lib/utils/queries.dart index 8a91298f4..446c66880 100644 --- a/lib/utils/queries.dart +++ b/lib/utils/queries.dart @@ -147,22 +147,7 @@ class Queries { } } refreshToken - androidFirebaseOptions { - apiKey - appId - messagingSenderId - projectId - storageBucket - } - iosFirebaseOptions { - apiKey - appId - messagingSenderId - projectId - storageBucket - iosClientId - iosBundleId - } + } } """; @@ -193,21 +178,6 @@ class Queries { """; } - /// To save fcm token the backend fro notification. - /// - /// **params**: - /// * `token`: fcm token, read firebase docs for more info - /// - /// **returns**: - /// * `String`: return the mutation - String saveFcmToken(String? token) { - return """ - mutation { - saveFcmToken(token: "$token") - } - """; - } - /// logout muiation. /// /// **params**: diff --git a/lib/view_model/after_auth_view_models/profile_view_models/profile_page_view_model.dart b/lib/view_model/after_auth_view_models/profile_view_models/profile_page_view_model.dart index d17dadb47..da974fede 100644 --- a/lib/view_model/after_auth_view_models/profile_view_models/profile_page_view_model.dart +++ b/lib/view_model/after_auth_view_models/profile_view_models/profile_page_view_model.dart @@ -1,5 +1,6 @@ import 'package:currency_picker/currency_picker.dart'; import 'package:flutter/material.dart'; +import 'package:graphql_flutter/graphql_flutter.dart'; import 'package:hive/hive.dart'; import 'package:qr_flutter/qr_flutter.dart'; import 'package:talawa/constants/constants.dart'; @@ -16,6 +17,7 @@ import 'package:talawa/utils/app_localization.dart'; import 'package:talawa/view_model/base_view_model.dart'; import 'package:talawa/view_model/lang_view_model.dart'; import 'package:talawa/widgets/custom_alert_dialog.dart'; +import 'package:talawa/widgets/custom_progress_dialog.dart'; import 'package:talawa/widgets/talawa_error_dialog.dart'; /// ProfilePageViewModel class helps to interact with model to serve data and react to user's input in Profile Page view. @@ -87,7 +89,44 @@ class ProfilePageViewModel extends BaseModel { /// * `Future`: Resolves when user logout Future logout(BuildContext context) async { // push custom alert dialog with the confirmation message. - navigationService.pushDialog(logoutDialog()); + navigationService.pushDialog( + CustomAlertDialog( + reverse: true, + dialogSubTitle: 'Are you sure you want to logout?', + successText: 'Logout', + success: () async { + try { + final result = await databaseFunctions + .gqlAuthMutation(queries.logout()) as QueryResult?; + if (result != null && result.data!['logout'] == true) { + navigationService.pop(); + navigationService.pushDialog( + const CustomProgressDialog( + key: Key('LogoutProgress'), + ), + ); + Future.delayed(const Duration(seconds: 1)).then((value) { + user = Hive.box('currentUser'); + url = Hive.box('url'); + organisation = Hive.box('currentOrg'); + user.clear(); + url.clear(); + + organisation.clear(); + navigationService.pop(); + navigationService.removeAllAndPush( + '/selectLang', + '/', + arguments: '0', + ); + }); + } + } catch (e) { + print(e); + } + }, + ), + ); } /// This method changes the currency of the user for donation purpose. diff --git a/lib/view_model/pre_auth_view_models/login_view_model.dart b/lib/view_model/pre_auth_view_models/login_view_model.dart index 0f909bfdb..0bf731512 100644 --- a/lib/view_model/pre_auth_view_models/login_view_model.dart +++ b/lib/view_model/pre_auth_view_models/login_view_model.dart @@ -1,12 +1,11 @@ // ignore_for_file: talawa_api_doc, avoid_dynamic_calls // ignore_for_file: talawa_good_doc_comments -import 'package:firebase_messaging/firebase_messaging.dart'; import 'package:flutter/material.dart'; -import 'package:hive/hive.dart'; +// import 'package:hive/hive.dart'; import 'package:talawa/constants/routing_constants.dart'; import 'package:talawa/locator.dart'; -import 'package:talawa/main.dart'; +// import 'package:talawa/main.dart'; import 'package:talawa/models/mainscreen_navigation_args.dart'; import 'package:talawa/models/user/user_info.dart'; import 'package:talawa/utils/encryptor.dart'; @@ -105,36 +104,6 @@ class LoginViewModel extends BaseModel { arguments: MainScreenArgs(mainScreenIndex: 0, fromSignUp: false), ); } - final loginResult = result.data['login'] as Map; - androidFirebaseOptions = - loginResult['androidFirebaseOptions'] as Map; - iosFirebaseOptions = - loginResult['iosFirebaseOptions'] as Map; - if (androidFirebaseOptions['apiKey'] != null || - iosFirebaseOptions['apiKey'] != null) { - await setUpFirebase(); - - final token = await FirebaseMessaging.instance.getToken(); - await databaseFunctions.gqlAuthMutation( - queries.saveFcmToken(token), - ); - - await setUpFirebaseMessaging(); - - final androidFirebaseOptionsBox = - await Hive.openBox('androidFirebaseOptions'); - androidFirebaseOptionsBox.put( - 'androidFirebaseOptions', - androidFirebaseOptions, - ); - - final iosFirebaseOptionsBox = - await Hive.openBox('iosFirebaseOptions'); - iosFirebaseOptionsBox.put( - 'iosFirebaseOptions', - iosFirebaseOptions, - ); - } } } on Exception catch (e) { print('here'); diff --git a/pubspec.lock b/pubspec.lock index 8cebab539..1e552425c 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -17,14 +17,6 @@ packages: url: "https://pub.dev" source: hosted version: "61.0.0" - _flutterfire_internals: - dependency: transitive - description: - name: _flutterfire_internals - sha256: f5628cd9c92ed11083f425fd1f8f1bc60ecdda458c81d73b143aeda036c35fe7 - url: "https://pub.dev" - source: hosted - version: "1.3.16" analyzer: dependency: transitive description: @@ -213,10 +205,10 @@ packages: dependency: transitive description: name: collection - sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a + sha256: f092b211a4319e98e5ff58223576de6c2803db36221657b46c82574721240687 url: "https://pub.dev" source: hosted - version: "1.18.0" + version: "1.17.2" connectivity_plus: dependency: "direct main" description: @@ -409,54 +401,6 @@ packages: url: "https://pub.dev" source: hosted version: "0.9.3+1" - firebase_core: - dependency: "direct main" - description: - name: firebase_core - sha256: "96607c0e829a581c2a483c658f04e8b159964c3bae2730f73297070bc85d40bb" - url: "https://pub.dev" - source: hosted - version: "2.24.2" - firebase_core_platform_interface: - dependency: "direct main" - description: - name: firebase_core_platform_interface - sha256: c437ae5d17e6b5cc7981cf6fd458a5db4d12979905f9aafd1fea930428a9fe63 - url: "https://pub.dev" - source: hosted - version: "5.0.0" - firebase_core_web: - dependency: transitive - description: - name: firebase_core_web - sha256: d585bdf3c656c3f7821ba1bd44da5f13365d22fcecaf5eb75c4295246aaa83c0 - url: "https://pub.dev" - source: hosted - version: "2.10.0" - firebase_messaging: - dependency: "direct main" - description: - name: firebase_messaging - sha256: "199fe8186a5370d1cf5ce0819191079afc305914e8f38715f5e23943940dfe2d" - url: "https://pub.dev" - source: hosted - version: "14.7.9" - firebase_messaging_platform_interface: - dependency: "direct main" - description: - name: firebase_messaging_platform_interface - sha256: "54e283a0e41d81d854636ad0dad73066adc53407a60a7c3189c9656e2f1b6107" - url: "https://pub.dev" - source: hosted - version: "4.5.18" - firebase_messaging_web: - dependency: transitive - description: - name: firebase_messaging_web - sha256: "90dc7ed885e90a24bb0e56d661d4d2b5f84429697fd2cbb9e5890a0ca370e6f4" - url: "https://pub.dev" - source: hosted - version: "3.5.18" fixnum: dependency: transitive description: @@ -1049,10 +993,10 @@ packages: dependency: transitive description: name: meta - sha256: a6e590c838b18133bb482a2745ad77c5bb7715fb0451209e1a7567d416678b8e + sha256: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3" url: "https://pub.dev" source: hosted - version: "1.10.0" + version: "1.9.1" mime: dependency: transitive description: @@ -1518,18 +1462,18 @@ packages: dependency: transitive description: name: stack_trace - sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b" + sha256: c3c7d8edb15bee7f0f74debd4b9c5f3c2ea86766fe4178eb2a18eb30a0bdaed5 url: "https://pub.dev" source: hosted - version: "1.11.1" + version: "1.11.0" stream_channel: dependency: transitive description: name: stream_channel - sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7 + sha256: "83615bee9045c1d322bbbd1ba209b7a749c2cbcdcb3fdd1df8eb488b3279c1c8" url: "https://pub.dev" source: hosted - version: "2.1.2" + version: "2.1.1" stream_transform: dependency: transitive description: @@ -1597,10 +1541,10 @@ packages: dependency: transitive description: name: test_api - sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b" + sha256: "75760ffd7786fffdfb9597c35c5b27eaeec82be8edfb6d71d32651128ed7aab8" url: "https://pub.dev" source: hosted - version: "0.6.1" + version: "0.6.0" timelines: dependency: "direct main" description: @@ -1781,10 +1725,10 @@ packages: dependency: transitive description: name: web - sha256: afe077240a270dcfd2aafe77602b4113645af95d0ad31128cc02bce5ac5d5152 + sha256: dc8ccd225a2005c1be616fe02951e2e342092edf968cf0844220383757ef8f10 url: "https://pub.dev" source: hosted - version: "0.3.0" + version: "0.1.4-beta" web_socket_channel: dependency: transitive description: @@ -1834,5 +1778,5 @@ packages: source: hosted version: "3.1.2" sdks: - dart: ">=3.2.0-194.0.dev <3.13.0" + dart: ">=3.1.0 <3.13.0" flutter: ">=3.13.0" diff --git a/pubspec.yaml b/pubspec.yaml index 1796bafc9..5a2fdaf73 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -32,10 +32,6 @@ dependencies: # custom_lint_builder: ^0.4.0 ################################ file: ^7.0.0 - firebase_core: ^2.24.2 - firebase_core_platform_interface: ^5.0.0 - firebase_messaging: ^14.7.9 - firebase_messaging_platform_interface: ^4.5.17 flutter: sdk: flutter diff --git a/test/helpers/setup_firebase_mocks.dart b/test/helpers/setup_firebase_mocks.dart index 622f975ac..974219ebc 100644 --- a/test/helpers/setup_firebase_mocks.dart +++ b/test/helpers/setup_firebase_mocks.dart @@ -3,206 +3,204 @@ // ignore_for_file: return_of_invalid_type -import 'package:firebase_core/firebase_core.dart'; +// import 'package:firebase_core/firebase_core.dart'; // import 'package:firebase_core_platform_interface/firebase_core_platform_interface.dart'; -import 'package:firebase_messaging_platform_interface/firebase_messaging_platform_interface.dart'; -import 'package:flutter/services.dart'; -import 'package:flutter_test/flutter_test.dart'; -import 'package:mockito/mockito.dart'; -import 'package:plugin_platform_interface/plugin_platform_interface.dart'; - -final kMockMessagingPlatform = MockFirebaseMessaging(); - -Future neverEndingFuture() async { - // ignore: literal_only_boolean_expressions - while (true) { - await Future.delayed(const Duration(minutes: 5)); - } -} - -void setupFirebaseMocks() { - TestWidgetsFlutterBinding.ensureInitialized(); - - const firebaseChannel = MethodChannel( - 'plugins.flutter.io/firebase_core', - ); - - // ignore: deprecated_member_use - firebaseChannel.setMockMethodCallHandler((call) async { - if (call.method == 'Firebase#initializeCore') { - return [ - { - 'name': defaultFirebaseAppName, - 'options': { - 'apiKey': '123', - 'appId': '123', - 'messagingSenderId': '123', - 'projectId': '123', - }, - 'pluginConstants': {}, - } - ]; - } - - if (call.method == 'Firebase#initializeApp') { - return { - 'name': call.arguments['appName'], - 'options': call.arguments['options'], - 'pluginConstants': {}, - }; - } - - return null; - }); - - when(kMockMessagingPlatform.delegateFor(app: anyNamed('app'))) - .thenReturn(kMockMessagingPlatform); - when( - kMockMessagingPlatform.setInitialValues( - isAutoInitEnabled: anyNamed('isAutoInitEnabled'), - ), - ).thenReturn(kMockMessagingPlatform); -} - -class MockFirebaseMessaging extends Mock - with MockPlatformInterfaceMixin - implements FirebaseMessagingPlatform { - MockFirebaseMessaging() { - TestFirebaseMessagingPlatform(); - } - - @override - bool get isAutoInitEnabled { - return super.noSuchMethod( - Invocation.getter(#isAutoInitEnabled), - returnValue: true, - returnValueForMissingStub: true, - ); - } - - @override - FirebaseMessagingPlatform delegateFor({FirebaseApp? app}) { - return super.noSuchMethod( - Invocation.method(#delegateFor, [], {#app: app}), - returnValue: TestFirebaseMessagingPlatform(), - returnValueForMissingStub: TestFirebaseMessagingPlatform(), - ); - } - - @override - FirebaseMessagingPlatform setInitialValues({bool? isAutoInitEnabled}) { - return super.noSuchMethod( - Invocation.method( - #setInitialValues, - [], - {#isAutoInitEnabled: isAutoInitEnabled}, - ), - returnValue: TestFirebaseMessagingPlatform(), - returnValueForMissingStub: TestFirebaseMessagingPlatform(), - ); - } - - @override - Future getInitialMessage() { - return super.noSuchMethod( - Invocation.method(#getInitialMessage, []), - returnValue: neverEndingFuture(), - returnValueForMissingStub: neverEndingFuture(), - ); - } - - @override - Future deleteToken() { - return super.noSuchMethod( - Invocation.method(#deleteToken, []), - returnValue: Future.value(), - returnValueForMissingStub: Future.value(), - ); - } - - @override - Future getAPNSToken() { - return super.noSuchMethod( - Invocation.method(#getAPNSToken, []), - returnValue: Future.value(''), - returnValueForMissingStub: Future.value(''), - ); - } - - @override - Future getToken({String? vapidKey}) { - return super.noSuchMethod( - Invocation.method(#getToken, [], {#vapidKey: vapidKey}), - returnValue: Future.value(''), - returnValueForMissingStub: Future.value(''), - ); - } - - @override - Future setAutoInitEnabled(bool? enabled) { - return super.noSuchMethod( - Invocation.method(#setAutoInitEnabled, [enabled]), - returnValue: Future.value(), - returnValueForMissingStub: Future.value(), - ); - } - - @override - Stream get onTokenRefresh { - return super.noSuchMethod( - Invocation.getter(#onTokenRefresh), - returnValue: const Stream.empty(), - returnValueForMissingStub: const Stream.empty(), - ); - } - -// Comment out the notification logic for the MVP -// TODO: Re-enable notifications when needed for the final release. - - // @override - // Future requestPermission({ - // bool? alert = true, - // bool? announcement = false, - // bool? badge = true, - // bool? carPlay = false, - // bool? criticalAlert = false, - // bool? provisional = false, - // bool? sound = true, - // }) { - // return super.noSuchMethod( - // Invocation.method(#requestPermission, [], { - // #alert: alert, - // #announcement: announcement, - // #badge: badge, - // #carPlay: carPlay, - // #criticalAlert: criticalAlert, - // #provisional: provisional, - // #sound: sound, - // }), - // returnValue: neverEndingFuture(), - // returnValueForMissingStub: neverEndingFuture(), - // ); - // } - - @override - Future subscribeToTopic(String? topic) { - return super.noSuchMethod( - Invocation.method(#subscribeToTopic, [topic]), - returnValue: Future.value(), - returnValueForMissingStub: Future.value(), - ); - } - - @override - Future unsubscribeFromTopic(String? topic) { - return super.noSuchMethod( - Invocation.method(#unsubscribeFromTopic, [topic]), - returnValue: Future.value(), - returnValueForMissingStub: Future.value(), - ); - } -} - -class TestFirebaseMessagingPlatform extends FirebaseMessagingPlatform { - TestFirebaseMessagingPlatform() : super(); -} +// import 'package:firebase_messaging_platform_interface/firebase_messaging_platform_interface.dart'; +// import 'package:flutter/services.dart'; +// import 'package:flutter_test/flutter_test.dart'; +// import 'package:mockito/mockito.dart'; +// import 'package:plugin_platform_interface/plugin_platform_interface.dart'; + +// final kMockMessagingPlatform = MockFirebaseMessaging(); + +// Future neverEndingFuture() async { +// // ignore: literal_only_boolean_expressions +// while (true) { +// await Future.delayed(const Duration(minutes: 5)); +// } +// } + +// void setupFirebaseMocks() { +// TestWidgetsFlutterBinding.ensureInitialized(); + +// const firebaseChannel = MethodChannel( +// 'plugins.flutter.io/firebase_core', +// ); + +// // ignore: deprecated_member_use +// firebaseChannel.setMockMethodCallHandler((call) async { +// if (call.method == 'Firebase#initializeCore') { +// return [ +// { +// 'name': defaultFirebaseAppName, +// 'options': { +// 'apiKey': '123', +// 'appId': '123', +// 'messagingSenderId': '123', +// 'projectId': '123', +// }, +// 'pluginConstants': {}, +// } +// ]; +// } + +// if (call.method == 'Firebase#initializeApp') { +// return { +// 'name': call.arguments['appName'], +// 'options': call.arguments['options'], +// 'pluginConstants': {}, +// }; +// } + +// return null; +// }); + + // when(kMockMessagingPlatform.delegateFor(app: anyNamed('app'))) + // .thenReturn(kMockMessagingPlatform); + // when( + // kMockMessagingPlatform.setInitialValues( + // isAutoInitEnabled: anyNamed('isAutoInitEnabled'), + // ), + // ).thenReturn(kMockMessagingPlatform); +// } + +// class MockFirebaseMessaging extends Mock with MockPlatformInterfaceMixin { +// MockFirebaseMessaging() { +// // TestFirebaseMessagingPlatform(); +// } + +// @override +// bool get isAutoInitEnabled { +// return super.noSuchMethod( +// Invocation.getter(#isAutoInitEnabled), +// returnValue: true, +// returnValueForMissingStub: true, +// ); +// } + +// // @override +// // FirebaseMessagingPlatform delegateFor({FirebaseApp? app}) { +// // return super.noSuchMethod( +// // Invocation.method(#delegateFor, [], {#app: app}), +// // returnValue: TestFirebaseMessagingPlatform(), +// // returnValueForMissingStub: TestFirebaseMessagingPlatform(), +// // ); +// // } + +// // @override +// // FirebaseMessagingPlatform setInitialValues({bool? isAutoInitEnabled}) { +// // return super.noSuchMethod( +// // Invocation.method( +// // #setInitialValues, +// // [], +// // {#isAutoInitEnabled: isAutoInitEnabled}, +// // ), +// // returnValue: TestFirebaseMessagingPlatform(), +// // returnValueForMissingStub: TestFirebaseMessagingPlatform(), +// // ); +// // } + +// // @override +// // Future getInitialMessage() { +// // return super.noSuchMethod( +// // Invocation.method(#getInitialMessage, []), +// // returnValue: neverEndingFuture(), +// // returnValueForMissingStub: neverEndingFuture(), +// // ); +// // } + +// @override +// Future deleteToken() { +// return super.noSuchMethod( +// Invocation.method(#deleteToken, []), +// returnValue: Future.value(), +// returnValueForMissingStub: Future.value(), +// ); +// } + +// @override +// Future getAPNSToken() { +// return super.noSuchMethod( +// Invocation.method(#getAPNSToken, []), +// returnValue: Future.value(''), +// returnValueForMissingStub: Future.value(''), +// ); +// } + +// @override +// Future getToken({String? vapidKey}) { +// return super.noSuchMethod( +// Invocation.method(#getToken, [], {#vapidKey: vapidKey}), +// returnValue: Future.value(''), +// returnValueForMissingStub: Future.value(''), +// ); +// } + +// @override +// Future setAutoInitEnabled(bool? enabled) { +// return super.noSuchMethod( +// Invocation.method(#setAutoInitEnabled, [enabled]), +// returnValue: Future.value(), +// returnValueForMissingStub: Future.value(), +// ); +// } + +// @override +// Stream get onTokenRefresh { +// return super.noSuchMethod( +// Invocation.getter(#onTokenRefresh), +// returnValue: const Stream.empty(), +// returnValueForMissingStub: const Stream.empty(), +// ); +// } + +// // Comment out the notification logic for the MVP +// // TODO: Re-enable notifications when needed for the final release. + +// // @override +// // Future requestPermission({ +// // bool? alert = true, +// // bool? announcement = false, +// // bool? badge = true, +// // bool? carPlay = false, +// // bool? criticalAlert = false, +// // bool? provisional = false, +// // bool? sound = true, +// // }) { +// // return super.noSuchMethod( +// // Invocation.method(#requestPermission, [], { +// // #alert: alert, +// // #announcement: announcement, +// // #badge: badge, +// // #carPlay: carPlay, +// // #criticalAlert: criticalAlert, +// // #provisional: provisional, +// // #sound: sound, +// // }), +// // returnValue: neverEndingFuture(), +// // returnValueForMissingStub: neverEndingFuture(), +// // ); +// // } + +// @override +// Future subscribeToTopic(String? topic) { +// return super.noSuchMethod( +// Invocation.method(#subscribeToTopic, [topic]), +// returnValue: Future.value(), +// returnValueForMissingStub: Future.value(), +// ); +// } + +// @override +// Future unsubscribeFromTopic(String? topic) { +// return super.noSuchMethod( +// Invocation.method(#unsubscribeFromTopic, [topic]), +// returnValue: Future.value(), +// returnValueForMissingStub: Future.value(), +// ); +// } +// } + +// // class TestFirebaseMessagingPlatform extends FirebaseMessagingPlatform { +// // TestFirebaseMessagingPlatform() : super(); +// // } diff --git a/test/utils_tests/queries_test.dart b/test/utils_tests/queries_test.dart index 610147ca2..79d413539 100644 --- a/test/utils_tests/queries_test.dart +++ b/test/utils_tests/queries_test.dart @@ -27,16 +27,16 @@ void main() { } expect(mutation, true); }); - test("Check if saveFcmToken works correctly", () { - var mutation = false; - expect(mutation, false); - - final fnData = Queries().saveFcmToken('token123'); - if (fnData.contains('token123')) { - mutation = true; - } - expect(mutation, true); - }); + // test("Check if saveFcmToken works correctly", () { + // var mutation = false; + // expect(mutation, false); + + // final fnData = Queries().saveFcmToken('token123'); + // if (fnData.contains('token123')) { + // mutation = true; + // } + // expect(mutation, true); + // }); test("Check if logout works correctly", () { const mutation = false; expect(mutation, false); diff --git a/test/view_model_tests/pre_auth_view_models/login_view_model_test.dart b/test/view_model_tests/pre_auth_view_models/login_view_model_test.dart index 41360dbe7..7f9af6d62 100644 --- a/test/view_model_tests/pre_auth_view_models/login_view_model_test.dart +++ b/test/view_model_tests/pre_auth_view_models/login_view_model_test.dart @@ -1,8 +1,6 @@ // ignore_for_file: talawa_api_doc // ignore_for_file: talawa_good_doc_comments -// import 'package:firebase_core/firebase_core.dart'; -// import 'package:firebase_messaging_platform_interface/firebase_messaging_platform_interface.dart'; // import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; // import 'package:graphql_flutter/graphql_flutter.dart'; @@ -15,7 +13,6 @@ import 'package:talawa/services/user_config.dart'; // import 'package:talawa/utils/queries.dart'; // import 'package:talawa/view_model/pre_auth_view_models/login_view_model.dart'; -// import '../../helpers/setup_firebase_mocks.dart'; // import '../../helpers/test_helpers.dart'; final data = { @@ -28,32 +25,12 @@ final data = { }, 'accessToken': 'testtoken', 'refreshToken': 'testtoken', - 'androidFirebaseOptions': { - 'apiKey': 'test', - 'appId': 'test', - 'messagingSenderId': 'test', - 'projectId': 'test', - 'storageBucket': 'test', - }, - 'iosFirebaseOptions': { - 'apiKey': 'test', - 'appId': 'test', - 'messagingSenderId': 'test', - 'projectId': 'test', - 'storageBucket': 'test', - 'iosClientId': 'test', - 'iosBundleId': 'test', - }, }, }; bool empty = false; Future main() async { - // setupFirebaseMocks(); - // await Firebase.initializeApp(); - // FirebaseMessagingPlatform.instance = kMockMessagingPlatform; - // setUp(() async { // locator.registerSingleton(Queries()); // registerServices(); diff --git a/test/widget_tests/after_auth_screens/events/edit_event_page_test.dart b/test/widget_tests/after_auth_screens/events/edit_event_page_test.dart index c2eb5df00..821cad531 100644 --- a/test/widget_tests/after_auth_screens/events/edit_event_page_test.dart +++ b/test/widget_tests/after_auth_screens/events/edit_event_page_test.dart @@ -3,7 +3,6 @@ // ignore_for_file: unused_import -import 'package:firebase_core/firebase_core.dart'; import 'package:flutter/material.dart'; import 'package:flutter_localizations/flutter_localizations.dart'; import 'package:flutter_test/flutter_test.dart'; @@ -22,7 +21,6 @@ import 'package:talawa/views/after_auth_screens/events/edit_events_form.dart'; import 'package:talawa/views/base_view.dart'; import 'package:talawa/widgets/event_date_time_tile.dart'; -import '../../../helpers/setup_firebase_mocks.dart'; import '../../../helpers/test_helpers.dart'; import '../../../helpers/test_helpers.mocks.dart'; @@ -75,9 +73,6 @@ void main() { setupLocator(); graphqlConfig.test(); - setupFirebaseMocks(); - // await Firebase.initializeApp(); - group("Edit Event Screen Widget Test in dark mode", () { testWidgets("Testing if dark mode is applied", (tester) async { await tester.pumpWidget( diff --git a/test/widget_tests/pre_auth_screens/splash_screen_test.dart b/test/widget_tests/pre_auth_screens/splash_screen_test.dart index d8d490941..84c3c4856 100644 --- a/test/widget_tests/pre_auth_screens/splash_screen_test.dart +++ b/test/widget_tests/pre_auth_screens/splash_screen_test.dart @@ -3,7 +3,6 @@ // ignore_for_file: unused_import -import 'package:firebase_core/firebase_core.dart'; import 'package:flutter/material.dart'; import 'package:flutter_localizations/flutter_localizations.dart'; import 'package:flutter_test/flutter_test.dart'; @@ -16,8 +15,6 @@ import 'package:talawa/utils/app_localization.dart'; import 'package:talawa/view_model/lang_view_model.dart'; import 'package:talawa/views/base_view.dart'; -import '../../helpers/setup_firebase_mocks.dart'; - Widget createSplashScreenLight({ThemeMode themeMode = ThemeMode.light}) => BaseView( onModelReady: (model) => model.initialize(), @@ -68,9 +65,6 @@ Future main() async { setupLocator(); graphqlConfig.test(); - // setupFirebaseMocks(); - // await Firebase.initializeApp(); - group('Splash Screen Widget Test in light mode', () { testWidgets("Testing if Splash Screen shows up", (tester) async { await tester.pumpWidget(createSplashScreenLight()); From 5eda05157ca7ecbd95b49248aa213f2395eec447 Mon Sep 17 00:00:00 2001 From: Abhishek Saini <78199221+Abhisheksainii@users.noreply.github.com> Date: Mon, 18 Dec 2023 18:12:55 +0530 Subject: [PATCH 02/11] formatted firebase_mocks.dart --- test/helpers/setup_firebase_mocks.dart | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/test/helpers/setup_firebase_mocks.dart b/test/helpers/setup_firebase_mocks.dart index 974219ebc..ec3064674 100644 --- a/test/helpers/setup_firebase_mocks.dart +++ b/test/helpers/setup_firebase_mocks.dart @@ -55,13 +55,13 @@ // return null; // }); - // when(kMockMessagingPlatform.delegateFor(app: anyNamed('app'))) - // .thenReturn(kMockMessagingPlatform); - // when( - // kMockMessagingPlatform.setInitialValues( - // isAutoInitEnabled: anyNamed('isAutoInitEnabled'), - // ), - // ).thenReturn(kMockMessagingPlatform); +// when(kMockMessagingPlatform.delegateFor(app: anyNamed('app'))) +// .thenReturn(kMockMessagingPlatform); +// when( +// kMockMessagingPlatform.setInitialValues( +// isAutoInitEnabled: anyNamed('isAutoInitEnabled'), +// ), +// ).thenReturn(kMockMessagingPlatform); // } // class MockFirebaseMessaging extends Mock with MockPlatformInterfaceMixin { From 0131bfdfcb37219ccc6faf7f45924789e6521f69 Mon Sep 17 00:00:00 2001 From: Abhishek Saini <78199221+Abhisheksainii@users.noreply.github.com> Date: Mon, 18 Dec 2023 22:16:23 +0530 Subject: [PATCH 03/11] removed ignore directive for custom lint rule --- lib/view_model/pre_auth_view_models/login_view_model.dart | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/view_model/pre_auth_view_models/login_view_model.dart b/lib/view_model/pre_auth_view_models/login_view_model.dart index 0bf731512..c9dfbe7a9 100644 --- a/lib/view_model/pre_auth_view_models/login_view_model.dart +++ b/lib/view_model/pre_auth_view_models/login_view_model.dart @@ -1,5 +1,3 @@ -// ignore_for_file: talawa_api_doc, avoid_dynamic_calls -// ignore_for_file: talawa_good_doc_comments import 'package:flutter/material.dart'; // import 'package:hive/hive.dart'; From e661a5b95b1e7b23f8ce848776971d0c0e9c21f3 Mon Sep 17 00:00:00 2001 From: Abhishek Saini <78199221+Abhisheksainii@users.noreply.github.com> Date: Mon, 18 Dec 2023 22:45:18 +0530 Subject: [PATCH 04/11] formatted login_view_model file --- lib/view_model/pre_auth_view_models/login_view_model.dart | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/view_model/pre_auth_view_models/login_view_model.dart b/lib/view_model/pre_auth_view_models/login_view_model.dart index c9dfbe7a9..8878e0491 100644 --- a/lib/view_model/pre_auth_view_models/login_view_model.dart +++ b/lib/view_model/pre_auth_view_models/login_view_model.dart @@ -1,4 +1,3 @@ - import 'package:flutter/material.dart'; // import 'package:hive/hive.dart'; import 'package:talawa/constants/routing_constants.dart'; From 84e2feb4242f7ac60fe6aa51910b17c2821b9139 Mon Sep 17 00:00:00 2001 From: Abhishek Saini <78199221+Abhisheksainii@users.noreply.github.com> Date: Tue, 19 Dec 2023 21:25:29 +0530 Subject: [PATCH 05/11] removal of commented code --- android/app/src/main/AndroidManifest.xml | 3 - lib/firebase_options.dart | 93 ------------------- lib/main.dart | 1 - lib/services/database_mutation_functions.dart | 12 --- 4 files changed, 109 deletions(-) delete mode 100644 lib/firebase_options.dart diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 1d9989c3f..2a856d210 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -57,9 +57,6 @@ - androidFirebaseOptions, -// Map iosFirebaseOptions, -// ) { -// if (kIsWeb) { -// throw UnsupportedError( -// 'DefaultFirebaseOptions have not been configured for web - ' -// 'you can reconfigure this by running the FlutterFire CLI again.', -// ); -// } -// switch (defaultTargetPlatform) { -// case TargetPlatform.android: -// return android(androidFirebaseOptions); -// case TargetPlatform.iOS: -// return ios(iosFirebaseOptions); -// case TargetPlatform.macOS: -// throw UnsupportedError( -// 'DefaultFirebaseOptions have not been configured for macos - ' -// 'you can reconfigure this by running the FlutterFire CLI again.', -// ); -// default: -// throw UnsupportedError( -// 'DefaultFirebaseOptions are not supported for this platform.', -// ); -// } -// } - -// /// Scaffolds androidFirebaseOptions around FirebaseOptions. -// /// -// /// **params**: -// /// * `androidFirebaseOptions`: The options which we want to scaffold -// /// -// /// **returns**: -// /// * `FirebaseOptions`: Scaffolded FirebaseOptions -// static FirebaseOptions android(Map androidFirebaseOptions) => -// FirebaseOptions( -// apiKey: androidFirebaseOptions['apiKey'] as String, -// appId: androidFirebaseOptions['appId'] as String, -// messagingSenderId: -// androidFirebaseOptions['messagingSenderId'] as String, -// projectId: androidFirebaseOptions['projectId'] as String, -// storageBucket: androidFirebaseOptions['storageBucket'] as String, -// ); - -// /// Scaffolds iosFirebaseOptions around FirebaseOptions. -// /// -// /// more_info_if_required -// /// -// /// **params**: -// /// * `iosFirebaseOptions`: The options which we want to scaffold -// /// -// /// **returns**: -// /// * `FirebaseOptions`: Scaffolded FirebaseOptions -// static FirebaseOptions ios(Map iosFirebaseOptions) => -// FirebaseOptions( -// apiKey: iosFirebaseOptions['apiKey'] as String, -// appId: iosFirebaseOptions['appId'] as String, -// messagingSenderId: iosFirebaseOptions['messagingSenderId'] as String, -// projectId: iosFirebaseOptions['projectId'] as String, -// storageBucket: iosFirebaseOptions['storageBucket'] as String, -// iosClientId: iosFirebaseOptions['iosClientId'] as String, -// iosBundleId: iosFirebaseOptions['iosBundleId'] as String, -// ); -// } diff --git a/lib/main.dart b/lib/main.dart index d8931789d..fc6a7c5d0 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,6 +1,5 @@ import 'dart:io'; -import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart' as fs; import 'package:flutter_localizations/flutter_localizations.dart'; diff --git a/lib/services/database_mutation_functions.dart b/lib/services/database_mutation_functions.dart index ccf176ba7..6f420e119 100644 --- a/lib/services/database_mutation_functions.dart +++ b/lib/services/database_mutation_functions.dart @@ -191,18 +191,6 @@ class DataBaseMutationFunctions { } return false; } - // if (exception.graphqlErrors[i].message == - // notifFeatureNotInstalled.message) { - // if (showSnackBar) { - // WidgetsBinding.instance.addPostFrameCallback( - // (_) => navigationService.showTalawaErrorDialog( - // "Notification Feature is not installed", - // MessageType.error, - // ), - // ); - // } - // return false; - // } } // if the error is unknown From 461979ea04bb7a23df18ed1800ea3d05e6706e3b Mon Sep 17 00:00:00 2001 From: Abhishek Saini <78199221+Abhisheksainii@users.noreply.github.com> Date: Wed, 3 Jan 2024 00:03:45 +0530 Subject: [PATCH 06/11] removed fcmToken test --- test/utils_tests/queries_test.dart | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/test/utils_tests/queries_test.dart b/test/utils_tests/queries_test.dart index 79d413539..6fffa6739 100644 --- a/test/utils_tests/queries_test.dart +++ b/test/utils_tests/queries_test.dart @@ -27,16 +27,6 @@ void main() { } expect(mutation, true); }); - // test("Check if saveFcmToken works correctly", () { - // var mutation = false; - // expect(mutation, false); - - // final fnData = Queries().saveFcmToken('token123'); - // if (fnData.contains('token123')) { - // mutation = true; - // } - // expect(mutation, true); - // }); test("Check if logout works correctly", () { const mutation = false; expect(mutation, false); From f8484d5e6d74b2a3bc24713be30deff758fa979e Mon Sep 17 00:00:00 2001 From: Abhishek Saini <78199221+Abhisheksainii@users.noreply.github.com> Date: Wed, 3 Jan 2024 14:34:57 +0530 Subject: [PATCH 07/11] avoid dynamic calls check passed --- lib/view_model/pre_auth_view_models/login_view_model.dart | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/view_model/pre_auth_view_models/login_view_model.dart b/lib/view_model/pre_auth_view_models/login_view_model.dart index 8878e0491..3a8b637a6 100644 --- a/lib/view_model/pre_auth_view_models/login_view_model.dart +++ b/lib/view_model/pre_auth_view_models/login_view_model.dart @@ -1,3 +1,5 @@ +// ignore_for_file: avoid_dynamic_calls + import 'package:flutter/material.dart'; // import 'package:hive/hive.dart'; import 'package:talawa/constants/routing_constants.dart'; From 8114a394d49028b4cb5bb78d143e0e478793f17b Mon Sep 17 00:00:00 2001 From: Abhishek Saini <78199221+Abhisheksainii@users.noreply.github.com> Date: Fri, 5 Jan 2024 19:29:50 +0530 Subject: [PATCH 08/11] format check --- .../profile_view_models/profile_page_view_model.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/view_model/after_auth_view_models/profile_view_models/profile_page_view_model.dart b/lib/view_model/after_auth_view_models/profile_view_models/profile_page_view_model.dart index ecf4fb674..5b574a973 100644 --- a/lib/view_model/after_auth_view_models/profile_view_models/profile_page_view_model.dart +++ b/lib/view_model/after_auth_view_models/profile_view_models/profile_page_view_model.dart @@ -17,7 +17,6 @@ import 'package:talawa/utils/app_localization.dart'; import 'package:talawa/view_model/base_view_model.dart'; import 'package:talawa/view_model/lang_view_model.dart'; - /// ProfilePageViewModel class helps to interact with model to serve data and react to user's input in Profile Page view. /// /// Methods include: @@ -77,6 +76,7 @@ class ProfilePageViewModel extends BaseModel { currentUser = _userConfig.currentUser; setState(ViewState.idle); } + /// This method changes the currency of the user for donation purpose. /// /// **params**: From d2cfffed1f3550dd4632ea18aefe444c871ce1e2 Mon Sep 17 00:00:00 2001 From: Abhishek Saini <78199221+Abhisheksainii@users.noreply.github.com> Date: Sun, 7 Jan 2024 00:25:00 +0530 Subject: [PATCH 09/11] fixed linting issue --- .../profile_view_models/profile_page_view_model.dart | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/view_model/after_auth_view_models/profile_view_models/profile_page_view_model.dart b/lib/view_model/after_auth_view_models/profile_view_models/profile_page_view_model.dart index 5b574a973..b8444880b 100644 --- a/lib/view_model/after_auth_view_models/profile_view_models/profile_page_view_model.dart +++ b/lib/view_model/after_auth_view_models/profile_view_models/profile_page_view_model.dart @@ -1,6 +1,5 @@ import 'package:currency_picker/currency_picker.dart'; import 'package:flutter/material.dart'; -import 'package:graphql_flutter/graphql_flutter.dart'; import 'package:hive/hive.dart'; import 'package:qr_flutter/qr_flutter.dart'; import 'package:talawa/constants/constants.dart'; From 329ed336d114fd44b28491a9f92b816022077988 Mon Sep 17 00:00:00 2001 From: Abhishek Saini <78199221+Abhisheksainii@users.noreply.github.com> Date: Sun, 7 Jan 2024 17:36:23 +0530 Subject: [PATCH 10/11] added documentation for event_queries file --- lib/utils/event_queries.dart | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/utils/event_queries.dart b/lib/utils/event_queries.dart index 23b06458b..74e4bb6a1 100644 --- a/lib/utils/event_queries.dart +++ b/lib/utils/event_queries.dart @@ -1,9 +1,15 @@ -// ignore_for_file: talawa_api_doc -// ignore_for_file: talawa_good_doc_comments - ///This class creates queries related to the events. class EventQueries { //Returns a query to fetch an organization's events + /// a_line_ending_with_end_punctuation. + /// + /// more_info_if_required + /// + /// **params**: + /// * `orgId`: the organisation ID for which the events need to be fetched + /// + /// **returns**: + /// * `String`: returns a query to fetch the events of a particular organisation String fetchOrgEvents(String orgId) { return """ query { From f194e950fc296d6292dbfd47d3a1aaa66dc73f6a Mon Sep 17 00:00:00 2001 From: Abhishek Saini <78199221+Abhisheksainii@users.noreply.github.com> Date: Sun, 7 Jan 2024 18:55:28 +0530 Subject: [PATCH 11/11] format check --- lib/utils/event_queries.dart | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/utils/event_queries.dart b/lib/utils/event_queries.dart index ba1b79870..6944de83f 100644 --- a/lib/utils/event_queries.dart +++ b/lib/utils/event_queries.dart @@ -1,6 +1,5 @@ ///This class creates queries related to the events. class EventQueries { - /// Fetches events by organization ID. /// /// **params**: