Skip to content

Commit

Permalink
iOS correction
Browse files Browse the repository at this point in the history
  • Loading branch information
ehsan6sha committed Jan 22, 2024
1 parent cc039a9 commit 6d707dc
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 12 deletions.
6 changes: 3 additions & 3 deletions ios/Fula.mm
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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)

Expand Down
25 changes: 16 additions & 9 deletions ios/Fula.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1256,44 +1256,51 @@ 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 {
reject("ERR_FULA", "joinPool: \(error.localizedDescription)", error)
}
}


@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 {
reject("ERR_FULA", "cancelPoolJoin: \(error.localizedDescription)", error)
}
}


@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 {
reject("ERR_FULA", "leavePool: \(error.localizedDescription)", error)
}
}


@objc(eraseBlData:withRejecter:)
func eraseBlData(resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
do {
Expand Down

0 comments on commit 6d707dc

Please sign in to comment.