FormidableLabs / FormidableLabs/react-native-app-auth

Instructions for react native 0.77 and 0.78

Open
#1,084 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
2.3k
Forks
473
PR merge metrics
No merged PRs in 30d

Description

## Documentation Feedback

I'm struggling to configure the lib for iOS, since the version of my project is 0.78, which AppDelegate.swift syntax is a little different from the expected in de documentation.

In example, a fresh project has this file: (got this info from [React Native Upgrade Helper](https://react-native-community.github.io/upgrade-helper/?from=0.75.3&to=0.78.3))

```swift

import UIKit
import React
import React_RCTAppDelegate
import ReactAppDependencyProvider
 
@main
class AppDelegate: RCTAppDelegate {
override func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
self.moduleName = "RnDiffApp"
self.dependencyProvider = RCTAppDependencyProvider()
 
// You can add your custom initial props in the dictionary below.
// They will be passed down to the ViewController used by React Native.
self.initialProps = [:]
 
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}
 
override func sourceURL(for bridge: RCTBridge) -> URL? {
self.bundleURL()
}
 
override func bundleURL() -> URL? {
#if DEBUG
RCTBundleURLProvider.sharedSettings().jsBundleURL(forBundleRoot: "index")
#else
Bundle.main.url(forResource: "main", withExtension: "jsbundle")
#endif
}
}

````

And the docs says that for react-native >= 0.77, this is expected:

```swift
@main
**class AppDelegate: UIResponder, UIApplicationDelegate,
RNAppAuthAuthorizationFlowManager** {
//... existing code...
// Required by RNAppAuthAuthorizationFlowManager protocol
public weak var authorizationFlowManagerDelegate:
RNAppAuthAuthorizationFlowManagerDelegate?
//... existing code...

// Handle OAuth redirect URL
func application(
_ app: UIApplication,
open url: URL,
options: [UIApplication.OpenURLOptionsKey: Any] = [:]
) -> Bool {
if let authorizationFlowManagerDelegate = self
.authorizationFlowManagerDelegate
{
if authorizationFlowManagerDelegate.resumeExternalUserAgentFlow(with: url)
{
return true
}
}
return false
}
}
```
Which is an update in AppDelegate.swift that took place in react native 0.79.0.
How should this be properly configured?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.