react-native-persona 2.2.20 → 2.2.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -7,6 +7,10 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
8
  ## Unreleased
9
9
 
10
+ ## [v2.2.21] - 2022-08-18
11
+
12
+ - Fixed a bug where the inquiry flow failed to present on iOS
13
+
10
14
  ## [v2.2.20] - 2022-08-15
11
15
 
12
16
  ### Changed
@@ -54,20 +54,35 @@ class PersonaInquiry2: RCTEventEmitter {
54
54
  fields: fieldsFrom(fieldsObject)
55
55
  )
56
56
  DispatchQueue.main.async {
57
- guard let rootViewController = UIApplication.shared.keyWindow?.rootViewController else {
58
- // TODO: Do something with the error
57
+ guard let viewController = self.findTopViewController() else {
58
+ self.sendEvent(
59
+ withName: "onError",
60
+ body: [
61
+ "debugMessage": "Couldn't resolve a root view controller"
62
+ ]
63
+ )
59
64
  return
60
65
  }
61
66
 
62
67
  Inquiry(
63
68
  config: config,
64
69
  delegate: self
65
- ).start(from: rootViewController)
70
+ ).start(from: viewController)
66
71
  }
67
72
  } catch {
68
73
  print("An error occurred while starting the Inquiry: \(error.localizedDescription)")
69
74
  }
70
75
  }
76
+
77
+ func findTopViewController() -> UIViewController? {
78
+ // Resolve rootViewController to top most presented view controller
79
+ var topViewController = UIApplication.shared.keyWindow?.rootViewController
80
+ while let presentedViewController = topViewController?.presentedViewController {
81
+ topViewController = presentedViewController
82
+ }
83
+
84
+ return topViewController
85
+ }
71
86
  }
72
87
 
73
88
  // MARK: - Inquiry Delegate Methods
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "react-native-persona",
3
3
  "title": "React Native Persona",
4
- "version": "2.2.20",
4
+ "version": "2.2.21",
5
5
  "description": "Launch a mobile native implementation of the Persona inquiry flow from React Native.",
6
6
  "main": "lib/commonjs/index",
7
7
  "module": "lib/module/index",