From 6e34b69cfdc0a2b0ce2146fa9065efdceec6a206 Mon Sep 17 00:00:00 2001 From: raviramnani Date: Fri, 5 Jul 2024 12:23:12 +0530 Subject: [PATCH 1/5] updated README.md and changes in AppDelegate.swift To run app in ios simulator --- wallet/README.md | 5 +++++ wallet/ios/Runner/AppDelegate.swift | 9 ++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/wallet/README.md b/wallet/README.md index 76871be19e..751ec35734 100644 --- a/wallet/README.md +++ b/wallet/README.md @@ -6,6 +6,11 @@ Pylons Wallet This project is a starting point for a Flutter application. +1) Req .prod_env file and place it in /wallet/env/ dir. +2) Req GoogleService-Info.plist file and place it in /wallet/ios/runner dir. +3) Req Google-services.json file and place it in /wallet/android/app dir. +4) Remove comments in AppDelegate.swift file to play in ios simulator +5) Req to add generated simulator Debug token to be added in firebase console>ios debug. diff --git a/wallet/ios/Runner/AppDelegate.swift b/wallet/ios/Runner/AppDelegate.swift index 3877d8faf8..b3b778ab1c 100644 --- a/wallet/ios/Runner/AppDelegate.swift +++ b/wallet/ios/Runner/AppDelegate.swift @@ -9,9 +9,12 @@ import flutter_downloader _ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? ) -> Bool { - // Uncomment while using ios simulator -// let providerFactory = AppCheckDebugProviderFactory() -// AppCheck.setAppCheckProviderFactory(providerFactory) + // Uncomment while using ios simulator + + let providerFactory = AppCheckDebugProviderFactory() + AppCheck.setAppCheckProviderFactory(providerFactory) + FirebaseApp.configure() + // Register Flutter plugins GeneratedPluginRegistrant.register(with: self) FlutterDownloaderPlugin.setPluginRegistrantCallback(registerPlugins) return super.application(application, didFinishLaunchingWithOptions: launchOptions) From c7714101089dc279ec2d45b856a878a76d3692c5 Mon Sep 17 00:00:00 2001 From: Raviramnani1 Date: Fri, 5 Jul 2024 13:24:56 +0530 Subject: [PATCH 2/5] updated main_prod.dart to show debug token to run in ios simulator --- wallet/lib/main_prod.dart | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/wallet/lib/main_prod.dart b/wallet/lib/main_prod.dart index 73b46aab92..b81c7517fe 100644 --- a/wallet/lib/main_prod.dart +++ b/wallet/lib/main_prod.dart @@ -32,6 +32,8 @@ Future main() async { await FlutterDownloader.initialize(ignoreSsl: true); await EasyLocalization.ensureInitialized(); await Firebase.initializeApp(); + await FirebaseAppCheck.instance.activate( + appleProvider: AppleProvider.debug,); await FirebaseCrashlytics.instance .setCrashlyticsCollectionEnabled(!kDebugMode); @@ -96,15 +98,7 @@ Future initializeAppCheck() async { // This kDebugMode check gets a android debug token from FirebaseAppCheck which can then be added on the Firebase console // iOS debug token from FirebaseAppCheck automatically get without method channel when run on debug mode which can then be added on the Firebase console // So that the application can be allowed to access to Firebase AppCheck token in debug mode. - if (kDebugMode && Platform.isAndroid) { - try { - const MethodChannel methodChannel = - MethodChannel(kGetFirebaseAppCheckTokenMethodChannelKey); - await methodChannel.invokeMethod(kGetFirebaseAppCheckDebugTokenKey); - } catch (e) { - e.toString().show(); - } - } + } class MyHttpOverrides extends HttpOverrides { From 5d847658411806beb57e09473f308d233573d66a Mon Sep 17 00:00:00 2001 From: Raviramnani1 <64575750+Raviramnani1@users.noreply.github.com> Date: Fri, 5 Jul 2024 13:43:25 +0530 Subject: [PATCH 3/5] Update main_prod.dart --- wallet/lib/main_prod.dart | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/wallet/lib/main_prod.dart b/wallet/lib/main_prod.dart index b81c7517fe..bc5c2d44ad 100644 --- a/wallet/lib/main_prod.dart +++ b/wallet/lib/main_prod.dart @@ -98,7 +98,15 @@ Future initializeAppCheck() async { // This kDebugMode check gets a android debug token from FirebaseAppCheck which can then be added on the Firebase console // iOS debug token from FirebaseAppCheck automatically get without method channel when run on debug mode which can then be added on the Firebase console // So that the application can be allowed to access to Firebase AppCheck token in debug mode. - +if (kDebugMode && Platform.isAndroid) { + try { + const MethodChannel methodChannel = + MethodChannel(kGetFirebaseAppCheckTokenMethodChannelKey); + await methodChannel.invokeMethod(kGetFirebaseAppCheckDebugTokenKey); + } catch (e) { + e.toString().show(); + } + } } class MyHttpOverrides extends HttpOverrides { From 830e0ac5221c26947e6fd2ddb02676feca774f5a Mon Sep 17 00:00:00 2001 From: Raviramnani1 <64575750+Raviramnani1@users.noreply.github.com> Date: Wed, 17 Jul 2024 16:40:18 +0530 Subject: [PATCH 4/5] Update README.md --- wallet/README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/wallet/README.md b/wallet/README.md index 751ec35734..784552d8e6 100644 --- a/wallet/README.md +++ b/wallet/README.md @@ -9,8 +9,7 @@ This project is a starting point for a Flutter application. 1) Req .prod_env file and place it in /wallet/env/ dir. 2) Req GoogleService-Info.plist file and place it in /wallet/ios/runner dir. 3) Req Google-services.json file and place it in /wallet/android/app dir. -4) Remove comments in AppDelegate.swift file to play in ios simulator -5) Req to add generated simulator Debug token to be added in firebase console>ios debug. +4) Req to add generated simulator Debug token to be added in firebase console>ios debug. From 2d62309b757980e68622d736b595e2e93da182ce Mon Sep 17 00:00:00 2001 From: Raviramnani1 <64575750+Raviramnani1@users.noreply.github.com> Date: Wed, 17 Jul 2024 16:42:01 +0530 Subject: [PATCH 5/5] Update AppDelegate.swift --- wallet/ios/Runner/AppDelegate.swift | 2 ++ 1 file changed, 2 insertions(+) diff --git a/wallet/ios/Runner/AppDelegate.swift b/wallet/ios/Runner/AppDelegate.swift index b3b778ab1c..ce807f935c 100644 --- a/wallet/ios/Runner/AppDelegate.swift +++ b/wallet/ios/Runner/AppDelegate.swift @@ -11,9 +11,11 @@ import flutter_downloader ) -> Bool { // Uncomment while using ios simulator + #if DEBUG let providerFactory = AppCheckDebugProviderFactory() AppCheck.setAppCheckProviderFactory(providerFactory) FirebaseApp.configure() + #endif // Register Flutter plugins GeneratedPluginRegistrant.register(with: self) FlutterDownloaderPlugin.setPluginRegistrantCallback(registerPlugins)