Skip to content

Commit

Permalink
Correct the type on sessionIdentifierMetadata.
Browse files Browse the repository at this point in the history
This has never been limited to `NSString` values, and if it was called from
Swift it likely would cause problems. Luckily, it is really meant to be an
internal api so clients shouldn't be calling it. But since it is public, it is a
breaking change to Swift.

Part of #398
  • Loading branch information
thomasvl committed Jan 9, 2025
1 parent 0c9cc25 commit 62615f5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
4 changes: 2 additions & 2 deletions Sources/Core/GTMSessionFetcher.m
Original file line number Diff line number Diff line change
Expand Up @@ -1686,15 +1686,15 @@ - (void)restoreDefaultStateForSessionIdentifierMetadata {
}
}

- (nullable NSDictionary *)sessionIdentifierMetadata {
- (nullable NSDictionary<NSString *, id> *)sessionIdentifierMetadata {
@synchronized(self) {
GTMSessionMonitorSynchronized(self);

return [self sessionIdentifierMetadataUnsynchronized];
}
}

- (nullable NSDictionary *)sessionIdentifierMetadataUnsynchronized {
- (nullable NSDictionary<NSString *, id> *)sessionIdentifierMetadataUnsynchronized {
GTMSessionCheckSynchronized(self);

// Session Identifier format: "com.google.<ClassName>_<UUID>_<Metadata in JSON format>
Expand Down
7 changes: 3 additions & 4 deletions Sources/Core/Public/GTMSessionFetcher/GTMSessionFetcher.h
Original file line number Diff line number Diff line change
Expand Up @@ -872,10 +872,9 @@ __deprecated_msg("implement GTMSessionFetcherAuthorizer instead")

// The fetcher encodes information used to resume a session in the session identifier.
// This method, intended for internal use returns the encoded information. The sessionUserInfo
// dictionary is stored as identifier metadata.
// NOTE: This type is a lie and could be an issue for Swift. The values for private keys (prefixed
// with an underscore) aren't always strings; but changing the type is a breaking change.
- (nullable NSDictionary<NSString *, NSString *> *)sessionIdentifierMetadata;
// dictionary is stored as identifier metadata. The values here are limited to things that
// can be stored in a plist, so they aren't completely open ended.
- (nullable NSDictionary<NSString *, id> *)sessionIdentifierMetadata;

#if TARGET_OS_IPHONE && !TARGET_OS_WATCH
// The app should pass to this method the completion handler passed in the app delegate method
Expand Down

0 comments on commit 62615f5

Please sign in to comment.