Created
May 9, 2018 22:23
-
-
Save skiph/e059600e8ce9358e70f28e8a116e06d5 to your computer and use it in GitHub Desktop.
rndemo: swift bridging class
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
import Approov | |
@objc(Approov) | |
class Approov: NSObject { | |
@objc func fetchApproovToken(_ url: String, | |
resolver resolve: @escaping RCTPromiseResolveBlock, | |
rejecter reject: @escaping RCTPromiseRejectBlock) -> Void { | |
let attestee = ApproovAttestee.shared() | |
attestee?.fetchApproovToken({ (tokenFetchData: ApproovTokenFetchData) in | |
switch tokenFetchData.result { | |
case .successful: | |
resolve(tokenFetchData.approovToken) | |
case .failed: | |
resolve("NO_TOKEN") | |
} | |
}, url) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment