Skip to content

Commit

Permalink
Address feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
erdemyerebasmaz committed Mar 22, 2024
1 parent dda5a51 commit d6aeb17
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/gen_kotlin/templates/module.kt
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,11 @@ class BreezSDKModule(reactContext: ReactApplicationContext) : ReactContextBaseJa
{% endif -%}
{%- endfor %}
@ReactMethod
fun setLogStream(filterLevel: String, promise: Promise) {
fun setLogStream(filterLevel: String?, promise: Promise) {
executor.execute {
try {
val emitter = reactApplicationContext.getJSModule(RCTDeviceEventEmitter::class.java)
val levelFilter = asLevelFilter(filterLevel);
val levelFilter = filterLevel?.let { asLevelFilter(filterLevel) }

setLogStream(BreezSDKLogStream(emitter), levelFilter)
promise.resolve(readableMapOf("status" to "ok"))
Expand Down
10 changes: 7 additions & 3 deletions src/gen_swift/templates/module.swift
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,14 @@ class RNBreezSDK: RCTEventEmitter {
{% include "TopLevelFunctionTemplate.swift" %}
{% endif -%}
{%- endfor %}
@objc(setLogStream:reject:)
func setLogStream(_ filterLevel: LevelFilter = nil, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) -> Void {
@objc(setLogStream:resolve:reject:)
func setLogStream(_ filterLevel: String?, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) -> Void {
do {
try BreezSDK.setLogStream(logStream: BreezSDKLogStream(), filterLevel: filterLevel)
var levelFilter: LevelFilter? = nil
if filterLevel != nil {
levelFilter = try BreezSDKMapper.asLevelFilter(levelFilter: filterLevel!)
}
try BreezSDK.setLogStream(logStream: BreezSDKLogStream(), filterLevel: levelFilter)
resolve(["status": "ok"])
} catch let err {
rejectErr(err: err, reject: reject)
Expand Down

0 comments on commit d6aeb17

Please sign in to comment.