Skip to content

Commit 8ef949b

Browse files
committed
Removed the support for handling nested containers in GIDEMMSupport.m
1 parent 97393fa commit 8ef949b

2 files changed

Lines changed: 4 additions & 82 deletions

File tree

GoogleSignIn/Sources/GIDEMMSupport.m

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -161,20 +161,10 @@ - (void)updateErrorForAuthSession:(GTMAuthSession *)authSession
161161
return;
162162
}
163163

164-
// Case 3: The value is of `NSArray` or `NSDictionary` type.
165-
// To satisfy `GTMAppAuth`'s requirement for `NSDictionary<NSString *, NSString *>` parameter,
166-
// the entire value object is serialized into a single `JSON` string.
167-
if ([NSJSONSerialization isValidJSONObject:value]) {
168-
NSError *error = nil;
169-
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:value options:0 error:&error];
170-
171-
if (jsonData && !error) {
172-
stringifiedDictionary[key] = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
173-
} else {
174-
stringifiedDictionary[key] = [value description];
175-
}
176-
return;
177-
}
164+
// NOTE: Nested container objects (e.g., NSArray, NSDictionary) are intentionally ignored.
165+
// The underlying AppAuth API expects a flat `NSDictionary<NSString *, NSString *>` and is
166+
// not designed for serialized, nested objects. A proper fix for nested objects
167+
// would require a larger refactoring of the AppAuth and GTMAppAuth libraries.
178168
}];
179169
return stringifiedDictionary;
180170
}

GoogleSignIn/Tests/Unit/GIDEMMSupportTest.m

Lines changed: 0 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -353,74 +353,6 @@ - (void)testStringConversion_withString_remainsUnchanged {
353353
@"The original string value should be preserved.");
354354
}
355355

356-
- (void)testStringConversion_withArray_isConvertedToJSONString {
357-
NSDictionary *inputDictionary = @{
358-
@"array_key": @[ @1, @"two", @YES ]
359-
};
360-
361-
NSDictionary *resultDictionary = [GIDEMMSupport
362-
dictionaryWithStringValuesFromDictionary:inputDictionary];
363-
364-
XCTAssertTrue([resultDictionary[@"array_key"] isKindOfClass:[NSString class]],
365-
@"The value should be an NSString.");
366-
XCTAssertEqualObjects(resultDictionary[@"array_key"], @"[1,\"two\",true]",
367-
@"The array should be serialized into a JSON string.");
368-
}
369-
370-
- (void)testStringConversion_withDictionary_isConvertedToJSONString {
371-
NSDictionary *inputDictionary = @{
372-
@"dict_key": @{
373-
@"nested_key": @"nested_value"
374-
}
375-
};
376-
377-
NSDictionary *resultDictionary = [GIDEMMSupport
378-
dictionaryWithStringValuesFromDictionary:inputDictionary];
379-
380-
XCTAssertTrue([resultDictionary[@"dict_key"] isKindOfClass:[NSString class]],
381-
@"The value should be an NSString.");
382-
XCTAssertEqualObjects(resultDictionary[@"dict_key"], @"{\"nested_key\":\"nested_value\"}",
383-
@"The dictionary should be serialized into a JSON string.");
384-
}
385-
386-
- (void)testStringConversion_withMixedTypes_allAreConverted {
387-
NSDictionary *inputDictionary = @{
388-
@"string_key": @"hello",
389-
@"number_key": @987,
390-
@"bool_key": @YES,
391-
@"array_key": @[ @"a", @NO ],
392-
};
393-
394-
NSDictionary *resultDictionary = [GIDEMMSupport
395-
dictionaryWithStringValuesFromDictionary:inputDictionary];
396-
397-
XCTAssertTrue([resultDictionary[@"string_key"] isKindOfClass:[NSString class]],
398-
@"The value should be an NSString.");
399-
XCTAssertEqualObjects(resultDictionary[@"string_key"], @"hello",
400-
@"The original string value should be preserved");
401-
402-
XCTAssertTrue([resultDictionary[@"number_key"] isKindOfClass:[NSString class]],
403-
@"The value should be an NSString.");
404-
XCTAssertEqualObjects(resultDictionary[@"number_key"], @"987",
405-
@"The NSNumber should be converted to a string.");
406-
407-
XCTAssertTrue([resultDictionary[@"bool_key"] isKindOfClass:[NSString class]],
408-
@"The value should be an NSString.");
409-
XCTAssertEqualObjects(resultDictionary[@"bool_key"], @"true",
410-
@"The boolean YES should be converted to the string 'true'.");
411-
412-
XCTAssertTrue([resultDictionary[@"array_key"] isKindOfClass:[NSString class]],
413-
@"The value should be an NSString.");
414-
XCTAssertEqualObjects(resultDictionary[@"array_key"], @"[\"a\",false]",
415-
@"The array should be serialized into a JSON string.");
416-
}
417-
418-
- (void)testStringConversion_withEmptyDictionary_returnsEmptyDictionary {
419-
NSDictionary *resultDictionary = [GIDEMMSupport dictionaryWithStringValuesFromDictionary:@{}];
420-
421-
XCTAssertEqual(resultDictionary.count, 0, @"The resulting dictionary should be empty.");
422-
}
423-
424356
# pragma mark - Helpers
425357

426358
- (NSString *)systemVersion {

0 commit comments

Comments
 (0)