feat: Add entitlements file and update GoogleService-Info.plist for improved authentication support

This commit is contained in:
Van Leemput Dayron
2025-11-02 20:05:41 +01:00
parent 2eac2348a9
commit 9cfd9b4ec7
5 changed files with 107 additions and 72 deletions

View File

@@ -50,6 +50,7 @@
331C8081294A63A400263BE5 /* RunnerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RunnerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };
67EC5B6326AB6B6B093D53CE /* Pods-RunnerTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.release.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.release.xcconfig"; sourceTree = "<group>"; };
69B9D71F2EB7E2C900F2639E /* Runner.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Runner.entitlements; sourceTree = "<group>"; };
74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = "<group>"; };
74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; };
@@ -105,7 +106,6 @@
67EC5B6326AB6B6B093D53CE /* Pods-RunnerTests.release.xcconfig */,
F230D285980CEE0F11E7B0BC /* Pods-RunnerTests.profile.xcconfig */,
);
name = Pods;
path = Pods;
sourceTree = "<group>";
};
@@ -144,6 +144,7 @@
97C146F01CF9000F007C117D /* Runner */ = {
isa = PBXGroup;
children = (
69B9D71F2EB7E2C900F2639E /* Runner.entitlements */,
97C146FA1CF9000F007C117D /* Main.storyboard */,
97C146FD1CF9000F007C117D /* Assets.xcassets */,
97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */,
@@ -339,10 +340,14 @@
inputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist",
);
inputPaths = (
);
name = "[CP] Embed Pods Frameworks";
outputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist",
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";
@@ -371,10 +376,14 @@
inputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-input-files.xcfilelist",
);
inputPaths = (
);
name = "[CP] Copy Pods Resources";
outputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-output-files.xcfilelist",
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources.sh\"\n";
@@ -488,6 +497,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
@@ -495,7 +505,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = com.example.travelMate;
PRODUCT_BUNDLE_IDENTIFIER = be.devdayronvl.TravelMate;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_VERSION = 5.0;
@@ -670,6 +680,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
@@ -677,7 +688,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = com.example.travelMate;
PRODUCT_BUNDLE_IDENTIFIER = be.devdayronvl.TravelMate;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
@@ -692,6 +703,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
@@ -699,7 +711,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = com.example.travelMate;
PRODUCT_BUNDLE_IDENTIFIER = be.devdayronvl.TravelMate;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_VERSION = 5.0;

View File

@@ -3,11 +3,11 @@
<plist version="1.0">
<dict>
<key>CLIENT_ID</key>
<string>521527250907-3i1qe2656eojs8k9hjdi573j09i9p41m.apps.googleusercontent.com</string>
<string>521527250907-196i04qgm4talrosgi0ne0q8en90hkkh.apps.googleusercontent.com</string>
<key>REVERSED_CLIENT_ID</key>
<string>com.googleusercontent.apps.521527250907-3i1qe2656eojs8k9hjdi573j09i9p41m</string>
<string>com.googleusercontent.apps.521527250907-196i04qgm4talrosgi0ne0q8en90hkkh</string>
<key>ANDROID_CLIENT_ID</key>
<string>521527250907-lqgj1lmfcsjusm2be9r6kpuanq3jvjcd.apps.googleusercontent.com</string>
<string>521527250907-19lrclc10eb0p8li1qutepctfqdohn0b.apps.googleusercontent.com</string>
<key>API_KEY</key>
<string>AIzaSyBFaSzvcvO8qg7El-2jRf7WctZIMKNA4-I</string>
<key>GCM_SENDER_ID</key>
@@ -15,7 +15,7 @@
<key>PLIST_VERSION</key>
<string>1</string>
<key>BUNDLE_ID</key>
<string>com.example.travelMate</string>
<string>be.devdayronvl.TravelMate</string>
<key>PROJECT_ID</key>
<string>travelmate-a47f5</string>
<key>STORAGE_BUCKET</key>
@@ -31,6 +31,6 @@
<key>IS_SIGNIN_ENABLED</key>
<true></true>
<key>GOOGLE_APP_ID</key>
<string>1:521527250907:ios:64b41be39c54db1c7da1fe</string>
<string>1:521527250907:ios:52058410e09e5d3a7da1fe</string>
</dict>
</plist>

View File

@@ -2,6 +2,8 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CADisableMinimumFrameDurationOnPhone</key>
<true/>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleDisplayName</key>
@@ -20,10 +22,29 @@
<string>$(FLUTTER_BUILD_NAME)</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLName</key>
<string>REVERSED_CLIENT_ID</string>
<key>CFBundleURLSchemes</key>
<array>
<string>com.googleusercontent.apps.521527250907-3i1qe2656eojs8k9hjdi573j09i9p41m</string>
</array>
</dict>
</array>
<key>CFBundleVersion</key>
<string>$(FLUTTER_BUILD_NUMBER)</string>
<key>GIDClientID</key>
<string>521527250907-3i1qe2656eojs8k9hjdi573j09i9p41m.apps.googleusercontent.com</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSLocationAlwaysUsageDescription</key>
<string>Cette application a besoin de votre position pour afficher votre localisation sur la carte</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>Cette application a besoin de votre position pour afficher votre localisation sur la carte</string>
<key>UIApplicationSupportsIndirectInputEvents</key>
<true/>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
@@ -41,27 +62,5 @@
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>CADisableMinimumFrameDurationOnPhone</key>
<true/>
<key>UIApplicationSupportsIndirectInputEvents</key>
<true/>
<key>NSLocationWhenInUseUsageDescription</key>
<string>Cette application a besoin de votre position pour afficher votre localisation sur la carte</string>
<key>NSLocationAlwaysUsageDescription</key>
<string>Cette application a besoin de votre position pour afficher votre localisation sur la carte</string>
<key>GIDClientID</key>
<string>521527250907-3i1qe2656eojs8k9hjdi573j09i9p41m.apps.googleusercontent.com</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLName</key>
<string>REVERSED_CLIENT_ID</string>
<key>CFBundleURLSchemes</key>
<array>
<string>com.googleusercontent.apps.521527250907-3i1qe2656eojs8k9hjdi573j09i9p41m</string>
</array>
</dict>
</array>
</dict>
</plist>

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.developer.applesignin</key>
<array>
<string>Default</string>
</array>
</dict>
</plist>

View File

@@ -30,10 +30,12 @@ class AuthService {
/// Throws [FirebaseAuthException] if authentication fails.
Future<UserCredential> signInWithEmailAndPassword({
required String email,
required String password
required String password,
}) async {
return await firebaseAuth.signInWithEmailAndPassword(
email: email, password: password);
email: email,
password: password,
);
}
/// Creates a new user account with email and password.
@@ -42,10 +44,12 @@ class AuthService {
/// Throws [FirebaseAuthException] if account creation fails.
Future<UserCredential> signUpWithEmailAndPassword({
required String email,
required String password
required String password,
}) async {
return await firebaseAuth.createUserWithEmailAndPassword(
email: email, password: password);
email: email,
password: password,
);
}
/// Signs out the current user.
@@ -67,9 +71,7 @@ class AuthService {
///
/// Requires a user to be currently authenticated.
/// Throws if no user is signed in.
Future<void> updateDisplayName({
required String displayName,
}) async {
Future<void> updateDisplayName({required String displayName}) async {
await currentUser!.updateDisplayName(displayName);
}
@@ -85,8 +87,10 @@ class AuthService {
required String email,
}) async {
// Re-authenticate the user for security
AuthCredential credential =
EmailAuthProvider.credential(email: email, password: password);
AuthCredential credential = EmailAuthProvider.credential(
email: email,
password: password,
);
await currentUser!.reauthenticateWithCredential(credential);
// Delete the user account permanently
@@ -108,8 +112,10 @@ class AuthService {
required String email,
}) async {
// Re-authenticate the user for security
AuthCredential credential =
EmailAuthProvider.credential(email: email, password: currentPassword);
AuthCredential credential = EmailAuthProvider.credential(
email: email,
password: currentPassword,
);
await currentUser!.reauthenticateWithCredential(credential);
// Update to the new password
@@ -133,7 +139,8 @@ class AuthService {
Future<UserCredential> signInWithGoogle() async {
try {
await ensureInitialized();
final AuthenticationResults result = await GoogleSignInPlatform.instance.authenticate(const AuthenticateParameters());
final AuthenticationResults result = await GoogleSignInPlatform.instance
.authenticate(const AuthenticateParameters());
final String? idToken = result.authenticationTokens.idToken;
if (idToken == null) {
throw FirebaseAuthException(
@@ -141,31 +148,38 @@ class AuthService {
message: 'Missing Google ID Token',
);
} else {
final OAuthCredential credential = GoogleAuthProvider.credential(idToken: idToken);
UserCredential userCredential = await firebaseAuth.signInWithCredential(credential);
final OAuthCredential credential = GoogleAuthProvider.credential(
idToken: idToken,
);
UserCredential userCredential = await firebaseAuth.signInWithCredential(
credential,
);
// Return the UserCredential instead of void
return userCredential;
}
} on GoogleSignInException catch (e) {
_errorService.logError('Google Sign-In error: $e', StackTrace.current);
rethrow;
} on FirebaseAuthException catch (e) {
_errorService.logError('Firebase error during Google Sign-In initialization: $e', StackTrace.current);
_errorService.logError(
'Firebase error during Google Sign-In initialization: $e',
StackTrace.current,
);
rethrow;
} catch (e) {
_errorService.logError('Unknown error during Google Sign-In initialization: $e', StackTrace.current);
_errorService.logError(
'Unknown error during Google Sign-In initialization: $e',
StackTrace.current,
);
rethrow;
}
}
/// Signs in a user using Apple authentication.
///
/// TODO: Implement Apple Sign-In functionality
/// This method is currently a placeholder for future Apple authentication support.
Future signInWithApple() async {
// TODO: Implement Apple sign-in
}
}