Quellcode durchsuchen

Fix pod lib lint for watchOS + add CI test (#7740)

* Fix pod lib lint for watchOS

* Add watchOS build test.

* Code review feedback

* Typo and formatting

* Typo and formatting

* fix typo

* Add missing test util files to tests targets

Co-authored-by: Maksym Malyhin <mmaksym@google.com>
Ryan Wilson vor 5 Jahren
Ursprung
Commit
4c30dbee86

+ 1 - 1
.github/workflows/database.yml

@@ -111,7 +111,7 @@ jobs:
 
     strategy:
       matrix:
-        target: [ios, tvos, macos]
+        target: [ios, tvos, macos, watchos]
     steps:
     - uses: actions/checkout@v2
     - name: Setup Bundler

+ 2 - 1
FirebaseDatabase.podspec

@@ -59,7 +59,7 @@ Simplify your iOS development, grow your user base, and monetize more effectivel
       'FirebaseDatabase/Tests/Helpers/*.[mh]',
       'FirebaseDatabase/Tests/third_party/*.[mh]',
       'SharedTestUtilities/FIRAuthInteropFake.[mh]',
-      'SharedTestUtilities/FIRComponentTestUtilities.h',
+      'SharedTestUtilities/FIRComponentTestUtilities.[mh]',
       'SharedTestUtilities/FIROptionsMock.[mh]',
     ]
     unit_tests.dependency 'OCMock'
@@ -74,6 +74,7 @@ Simplify your iOS development, grow your user base, and monetize more effectivel
       'FirebaseDatabase/Tests/Integration/*.[mh]',
       'FirebaseDatabase/Tests/Helpers/*.[mh]',
       'SharedTestUtilities/FIRAuthInteropFake.[mh]',
+      'SharedTestUtilities/FIRComponentTestUtilities.[mh]',
       'SharedTestUtilities/FIROptionsMock.[mh]',
     ]
     int_tests.dependency 'OCMock'

+ 10 - 4
FirebaseDatabase/Sources/Realtime/FWebSocketConnection.m

@@ -327,20 +327,26 @@
 }
 
 - (void)receiveWebSocketData {
+    __weak __auto_type weakSelf = self;
     [self.webSocketTask receiveMessageWithCompletionHandler:^(
                             NSURLSessionWebSocketMessage *_Nullable message,
                             NSError *_Nullable error) {
+      __auto_type strongSelf = weakSelf;
+      if (strongSelf == nil) {
+          return;
+      }
+
       if (message) {
-          [self handleIncomingFrame:message.string];
-      } else if (error && !isClosed) {
+          [strongSelf handleIncomingFrame:message.string];
+      } else if (error && !strongSelf->isClosed) {
           FFWarn(@"I-RDB083020",
                  @"Error received from web socket, closing the connection. %@",
                  error);
-          [self shutdown];
+          [strongSelf shutdown];
           return;
       }
 
-      [self receiveWebSocketData];
+      [strongSelf receiveWebSocketData];
     }];
 }
 

+ 0 - 17
FirebaseDatabase/Tests/Helpers/FIRFakeApp.m

@@ -47,23 +47,6 @@
 @property(nonatomic, strong) NSMutableDictionary<NSString *, FIRComponentCreationBlock> *components;
 @end
 
-@interface FIRComponentContainer (TestInternalImplementations)
-- (instancetype)initWithApp:(FIRApp *)app
-                 components:(NSDictionary<NSString *, FIRComponentCreationBlock> *)components;
-@end
-
-@implementation FIRComponentContainer (TestInternalImplementations)
-
-- (instancetype)initWithApp:(FIRApp *)app
-                 components:(NSDictionary<NSString *, FIRComponentCreationBlock> *)components {
-  self = [self initWithApp:app registrants:[[NSMutableSet alloc] init]];
-  if (self) {
-    self.components = [components mutableCopy];
-  }
-  return self;
-}
-@end
-
 @implementation FIRFakeApp
 
 - (instancetype)initWithName:(NSString *)name URL:(NSString *_Nullable)url {