expo-web-browser 12.3.0 → 12.3.1

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,12 @@
10
10
 
11
11
  ### 💡 Others
12
12
 
13
+ ## 12.3.1 — 2023-06-27
14
+
15
+ ### 🐛 Bug fixes
16
+
17
+ - On `iOS`, fixed crash when opening an invalid URL in the web browser. ([#22986](https://github.com/expo/expo/pull/23084) by [@hirbod](https://github.com/hirbod))
18
+
13
19
  ## 12.3.0 — 2023-06-21
14
20
 
15
21
  ### 📚 3rd party library updates
@@ -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.3.0'
6
+ version = '12.3.1'
7
7
 
8
8
 
9
9
  buildscript {
@@ -68,7 +68,7 @@ android {
68
68
  minSdkVersion safeExtGet("minSdkVersion", 21)
69
69
  targetSdkVersion safeExtGet("targetSdkVersion", 33)
70
70
  versionCode 18
71
- versionName '12.3.0'
71
+ versionName '12.3.1'
72
72
  }
73
73
  lintOptions {
74
74
  abortOnError false
@@ -7,3 +7,9 @@ final class WebBrowserAlreadyOpenException: Exception {
7
7
  "Another web browser is already open"
8
8
  }
9
9
  }
10
+
11
+ final class WebBrowserInvalidURLException: Exception {
12
+ override var reason: String {
13
+ return "The provided URL is not valid."
14
+ }
15
+ }
@@ -8,6 +8,10 @@ final public class WebBrowserModule: Module {
8
8
  private var currentWebBrowserSession: WebBrowserSession?
9
9
  private var currentAuthSession: WebAuthSession?
10
10
 
11
+ private func isValid(url: URL) -> Bool {
12
+ return url.scheme == "http" || url.scheme == "https"
13
+ }
14
+
11
15
  public func definition() -> ModuleDefinition {
12
16
  Name("ExpoWebBrowser")
13
17
 
@@ -15,10 +19,16 @@ final public class WebBrowserModule: Module {
15
19
  guard self.currentWebBrowserSession == nil else {
16
20
  throw WebBrowserAlreadyOpenException()
17
21
  }
22
+
23
+ guard self.isValid(url: url) else {
24
+ throw WebBrowserInvalidURLException()
25
+ }
26
+
18
27
  self.currentWebBrowserSession = WebBrowserSession(url: url, options: options) { [promise] type in
19
28
  promise.resolve(["type": type])
20
29
  self.currentWebBrowserSession = nil
21
30
  }
31
+
22
32
  self.currentWebBrowserSession?.open()
23
33
  }
24
34
  .runOnQueue(.main)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-web-browser",
3
- "version": "12.3.0",
3
+ "version": "12.3.1",
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": "fa5ecca8251986b9f197cc14074eec0ab6dfb6db"
48
+ "gitHead": "aa6bda733cef821234c77a19bbe6008b72c1c594"
49
49
  }