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

Remove any forcing for LDClient.get() to a null check first. This wil… #78

Merged
merged 1 commit into from
Jun 1, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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