Skip to content

Commit f88403d

Browse files
committed
Fix build
1 parent 53ccdf0 commit f88403d

File tree

2 files changed

+7
-33
lines changed

2 files changed

+7
-33
lines changed

ios/RCTMqtt/Mqtt.m

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ @interface Mqtt ()
1414
@property (strong, nonatomic) MQTTSessionManager *manager;
1515
@property (nonatomic, strong) NSDictionary *defaultOptions;
1616
@property (nonatomic, retain) NSMutableDictionary *options;
17-
@property BOOL isConnect;
1817
@property int clientRef;
1918
@property (nonatomic, strong) RCTBridge * bridge;
2019

@@ -43,9 +42,9 @@ - (id)init {
4342
@"willQos": @0,
4443
@"willRetainFlag": @NO
4544
};
46-
45+
4746
}
48-
47+
4948
return self;
5049
}
5150

@@ -61,7 +60,7 @@ - (instancetype) initWithBrigde:(RCTBridge *) bridge
6160
}
6261
self.manager = [[MQTTSessionManager alloc] init];
6362
self.manager.delegate = self;
64-
63+
6564
return self;
6665
}
6766

@@ -71,7 +70,7 @@ - (void) connect {
7170
securityPolicy = [MQTTSSLSecurityPolicy policyWithPinningMode:MQTTSSLPinningModeNone];
7271
securityPolicy.allowInvalidCertificates = YES;
7372
}
74-
73+
7574
NSData *willMsg = nil;
7675
if(self.options[@"willMsg"] != [NSNull null]) {
7776
willMsg = [self.options[@"willMsg"] dataUsingEncoding:NSUTF8StringEncoding];
@@ -172,7 +171,7 @@ - (void)handleMessage:(NSData *)data onTopic:(NSString *)topic retained:(BOOL)re
172171
@"retain": [NSNumber numberWithBool:retained]
173172
}
174173
}];
175-
174+
176175
}
177176

178177

ios/RCTMqtt/RCTMqtt.m

Lines changed: 2 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -37,33 +37,12 @@ -(int)getRandomNumberBetween:(int)from to:(int)to {
3737
- (instancetype)init
3838
{
3939
if ((self = [super init])) {
40-
41-
NSNotificationCenter *defaultCenter = [NSNotificationCenter defaultCenter];
42-
4340
_clients = [[NSMutableDictionary alloc] init];
44-
45-
[defaultCenter addObserver:self
46-
selector:@selector(appDidBecomeActive)
47-
name:UIApplicationDidBecomeActiveNotification
48-
object:nil];
49-
50-
51-
5241
}
5342
return self;
5443

5544
}
5645

57-
- (void)appDidBecomeActive {
58-
// if(self.isConnect) {
59-
// [self.manager addObserver:self
60-
// forKeyPath:@"state"
61-
// options:NSKeyValueObservingOptionInitial | NSKeyValueObservingOptionNew
62-
// context:nil];
63-
// }
64-
65-
}
66-
6746
RCT_EXPORT_METHOD(createClient:(NSDictionary *) options
6847
resolver:(RCTPromiseResolveBlock)resolve
6948
rejecter:(RCTPromiseRejectBlock)reject) {
@@ -79,9 +58,7 @@ - (void)appDidBecomeActive {
7958

8059
}
8160
RCT_EXPORT_METHOD(connect:(nonnull NSNumber *) clientRef) {
82-
8361
[[[self clients] objectForKey:clientRef] connect];
84-
8562
}
8663

8764

@@ -94,21 +71,19 @@ - (void)appDidBecomeActive {
9471
}
9572

9673
RCT_EXPORT_METHOD(unsubscribe:(nonnull NSNumber *) clientRef topic:(NSString *)topic) {
97-
[[[self clients] objectForKey:clientRef] unsubscribe:topic qos:qos];
74+
[[[self clients] objectForKey:clientRef] unsubscribe:topic];
9875
}
9976

10077
RCT_EXPORT_METHOD(publish:(nonnull NSNumber *) clientRef topic:(NSString *)topic data:(NSString*)data qos:(nonnull NSNumber *)qos retain:(BOOL)retain) {
10178
[[[self clients] objectForKey:clientRef] publish:topic
10279
data:[data dataUsingEncoding:NSUTF8StringEncoding]
10380
qos:qos
10481
retain:retain];
105-
82+
10683
}
10784

10885
- (void)dealloc
10986
{
110-
111-
11287
}
11388

11489
@end

0 commit comments

Comments
 (0)