From dda5a513e0d30d0d7b03928c5bb812e8a7722173 Mon Sep 17 00:00:00 2001 From: Erdem Yerebasmaz Date: Fri, 22 Mar 2024 17:43:51 +0300 Subject: [PATCH] Update implementation on native generators --- src/gen_kotlin/templates/module.kt | 5 +++-- src/gen_swift/templates/extern.m | 3 ++- src/gen_swift/templates/module.swift | 4 ++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/gen_kotlin/templates/module.kt b/src/gen_kotlin/templates/module.kt index a5196e9..92734f9 100644 --- a/src/gen_kotlin/templates/module.kt +++ b/src/gen_kotlin/templates/module.kt @@ -62,12 +62,13 @@ class BreezSDKModule(reactContext: ReactApplicationContext) : ReactContextBaseJa {% endif -%} {%- endfor %} @ReactMethod - fun setLogStream(promise: Promise) { + fun setLogStream(filterLevel: String, promise: Promise) { executor.execute { try { val emitter = reactApplicationContext.getJSModule(RCTDeviceEventEmitter::class.java) + val levelFilter = asLevelFilter(filterLevel); - setLogStream(BreezSDKLogStream(emitter)) + setLogStream(BreezSDKLogStream(emitter), levelFilter) promise.resolve(readableMapOf("status" to "ok")) } catch (e: Exception) { e.printStackTrace() diff --git a/src/gen_swift/templates/extern.m b/src/gen_swift/templates/extern.m index 42da3af..2c2e8b7 100644 --- a/src/gen_swift/templates/extern.m +++ b/src/gen_swift/templates/extern.m @@ -8,7 +8,8 @@ @interface RCT_EXTERN_MODULE(RNBreezSDK, RCTEventEmitter) {% endif %} {%- endfor %} RCT_EXTERN_METHOD( - setLogStream: (RCTPromiseResolveBlock)resolve + setLogStream: (NSString*)filterLevel + resolve: (RCTPromiseResolveBlock)resolve reject: (RCTPromiseRejectBlock)reject ) diff --git a/src/gen_swift/templates/module.swift b/src/gen_swift/templates/module.swift index b124279..332cd9e 100644 --- a/src/gen_swift/templates/module.swift +++ b/src/gen_swift/templates/module.swift @@ -73,9 +73,9 @@ class RNBreezSDK: RCTEventEmitter { {% endif -%} {%- endfor %} @objc(setLogStream:reject:) - func setLogStream(_ resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) -> Void { + func setLogStream(_ filterLevel: LevelFilter = nil, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) -> Void { do { - try BreezSDK.setLogStream(logStream: BreezSDKLogStream()) + try BreezSDK.setLogStream(logStream: BreezSDKLogStream(), filterLevel: filterLevel) resolve(["status": "ok"]) } catch let err { rejectErr(err: err, reject: reject)