expo-web-browser 15.0.8-canary-20250912-b5ce2a8 → 15.0.8-canary-20250930-9dc59d3

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.
Files changed (39) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/android/build.gradle +5 -5
  3. package/expo-module.config.json +1 -1
  4. package/local-maven-repo/host/exp/exponent/expo.modules.webbrowser/{15.0.8-canary-20250912-b5ce2a8/expo.modules.webbrowser-15.0.8-canary-20250912-b5ce2a8.module → 15.0.8-canary-20250930-9dc59d3/expo.modules.webbrowser-15.0.8-canary-20250930-9dc59d3.module} +14 -23
  5. package/local-maven-repo/host/exp/exponent/expo.modules.webbrowser/15.0.8-canary-20250930-9dc59d3/expo.modules.webbrowser-15.0.8-canary-20250930-9dc59d3.module.md5 +1 -0
  6. package/local-maven-repo/host/exp/exponent/expo.modules.webbrowser/15.0.8-canary-20250930-9dc59d3/expo.modules.webbrowser-15.0.8-canary-20250930-9dc59d3.module.sha1 +1 -0
  7. package/local-maven-repo/host/exp/exponent/expo.modules.webbrowser/15.0.8-canary-20250930-9dc59d3/expo.modules.webbrowser-15.0.8-canary-20250930-9dc59d3.module.sha256 +1 -0
  8. package/local-maven-repo/host/exp/exponent/expo.modules.webbrowser/15.0.8-canary-20250930-9dc59d3/expo.modules.webbrowser-15.0.8-canary-20250930-9dc59d3.module.sha512 +1 -0
  9. package/local-maven-repo/host/exp/exponent/expo.modules.webbrowser/{15.0.8-canary-20250912-b5ce2a8/expo.modules.webbrowser-15.0.8-canary-20250912-b5ce2a8.pom → 15.0.8-canary-20250930-9dc59d3/expo.modules.webbrowser-15.0.8-canary-20250930-9dc59d3.pom} +8 -8
  10. package/local-maven-repo/host/exp/exponent/expo.modules.webbrowser/15.0.8-canary-20250930-9dc59d3/expo.modules.webbrowser-15.0.8-canary-20250930-9dc59d3.pom.md5 +1 -0
  11. package/local-maven-repo/host/exp/exponent/expo.modules.webbrowser/15.0.8-canary-20250930-9dc59d3/expo.modules.webbrowser-15.0.8-canary-20250930-9dc59d3.pom.sha1 +1 -0
  12. package/local-maven-repo/host/exp/exponent/expo.modules.webbrowser/15.0.8-canary-20250930-9dc59d3/expo.modules.webbrowser-15.0.8-canary-20250930-9dc59d3.pom.sha256 +1 -0
  13. package/local-maven-repo/host/exp/exponent/expo.modules.webbrowser/15.0.8-canary-20250930-9dc59d3/expo.modules.webbrowser-15.0.8-canary-20250930-9dc59d3.pom.sha512 +1 -0
  14. package/local-maven-repo/host/exp/exponent/expo.modules.webbrowser/maven-metadata.xml +4 -4
  15. package/local-maven-repo/host/exp/exponent/expo.modules.webbrowser/maven-metadata.xml.md5 +1 -1
  16. package/local-maven-repo/host/exp/exponent/expo.modules.webbrowser/maven-metadata.xml.sha1 +1 -1
  17. package/local-maven-repo/host/exp/exponent/expo.modules.webbrowser/maven-metadata.xml.sha256 +1 -1
  18. package/local-maven-repo/host/exp/exponent/expo.modules.webbrowser/maven-metadata.xml.sha512 +1 -1
  19. package/package.json +3 -3
  20. package/plugin/build/withWebBrowserAndroid.js +15 -6
  21. package/plugin/src/withWebBrowserAndroid.ts +27 -13
  22. package/local-maven-repo/host/exp/exponent/expo.modules.webbrowser/15.0.8-canary-20250912-b5ce2a8/expo.modules.webbrowser-15.0.8-canary-20250912-b5ce2a8.module.md5 +0 -1
  23. package/local-maven-repo/host/exp/exponent/expo.modules.webbrowser/15.0.8-canary-20250912-b5ce2a8/expo.modules.webbrowser-15.0.8-canary-20250912-b5ce2a8.module.sha1 +0 -1
  24. package/local-maven-repo/host/exp/exponent/expo.modules.webbrowser/15.0.8-canary-20250912-b5ce2a8/expo.modules.webbrowser-15.0.8-canary-20250912-b5ce2a8.module.sha256 +0 -1
  25. package/local-maven-repo/host/exp/exponent/expo.modules.webbrowser/15.0.8-canary-20250912-b5ce2a8/expo.modules.webbrowser-15.0.8-canary-20250912-b5ce2a8.module.sha512 +0 -1
  26. package/local-maven-repo/host/exp/exponent/expo.modules.webbrowser/15.0.8-canary-20250912-b5ce2a8/expo.modules.webbrowser-15.0.8-canary-20250912-b5ce2a8.pom.md5 +0 -1
  27. package/local-maven-repo/host/exp/exponent/expo.modules.webbrowser/15.0.8-canary-20250912-b5ce2a8/expo.modules.webbrowser-15.0.8-canary-20250912-b5ce2a8.pom.sha1 +0 -1
  28. package/local-maven-repo/host/exp/exponent/expo.modules.webbrowser/15.0.8-canary-20250912-b5ce2a8/expo.modules.webbrowser-15.0.8-canary-20250912-b5ce2a8.pom.sha256 +0 -1
  29. package/local-maven-repo/host/exp/exponent/expo.modules.webbrowser/15.0.8-canary-20250912-b5ce2a8/expo.modules.webbrowser-15.0.8-canary-20250912-b5ce2a8.pom.sha512 +0 -1
  30. /package/local-maven-repo/host/exp/exponent/expo.modules.webbrowser/{15.0.8-canary-20250912-b5ce2a8/expo.modules.webbrowser-15.0.8-canary-20250912-b5ce2a8-sources.jar → 15.0.8-canary-20250930-9dc59d3/expo.modules.webbrowser-15.0.8-canary-20250930-9dc59d3-sources.jar} +0 -0
  31. /package/local-maven-repo/host/exp/exponent/expo.modules.webbrowser/{15.0.8-canary-20250912-b5ce2a8/expo.modules.webbrowser-15.0.8-canary-20250912-b5ce2a8-sources.jar.md5 → 15.0.8-canary-20250930-9dc59d3/expo.modules.webbrowser-15.0.8-canary-20250930-9dc59d3-sources.jar.md5} +0 -0
  32. /package/local-maven-repo/host/exp/exponent/expo.modules.webbrowser/{15.0.8-canary-20250912-b5ce2a8/expo.modules.webbrowser-15.0.8-canary-20250912-b5ce2a8-sources.jar.sha1 → 15.0.8-canary-20250930-9dc59d3/expo.modules.webbrowser-15.0.8-canary-20250930-9dc59d3-sources.jar.sha1} +0 -0
  33. /package/local-maven-repo/host/exp/exponent/expo.modules.webbrowser/{15.0.8-canary-20250912-b5ce2a8/expo.modules.webbrowser-15.0.8-canary-20250912-b5ce2a8-sources.jar.sha256 → 15.0.8-canary-20250930-9dc59d3/expo.modules.webbrowser-15.0.8-canary-20250930-9dc59d3-sources.jar.sha256} +0 -0
  34. /package/local-maven-repo/host/exp/exponent/expo.modules.webbrowser/{15.0.8-canary-20250912-b5ce2a8/expo.modules.webbrowser-15.0.8-canary-20250912-b5ce2a8-sources.jar.sha512 → 15.0.8-canary-20250930-9dc59d3/expo.modules.webbrowser-15.0.8-canary-20250930-9dc59d3-sources.jar.sha512} +0 -0
  35. /package/local-maven-repo/host/exp/exponent/expo.modules.webbrowser/{15.0.8-canary-20250912-b5ce2a8/expo.modules.webbrowser-15.0.8-canary-20250912-b5ce2a8.aar → 15.0.8-canary-20250930-9dc59d3/expo.modules.webbrowser-15.0.8-canary-20250930-9dc59d3.aar} +0 -0
  36. /package/local-maven-repo/host/exp/exponent/expo.modules.webbrowser/{15.0.8-canary-20250912-b5ce2a8/expo.modules.webbrowser-15.0.8-canary-20250912-b5ce2a8.aar.md5 → 15.0.8-canary-20250930-9dc59d3/expo.modules.webbrowser-15.0.8-canary-20250930-9dc59d3.aar.md5} +0 -0
  37. /package/local-maven-repo/host/exp/exponent/expo.modules.webbrowser/{15.0.8-canary-20250912-b5ce2a8/expo.modules.webbrowser-15.0.8-canary-20250912-b5ce2a8.aar.sha1 → 15.0.8-canary-20250930-9dc59d3/expo.modules.webbrowser-15.0.8-canary-20250930-9dc59d3.aar.sha1} +0 -0
  38. /package/local-maven-repo/host/exp/exponent/expo.modules.webbrowser/{15.0.8-canary-20250912-b5ce2a8/expo.modules.webbrowser-15.0.8-canary-20250912-b5ce2a8.aar.sha256 → 15.0.8-canary-20250930-9dc59d3/expo.modules.webbrowser-15.0.8-canary-20250930-9dc59d3.aar.sha256} +0 -0
  39. /package/local-maven-repo/host/exp/exponent/expo.modules.webbrowser/{15.0.8-canary-20250912-b5ce2a8/expo.modules.webbrowser-15.0.8-canary-20250912-b5ce2a8.aar.sha512 → 15.0.8-canary-20250930-9dc59d3/expo.modules.webbrowser-15.0.8-canary-20250930-9dc59d3.aar.sha512} +0 -0
package/CHANGELOG.md CHANGED
@@ -8,6 +8,8 @@
8
8
 
9
9
  ### 🐛 Bug fixes
10
10
 
11
+ - [Android] Fix multiple runs of prebuild repeateadly adding generated code. ([#39702](https://github.com/expo/expo/pull/39702) by [@alanjhughes](https://github.com/alanjhughes))
12
+
11
13
  ### 💡 Others
12
14
 
13
15
  ## 15.0.7 — 2025-09-11
@@ -4,23 +4,23 @@ plugins {
4
4
  }
5
5
 
6
6
  group = 'host.exp.exponent'
7
- version = '15.0.8-canary-20250912-b5ce2a8'
7
+ version = '15.0.8-canary-20250930-9dc59d3'
8
8
 
9
9
  android {
10
10
  namespace "expo.modules.webbrowser"
11
11
  defaultConfig {
12
12
  versionCode 18
13
- versionName '15.0.8-canary-20250912-b5ce2a8'
13
+ versionName '15.0.8-canary-20250930-9dc59d3'
14
14
  }
15
15
  }
16
16
 
17
17
  dependencies {
18
- api "androidx.browser:browser:1.6.0"
18
+ implementation "androidx.browser:browser:1.6.0"
19
19
 
20
- implementation "androidx.core:core-ktx:1.13.1"
20
+ implementation "androidx.core:core-ktx:1.17.0"
21
21
 
22
22
  if (project.findProject(':expo-modules-test-core')) {
23
23
  testImplementation project(':expo-modules-test-core')
24
24
  }
25
- testImplementation "org.robolectric:robolectric:4.11.1"
25
+ testImplementation "org.robolectric:robolectric:4.16"
26
26
  }
@@ -8,7 +8,7 @@
8
8
  "publication": {
9
9
  "groupId": "host.exp.exponent",
10
10
  "artifactId": "expo.modules.webbrowser",
11
- "version": "15.0.8-canary-20250912-b5ce2a8",
11
+ "version": "15.0.8-canary-20250930-9dc59d3",
12
12
  "repository": "local-maven-repo"
13
13
  }
14
14
  }
@@ -3,14 +3,14 @@
3
3
  "component": {
4
4
  "group": "host.exp.exponent",
5
5
  "module": "expo.modules.webbrowser",
6
- "version": "15.0.8-canary-20250912-b5ce2a8",
6
+ "version": "15.0.8-canary-20250930-9dc59d3",
7
7
  "attributes": {
8
8
  "org.gradle.status": "release"
9
9
  }
10
10
  },
11
11
  "createdBy": {
12
12
  "gradle": {
13
- "version": "8.14.3"
13
+ "version": "9.0.0"
14
14
  }
15
15
  },
16
16
  "variants": [
@@ -22,19 +22,10 @@
22
22
  "org.gradle.libraryelements": "aar",
23
23
  "org.gradle.usage": "java-api"
24
24
  },
25
- "dependencies": [
26
- {
27
- "group": "androidx.browser",
28
- "module": "browser",
29
- "version": {
30
- "requires": "1.6.0"
31
- }
32
- }
33
- ],
34
25
  "files": [
35
26
  {
36
- "name": "expo.modules.webbrowser-15.0.8-canary-20250912-b5ce2a8.aar",
37
- "url": "expo.modules.webbrowser-15.0.8-canary-20250912-b5ce2a8.aar",
27
+ "name": "expo.modules.webbrowser-15.0.8-canary-20250930-9dc59d3.aar",
28
+ "url": "expo.modules.webbrowser-15.0.8-canary-20250930-9dc59d3.aar",
38
29
  "size": 41740,
39
30
  "sha512": "ab014a3a7bae9a8a22771127e357b6d926199a4d78aedd09b8f73fe9be1923d502721444ff78eec26e53d22e8f3717a39a1ae4006698c8ba285f425ec638dddf",
40
31
  "sha256": "dcf177bf57c9ad585839cdc30851b94effd29d149fda0340ead1766b4f9673d7",
@@ -60,24 +51,24 @@
60
51
  }
61
52
  },
62
53
  {
63
- "group": "androidx.core",
64
- "module": "core-ktx",
54
+ "group": "androidx.browser",
55
+ "module": "browser",
65
56
  "version": {
66
- "requires": "1.13.1"
57
+ "requires": "1.6.0"
67
58
  }
68
59
  },
69
60
  {
70
- "group": "androidx.browser",
71
- "module": "browser",
61
+ "group": "androidx.core",
62
+ "module": "core-ktx",
72
63
  "version": {
73
- "requires": "1.6.0"
64
+ "requires": "1.17.0"
74
65
  }
75
66
  }
76
67
  ],
77
68
  "files": [
78
69
  {
79
- "name": "expo.modules.webbrowser-15.0.8-canary-20250912-b5ce2a8.aar",
80
- "url": "expo.modules.webbrowser-15.0.8-canary-20250912-b5ce2a8.aar",
70
+ "name": "expo.modules.webbrowser-15.0.8-canary-20250930-9dc59d3.aar",
71
+ "url": "expo.modules.webbrowser-15.0.8-canary-20250930-9dc59d3.aar",
81
72
  "size": 41740,
82
73
  "sha512": "ab014a3a7bae9a8a22771127e357b6d926199a4d78aedd09b8f73fe9be1923d502721444ff78eec26e53d22e8f3717a39a1ae4006698c8ba285f425ec638dddf",
83
74
  "sha256": "dcf177bf57c9ad585839cdc30851b94effd29d149fda0340ead1766b4f9673d7",
@@ -96,8 +87,8 @@
96
87
  },
97
88
  "files": [
98
89
  {
99
- "name": "expo.modules.webbrowser-15.0.8-canary-20250912-b5ce2a8-sources.jar",
100
- "url": "expo.modules.webbrowser-15.0.8-canary-20250912-b5ce2a8-sources.jar",
90
+ "name": "expo.modules.webbrowser-15.0.8-canary-20250930-9dc59d3-sources.jar",
91
+ "url": "expo.modules.webbrowser-15.0.8-canary-20250930-9dc59d3-sources.jar",
101
92
  "size": 6291,
102
93
  "sha512": "cb205a40f7a6a699303dfb8283471b9c20b8f9a98e3f3be3a386b19e2cc71a6742f11900988303751b03ec3c936c489e41062404023fef8c9a5d93664ae2bc0b",
103
94
  "sha256": "226ce0c4b274d09771d41e3e1fb1fee44cebb87a5c8c5304ca799f6889be9e50",
@@ -0,0 +1 @@
1
+ dc066abc480d095188e54b2e8a83652258cb44ae0de05d71f7d8727b3508f6f5f88a62ab5b0fb862ce44a93580cf3872dc6d0e9d320b0c780bd052a106a9e4b2
@@ -9,7 +9,7 @@
9
9
  <modelVersion>4.0.0</modelVersion>
10
10
  <groupId>host.exp.exponent</groupId>
11
11
  <artifactId>expo.modules.webbrowser</artifactId>
12
- <version>15.0.8-canary-20250912-b5ce2a8</version>
12
+ <version>15.0.8-canary-20250930-9dc59d3</version>
13
13
  <packaging>aar</packaging>
14
14
  <name>expo.modules.webbrowser</name>
15
15
  <url>https://github.com/expo/expo</url>
@@ -25,22 +25,22 @@
25
25
  <url>https://github.com/expo/expo</url>
26
26
  </scm>
27
27
  <dependencies>
28
- <dependency>
29
- <groupId>androidx.browser</groupId>
30
- <artifactId>browser</artifactId>
31
- <version>1.6.0</version>
32
- <scope>compile</scope>
33
- </dependency>
34
28
  <dependency>
35
29
  <groupId>org.jetbrains.kotlin</groupId>
36
30
  <artifactId>kotlin-stdlib-jdk7</artifactId>
37
31
  <version>2.1.20</version>
38
32
  <scope>runtime</scope>
39
33
  </dependency>
34
+ <dependency>
35
+ <groupId>androidx.browser</groupId>
36
+ <artifactId>browser</artifactId>
37
+ <version>1.6.0</version>
38
+ <scope>runtime</scope>
39
+ </dependency>
40
40
  <dependency>
41
41
  <groupId>androidx.core</groupId>
42
42
  <artifactId>core-ktx</artifactId>
43
- <version>1.13.1</version>
43
+ <version>1.17.0</version>
44
44
  <scope>runtime</scope>
45
45
  </dependency>
46
46
  </dependencies>
@@ -0,0 +1 @@
1
+ 0699d6a309975b53fc3e267cf2c86f238f887ec6c47f7055591dcc2a5ed3f1ba2f068d6e01a3a98c19370b18398fa55f17ab3e728e0c140eac67200d2e191987
@@ -3,11 +3,11 @@
3
3
  <groupId>host.exp.exponent</groupId>
4
4
  <artifactId>expo.modules.webbrowser</artifactId>
5
5
  <versioning>
6
- <latest>15.0.8-canary-20250912-b5ce2a8</latest>
7
- <release>15.0.8-canary-20250912-b5ce2a8</release>
6
+ <latest>15.0.8-canary-20250930-9dc59d3</latest>
7
+ <release>15.0.8-canary-20250930-9dc59d3</release>
8
8
  <versions>
9
- <version>15.0.8-canary-20250912-b5ce2a8</version>
9
+ <version>15.0.8-canary-20250930-9dc59d3</version>
10
10
  </versions>
11
- <lastUpdated>20250912124604</lastUpdated>
11
+ <lastUpdated>20250930162411</lastUpdated>
12
12
  </versioning>
13
13
  </metadata>
@@ -1 +1 @@
1
- 42d6a4cacac11c51ec25ff64cfb05f65
1
+ 918923cdd686fb46b8cca78d1c7c48e5
@@ -1 +1 @@
1
- 0803dd425376385a33bd70b13dd54aee80f3ced8
1
+ dd34121af11344cde690e3f6d00b8ed3219219f4
@@ -1 +1 @@
1
- 2789df4941d3a7ec5d33ab1431cc5f9f50d9687850b757dcdac66cfb48ac425a
1
+ 3cbf2e9fe2124e49d4156ec14e349177e2cec546ac0da5ca71d1da134054514b
@@ -1 +1 @@
1
- a8e3b35aebebba71d93426ba1bc08f941fe9bf253f5b1979fd26caf8f1419f6a8ae958edc69f3244d11d92f63c4e45605b5f53b1270b641272d2b518a14689a4
1
+ b3d3edbfd22c274fbcbf08cfabf16a13045e174dc4aa3c9faacda36ba786e8030712051b994462ff3c9fd60e10f7fe5fe2a24cb93153447ab2bf96d54b089f01
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-web-browser",
3
- "version": "15.0.8-canary-20250912-b5ce2a8",
3
+ "version": "15.0.8-canary-20250930-9dc59d3",
4
4
  "description": "Provides access to the system's web browser and supports handling redirects. On iOS, it uses SFSafariViewController or ASWebAuthenticationSession, 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",
@@ -36,10 +36,10 @@
36
36
  "preset": "expo-module-scripts"
37
37
  },
38
38
  "devDependencies": {
39
- "expo-module-scripts": "5.0.8-canary-20250912-b5ce2a8"
39
+ "expo-module-scripts": "5.0.8-canary-20250930-9dc59d3"
40
40
  },
41
41
  "peerDependencies": {
42
- "expo": "55.0.0-canary-20250912-b5ce2a8",
42
+ "expo": "55.0.0-canary-20250930-9dc59d3",
43
43
  "react-native": "*"
44
44
  }
45
45
  }
@@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.withWebBrowserAndroid = void 0;
7
7
  const config_plugins_1 = require("expo/config-plugins");
8
- const promises_1 = __importDefault(require("fs/promises"));
8
+ const fs_1 = __importDefault(require("fs"));
9
9
  const path_1 = __importDefault(require("path"));
10
10
  const utils_1 = require("./utils");
11
11
  const withWebBrowserAndroid = (config) => {
@@ -48,6 +48,11 @@ function addLauncherClassToProject(config) {
48
48
  'android',
49
49
  async (config) => {
50
50
  const fileName = 'BrowserLauncherActivity.kt';
51
+ const dir = path_1.default.dirname(config_plugins_1.AndroidConfig.Paths.getProjectFilePath(config.modRequest.projectRoot, 'MainApplication'));
52
+ const fullPath = path_1.default.join(dir, fileName);
53
+ if (fs_1.default.existsSync(fullPath)) {
54
+ return config;
55
+ }
51
56
  const classTemplate = `package ${config.android?.package || ''};
52
57
 
53
58
  import android.app.Activity
@@ -66,9 +71,7 @@ class BrowserLauncherActivity : Activity() {
66
71
  }
67
72
  }
68
73
  `;
69
- const dir = path_1.default.dirname(config_plugins_1.AndroidConfig.Paths.getProjectFilePath(config.modRequest.projectRoot, 'MainApplication'));
70
- const fullPath = path_1.default.join(dir, fileName);
71
- await promises_1.default.writeFile(fullPath, classTemplate);
74
+ await fs_1.default.promises.writeFile(fullPath, classTemplate);
72
75
  return config;
73
76
  },
74
77
  ]);
@@ -77,8 +80,11 @@ function modifyMainApplication(config) {
77
80
  return (0, config_plugins_1.withMainApplication)(config, (config) => {
78
81
  const mainApplication = config.modResults;
79
82
  const importsMod = (0, utils_1.addImports)(mainApplication.contents, ['android.app.Activity', 'android.os.Bundle'], false);
80
- const onCreateMod = (0, utils_1.appendContentsInsideDeclarationBlock)(importsMod, 'onCreate', ' registerActivityLifecycleCallbacks(lifecycleCallbacks)');
81
- const result = addMainApplicationMod(onCreateMod);
83
+ let contents = importsMod;
84
+ if (!mainApplication.contents.includes('registerActivityLifecycleCallbacks(lifecycleCallbacks)')) {
85
+ contents = (0, utils_1.appendContentsInsideDeclarationBlock)(importsMod, 'onCreate', 'registerActivityLifecycleCallbacks(lifecycleCallbacks)');
86
+ }
87
+ const result = addMainApplicationMod(contents);
82
88
  return {
83
89
  ...config,
84
90
  modResults: {
@@ -89,6 +95,9 @@ function modifyMainApplication(config) {
89
95
  });
90
96
  }
91
97
  function addMainApplicationMod(contents) {
98
+ if (contents.includes('private val runningActivities = ArrayList<Class<*>>()')) {
99
+ return contents;
100
+ }
92
101
  const codeMod = `
93
102
  private val runningActivities = ArrayList<Class<*>>()
94
103
 
@@ -7,7 +7,7 @@ import {
7
7
  withDangerousMod,
8
8
  withMainApplication,
9
9
  } from 'expo/config-plugins';
10
- import fs from 'fs/promises';
10
+ import fs from 'fs';
11
11
  import path from 'path';
12
12
 
13
13
  import { appendContentsInsideDeclarationBlock, addImports } from './utils';
@@ -62,6 +62,16 @@ function addLauncherClassToProject(config: ExpoConfig) {
62
62
  'android',
63
63
  async (config) => {
64
64
  const fileName = 'BrowserLauncherActivity.kt';
65
+ const dir = path.dirname(
66
+ AndroidConfig.Paths.getProjectFilePath(config.modRequest.projectRoot, 'MainApplication')
67
+ );
68
+
69
+ const fullPath = path.join(dir, fileName);
70
+
71
+ if (fs.existsSync(fullPath)) {
72
+ return config;
73
+ }
74
+
65
75
  const classTemplate = `package ${config.android?.package || ''};
66
76
 
67
77
  import android.app.Activity
@@ -81,12 +91,7 @@ class BrowserLauncherActivity : Activity() {
81
91
  }
82
92
  `;
83
93
 
84
- const dir = path.dirname(
85
- AndroidConfig.Paths.getProjectFilePath(config.modRequest.projectRoot, 'MainApplication')
86
- );
87
-
88
- const fullPath = path.join(dir, fileName);
89
- await fs.writeFile(fullPath, classTemplate);
94
+ await fs.promises.writeFile(fullPath, classTemplate);
90
95
  return config;
91
96
  },
92
97
  ]);
@@ -102,13 +107,18 @@ function modifyMainApplication(config: ExpoConfig) {
102
107
  false
103
108
  );
104
109
 
105
- const onCreateMod = appendContentsInsideDeclarationBlock(
106
- importsMod,
107
- 'onCreate',
108
- ' registerActivityLifecycleCallbacks(lifecycleCallbacks)'
109
- );
110
+ let contents = importsMod;
111
+ if (
112
+ !mainApplication.contents.includes('registerActivityLifecycleCallbacks(lifecycleCallbacks)')
113
+ ) {
114
+ contents = appendContentsInsideDeclarationBlock(
115
+ importsMod,
116
+ 'onCreate',
117
+ 'registerActivityLifecycleCallbacks(lifecycleCallbacks)'
118
+ );
119
+ }
110
120
 
111
- const result = addMainApplicationMod(onCreateMod);
121
+ const result = addMainApplicationMod(contents);
112
122
 
113
123
  return {
114
124
  ...config,
@@ -121,6 +131,10 @@ function modifyMainApplication(config: ExpoConfig) {
121
131
  }
122
132
 
123
133
  function addMainApplicationMod(contents: string) {
134
+ if (contents.includes('private val runningActivities = ArrayList<Class<*>>()')) {
135
+ return contents;
136
+ }
137
+
124
138
  const codeMod = `
125
139
  private val runningActivities = ArrayList<Class<*>>()
126
140
 
@@ -1 +0,0 @@
1
- 85ab711ad93c7586e7230737d46bcea7d10d96b4d2ba9552b8a10f156947996cfdb4f9fb4d659e04789b272651127db642a0e4352f172a6ff2b938460cd7f53b
@@ -1 +0,0 @@
1
- 01d6aa91175577acb965b8fb916ac7f283201ce02e86494e2d1b91b87f29cb7efea26289d83f6c37cbeac09715a3c34b593e56d64ed8c286ca95afa9ee19707e