Quellcode durchsuchen

Re-enable HTTPSCallableTests (#8265)

* Cache FIRStorage instances by app

* changelog

* nuts

* format

* appease the code coverage bot

* storage -> functions

* style

* appease codecov again

* Go the component way

* doc comments and style

* fix copyrights

* Fix bad import

* nit

* make it threadsafe

* attempt to fix swift test

* fix tests again

* debug

* Disable Combine tests

* allow subclasses in functions component

* reenable test

* Remove class check

* style

* Add changelog
Morgan Chen vor 4 Jahren
Ursprung
Commit
3ab732b278

+ 2 - 2
.github/workflows/functions.yml

@@ -46,8 +46,8 @@ jobs:
       run: scripts/setup_spm_tests.sh
     - name: iOS Unit Tests
       run: scripts/third_party/travis/retry.sh ./scripts/build.sh FirebaseFunctions iOS spmbuildonly
-    # - name: Combine Unit Tests
-    #   run: scripts/third_party/travis/retry.sh ./scripts/build.sh FunctionsCombineUnit iOS spm
+    - name: Combine Unit Tests
+      run: scripts/third_party/travis/retry.sh ./scripts/build.sh FunctionsCombineUnit iOS spm
 
   spm-cron:
     # Don't run on private repo.

+ 3 - 0
Functions/CHANGELOG.md

@@ -1,3 +1,6 @@
+# v8.3.0
+- [fixed] Fixed an issue where subclassing Functions was unusable (#8265).
+
 # v8.2.0
 - [fixed] Fixed an issue where factory class methods returned a new instance on every invocation, causing emulator settings to not persist between invocations (#7783).
 

+ 1 - 1
Functions/FirebaseFunctions/FIRFunctions.m

@@ -103,7 +103,7 @@ NSString *const kFUNDefaultRegion = @"us-central1";
                          region:(NSString *)region
                    customDomain:(nullable NSString *)customDomain {
   id<FIRFunctionsProvider> provider = FIR_COMPONENT(FIRFunctionsProvider, app.container);
-  return [provider functionsForApp:app region:region customDomain:customDomain];
+  return [provider functionsForApp:app region:region customDomain:customDomain type:[self class]];
 }
 
 - (instancetype)initWithApp:(FIRApp *)app

+ 2 - 1
Functions/FirebaseFunctions/FIRFunctionsComponent.h

@@ -24,7 +24,8 @@ NS_ASSUME_NONNULL_BEGIN
 
 - (FIRFunctions *)functionsForApp:(FIRApp *)app
                            region:(nullable NSString *)region
-                     customDomain:(nullable NSString *)customDomain;
+                     customDomain:(nullable NSString *)customDomain
+                             type:(Class)cls;
 
 @end
 

+ 3 - 4
Functions/FirebaseFunctions/FIRFunctionsComponent.m

@@ -92,7 +92,8 @@
 
 - (FIRFunctions *)functionsForApp:(FIRApp *)app
                            region:(NSString *)region
-                     customDomain:(NSString *_Nullable)customDomain {
+                     customDomain:(NSString *_Nullable)customDomain
+                             type:(Class)cls {
   os_unfair_lock_lock(&_instancesLock);
   NSArray<FIRFunctions *> *associatedInstances = [self instances][app.name];
   if (associatedInstances.count > 0) {
@@ -111,9 +112,7 @@
     }
   }
 
-  FIRFunctions *newInstance = [[FIRFunctions alloc] initWithApp:app
-                                                         region:region
-                                                   customDomain:customDomain];
+  FIRFunctions *newInstance = [[cls alloc] initWithApp:app region:region customDomain:customDomain];
 
   if (self.instances[app.name] == nil) {
     NSMutableArray *array = [NSMutableArray arrayWithObject:newInstance];