Skip to content
This repository has been archived by the owner on Oct 29, 2024. It is now read-only.

Commit

Permalink
Merge pull request #78 from andvalsol/Issue75
Browse files Browse the repository at this point in the history
Remove any forcing for LDClient.get() to a null check first. This wil…
  • Loading branch information
gwhelanLD authored Jun 1, 2021
2 parents 4e94289 + 49c9139 commit c0a5045
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions ios/LaunchdarklyReactNativeClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -449,34 +449,34 @@ class LaunchdarklyReactNativeClient: RCTEventEmitter {
}

@objc func setOffline(_ resolve: @escaping RCTPromiseResolveBlock, reject: RCTPromiseRejectBlock) -> Void {
LDClient.get()!.setOnline(false) {
LDClient.get()?.setOnline(false) {
return resolve(true)
}
}

@objc func isOffline(_ resolve: RCTPromiseResolveBlock, reject: RCTPromiseRejectBlock) -> Void {
resolve(LDClient.get()!.isOnline)
resolve(LDClient.get()?.isOnline)
}

@objc func setOnline(_ resolve: @escaping RCTPromiseResolveBlock, reject: RCTPromiseRejectBlock) -> Void {
LDClient.get()!.setOnline(true) {
LDClient.get()?.setOnline(true) {
return resolve(true)
}
}

@objc func flush() -> Void {
LDClient.get()!.flush()
LDClient.get()?.flush()
}

@objc func close(_ resolve: RCTPromiseResolveBlock, reject: RCTPromiseRejectBlock) -> Void {
LDClient.get()!.close()
LDClient.get()?.close()
resolve(true)
}

@objc func identify(_ options: NSDictionary, resolve: @escaping RCTPromiseResolveBlock, reject: RCTPromiseRejectBlock) -> Void {
let user = userBuild(userDict: options)
if let usr = user {
LDClient.get()!.identify(user: usr) {
LDClient.get()?.identify(user: usr) {
resolve(nil)
}
} else {
Expand Down

0 comments on commit c0a5045

Please sign in to comment.