@@ -85,33 +85,42 @@ - (void)appDidBecomeActive {
85
85
resolve ([NSNumber numberWithInt: clientRef]);
86
86
87
87
}
88
- RCT_EXPORT_METHOD (connect:(int ) clientRef) {
88
+
89
+ RCT_EXPORT_METHOD (removeClient:(int ) clientRef
90
+ resolver:(RCTPromiseResolveBlock)resolve
91
+ rejecter:(RCTPromiseRejectBlock)reject) {
89
92
90
- [[[self clients ] objectForKey: [NSNumber numberWithInt: clientRef]] connect ];
93
+ [[self clients ] removeObjectForKey: [NSNumber numberWithInt: clientRef]];
94
+ resolve ([NSNumber numberWithInt: clientRef]);
91
95
92
96
}
93
97
94
-
95
- RCT_EXPORT_METHOD (disconnect:(int ) clientRef) {
96
- [[[self clients ] objectForKey: [NSNumber numberWithInt: clientRef]] disconnect ];
98
+ RCT_EXPORT_METHOD (connect:(nonnull NSNumber *) clientRef) {
99
+
100
+ [[[self clients ] objectForKey: clientRef] connect ];
101
+
97
102
}
98
103
99
- RCT_EXPORT_METHOD (subscribe:( int ) clientRef topic:( NSString *)topic qos:( int )qos) {
100
- [[[ self clients ] objectForKey: [ NSNumber numberWithInt: clientRef]] subscribe: topic qos: [ NSNumber numberWithInt: qos]];
101
-
104
+
105
+ RCT_EXPORT_METHOD (disconnect:(nonnull NSNumber *) clientRef) {
106
+ [[[ self clients ] objectForKey: clientRef] disconnect ];
102
107
}
103
108
104
- RCT_EXPORT_METHOD (unsubscribe:( int ) clientRef topic:(NSString *)topic) {
105
- [[[self clients ] objectForKey: [ NSNumber numberWithInt: clientRef]] unsubscribe : topic];
109
+ RCT_EXPORT_METHOD (subscribe:(nonnull NSNumber * ) clientRef topic:(NSString *)topic qos:(nonnull NSNumber *)qos ) {
110
+ [[[self clients ] objectForKey: clientRef] subscribe : topic qos: qos] ];
106
111
107
112
}
108
113
109
- RCT_EXPORT_METHOD (publish:(int ) clientRef topic:(NSString *)topic data:(NSString *)data qos:(int )qos retain:(int )retain) {
110
- [[[self clients ] objectForKey: [NSNumber numberWithInt: clientRef]] publish: topic
111
- data: [data dataUsingEncoding: NSUTF8StringEncoding]
112
- qos: [NSNumber numberWithInt: qos]
113
- retain: (BOOL )retain];
114
+ RCT_EXPORT_METHOD (publish:(nonnull NSNumber *) clientRef topic:(NSString *)topic data:(NSString *)data qos:(nonnull NSNumber *)qos retain:(BOOL )retain) {
115
+ [[[self clients ] objectForKey: clientRef] publish: topic
116
+ data: [data dataUsingEncoding: NSUTF8StringEncoding]
117
+ qos: qos
118
+ retain: retain];
119
+
120
+ }
114
121
122
+ RCT_EXPORT_METHOD (unsubscribe:(nonnull NSNumber *) clientRef topic:(NSString *)topic) {
123
+ [[[self clients ] objectForKey: clientRef] unsubscribe: topic];
115
124
}
116
125
117
126
- (void )dealloc
0 commit comments