Skip to content

Commit 24b8571

Browse files
Address review feedback for UseUserAccessGroup
This commit addresses feedback from the pull request review for the UseUserAccessGroup feature: - Added a stub implementation for Android in `auth_android.cc`. - Updated iOS implementation in `auth_ios.mm` to pass an empty NSString (`@""`) to the native SDK if an empty C++ string is provided. `nullptr` still results in `nil` being passed. - Updated Doxygen comments in `auth.h` to reflect the iOS behavior for `nullptr` and empty string inputs more accurately. - Investigated potential NSError codes for the underlying iOS SDK method. Confirmed that `FIRAuthErrorCodeKeychainError` is the most relevant documented error, and it is already correctly handled by the existing C++ error mapping.
1 parent 48c8469 commit 24b8571

File tree

3 files changed

+14
-4
lines changed

3 files changed

+14
-4
lines changed

auth/src/android/auth_android.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -676,5 +676,10 @@ void DisableTokenAutoRefresh(AuthData* auth_data) {}
676676
void InitializeTokenRefresher(AuthData* auth_data) {}
677677
void DestroyTokenRefresher(AuthData* auth_data) {}
678678

679+
AuthError Auth::UseUserAccessGroup(const char* access_group) {
680+
// This is an iOS-only feature. No-op on other platforms.
681+
return kAuthErrorNone;
682+
}
683+
679684
} // namespace auth
680685
} // namespace firebase

auth/src/include/firebase/auth.h

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -525,11 +525,16 @@ class Auth {
525525
/// If you are using iCloud keychain synchronization, you will need to call
526526
/// this method to set the user access group.
527527
///
528-
/// @param[in] access_group The user access group to use. Set to `nullptr` or
529-
/// an empty string to use the default access group.
528+
/// @param[in] access_group The user access group to use.
529+
/// - On iOS, if `nullptr` is provided, `nil` will be passed to the
530+
/// underlying SDK, typically resetting to the default or app's main
531+
/// access group.
532+
/// - On iOS, if an empty string (`""`) is provided, an empty `NSString`
533+
/// will be passed to the underlying SDK.
534+
/// - On other platforms, this parameter is ignored.
530535
///
531536
/// @return `kAuthErrorNone` on success, or an AuthError code if an error
532-
/// occurred.
537+
/// occurred (iOS only).
533538
AuthError UseUserAccessGroup(const char* access_group);
534539

535540
private:

auth/src/ios/auth_ios.mm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -613,7 +613,7 @@ void DestroyTokenRefresher(AuthData *auth_data) {}
613613
return kAuthErrorUninitialized;
614614
}
615615
NSString* access_group_ns_str = nil;
616-
if (access_group_str != nullptr && strlen(access_group_str) > 0) {
616+
if (access_group_str != nullptr) {
617617
access_group_ns_str = [NSString stringWithUTF8String:access_group_str];
618618
}
619619

0 commit comments

Comments
 (0)