Skip to content

Commit

Permalink
Update implementation on native generators
Browse files Browse the repository at this point in the history
  • Loading branch information
erdemyerebasmaz committed Mar 22, 2024
1 parent 130bb38 commit dda5a51
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
5 changes: 3 additions & 2 deletions src/gen_kotlin/templates/module.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
3 changes: 2 additions & 1 deletion src/gen_swift/templates/extern.m
Original file line number Diff line number Diff line change
Expand Up @@ -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
)

Expand Down
4 changes: 2 additions & 2 deletions src/gen_swift/templates/module.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit dda5a51

Please sign in to comment.