aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--Example/Core/Tests/FIRAppTest.m3
-rw-r--r--Firebase/Core/FIRApp.m11
-rw-r--r--Firebase/Core/Private/FIRAppInternal.h2
3 files changed, 6 insertions, 10 deletions
diff --git a/Example/Core/Tests/FIRAppTest.m b/Example/Core/Tests/FIRAppTest.m
index 707c763..28378d2 100644
--- a/Example/Core/Tests/FIRAppTest.m
+++ b/Example/Core/Tests/FIRAppTest.m
@@ -614,8 +614,7 @@ NSString *const kFIRTestAppName2 = @"test-app-name-2";
- (void)testMultipleLibraries {
[FIRApp registerLibrary:@"LegalName" withVersion:@"1.0.0"];
[FIRApp registerLibrary:@"LegalName2" withVersion:@"2.0.0"];
- XCTAssertTrue([[FIRApp firebaseUserAgent] containsString:@"LegalName/1.0.0"]);
- XCTAssertTrue([[FIRApp firebaseUserAgent] containsString:@"LegalName2/2.0.0"]);
+ XCTAssertTrue([[FIRApp firebaseUserAgent] isEqualToString:@"LegalName/1.0.0 LegalName2/2.0.0"]);
}
#pragma mark - private
diff --git a/Firebase/Core/FIRApp.m b/Firebase/Core/FIRApp.m
index d8ff75d..eed63b8 100644
--- a/Firebase/Core/FIRApp.m
+++ b/Firebase/Core/FIRApp.m
@@ -403,13 +403,9 @@ static NSMutableDictionary *sLibraryVersions;
+ (void)registerLibrary:(nonnull NSString *)library withVersion:(nonnull NSString *)version {
// Create the set of characters which aren't allowed, only if this feature is used.
- static NSCharacterSet *disallowedSet;
- static dispatch_once_t onceToken;
- dispatch_once(&onceToken, ^{
- NSMutableCharacterSet *allowedSet = [NSMutableCharacterSet alphanumericCharacterSet];
- [allowedSet addCharactersInString:@"-_."];
- disallowedSet = [allowedSet invertedSet];
- });
+ NSMutableCharacterSet *allowedSet = [NSMutableCharacterSet alphanumericCharacterSet];
+ [allowedSet addCharactersInString:@"-_."];
+ NSCharacterSet *disallowedSet = [allowedSet invertedSet];
// Make sure the library name and version strings do not contain unexpected characters, and
// add the name/version pair to the dictionary.
if ([library rangeOfCharacterFromSet:disallowedSet].location == NSNotFound &&
@@ -433,6 +429,7 @@ static NSMutableDictionary *sLibraryVersions;
[libraries addObject:
[NSString stringWithFormat:@"%@/%@", libraryName, sLibraryVersions[libraryName]]];
}
+ [libraries sortUsingSelector:@selector(localizedCaseInsensitiveCompare:)];
return [libraries componentsJoinedByString:@" "];
}
diff --git a/Firebase/Core/Private/FIRAppInternal.h b/Firebase/Core/Private/FIRAppInternal.h
index bbf0477..4b56728 100644
--- a/Firebase/Core/Private/FIRAppInternal.h
+++ b/Firebase/Core/Private/FIRAppInternal.h
@@ -142,7 +142,7 @@ typedef NSString *_Nullable (^FIRAppGetUIDImplementation)(void);
* @param library Name of the library
* @param version Version of the library
*/
-+ (void)registerLibrary:(nonnull NSString *)library withVersion:(nonnull NSString *)version \
++ (void)registerLibrary:(nonnull NSString *)library withVersion:(nonnull NSString *)version
NS_SWIFT_NAME(registerLibrary(_:version:));
/**