diff --git a/ios/Fula.mm b/ios/Fula.mm index 4376fa3..cf9d39c 100644 --- a/ios/Fula.mm +++ b/ios/Fula.mm @@ -125,12 +125,12 @@ @interface RCT_EXTERN_MODULE(FulaModule, NSObject) RCT_EXTERN_METHOD(listPools:(RCTPromiseResolveBlock)resolve withRejecter:(RCTPromiseRejectBlock)reject) -RCT_EXTERN_METHOD(joinPool: (NSNumber *)poolID +RCT_EXTERN_METHOD(joinPool: (NSString *)poolID withResolver:(RCTPromiseResolveBlock)resolve withRejecter:(RCTPromiseRejectBlock)reject) -RCT_EXTERN_METHOD(cancelPoolJoin:(NSNumber *)poolID +RCT_EXTERN_METHOD(cancelPoolJoin:(NSString *)poolID withResolver:(RCTPromiseResolveBlock)resolve withRejecter:(RCTPromiseRejectBlock)reject) @@ -145,7 +145,7 @@ @interface RCT_EXTERN_MODULE(FulaModule, NSObject) withResolver:(RCTPromiseResolveBlock)resolve withRejecter:(RCTPromiseRejectBlock)reject) -RCT_EXTERN_METHOD(leavePool:(NSNumber *)poolID +RCT_EXTERN_METHOD(leavePool:(NSString *)poolID withResolver:(RCTPromiseResolveBlock)resolve withRejecter:(RCTPromiseRejectBlock)reject) diff --git a/ios/Fula.swift b/ios/Fula.swift index 180794d..7790b28 100644 --- a/ios/Fula.swift +++ b/ios/Fula.swift @@ -1256,12 +1256,14 @@ class FulaModule: NSObject { } } - @objc(joinPool:withResolver:withRejecter:) - func joinPool(poolID: Int, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) { + func joinPool(poolID: String, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) { print("ReactNative", "joinPool: poolID = ", poolID) do { - let result = try fula!.joinPool(poolID: poolID) + guard let poolIdInt = Int(poolID) else { + throw NSError(domain: "Invalid poolID", code: 0, userInfo: nil) + } + let result = try fula!.joinPool(poolID: poolIdInt) let resultString = String(data: result, encoding: .utf8) resolve(resultString) } catch let error { @@ -1269,11 +1271,13 @@ class FulaModule: NSObject { } } - @objc(cancelPoolJoin:withResolver:withRejecter:) - func cancelPoolJoin(poolID: Int, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) { + func cancelPoolJoin(poolID: String, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) { do { - let result = try fula!.cancelPoolJoin(poolID: poolID) + guard let poolIdInt = Int(poolID) else { + throw NSError(domain: "Invalid poolID", code: 0, userInfo: nil) + } + let result = try fula!.cancelPoolJoin(poolID: poolIdInt) let resultString = String(data: result, encoding: .utf8) resolve(resultString) } catch let error { @@ -1281,12 +1285,14 @@ class FulaModule: NSObject { } } - @objc(leavePool:withResolver:withRejecter:) - func leavePool(poolID: Int, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) { + func leavePool(poolID: String, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) { print("ReactNative", "leavePool: poolID = ", poolID) do { - let result = try fula!.leavePool(poolID: poolID) + guard let poolIdInt = Int(poolID) else { + throw NSError(domain: "Invalid poolID", code: 0, userInfo: nil) + } + let result = try fula!.leavePool(poolID: poolIdInt) let resultString = String(data: result, encoding: .utf8) resolve(resultString) } catch let error { @@ -1294,6 +1300,7 @@ class FulaModule: NSObject { } } + @objc(eraseBlData:withRejecter:) func eraseBlData(resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) { do {