@bubblewrap/core 1.13.6

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 (84) hide show
  1. package/LICENSE +203 -0
  2. package/README.md +63 -0
  3. package/dist/index.d.ts +17 -0
  4. package/dist/index.js +56 -0
  5. package/dist/lib/BufferedLog.d.ts +20 -0
  6. package/dist/lib/BufferedLog.js +83 -0
  7. package/dist/lib/Config.d.ts +9 -0
  8. package/dist/lib/Config.js +50 -0
  9. package/dist/lib/DigitalAssetLinks.d.ts +3 -0
  10. package/dist/lib/DigitalAssetLinks.js +37 -0
  11. package/dist/lib/FetchUtils.d.ts +17 -0
  12. package/dist/lib/FetchUtils.js +79 -0
  13. package/dist/lib/GooglePlay.d.ts +41 -0
  14. package/dist/lib/GooglePlay.js +92 -0
  15. package/dist/lib/GradleWrapper.d.ts +31 -0
  16. package/dist/lib/GradleWrapper.js +62 -0
  17. package/dist/lib/ImageHelper.d.ts +37 -0
  18. package/dist/lib/ImageHelper.js +112 -0
  19. package/dist/lib/Log.d.ts +88 -0
  20. package/dist/lib/Log.js +114 -0
  21. package/dist/lib/Result.d.ts +46 -0
  22. package/dist/lib/Result.js +97 -0
  23. package/dist/lib/ShortcutInfo.d.ts +32 -0
  24. package/dist/lib/ShortcutInfo.js +84 -0
  25. package/dist/lib/TwaGenerator.d.ts +39 -0
  26. package/dist/lib/TwaGenerator.js +362 -0
  27. package/dist/lib/TwaManifest.d.ts +234 -0
  28. package/dist/lib/TwaManifest.js +384 -0
  29. package/dist/lib/androidSdk/AndroidSdkTools.d.ts +87 -0
  30. package/dist/lib/androidSdk/AndroidSdkTools.js +226 -0
  31. package/dist/lib/errors/ValidatePathError.d.ts +9 -0
  32. package/dist/lib/errors/ValidatePathError.js +16 -0
  33. package/dist/lib/features/AppsFlyerFeature.d.ts +8 -0
  34. package/dist/lib/features/AppsFlyerFeature.js +70 -0
  35. package/dist/lib/features/EmptyFeature.d.ts +28 -0
  36. package/dist/lib/features/EmptyFeature.js +44 -0
  37. package/dist/lib/features/Feature.d.ts +120 -0
  38. package/dist/lib/features/Feature.js +17 -0
  39. package/dist/lib/features/FeatureManager.d.ts +36 -0
  40. package/dist/lib/features/FeatureManager.js +137 -0
  41. package/dist/lib/features/FirstRunFlagFeature.d.ts +8 -0
  42. package/dist/lib/features/FirstRunFlagFeature.js +43 -0
  43. package/dist/lib/features/LocationDelegationFeature.d.ts +7 -0
  44. package/dist/lib/features/LocationDelegationFeature.js +32 -0
  45. package/dist/lib/features/PlayBillingFeature.d.ts +7 -0
  46. package/dist/lib/features/PlayBillingFeature.js +53 -0
  47. package/dist/lib/jdk/JarSigner.d.ts +13 -0
  48. package/dist/lib/jdk/JarSigner.js +55 -0
  49. package/dist/lib/jdk/JdkHelper.d.ts +55 -0
  50. package/dist/lib/jdk/JdkHelper.js +127 -0
  51. package/dist/lib/jdk/KeyTool.d.ts +57 -0
  52. package/dist/lib/jdk/KeyTool.js +136 -0
  53. package/dist/lib/mock/MockLog.d.ts +37 -0
  54. package/dist/lib/mock/MockLog.js +70 -0
  55. package/dist/lib/types/WebManifest.d.ts +44 -0
  56. package/dist/lib/types/WebManifest.js +17 -0
  57. package/dist/lib/util.d.ts +82 -0
  58. package/dist/lib/util.js +279 -0
  59. package/dist/lib/wrappers/svg2img.d.ts +14 -0
  60. package/dist/lib/wrappers/svg2img.js +39 -0
  61. package/package.json +58 -0
  62. package/template_project/app/.gitignore +1 -0
  63. package/template_project/app/build.gradle +211 -0
  64. package/template_project/app/src/main/AndroidManifest.xml +204 -0
  65. package/template_project/app/src/main/java/Application.java +35 -0
  66. package/template_project/app/src/main/java/DelegationService.java +18 -0
  67. package/template_project/app/src/main/java/LauncherActivity.java +62 -0
  68. package/template_project/app/src/main/res/drawable-anydpi/shortcut_legacy_background.xml +25 -0
  69. package/template_project/app/src/main/res/drawable-anydpi/shortcut_monochrome.xml +27 -0
  70. package/template_project/app/src/main/res/drawable-anydpi-v26/shortcut_maskable.xml +32 -0
  71. package/template_project/app/src/main/res/drawable-anydpi-v26/shortcut_monochrome.xml +26 -0
  72. package/template_project/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml +33 -0
  73. package/template_project/app/src/main/res/values/colors.xml +18 -0
  74. package/template_project/app/src/main/res/values/strings.xml +50 -0
  75. package/template_project/app/src/main/res/xml/filepaths.xml +18 -0
  76. package/template_project/app/src/main/res/xml/shortcuts.xml +16 -0
  77. package/template_project/build.gradle +42 -0
  78. package/template_project/enable-debug.sh +27 -0
  79. package/template_project/gradle/wrapper/gradle-wrapper.jar +0 -0
  80. package/template_project/gradle/wrapper/gradle-wrapper.properties +5 -0
  81. package/template_project/gradle.properties +14 -0
  82. package/template_project/gradlew +188 -0
  83. package/template_project/gradlew.bat +100 -0
  84. package/template_project/settings.gradle +1 -0
@@ -0,0 +1,35 @@
1
+ /*
2
+ * Copyright 2020 Google Inc.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ package <%= packageId %>;
17
+
18
+ <% for(const imp of applicationClass.imports) { %>
19
+ import <%= imp %>;
20
+ <% } %>
21
+
22
+ public class Application extends android.app.Application {
23
+
24
+ <% for(const variable of applicationClass.variables) { %>
25
+ <%= variable %>
26
+ <% } %>
27
+
28
+ @Override
29
+ public void onCreate() {
30
+ super.onCreate();
31
+ <% for(const code of applicationClass.onCreate) { %>
32
+ <%= code %>
33
+ <% } %>
34
+ }
35
+ }
@@ -0,0 +1,18 @@
1
+ package <%= packageId %>;
2
+
3
+ <% for(const imp of delegationService.imports) { %>
4
+ import <%= imp %>;
5
+ <% } %>
6
+
7
+ public class DelegationService extends
8
+ com.google.androidbrowserhelper.trusted.DelegationService {
9
+ @Override
10
+ public void onCreate() {
11
+ super.onCreate();
12
+
13
+ <% for(const code of delegationService.onCreate) { %>
14
+ <%= code %>
15
+ <% } %>
16
+ }
17
+ }
18
+
@@ -0,0 +1,62 @@
1
+ /*
2
+ * Copyright 2020 Google Inc.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ package <%= packageId %>;
17
+
18
+ import android.content.pm.ActivityInfo;
19
+ import android.net.Uri;
20
+ import android.os.Build;
21
+ import android.os.Bundle;
22
+
23
+ <% for(const imp of launcherActivity.imports) { %>
24
+ import <%= imp %>;
25
+ <% } %>
26
+
27
+ public class LauncherActivity
28
+ extends com.google.androidbrowserhelper.trusted.LauncherActivity {
29
+ <% for(const variable of launcherActivity.variables) { %>
30
+ <%= variable %>
31
+ <% } %>
32
+
33
+ <% for(const method of launcherActivity.methods) { %>
34
+ <%= method %>
35
+ <% } %>
36
+
37
+ @Override
38
+ protected void onCreate(Bundle savedInstanceState) {
39
+ super.onCreate(savedInstanceState);
40
+ // Setting an orientation crashes the app due to the transparent background on Android 8.0
41
+ // Oreo and below. We only set the orientation on Oreo and above. This only affects the
42
+ // splash screen and Chrome will still respect the orientation.
43
+ // See https://github.com/GoogleChromeLabs/bubblewrap/issues/496 for details.
44
+ if (Build.VERSION.SDK_INT > Build.VERSION_CODES.O) {
45
+ setRequestedOrientation(<%= toAndroidScreenOrientation(orientation) %>);
46
+ } else {
47
+ setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
48
+ }
49
+ }
50
+
51
+ @Override
52
+ protected Uri getLaunchingUrl() {
53
+ // Get the original launch Url.
54
+ Uri uri = super.getLaunchingUrl();
55
+
56
+ <% for(const code of launcherActivity.launchUrl) { %>
57
+ <%= code %>
58
+ <% } %>
59
+
60
+ return uri;
61
+ }
62
+ }
@@ -0,0 +1,25 @@
1
+ <!--
2
+ Copyright 2020 Google Inc. All Rights Reserved.
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+ -->
16
+ <inset xmlns:android="http://schemas.android.com/apk/res/android"
17
+ xmlns:aapt="http://schemas.android.com/aapt"
18
+ android:inset="2dp">
19
+ <aapt:attr name="android:drawable">
20
+ <shape android:shape="oval">
21
+ <solid android:color="@color/shortcut_background" />
22
+ <size android:width="44dp" android:height="44dp" />
23
+ </shape>
24
+ </aapt:attr>
25
+ </inset>
@@ -0,0 +1,27 @@
1
+ <!--
2
+ Copyright 2020 Google Inc. All Rights Reserved.
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+ -->
16
+ <layer-list xmlns:android="http://schemas.android.com/apk/res/android">
17
+ <item android:drawable="@drawable/shortcut_legacy_background" />
18
+ <!--
19
+ 12dp padding on each side of 48dp asset to
20
+ create a 24dp box for the icon.
21
+ -->
22
+ <item android:drawable="@drawable/<%= monochromeAssetName %>"
23
+ android:top="12dp"
24
+ android:right="12dp"
25
+ android:left="12dp"
26
+ android:bottom="12dp" />
27
+ </layer-list>
@@ -0,0 +1,32 @@
1
+ <!--
2
+ Copyright 2020 Google Inc. All Rights Reserved.
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+ -->
16
+ <adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
17
+ <background>
18
+ <layer-list>
19
+ <item android:drawable="@color/shortcut_background" />
20
+ <!--
21
+ The paddings below give the icons a similar proportion as the
22
+ icon generated by WebAPKs.
23
+ -->
24
+ <item android:drawable="@drawable/<%= maskableAssetName %>"
25
+ android:top="8.5dp"
26
+ android:right="8.5dp"
27
+ android:left="8.5dp"
28
+ android:bottom="8.5dp" />
29
+ </layer-list>
30
+ </background>
31
+ <foreground android:drawable="@android:color/transparent" />
32
+ </adaptive-icon>
@@ -0,0 +1,26 @@
1
+ <!--
2
+ Copyright 2020 Google Inc. All Rights Reserved.
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+ -->
16
+ <adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
17
+ <background android:drawable="@color/shortcut_background" />
18
+ <foreground>
19
+ <!--
20
+ 32dp padding on each side of 108dp asset to
21
+ create a 44dp box for the icon.
22
+ -->
23
+ <inset android:drawable="@drawable/<%= monochromeAssetName %>"
24
+ android:inset="32dp" />
25
+ </foreground>
26
+ </adaptive-icon>
@@ -0,0 +1,33 @@
1
+ <!--
2
+ Copyright 2019 Google Inc. All Rights Reserved.
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+ -->
16
+ <adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android"
17
+ xmlns:aapt="http://schemas.android.com/aapt">
18
+ <background>
19
+ <layer-list>
20
+ <item android:drawable="@android:color/white" />
21
+ <!--
22
+ The paddings below give the icons a similar proportion as the
23
+ icon generated by WebAPKs.
24
+ -->
25
+ <item android:drawable="@mipmap/ic_maskable"
26
+ android:top="8.5dp"
27
+ android:right="8.5dp"
28
+ android:left="8.5dp"
29
+ android:bottom="8.5dp" />
30
+ </layer-list>
31
+ </background>
32
+ <foreground android:drawable="@android:color/transparent" />
33
+ </adaptive-icon>
@@ -0,0 +1,18 @@
1
+ <!--
2
+ Copyright 2020 Google Inc. All Rights Reserved.
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+ -->
16
+ <resources>
17
+ <color name="shortcut_background">#F5F5F5</color>
18
+ </resources>
@@ -0,0 +1,50 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!--
3
+ Copyright 2021 Google Inc. All Rights Reserved.
4
+
5
+ Licensed under the Apache License, Version 2.0 (the "License");
6
+ you may not use this file except in compliance with the License.
7
+ You may obtain a copy of the License at
8
+
9
+ http://www.apache.org/licenses/LICENSE-2.0
10
+
11
+ Unless required by applicable law or agreed to in writing, software
12
+ distributed under the License is distributed on an "AS IS" BASIS,
13
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ See the License for the specific language governing permissions and
15
+ limitations under the License.
16
+ -->
17
+ <resources>
18
+ <% if (additionalTrustedOrigins.length > 0) { %>
19
+ <string-array name="additional_trusted_origins">
20
+ <% for (const additionalOrigin of additionalTrustedOrigins) { %>
21
+ <item>https://<%= additionalOrigin %></item>
22
+ <% } %>
23
+ </string-array>
24
+ <% } %>
25
+
26
+ <!--
27
+ This variable below expresses the relationship between the app and the site,
28
+ as documented in the TWA documentation at
29
+ https://developers.google.com/web/updates/2017/10/using-twa#set_up_digital_asset_links_in_an_android_app
30
+ and is injected into the AndroidManifest.xml
31
+ -->
32
+ <string name="assetStatements">
33
+ [{
34
+ \"relation\": [\"delegate_permission/common.handle_all_urls\"],
35
+ \"target\": {
36
+ \"namespace\": \"web\",
37
+ \"site\": \"https://<%= host %>\"
38
+ }
39
+ }]
40
+ <% for (const additionalOrigin of additionalTrustedOrigins) { %>
41
+ ,[{
42
+ \"relation\": [\"delegate_permission/common.handle_all_urls\"],
43
+ \"target\": {
44
+ \"namespace\": \"web\",
45
+ \"site\": \"https://<%= additionalOrigin %>\"
46
+ }
47
+ }]
48
+ <% } %>
49
+ </string>
50
+ </resources>
@@ -0,0 +1,18 @@
1
+ <!--
2
+ Copyright 2019 Google Inc. All Rights Reserved.
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+ -->
16
+ <paths>
17
+ <files-path path="twa_splash/" name="twa_splash" />
18
+ </paths>
@@ -0,0 +1,16 @@
1
+ <!--
2
+ Copyright 2019 Google Inc. All Rights Reserved.
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+ -->
16
+ <shortcuts xmlns:android='http://schemas.android.com/apk/res/android' />
@@ -0,0 +1,42 @@
1
+ /*
2
+ * Copyright 2019 Google Inc.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ // Top-level build file where you can add configuration options common to all sub-projects/modules.
18
+
19
+ buildscript {
20
+
21
+ repositories {
22
+ google()
23
+ jcenter()
24
+ }
25
+ dependencies {
26
+ classpath 'com.android.tools.build:gradle:4.1.3'
27
+
28
+ // NOTE: Do not place your application dependencies here; they belong
29
+ // in the individual module build.gradle files
30
+ }
31
+ }
32
+
33
+ allprojects {
34
+ repositories {
35
+ google()
36
+ jcenter()
37
+ }
38
+ }
39
+
40
+ task clean(type: Delete) {
41
+ delete rootProject.buildDir
42
+ }
@@ -0,0 +1,27 @@
1
+ #!/usr/bin/env bash
2
+
3
+ #
4
+ # Copyright 2019 Google Inc.
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+
19
+ # Check if at least 1 argument is provided
20
+ if [[ $# -eq 0 ]]
21
+ then
22
+ echo "Usage: 'enable-debug.sh <host>'"
23
+ exit 1
24
+ fi
25
+
26
+ # Invokes ADB and creates the file with the command line
27
+ adb shell "echo '_ --disable-digital-asset-link-verification-for-url=\"$1\"' > /data/local/tmp/chrome-command-line"