Skip to content

Commit 4c30dbe

Browse files
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 <[email protected]>
1 parent 26eb531 commit 4c30dbe

File tree

4 files changed

+13
-23
lines changed

4 files changed

+13
-23
lines changed

.github/workflows/database.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ jobs:
111111

112112
strategy:
113113
matrix:
114-
target: [ios, tvos, macos]
114+
target: [ios, tvos, macos, watchos]
115115
steps:
116116
- uses: actions/checkout@v2
117117
- name: Setup Bundler

FirebaseDatabase.podspec

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ Simplify your iOS development, grow your user base, and monetize more effectivel
5959
'FirebaseDatabase/Tests/Helpers/*.[mh]',
6060
'FirebaseDatabase/Tests/third_party/*.[mh]',
6161
'SharedTestUtilities/FIRAuthInteropFake.[mh]',
62-
'SharedTestUtilities/FIRComponentTestUtilities.h',
62+
'SharedTestUtilities/FIRComponentTestUtilities.[mh]',
6363
'SharedTestUtilities/FIROptionsMock.[mh]',
6464
]
6565
unit_tests.dependency 'OCMock'
@@ -74,6 +74,7 @@ Simplify your iOS development, grow your user base, and monetize more effectivel
7474
'FirebaseDatabase/Tests/Integration/*.[mh]',
7575
'FirebaseDatabase/Tests/Helpers/*.[mh]',
7676
'SharedTestUtilities/FIRAuthInteropFake.[mh]',
77+
'SharedTestUtilities/FIRComponentTestUtilities.[mh]',
7778
'SharedTestUtilities/FIROptionsMock.[mh]',
7879
]
7980
int_tests.dependency 'OCMock'

FirebaseDatabase/Sources/Realtime/FWebSocketConnection.m

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -327,20 +327,26 @@ - (void)URLSession:(NSURLSession *)session
327327
}
328328

329329
- (void)receiveWebSocketData {
330+
__weak __auto_type weakSelf = self;
330331
[self.webSocketTask receiveMessageWithCompletionHandler:^(
331332
NSURLSessionWebSocketMessage *_Nullable message,
332333
NSError *_Nullable error) {
334+
__auto_type strongSelf = weakSelf;
335+
if (strongSelf == nil) {
336+
return;
337+
}
338+
333339
if (message) {
334-
[self handleIncomingFrame:message.string];
335-
} else if (error && !isClosed) {
340+
[strongSelf handleIncomingFrame:message.string];
341+
} else if (error && !strongSelf->isClosed) {
336342
FFWarn(@"I-RDB083020",
337343
@"Error received from web socket, closing the connection. %@",
338344
error);
339-
[self shutdown];
345+
[strongSelf shutdown];
340346
return;
341347
}
342348

343-
[self receiveWebSocketData];
349+
[strongSelf receiveWebSocketData];
344350
}];
345351
}
346352

FirebaseDatabase/Tests/Helpers/FIRFakeApp.m

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -47,23 +47,6 @@ @interface FIRComponentContainer (TestInternal)
4747
@property(nonatomic, strong) NSMutableDictionary<NSString *, FIRComponentCreationBlock> *components;
4848
@end
4949

50-
@interface FIRComponentContainer (TestInternalImplementations)
51-
- (instancetype)initWithApp:(FIRApp *)app
52-
components:(NSDictionary<NSString *, FIRComponentCreationBlock> *)components;
53-
@end
54-
55-
@implementation FIRComponentContainer (TestInternalImplementations)
56-
57-
- (instancetype)initWithApp:(FIRApp *)app
58-
components:(NSDictionary<NSString *, FIRComponentCreationBlock> *)components {
59-
self = [self initWithApp:app registrants:[[NSMutableSet alloc] init]];
60-
if (self) {
61-
self.components = [components mutableCopy];
62-
}
63-
return self;
64-
}
65-
@end
66-
6750
@implementation FIRFakeApp
6851

6952
- (instancetype)initWithName:(NSString *)name URL:(NSString *_Nullable)url {

0 commit comments

Comments
 (0)