Skip to content

Commit

Permalink
Add sharedContainerID in configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
blancham committed Jul 1, 2021
1 parent 2a6c269 commit f4b9dc4
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
11 changes: 11 additions & 0 deletions FirebaseCore/Sources/FIROptions.m
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
NSString *const kFIRStorageBucket = @"STORAGE_BUCKET";
// The key to locate the expected bundle identifier in the plist file.
NSString *const kFIRBundleID = @"BUNDLE_ID";
// The key to locate the expected shared container identifier in the plist file.
NSString *const kFIRSharedContainerID = @"SHARED_CONTAINER_ID";
// The key to locate the project identifier in the plist file.
NSString *const kFIRProjectID = @"PROJECT_ID";

Expand Down Expand Up @@ -332,6 +334,15 @@ - (void)setBundleID:(NSString *)bundleID {
_optionsDictionary[kFIRBundleID] = [bundleID copy];
}

- (NSString *)sharedContainerID {
return self.optionsDictionary[kFIRSharedContainerID];
}

- (void)setSharedContainerID:(NSString *)sharedContainerID {
[self checkEditingLocked];
_optionsDictionary[kFIRSharedContainerID] = [sharedContainerID copy];
}

- (void)setAppGroupID:(NSString *)appGroupID {
[self checkEditingLocked];
_appGroupID = [appGroupID copy];
Expand Down
5 changes: 5 additions & 0 deletions FirebaseCore/Sources/Public/FirebaseCore/FIROptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ NS_SWIFT_NAME(FirebaseOptions)
*/
@property(nonatomic, copy) NSString *bundleID;

/**
* The shared container ID for the application (useful for download/ upload from share extension).
*/
@property(nonatomic, copy) NSString *sharedContainerID;

/**
* The OAuth2 client ID for iOS application used to authenticate Google users, for example
* @"12345.apps.googleusercontent.com", used for signing in with Google.
Expand Down
5 changes: 5 additions & 0 deletions FirebaseStorage/Sources/FIRStorage.m
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,11 @@ + (GTMSessionFetcherService *)fetcherServiceForApp:(FIRApp *)app
[fetcherService setRetryEnabled:YES];
[fetcherService setRetryBlock:_retryWhenOffline];
[fetcherService setAllowLocalhostRequest:YES];
[fetcherService setConfigurationBlock:^(GTMSessionFetcher * _Nonnull fetcher, NSURLSessionConfiguration * _Nonnull configuration) {
if (app.options.sharedContainerID != nil) {
configuration.sharedContainerIdentifier = app.options.sharedContainerID;
}
}];
FIRStorageTokenAuthorizer *authorizer =
[[FIRStorageTokenAuthorizer alloc] initWithGoogleAppID:app.options.googleAppID
fetcherService:fetcherService
Expand Down

0 comments on commit f4b9dc4

Please sign in to comment.