Skip to content
This repository was archived by the owner on Dec 17, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion example/ios/Podfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
source 'https://github.com/artsy/Specs.git'
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '13.0'
platform :ios, '15.0'

plugin 'cocoapods-art', :sources => [
'onegini'
Expand Down
12 changes: 6 additions & 6 deletions example/ios/Runner/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CADisableMinimumFrameDurationOnPhone</key>
<true/>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
Expand Down Expand Up @@ -41,10 +43,12 @@
</array>
<key>NSCameraUsageDescription</key>
<string>Need to access your camera to scan QR code</string>
<key>NSLocalNetworkUsageDescription</key>
<string>Set to your desired customized permission dialog text.</string>
<key>NSFaceIDUsageDescription</key>
<string>Please provide access to your Face ID</string>
<key>NSLocalNetworkUsageDescription</key>
<string>Set to your desired customized permission dialog text.</string>
<key>UIApplicationSupportsIndirectInputEvents</key>
<true/>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
Expand All @@ -64,9 +68,5 @@
<false/>
<key>io.flutter.embedded_views_preview</key>
<true/>
<key>CADisableMinimumFrameDurationOnPhone</key>
<true/>
<key>UIApplicationSupportsIndirectInputEvents</key>
<true/>
</dict>
</plist>
3 changes: 1 addition & 2 deletions example/lib/screens/user_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -435,8 +435,7 @@ class Info extends StatefulWidget {

class _InfoState extends State<Info> {
Future<ApplicationDetails> _getApplicationDetails() async {
await Onegini.instance.userClient
.authenticateDevice(["read", "write", "application-details"]);
await Onegini.instance.userClient.authenticateDevice(["application-details"]);
final response = await Onegini.instance.resourcesMethods.requestResource(
ResourceRequestType.anonymous,
RequestDetails(
Expand Down
2 changes: 1 addition & 1 deletion ios/Classes/NativeBridge/Handlers/BrowserHandler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class BrowserViewController: NSObject, BrowserHandlerProtocol {
}

private func openInternalBrowser(url: URL) {
let scheme = URL(string: ONGClient.sharedInstance().configModel.redirectURL)!.scheme
let scheme = URL(string: SharedClient.instance.configModel.redirectURL)!.scheme
webAuthSession = ASWebAuthenticationSession(url: url, callbackURLScheme: scheme, completionHandler: { callbackURL, error in
Logger.log("webAuthSession completionHandler", sender: self)
guard error == nil, let successURL = callbackURL else {
Expand Down
2 changes: 1 addition & 1 deletion ios/Classes/NativeBridge/Handlers/ResourcesHandler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class ResourcesHandler: FetchResourcesHandlerProtocol {
func requestResource(_ requestType: ResourceRequestType, _ details: OWRequestDetails, completion: @escaping (Result<OWRequestResponse, FlutterError>) -> Void) {
Logger.log("requestResource", sender: self)
// Additional check for valid url
let resourceUrl = ONGClient.sharedInstance().configModel.resourceBaseURL ?? ""
let resourceUrl = SharedClient.instance.configModel.resourceBaseURL
if isValidUrl(details.path) == false && isValidUrl(resourceUrl + details.path) == false {
completion(.failure(FlutterError(SdkError(.invalidUrl))))
return
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import Flutter
extension OneginiModuleSwift {

func getIdentityProviders() -> Result<[OWIdentityProvider], FlutterError> {
let providers = ONGClient.sharedInstance().userClient.identityProviders()
return .success(providers.compactMap { OWIdentityProvider($0) })
let providers = SharedClient.instance.userClient.identityProviders
return .success(providers.compactMap { OWIdentityProvider(id: $0.identifier, name: $0.name) })
}

func logOut(callback: @escaping (Result<Void, FlutterError>) -> Void) {
Expand Down Expand Up @@ -86,14 +86,14 @@ extension OneginiModuleSwift {
}

func getAuthenticatedUserProfile() -> Result<OWUserProfile, FlutterError> {
guard let profile = ONGUserClient.sharedInstance().authenticatedUserProfile() else {
guard let profile = SharedUserClient.instance.authenticatedUserProfile else {
return .failure(FlutterError(.notAuthenticatedUser))
}
return .success(OWUserProfile(profile))
}

func getAccessToken() -> Result<String, FlutterError> {
guard let accessToken = ONGUserClient.sharedInstance().accessToken else {
guard let accessToken = SharedUserClient.instance.accessToken else {
return .failure(FlutterError(.notAuthenticatedUser))
}
return .success(accessToken)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ extension OneginiModuleSwift {

func validatePinWithPolicy(_ pin: String, completion: @escaping (Result<Void, FlutterError>) -> Void) {
// FIXME: Move this out of this file
ONGUserClient.sharedInstance().validatePin(withPolicy: pin) { (_, error) in
let userClient = SharedUserClient.instance
userClient.validatePolicyCompliance(for: pin) { error in
guard let error = error else {
completion(.success)
return
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ extension OneginiModuleSwift {
}

public func handleDeepLinkCallbackUrl(_ url: URL) -> Bool {
guard let schemeLibrary = URL.init(string: ONGClient.sharedInstance().configModel.redirectURL)?.scheme else {
guard let schemeLibrary = URL.init(string: SharedClient.instance.configModel.redirectURL)?.scheme else {
// FIXME: We should propagate an error here to the caller, not through events.
return false
}
Expand Down Expand Up @@ -50,6 +50,6 @@ extension OneginiModuleSwift {
}

func getRedirectUrl() -> Result<String, FlutterError> {
return .success(ONGClient.sharedInstance().configModel.redirectURL)
return .success(SharedClient.instance.configModel.redirectURL)
}
}
27 changes: 12 additions & 15 deletions ios/Classes/NativeBridge/OneginiModuleSwift.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,26 +18,23 @@ public class OneginiModuleSwift: NSObject {
}

func startOneginiModule(httpConnectionTimeout: Int64?, additionalResourceUrls: [String]?, callback: @escaping (Result<Void, FlutterError>) -> Void) {
ONGClientBuilder().setHttpRequestTimeout(TimeInterval(Double(httpConnectionTimeout ?? 5)))
ONGClientBuilder().setAdditionalResourceUrls(additionalResourceUrls ?? [])
ONGClientBuilder().build()
ONGClient.sharedInstance().start { result, error in
if let error = error {
let mappedError = ErrorMapper().mapError(error)
callback(.failure(mappedError.flutterError()))
return
let builder = ClientBuilder()
builder.setHttpRequestTimeout(TimeInterval(Double(httpConnectionTimeout ?? 5)))
builder.setAdditionalResourceUrls(additionalResourceUrls ?? [])
builder.buildAndWaitForProtectedData { client in
client.start { error in
if let error {
let mappedError = ErrorMapper().mapError(error)
callback(.failure(mappedError.flutterError()))
return
}
callback(.success)
}

if !result {
callback(.failure(SdkError(.genericError).flutterError()))
return
}
callback(.success)
}
}

func getUserProfiles() -> Result<[OWUserProfile], FlutterError> {
let profiles = ONGUserClient.sharedInstance().userProfiles()
let profiles = SharedUserClient.instance.userProfiles
return .success(profiles.compactMap { OWUserProfile($0) })
}
}