expo-web-browser 12.1.1 → 12.3.0

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
@@ -10,6 +10,21 @@
10
10
 
11
11
  ### 💡 Others
12
12
 
13
+ ## 12.3.0 — 2023-06-21
14
+
15
+ ### 📚 3rd party library updates
16
+
17
+ - Updated `robolectric` to `4.10`. ([#22395](https://github.com/expo/expo/pull/22395) by [@josephyanks](https://github.com/josephyanks))
18
+
19
+ ### 🐛 Bug fixes
20
+
21
+ - On `iOS` fix browser session being kept alive after view controller is dismissed. ([#22415](https://github.com/expo/expo/pull/22415) by [@alanjhughes](https://github.com/alanjhughes))
22
+ - Fixed Android build warnings for Gradle version 8. ([#22537](https://github.com/expo/expo/pull/22537), [#22609](https://github.com/expo/expo/pull/22609) by [@kudo](https://github.com/kudo))
23
+
24
+ ## 12.2.0 — 2023-05-08
25
+
26
+ _This version does not introduce any user-facing changes._
27
+
13
28
  ## 12.1.1 — 2023-02-09
14
29
 
15
30
  _This version does not introduce any user-facing changes._
package/README.md CHANGED
@@ -16,7 +16,7 @@ Provides access to the system's web browser and supports handling redirects. On
16
16
 
17
17
  # Installation in managed Expo projects
18
18
 
19
- For [managed](https://docs.expo.dev/versions/latest/introduction/managed-vs-bare/) Expo projects, please follow the installation instructions in the [API documentation for the latest stable release](https://docs.expo.dev/versions/latest/sdk/webbrowser/).
19
+ For [managed](https://docs.expo.dev/archive/managed-vs-bare/) Expo projects, please follow the installation instructions in the [API documentation for the latest stable release](https://docs.expo.dev/versions/latest/sdk/webbrowser/).
20
20
 
21
21
  # Installation in bare React Native projects
22
22
 
@@ -25,7 +25,7 @@ For bare React Native projects, you must ensure that you have [installed and con
25
25
  ### Add the package to your npm dependencies
26
26
 
27
27
  ```
28
- expo install expo-web-browser
28
+ npx expo install expo-web-browser
29
29
  ```
30
30
 
31
31
  ### Configure for iOS
@@ -3,7 +3,7 @@ apply plugin: 'kotlin-android'
3
3
  apply plugin: 'maven-publish'
4
4
 
5
5
  group = 'host.exp.exponent'
6
- version = '12.1.1'
6
+ version = '12.3.0'
7
7
 
8
8
 
9
9
  buildscript {
@@ -36,19 +36,11 @@ buildscript {
36
36
  }
37
37
  }
38
38
 
39
- // Creating sources with comments
40
- task androidSourcesJar(type: Jar) {
41
- classifier = 'sources'
42
- from android.sourceSets.main.java.srcDirs
43
- }
44
-
45
39
  afterEvaluate {
46
40
  publishing {
47
41
  publications {
48
42
  release(MavenPublication) {
49
43
  from components.release
50
- // Add additional sourcesJar to artifacts
51
- artifact(androidSourcesJar)
52
44
  }
53
45
  }
54
46
  repositories {
@@ -71,15 +63,21 @@ android {
71
63
  jvmTarget = JavaVersion.VERSION_11.majorVersion
72
64
  }
73
65
 
66
+ namespace "expo.modules.webbrowser"
74
67
  defaultConfig {
75
68
  minSdkVersion safeExtGet("minSdkVersion", 21)
76
69
  targetSdkVersion safeExtGet("targetSdkVersion", 33)
77
70
  versionCode 18
78
- versionName '12.1.1'
71
+ versionName '12.3.0'
79
72
  }
80
73
  lintOptions {
81
74
  abortOnError false
82
75
  }
76
+ publishing {
77
+ singleVariant("release") {
78
+ withSourcesJar()
79
+ }
80
+ }
83
81
  }
84
82
 
85
83
  dependencies {
@@ -93,5 +91,5 @@ dependencies {
93
91
  if (project.findProject(':expo-modules-test-core')) {
94
92
  testImplementation project(':expo-modules-test-core')
95
93
  }
96
- testImplementation "org.robolectric:robolectric:4.3.1"
94
+ testImplementation "org.robolectric:robolectric:4.10"
97
95
  }
@@ -1,6 +1,4 @@
1
- <manifest xmlns:android="http://schemas.android.com/apk/res/android"
2
- package="expo.modules.webbrowser">
3
-
1
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android">
4
2
  <queries>
5
3
  <intent>
6
4
  <!-- Required for opening tabs if targeting API 30 -->
@@ -11,18 +11,21 @@ final public class WebBrowserModule: Module {
11
11
  public func definition() -> ModuleDefinition {
12
12
  Name("ExpoWebBrowser")
13
13
 
14
- AsyncFunction("openBrowserAsync") { (url: URL, options: WebBrowserOptions, promise: Promise) throws in
15
- guard self.currentWebBrowserSession?.isOpen != true else {
14
+ AsyncFunction("openBrowserAsync") { (url: URL, options: WebBrowserOptions, promise: Promise) in
15
+ guard self.currentWebBrowserSession == nil else {
16
16
  throw WebBrowserAlreadyOpenException()
17
17
  }
18
- self.currentWebBrowserSession = WebBrowserSession(url: url, options: options)
19
- self.currentWebBrowserSession?.open(promise)
18
+ self.currentWebBrowserSession = WebBrowserSession(url: url, options: options) { [promise] type in
19
+ promise.resolve(["type": type])
20
+ self.currentWebBrowserSession = nil
21
+ }
22
+ self.currentWebBrowserSession?.open()
20
23
  }
21
24
  .runOnQueue(.main)
22
25
 
23
26
  AsyncFunction("dismissBrowser") {
24
- self.currentWebBrowserSession?.dismiss()
25
- self.currentWebBrowserSession = nil
27
+ currentWebBrowserSession?.dismiss()
28
+ currentWebBrowserSession = nil
26
29
  }
27
30
  .runOnQueue(.main)
28
31
 
@@ -5,12 +5,11 @@ import ExpoModulesCore
5
5
 
6
6
  internal class WebBrowserSession: NSObject, SFSafariViewControllerDelegate, UIAdaptivePresentationControllerDelegate {
7
7
  let viewController: SFSafariViewController
8
- var promise: Promise?
9
- var isOpen: Bool {
10
- promise != nil
11
- }
8
+ let onDismiss: (String) -> Void
9
+
10
+ init(url: URL, options: WebBrowserOptions, onDismiss: @escaping (String) -> Void) {
11
+ self.onDismiss = onDismiss
12
12
 
13
- init(url: URL, options: WebBrowserOptions) {
14
13
  let configuration = SFSafariViewController.Configuration()
15
14
  configuration.barCollapsingEnabled = options.enableBarCollapsing
16
15
  configuration.entersReaderIfAvailable = options.readerMode
@@ -26,14 +25,12 @@ internal class WebBrowserSession: NSObject, SFSafariViewControllerDelegate, UIAd
26
25
  viewController.presentationController?.delegate = self
27
26
  }
28
27
 
29
- func open(_ promise: Promise) {
28
+ func open() {
30
29
  var currentViewController = UIApplication.shared.keyWindow?.rootViewController
31
30
  while currentViewController?.presentedViewController != nil {
32
31
  currentViewController = currentViewController?.presentedViewController
33
32
  }
34
33
  currentViewController?.present(viewController, animated: true, completion: nil)
35
-
36
- self.promise = promise
37
34
  }
38
35
 
39
36
  func dismiss() {
@@ -57,7 +54,6 @@ internal class WebBrowserSession: NSObject, SFSafariViewControllerDelegate, UIAd
57
54
  // MARK: - Private
58
55
 
59
56
  private func finish(type: String) {
60
- promise?.resolve(["type": type])
61
- promise = nil
57
+ onDismiss(type)
62
58
  }
63
59
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-web-browser",
3
- "version": "12.1.1",
3
+ "version": "12.3.0",
4
4
  "description": "Provides access to the system's web browser and supports handling redirects. On iOS, it uses SFSafariViewController or SFAuthenticationSession, depending on the method you call, and on Android it uses ChromeCustomTabs. As of iOS 11, SFSafariViewController no longer shares cookies with Safari, so if you are using WebBrowser for authentication you will want to use WebBrowser.openAuthSessionAsync, and if you just want to open a webpage (such as your app privacy policy), then use WebBrowser.openBrowserAsync.",
5
5
  "main": "build/WebBrowser.js",
6
6
  "types": "build/WebBrowser.d.ts",
@@ -45,5 +45,5 @@
45
45
  "peerDependencies": {
46
46
  "expo": "*"
47
47
  },
48
- "gitHead": "1f8a6a09570fd451378565ca34933018ce48454e"
48
+ "gitHead": "fa5ecca8251986b9f197cc14074eec0ab6dfb6db"
49
49
  }