From 73fc8ee0a23dab9ec850b4c1acc9cec7096d44aa Mon Sep 17 00:00:00 2001 From: "Aamir.Muhammad" Date: Sun, 25 Aug 2024 14:57:05 +0300 Subject: [PATCH] IOS firebase fix --- ios/Runner.xcodeproj/project.pbxproj | 10 +++++++--- ios/Runner/AppDelegate.swift | 5 ++++- ios/Runner/Info.plist | 16 ++++++++-------- lib/main.dart | 22 ++++++++++++++-------- 4 files changed, 33 insertions(+), 20 deletions(-) diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index 3b730be..f8ceabd 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -8,6 +8,7 @@ /* Begin PBXBuildFile section */ 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; + 290601662C7B4B300089E959 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 290601652C7B4B300089E959 /* GoogleService-Info.plist */; }; 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; 5E9559759AEA0E089FDD9FD7 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BFCFDCCDB03A7D75BCB22117 /* Pods_Runner.framework */; }; 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; @@ -32,6 +33,7 @@ /* Begin PBXFileReference section */ 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; + 290601652C7B4B300089E959 /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = "GoogleService-Info.plist"; path = "../../../../GoogleService-Info.plist"; sourceTree = ""; }; 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; 589B0447F002C308698802BD /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; @@ -94,6 +96,7 @@ 97C146F01CF9000F007C117D /* Runner */ = { isa = PBXGroup; children = ( + 290601652C7B4B300089E959 /* GoogleService-Info.plist */, 97C146FA1CF9000F007C117D /* Main.storyboard */, 97C146FD1CF9000F007C117D /* Assets.xcassets */, 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, @@ -190,6 +193,7 @@ files = ( 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, + 290601662C7B4B300089E959 /* GoogleService-Info.plist in Resources */, 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, ); @@ -383,7 +387,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - PRODUCT_BUNDLE_IDENTIFIER = com.cloud.solutions.mowater.ksa.provider; + PRODUCT_BUNDLE_IDENTIFIER = com.cloud.solutions.mowater.ksa.provider.ios; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_VERSION = 5.0; @@ -511,7 +515,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - PRODUCT_BUNDLE_IDENTIFIER = com.cloud.solutions.mowater.ksa.provider; + PRODUCT_BUNDLE_IDENTIFIER = com.cloud.solutions.mowater.ksa.provider.ios; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; @@ -534,7 +538,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - PRODUCT_BUNDLE_IDENTIFIER = com.cloud.solutions.mowater.ksa.provider; + PRODUCT_BUNDLE_IDENTIFIER = com.cloud.solutions.mowater.ksa.provider.ios; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_VERSION = 5.0; diff --git a/ios/Runner/AppDelegate.swift b/ios/Runner/AppDelegate.swift index 30ea1df..fa75811 100644 --- a/ios/Runner/AppDelegate.swift +++ b/ios/Runner/AppDelegate.swift @@ -1,6 +1,9 @@ import UIKit import Flutter import GoogleMaps +import Firebase +import flutter_local_notifications + @UIApplicationMain @objc class AppDelegate: FlutterAppDelegate { @@ -8,7 +11,7 @@ import GoogleMaps _ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? ) -> Bool { - + FirebaseApp.configure() // This is required to make any communication available in the action isolate. FlutterLocalNotificationsPlugin.setPluginRegistrantCallback { (registry) in GeneratedPluginRegistrant.register(with: registry) diff --git a/ios/Runner/Info.plist b/ios/Runner/Info.plist index fd96eda..3722edb 100644 --- a/ios/Runner/Info.plist +++ b/ios/Runner/Info.plist @@ -28,16 +28,16 @@ Access to pick a photo NSCameraUsageDescription Access to take a photo by camera + NSFaceIDUsageDescription + This app requires Face ID to allow biometric authentication for app login. + NSLocationAlwaysAndWhenInUseUsageDescription + This App requires access to your location to pick the location. + NSLocationAlwaysUsageDescription + This App requires access to your location to pick the location. + NSLocationWhenInUseUsageDescription + This App requires access to your location to pick the location. NSPhotoLibraryUsageDescription Access to pick a photo - NSFaceIDUsageDescription - This app requires Face ID to allow biometric authentication for app login. - NSLocationAlwaysAndWhenInUseUsageDescription - This App requires access to your location to pick the location. - NSLocationAlwaysUsageDescription - This App requires access to your location to pick the location. - NSLocationWhenInUseUsageDescription - This App requires access to your location to pick the location. UIApplicationSupportsIndirectInputEvents UILaunchStoryboardName diff --git a/lib/main.dart b/lib/main.dart index 1986cb6..c95dc1e 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,3 +1,5 @@ +import 'dart:io'; + import 'package:car_provider_app/config/provider_dependencies.dart'; import 'package:mc_common_app/repositories/items_repo.dart'; import 'package:mc_common_app/repositories/schedule_repo.dart'; @@ -42,14 +44,18 @@ import 'config/provider_routes.dart'; Future main() async { WidgetsFlutterBinding.ensureInitialized(); await EasyLocalization.ensureInitialized(); - await Firebase.initializeApp( - options: const FirebaseOptions( - apiKey: 'AIzaSyD1WNNGrbBiCNvCrI31d3DV5AOgToq-Lus', - appId: '1:294636898500:android:e93b7e5d1cc15ae6b0e191', - messagingSenderId: '294636898500', - projectId: 'mowater-2c81a', - ), - ); + if(Platform.isAndroid) { + await Firebase.initializeApp( + options: const FirebaseOptions( + apiKey: 'AIzaSyD1WNNGrbBiCNvCrI31d3DV5AOgToq-Lus', + appId: '1:294636898500:android:e93b7e5d1cc15ae6b0e191', + messagingSenderId: '294636898500', + projectId: 'mowater-2c81a', + ), + ); + } else{ + await Firebase.initializeApp(); + } ProviderAppDependencies.addDependencies(); injector.get().initializeNotifications(); ProviderAppRoutes.routes.addAll(AppRoutes.routes);