From 62615f50ad06155fb47e91bab3c064e5d033eba5 Mon Sep 17 00:00:00 2001 From: Thomas Van Lenten Date: Thu, 9 Jan 2025 13:33:46 -0500 Subject: [PATCH] Correct the type on sessionIdentifierMetadata. 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 --- Sources/Core/GTMSessionFetcher.m | 4 ++-- Sources/Core/Public/GTMSessionFetcher/GTMSessionFetcher.h | 7 +++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/Sources/Core/GTMSessionFetcher.m b/Sources/Core/GTMSessionFetcher.m index e3fdf78..870a740 100644 --- a/Sources/Core/GTMSessionFetcher.m +++ b/Sources/Core/GTMSessionFetcher.m @@ -1686,7 +1686,7 @@ - (void)restoreDefaultStateForSessionIdentifierMetadata { } } -- (nullable NSDictionary *)sessionIdentifierMetadata { +- (nullable NSDictionary *)sessionIdentifierMetadata { @synchronized(self) { GTMSessionMonitorSynchronized(self); @@ -1694,7 +1694,7 @@ - (nullable NSDictionary *)sessionIdentifierMetadata { } } -- (nullable NSDictionary *)sessionIdentifierMetadataUnsynchronized { +- (nullable NSDictionary *)sessionIdentifierMetadataUnsynchronized { GTMSessionCheckSynchronized(self); // Session Identifier format: "com.google.__ diff --git a/Sources/Core/Public/GTMSessionFetcher/GTMSessionFetcher.h b/Sources/Core/Public/GTMSessionFetcher/GTMSessionFetcher.h index 6c1492d..6398f6e 100644 --- a/Sources/Core/Public/GTMSessionFetcher/GTMSessionFetcher.h +++ b/Sources/Core/Public/GTMSessionFetcher/GTMSessionFetcher.h @@ -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 *)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 *)sessionIdentifierMetadata; #if TARGET_OS_IPHONE && !TARGET_OS_WATCH // The app should pass to this method the completion handler passed in the app delegate method