@bubblewrap/core 1.17.2 → 1.18.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.
|
@@ -56,6 +56,7 @@ declare type alphaDependencies = {
|
|
|
56
56
|
* splashScreenFadeOutDuration: 300
|
|
57
57
|
* isChromeOSOnly: false, // Setting to true will enable a feature that prevents non-ChromeOS devices
|
|
58
58
|
* from installing the app.
|
|
59
|
+
* isMetaQuest: false, // Setting to true will generate the build compatible with Meta Quest devices.
|
|
59
60
|
* serviceAccountJsonFile: '<%= serviceAccountJsonFile %>', // The service account used to communicate with
|
|
60
61
|
* Google Play.
|
|
61
62
|
*
|
|
@@ -89,6 +90,9 @@ export declare class TwaManifest {
|
|
|
89
90
|
alphaDependencies: alphaDependencies;
|
|
90
91
|
enableSiteSettingsShortcut: boolean;
|
|
91
92
|
isChromeOSOnly: boolean;
|
|
93
|
+
isMetaQuest: boolean;
|
|
94
|
+
fullScopeUrl?: URL;
|
|
95
|
+
minSdkVersion: number;
|
|
92
96
|
shareTarget?: ShareTarget;
|
|
93
97
|
orientation: Orientation;
|
|
94
98
|
fingerprints: Fingerprint[];
|
|
@@ -221,6 +225,9 @@ export interface TwaManifestJson {
|
|
|
221
225
|
};
|
|
222
226
|
enableSiteSettingsShortcut?: boolean;
|
|
223
227
|
isChromeOSOnly?: boolean;
|
|
228
|
+
isMetaQuest?: boolean;
|
|
229
|
+
fullScopeUrl?: string;
|
|
230
|
+
minSdkVersion?: number;
|
|
224
231
|
shareTarget?: ShareTarget;
|
|
225
232
|
orientation?: Orientation;
|
|
226
233
|
fingerprints?: Fingerprint[];
|
package/dist/lib/TwaManifest.js
CHANGED
|
@@ -57,6 +57,7 @@ const DEFAULT_NAVIGATION_DIVIDER_COLOR = '#00000000';
|
|
|
57
57
|
const DEFAULT_BACKGROUND_COLOR = '#FFFFFF';
|
|
58
58
|
const DEFAULT_APP_VERSION_CODE = 1;
|
|
59
59
|
const DEFAULT_APP_VERSION_NAME = DEFAULT_APP_VERSION_CODE.toString();
|
|
60
|
+
const DEFAULT_MIN_SDK_VERSION = 19;
|
|
60
61
|
const DEFAULT_SIGNING_KEY_PATH = './android.keystore';
|
|
61
62
|
const DEFAULT_SIGNING_KEY_ALIAS = 'android';
|
|
62
63
|
const DEFAULT_ENABLE_NOTIFICATIONS = true;
|
|
@@ -93,6 +94,7 @@ const DEFAULT_ORIENTATION = 'default';
|
|
|
93
94
|
* splashScreenFadeOutDuration: 300
|
|
94
95
|
* isChromeOSOnly: false, // Setting to true will enable a feature that prevents non-ChromeOS devices
|
|
95
96
|
* from installing the app.
|
|
97
|
+
* isMetaQuest: false, // Setting to true will generate the build compatible with Meta Quest devices.
|
|
96
98
|
* serviceAccountJsonFile: '<%= serviceAccountJsonFile %>', // The service account used to communicate with
|
|
97
99
|
* Google Play.
|
|
98
100
|
*
|
|
@@ -133,6 +135,9 @@ class TwaManifest {
|
|
|
133
135
|
this.enableSiteSettingsShortcut = data.enableSiteSettingsShortcut != undefined ?
|
|
134
136
|
data.enableSiteSettingsShortcut : true;
|
|
135
137
|
this.isChromeOSOnly = data.isChromeOSOnly != undefined ? data.isChromeOSOnly : false;
|
|
138
|
+
this.isMetaQuest = data.isMetaQuest != undefined ? data.isMetaQuest : false;
|
|
139
|
+
this.fullScopeUrl = data.fullScopeUrl ? new URL(data.fullScopeUrl) : undefined;
|
|
140
|
+
this.minSdkVersion = data.minSdkVersion || DEFAULT_MIN_SDK_VERSION;
|
|
136
141
|
this.shareTarget = data.shareTarget;
|
|
137
142
|
this.orientation = data.orientation || DEFAULT_ORIENTATION;
|
|
138
143
|
this.fingerprints = data.fingerprints || [];
|
|
@@ -155,6 +160,7 @@ class TwaManifest {
|
|
|
155
160
|
backgroundColor: this.backgroundColor.hex(),
|
|
156
161
|
appVersion: this.appVersionName,
|
|
157
162
|
webManifestUrl: this.webManifestUrl ? this.webManifestUrl.toString() : undefined,
|
|
163
|
+
fullScopeUrl: this.fullScopeUrl ? this.fullScopeUrl.toString() : undefined,
|
|
158
164
|
});
|
|
159
165
|
}
|
|
160
166
|
/**
|
|
@@ -212,6 +218,7 @@ class TwaManifest {
|
|
|
212
218
|
const maskableIcon = util_1.findSuitableIcon(webManifest.icons, 'maskable', MIN_ICON_SIZE);
|
|
213
219
|
const monochromeIcon = util_1.findSuitableIcon(webManifest.icons, 'monochrome', MIN_NOTIFICATION_ICON_SIZE);
|
|
214
220
|
const fullStartUrl = new URL(webManifest['start_url'] || '/', webManifestUrl);
|
|
221
|
+
const fullScopeUrl = new URL(webManifest['scope'] || '.', webManifestUrl);
|
|
215
222
|
const shortcuts = this.getShortcuts(webManifestUrl, webManifest);
|
|
216
223
|
function resolveIconUrl(icon) {
|
|
217
224
|
return icon ? new URL(icon.src, webManifestUrl).toString() : undefined;
|
|
@@ -244,6 +251,7 @@ class TwaManifest {
|
|
|
244
251
|
features: {},
|
|
245
252
|
shareTarget: TwaManifest.verifyShareTarget(webManifestUrl, webManifest.share_target),
|
|
246
253
|
orientation: asOrientation(webManifest.orientation) || DEFAULT_ORIENTATION,
|
|
254
|
+
fullScopeUrl: fullScopeUrl.toString(),
|
|
247
255
|
});
|
|
248
256
|
return twaManifest;
|
|
249
257
|
}
|
|
@@ -355,7 +363,7 @@ class TwaManifest {
|
|
|
355
363
|
* @returns {Promise<TwaManifest>} the new and merged Twa manifest.
|
|
356
364
|
*/
|
|
357
365
|
static async merge(fieldsToIgnore, webManifestUrl, webManifest, oldTwaManifest) {
|
|
358
|
-
var _a;
|
|
366
|
+
var _a, _b;
|
|
359
367
|
let shortcuts = oldTwaManifest.shortcuts;
|
|
360
368
|
if (!(fieldsToIgnore.includes('shortcuts'))) {
|
|
361
369
|
shortcuts = this.getShortcuts(webManifestUrl, webManifest);
|
|
@@ -365,11 +373,13 @@ class TwaManifest {
|
|
|
365
373
|
const maskableIconUrl = this.getNewIconUrl(fieldsToIgnore, 'maskableIcons', oldTwaManifestJson.iconUrl, webManifest.icons, 'maskable', MIN_ICON_SIZE, webManifestUrl);
|
|
366
374
|
const monochromeIconUrl = this.getNewIconUrl(fieldsToIgnore, 'monochromeIcons', oldTwaManifestJson.iconUrl, webManifest.icons, 'monochrome', MIN_NOTIFICATION_ICON_SIZE, webManifestUrl);
|
|
367
375
|
const fullStartUrl = new URL(webManifest['start_url'] || '/', webManifestUrl);
|
|
376
|
+
const fullScopeUrl = new URL(webManifest['scope'] || '.', webManifestUrl);
|
|
368
377
|
const twaManifest = new TwaManifest({
|
|
369
378
|
...oldTwaManifestJson,
|
|
370
379
|
name: this.getNewFieldValue('name', fieldsToIgnore, oldTwaManifest.name, webManifest['name'] || webManifest['short_name']),
|
|
371
380
|
launcherName: this.getNewFieldValue('short_name', fieldsToIgnore, oldTwaManifest.launcherName, webManifest['short_name'] || ((_a = webManifest['name']) === null || _a === void 0 ? void 0 : _a.substring(0, SHORT_NAME_MAX_SIZE))),
|
|
372
381
|
display: this.getNewFieldValue('display', fieldsToIgnore, oldTwaManifest.display, asDisplayMode(webManifest['display'])),
|
|
382
|
+
fullScopeUrl: this.getNewFieldValue('fullScopeUrl', fieldsToIgnore, (_b = oldTwaManifest.fullScopeUrl) === null || _b === void 0 ? void 0 : _b.toString(), fullScopeUrl.toString()),
|
|
373
383
|
themeColor: this.getNewFieldValue('themeColor', fieldsToIgnore, oldTwaManifest.themeColor.hex(), webManifest['theme_color']),
|
|
374
384
|
backgroundColor: this.getNewFieldValue('backgroundColor', fieldsToIgnore, oldTwaManifest.backgroundColor.hex(), webManifest['background_color']),
|
|
375
385
|
startUrl: this.getNewFieldValue('startUrl', fieldsToIgnore, oldTwaManifest.startUrl, fullStartUrl.pathname + fullStartUrl.search),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bubblewrap/core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.18.0",
|
|
4
4
|
"description": "Core Library to generate, build and sign TWA projects",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "tsc",
|
|
@@ -56,5 +56,5 @@
|
|
|
56
56
|
"optionalDependencies": {
|
|
57
57
|
"svg2img": "^0.9.3"
|
|
58
58
|
},
|
|
59
|
-
"gitHead": "
|
|
59
|
+
"gitHead": "e9713580c8eebacdb96d745618414b186dcfddc3"
|
|
60
60
|
}
|
|
@@ -53,7 +53,7 @@ android {
|
|
|
53
53
|
compileSdkVersion 31
|
|
54
54
|
defaultConfig {
|
|
55
55
|
applicationId "<%= packageId %>"
|
|
56
|
-
minSdkVersion
|
|
56
|
+
minSdkVersion <%= minSdkVersion %>
|
|
57
57
|
targetSdkVersion 31
|
|
58
58
|
versionCode <%= appVersionCode %>
|
|
59
59
|
versionName "<%= appVersionName %>"
|
|
@@ -70,11 +70,16 @@ android {
|
|
|
70
70
|
|
|
71
71
|
<% if (webManifestUrl) { %>
|
|
72
72
|
// The URL the Web Manifest for the Progressive Web App that the TWA points to. This
|
|
73
|
-
// is used by Chrome OS to open the Web version of the PWA instead of
|
|
74
|
-
// will probably give a better user experience for non-mobile devices.
|
|
73
|
+
// is used by Chrome OS and Meta Quest to open the Web version of the PWA instead of
|
|
74
|
+
// the TWA, as it will probably give a better user experience for non-mobile devices.
|
|
75
75
|
resValue "string", "webManifestUrl", '<%= webManifestUrl %>'
|
|
76
76
|
<% } %>
|
|
77
77
|
|
|
78
|
+
<% if (fullScopeUrl) { %>
|
|
79
|
+
// This is used by Meta Quest.
|
|
80
|
+
resValue "string", "fullScopeUrl", '<%= fullScopeUrl %>'
|
|
81
|
+
<% } %>
|
|
82
|
+
|
|
78
83
|
<% if (shareTarget) { %>
|
|
79
84
|
// The data for the app to support web share target.
|
|
80
85
|
resValue "string", "shareTarget", '<%= escapeJsonString(escapeGradleString(JSON.stringify(shareTarget))) %>'
|
|
@@ -26,10 +26,25 @@
|
|
|
26
26
|
<uses-permission android:name="<%= permission %>"/>
|
|
27
27
|
<% } %>
|
|
28
28
|
|
|
29
|
+
<% if (isMetaQuest) { %>
|
|
30
|
+
<uses-permission android:name="com.oculus.permission.HAND_TRACKING" />
|
|
31
|
+
<% } %>
|
|
32
|
+
|
|
29
33
|
<% if (isChromeOSOnly) { %>
|
|
30
34
|
<uses-feature android:name="org.chromium.arc" android:required="true" />
|
|
31
35
|
<% } %>
|
|
32
36
|
|
|
37
|
+
<% if (isMetaQuest) { %>
|
|
38
|
+
<uses-feature
|
|
39
|
+
android:name="android.hardware.vr.headtracking"
|
|
40
|
+
android:required="false"
|
|
41
|
+
android:version="1" />
|
|
42
|
+
|
|
43
|
+
<uses-feature
|
|
44
|
+
android:name="oculus.software.handtracking"
|
|
45
|
+
android:required="false" />
|
|
46
|
+
<% } %>
|
|
47
|
+
|
|
33
48
|
<application
|
|
34
49
|
android:name="Application"
|
|
35
50
|
android:allowBackup="true"
|
|
@@ -61,6 +76,20 @@
|
|
|
61
76
|
android:value="<%= metadata.value %>" />
|
|
62
77
|
<% } %>
|
|
63
78
|
|
|
79
|
+
<% if (isMetaQuest) { %>
|
|
80
|
+
<meta-data
|
|
81
|
+
android:name="com.oculus.pwa.NAME"
|
|
82
|
+
android:value="@string/appName" />
|
|
83
|
+
|
|
84
|
+
<meta-data
|
|
85
|
+
android:name="com.oculus.pwa.START_URL"
|
|
86
|
+
android:value="@string/launchUrl" />
|
|
87
|
+
|
|
88
|
+
<meta-data
|
|
89
|
+
android:name="com.oculus.pwa.SCOPE"
|
|
90
|
+
android:value="@string/fullScopeUrl" />
|
|
91
|
+
<% } %>
|
|
92
|
+
|
|
64
93
|
<% if (enableSiteSettingsShortcut) { %>
|
|
65
94
|
<activity android:name="com.google.androidbrowserhelper.trusted.ManageDataLauncherActivity">
|
|
66
95
|
<meta-data
|