@bubblewrap/core 1.14.0 → 1.15.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/dist/lib/GooglePlay.d.ts +53 -13
- package/dist/lib/GooglePlay.js +123 -20
- package/dist/lib/TwaManifest.d.ts +5 -0
- package/dist/lib/TwaManifest.js +2 -1
- package/dist/lib/features/ArCoreFeature.d.ts +7 -0
- package/dist/lib/features/ArCoreFeature.js +27 -0
- package/dist/lib/features/EmptyFeature.d.ts +2 -1
- package/dist/lib/features/EmptyFeature.js +1 -0
- package/dist/lib/features/Feature.d.ts +9 -0
- package/dist/lib/features/Feature.js +9 -0
- package/dist/lib/features/FeatureManager.d.ts +2 -0
- package/dist/lib/features/FeatureManager.js +9 -1
- package/package.json +2 -2
- package/template_project/app/build.gradle +0 -9
- package/template_project/app/src/main/AndroidManifest.xml +6 -0
package/dist/lib/GooglePlay.d.ts
CHANGED
|
@@ -1,40 +1,80 @@
|
|
|
1
|
-
import { GradleWrapper } from '..';
|
|
2
1
|
declare const TRACK_VALUES: string[];
|
|
3
2
|
export declare type PlayStoreTrack = typeof TRACK_VALUES[number];
|
|
4
3
|
export declare const PlayStoreTracks: PlayStoreTrack[];
|
|
5
4
|
export declare function asPlayStoreTrack(input?: string): PlayStoreTrack | null;
|
|
6
5
|
export declare class GooglePlay {
|
|
7
|
-
private
|
|
8
|
-
private _googlePlayApi?;
|
|
6
|
+
private _googlePlayApi;
|
|
9
7
|
/**
|
|
10
8
|
* Constructs a Google Play object with the gradleWrapper so we can use a
|
|
11
9
|
* gradle plugin to communicate with Google Play.
|
|
12
10
|
*
|
|
13
|
-
* @param
|
|
14
|
-
*
|
|
11
|
+
* @param serviceAccountJsonFilePath This is the service account file to communicate with the
|
|
12
|
+
* play publisher API.
|
|
15
13
|
*/
|
|
16
|
-
constructor(
|
|
14
|
+
constructor(serviceAccountJsonFilePath: string);
|
|
17
15
|
/**
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
16
|
+
* Generates an editId that should be used in all play operations.
|
|
17
|
+
* @param packageName - The package that will be worked upon.
|
|
18
|
+
* @param operation - The Play Operation which requires an editId injected
|
|
19
|
+
* @param commitEdit - Whether or not this edit is a action or query edit. true indicates an action edit.
|
|
20
|
+
* @returns - A PlayOperationResult which contains the output of the operation in a field that was worked upon.
|
|
21
21
|
*/
|
|
22
|
-
|
|
22
|
+
performPlayOperation<Type>(packageName: string, operation: (editId: string) => Promise<Type>, commitEdit?: boolean): Promise<Type>;
|
|
23
23
|
/**
|
|
24
24
|
* This calls the publish bundle command and publishes an existing artifact to Google
|
|
25
25
|
* Play.
|
|
26
|
-
*
|
|
26
|
+
* Calls the following Play API commands in order:
|
|
27
|
+
* Edits.Insert
|
|
28
|
+
* Edits.Bundles.Upload
|
|
29
|
+
* Edits.Tracks.Update
|
|
30
|
+
* Edits.Commit
|
|
31
|
+
* https://developers.google.com/android-publisher/api-ref/rest/v3/edits.bundles/upload
|
|
32
|
+
* https://developers.google.com/android-publisher/edits#workflow
|
|
27
33
|
* @param track - Specifies the track that the user would like to publish to.
|
|
34
|
+
* @param filepath - Filepath of the App bundle you would like to upload.
|
|
35
|
+
* @param packageName - Package name of the bundle.
|
|
36
|
+
* @param retainedBundles - All bundles that should be retained on upload. This is useful for
|
|
37
|
+
* ChromeOS only releases.
|
|
28
38
|
*/
|
|
29
|
-
publishBundle(track: PlayStoreTrack, filepath: string): Promise<void>;
|
|
39
|
+
publishBundle(track: PlayStoreTrack, filepath: string, packageName: string, retainedBundles: number[], editId: string): Promise<void>;
|
|
40
|
+
/**
|
|
41
|
+
* This calls the Edits.Tracks.Update play publisher api command. This will do the updating of
|
|
42
|
+
* the user selected track for the reelase to the play store.
|
|
43
|
+
* @param track - Specifies the track that the user would like to publish to.
|
|
44
|
+
* @param versionCodes - Specifies all versions of the app bundle to be included on release
|
|
45
|
+
* (including retained artifacts).
|
|
46
|
+
* @param packageName - packageName of the bundle.
|
|
47
|
+
* @param editId - The current edit hosted on Google Play.
|
|
48
|
+
*/
|
|
49
|
+
private addBundleToTrack;
|
|
30
50
|
/**
|
|
31
51
|
* Connects to the Google Play Console and retrieves a list of all Android App Bundles for the
|
|
32
52
|
* given packageName. Finds the largest versionCode of those bundles and returns it. Considers
|
|
33
53
|
* both ChromeOS and Android Releases.
|
|
54
|
+
* @param packageName - The packageName of the versionCode we are looking up.
|
|
55
|
+
*/
|
|
56
|
+
getLargestVersionCode(packageName: string, editId: string): Promise<number>;
|
|
57
|
+
/**
|
|
58
|
+
* Starts an edit on the Play servers. This is the basis for any play publishing api operation.
|
|
59
|
+
* @param packageName - the packageName of the app we want to interact with.
|
|
60
|
+
*/
|
|
61
|
+
private startPlayOperation;
|
|
62
|
+
/**
|
|
63
|
+
* Cancels the edit in progress on the Play server.
|
|
64
|
+
* @param packageName - The packageName of the app we are interacting with.
|
|
65
|
+
* @param editId - The editId that is currently in progress.
|
|
66
|
+
*/
|
|
67
|
+
private endPlayOperation;
|
|
68
|
+
/**
|
|
69
|
+
* Checks to see if the version that we want to retain already exists within the Play Store.
|
|
70
|
+
* @param packageName - The packageName of the versionCode we are looking up.
|
|
71
|
+
* @param versionCode - The version code of the APK / Bundle we want to retain.
|
|
34
72
|
*/
|
|
35
|
-
|
|
73
|
+
versionExists(packageName: string, versionCode: number, editId: string): Promise<boolean>;
|
|
36
74
|
/**
|
|
37
75
|
* This fetches the Android client using the bubblewrap configuration file.
|
|
76
|
+
* @param serviceAccountJsonFilePath - The file path to the service account file. This allows
|
|
77
|
+
* communication to the Play Publisher API.
|
|
38
78
|
*/
|
|
39
79
|
private getAndroidClient;
|
|
40
80
|
}
|
package/dist/lib/GooglePlay.js
CHANGED
|
@@ -17,9 +17,11 @@
|
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
exports.GooglePlay = exports.asPlayStoreTrack = exports.PlayStoreTracks = void 0;
|
|
19
19
|
const googleapis_1 = require("googleapis");
|
|
20
|
+
const fs_1 = require("fs");
|
|
20
21
|
// Possible values for release tracks
|
|
21
22
|
const TRACK_VALUES = ['alpha', 'beta', 'internal', 'production'];
|
|
22
23
|
exports.PlayStoreTracks = [...TRACK_VALUES];
|
|
24
|
+
const PLAY_API_TIMEOUT_MS = 180000;
|
|
23
25
|
function asPlayStoreTrack(input) {
|
|
24
26
|
if (!input) {
|
|
25
27
|
return null;
|
|
@@ -32,49 +34,150 @@ class GooglePlay {
|
|
|
32
34
|
* Constructs a Google Play object with the gradleWrapper so we can use a
|
|
33
35
|
* gradle plugin to communicate with Google Play.
|
|
34
36
|
*
|
|
35
|
-
* @param
|
|
36
|
-
*
|
|
37
|
+
* @param serviceAccountJsonFilePath This is the service account file to communicate with the
|
|
38
|
+
* play publisher API.
|
|
37
39
|
*/
|
|
38
|
-
constructor(
|
|
39
|
-
this.
|
|
40
|
+
constructor(serviceAccountJsonFilePath) {
|
|
41
|
+
this._googlePlayApi = this.getAndroidClient(serviceAccountJsonFilePath);
|
|
42
|
+
if (!this._googlePlayApi) {
|
|
43
|
+
throw new Error('Could not create a Google Play API client');
|
|
44
|
+
}
|
|
40
45
|
}
|
|
41
46
|
/**
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
47
|
+
* Generates an editId that should be used in all play operations.
|
|
48
|
+
* @param packageName - The package that will be worked upon.
|
|
49
|
+
* @param operation - The Play Operation which requires an editId injected
|
|
50
|
+
* @param commitEdit - Whether or not this edit is a action or query edit. true indicates an action edit.
|
|
51
|
+
* @returns - A PlayOperationResult which contains the output of the operation in a field that was worked upon.
|
|
45
52
|
*/
|
|
46
|
-
async
|
|
47
|
-
await this.
|
|
53
|
+
async performPlayOperation(packageName, operation, commitEdit = false) {
|
|
54
|
+
const editId = await this.startPlayOperation(packageName);
|
|
55
|
+
const result = await operation(editId);
|
|
56
|
+
if (!commitEdit) {
|
|
57
|
+
await this.endPlayOperation(packageName, editId);
|
|
58
|
+
}
|
|
59
|
+
return result;
|
|
48
60
|
}
|
|
49
61
|
/**
|
|
50
62
|
* This calls the publish bundle command and publishes an existing artifact to Google
|
|
51
63
|
* Play.
|
|
52
|
-
*
|
|
64
|
+
* Calls the following Play API commands in order:
|
|
65
|
+
* Edits.Insert
|
|
66
|
+
* Edits.Bundles.Upload
|
|
67
|
+
* Edits.Tracks.Update
|
|
68
|
+
* Edits.Commit
|
|
69
|
+
* https://developers.google.com/android-publisher/api-ref/rest/v3/edits.bundles/upload
|
|
70
|
+
* https://developers.google.com/android-publisher/edits#workflow
|
|
53
71
|
* @param track - Specifies the track that the user would like to publish to.
|
|
72
|
+
* @param filepath - Filepath of the App bundle you would like to upload.
|
|
73
|
+
* @param packageName - Package name of the bundle.
|
|
74
|
+
* @param retainedBundles - All bundles that should be retained on upload. This is useful for
|
|
75
|
+
* ChromeOS only releases.
|
|
54
76
|
*/
|
|
55
|
-
async publishBundle(track, filepath) {
|
|
56
|
-
|
|
57
|
-
|
|
77
|
+
async publishBundle(track, filepath, packageName, retainedBundles, editId) {
|
|
78
|
+
const result = await this._googlePlayApi.edits.bundles.upload({
|
|
79
|
+
ackBundleInstallationWarning: false,
|
|
80
|
+
editId: editId,
|
|
81
|
+
packageName: packageName,
|
|
82
|
+
media: {
|
|
83
|
+
body: fs_1.createReadStream(filepath),
|
|
84
|
+
},
|
|
85
|
+
}, {
|
|
86
|
+
timeout: PLAY_API_TIMEOUT_MS,
|
|
87
|
+
});
|
|
88
|
+
const versionCodeUploaded = result.data.versionCode;
|
|
89
|
+
if (!versionCodeUploaded) {
|
|
90
|
+
throw new Error('Version code could not be found from Play API.');
|
|
91
|
+
}
|
|
92
|
+
const retainedBundlesStr = retainedBundles.map((n) => n.toString());
|
|
93
|
+
await this.addBundleToTrack(track, [versionCodeUploaded.toString(), ...retainedBundlesStr], packageName, editId);
|
|
94
|
+
await this._googlePlayApi.edits.commit({
|
|
95
|
+
changesNotSentForReview: false,
|
|
96
|
+
editId: editId,
|
|
97
|
+
packageName: packageName,
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* This calls the Edits.Tracks.Update play publisher api command. This will do the updating of
|
|
102
|
+
* the user selected track for the reelase to the play store.
|
|
103
|
+
* @param track - Specifies the track that the user would like to publish to.
|
|
104
|
+
* @param versionCodes - Specifies all versions of the app bundle to be included on release
|
|
105
|
+
* (including retained artifacts).
|
|
106
|
+
* @param packageName - packageName of the bundle.
|
|
107
|
+
* @param editId - The current edit hosted on Google Play.
|
|
108
|
+
*/
|
|
109
|
+
async addBundleToTrack(track, versionCodes, packageName, editId) {
|
|
110
|
+
const tracksUpdate = {
|
|
111
|
+
track: track,
|
|
112
|
+
packageName: packageName,
|
|
113
|
+
editId: editId,
|
|
114
|
+
requestBody: {
|
|
115
|
+
releases: [{
|
|
116
|
+
versionCodes: versionCodes,
|
|
117
|
+
status: 'completed',
|
|
118
|
+
}],
|
|
119
|
+
track: track,
|
|
120
|
+
},
|
|
121
|
+
};
|
|
122
|
+
await this._googlePlayApi.edits.tracks.update(tracksUpdate);
|
|
58
123
|
}
|
|
59
124
|
/**
|
|
60
125
|
* Connects to the Google Play Console and retrieves a list of all Android App Bundles for the
|
|
61
126
|
* given packageName. Finds the largest versionCode of those bundles and returns it. Considers
|
|
62
127
|
* both ChromeOS and Android Releases.
|
|
128
|
+
* @param packageName - The packageName of the versionCode we are looking up.
|
|
63
129
|
*/
|
|
64
|
-
async getLargestVersionCode(packageName,
|
|
65
|
-
|
|
66
|
-
|
|
130
|
+
async getLargestVersionCode(packageName, editId) {
|
|
131
|
+
const bundleResponse = await this._googlePlayApi.edits.bundles.list({ packageName: packageName, editId: editId });
|
|
132
|
+
if (!bundleResponse.data.bundles) {
|
|
133
|
+
throw new Error('No bundles found from Google Play');
|
|
67
134
|
}
|
|
135
|
+
const versionCode = Math.max(...bundleResponse.data.bundles.map((bundle) => bundle.versionCode));
|
|
136
|
+
return versionCode;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Starts an edit on the Play servers. This is the basis for any play publishing api operation.
|
|
140
|
+
* @param packageName - the packageName of the app we want to interact with.
|
|
141
|
+
*/
|
|
142
|
+
async startPlayOperation(packageName) {
|
|
68
143
|
const edit = await this._googlePlayApi.edits.insert({ packageName: packageName });
|
|
69
144
|
const editId = edit.data.id;
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
145
|
+
if (!editId) {
|
|
146
|
+
throw new Error('Could not create a Google Play edit');
|
|
147
|
+
}
|
|
148
|
+
return editId;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Cancels the edit in progress on the Play server.
|
|
152
|
+
* @param packageName - The packageName of the app we are interacting with.
|
|
153
|
+
* @param editId - The editId that is currently in progress.
|
|
154
|
+
*/
|
|
155
|
+
async endPlayOperation(packageName, editId) {
|
|
73
156
|
await this._googlePlayApi.edits.delete({ editId: editId, packageName: packageName });
|
|
74
|
-
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Checks to see if the version that we want to retain already exists within the Play Store.
|
|
160
|
+
* @param packageName - The packageName of the versionCode we are looking up.
|
|
161
|
+
* @param versionCode - The version code of the APK / Bundle we want to retain.
|
|
162
|
+
*/
|
|
163
|
+
async versionExists(packageName, versionCode, editId) {
|
|
164
|
+
var _a, _b;
|
|
165
|
+
const uploadedApks = await this._googlePlayApi.edits.apks.list({ packageName: packageName, editId: editId });
|
|
166
|
+
let found = (_a = uploadedApks.data.apks) === null || _a === void 0 ? void 0 : _a.find((obj) => obj.versionCode == versionCode);
|
|
167
|
+
if (found) {
|
|
168
|
+
return true;
|
|
169
|
+
}
|
|
170
|
+
const uploadedBundles = await this._googlePlayApi.edits.bundles.list({ packageName: packageName, editId: editId });
|
|
171
|
+
found = (_b = uploadedBundles.data.bundles) === null || _b === void 0 ? void 0 : _b.find((obj) => obj.versionCode == versionCode);
|
|
172
|
+
if (found) {
|
|
173
|
+
return true;
|
|
174
|
+
}
|
|
175
|
+
return false;
|
|
75
176
|
}
|
|
76
177
|
/**
|
|
77
178
|
* This fetches the Android client using the bubblewrap configuration file.
|
|
179
|
+
* @param serviceAccountJsonFilePath - The file path to the service account file. This allows
|
|
180
|
+
* communication to the Play Publisher API.
|
|
78
181
|
*/
|
|
79
182
|
getAndroidClient(serviceAccountJsonFilePath) {
|
|
80
183
|
// Initialize the Google API Client from service account credentials
|
|
@@ -5,6 +5,7 @@ import { AppsFlyerConfig } from './features/AppsFlyerFeature';
|
|
|
5
5
|
import { LocationDelegationConfig } from './features/LocationDelegationFeature';
|
|
6
6
|
import { PlayBillingConfig } from './features/PlayBillingFeature';
|
|
7
7
|
import { FirstRunFlagConfig } from './features/FirstRunFlagFeature';
|
|
8
|
+
import { ArCoreConfig } from './features/ArCoreFeature';
|
|
8
9
|
declare const DISPLAY_MODE_VALUES: string[];
|
|
9
10
|
export declare type DisplayMode = typeof DISPLAY_MODE_VALUES[number];
|
|
10
11
|
export declare const DisplayModes: DisplayMode[];
|
|
@@ -19,6 +20,7 @@ declare type Features = {
|
|
|
19
20
|
locationDelegation?: LocationDelegationConfig;
|
|
20
21
|
playBilling?: PlayBillingConfig;
|
|
21
22
|
firstRunFlag?: FirstRunFlagConfig;
|
|
23
|
+
arCore?: ArCoreConfig;
|
|
22
24
|
};
|
|
23
25
|
declare type alphaDependencies = {
|
|
24
26
|
enabled: boolean;
|
|
@@ -92,6 +94,7 @@ export declare class TwaManifest {
|
|
|
92
94
|
fingerprints: Fingerprint[];
|
|
93
95
|
serviceAccountJsonFile: string | undefined;
|
|
94
96
|
additionalTrustedOrigins: string[];
|
|
97
|
+
retainedBundles: number[];
|
|
95
98
|
private static log;
|
|
96
99
|
constructor(data: TwaManifestJson);
|
|
97
100
|
/**
|
|
@@ -211,6 +214,7 @@ export interface TwaManifestJson {
|
|
|
211
214
|
locationDelegation?: LocationDelegationConfig;
|
|
212
215
|
playBilling?: PlayBillingConfig;
|
|
213
216
|
firstRunFlag?: FirstRunFlagConfig;
|
|
217
|
+
arCore?: ArCoreConfig;
|
|
214
218
|
};
|
|
215
219
|
alphaDependencies?: {
|
|
216
220
|
enabled: boolean;
|
|
@@ -222,6 +226,7 @@ export interface TwaManifestJson {
|
|
|
222
226
|
fingerprints?: Fingerprint[];
|
|
223
227
|
serviceAccountJsonFile?: string;
|
|
224
228
|
additionalTrustedOrigins?: string[];
|
|
229
|
+
retainedBundles?: number[];
|
|
225
230
|
}
|
|
226
231
|
export interface SigningKeyInfo {
|
|
227
232
|
path: string;
|
package/dist/lib/TwaManifest.js
CHANGED
|
@@ -138,6 +138,7 @@ class TwaManifest {
|
|
|
138
138
|
this.fingerprints = data.fingerprints || [];
|
|
139
139
|
this.serviceAccountJsonFile = data.serviceAccountJsonFile;
|
|
140
140
|
this.additionalTrustedOrigins = data.additionalTrustedOrigins || [];
|
|
141
|
+
this.retainedBundles = data.retainedBundles || [];
|
|
141
142
|
}
|
|
142
143
|
/**
|
|
143
144
|
* Turns an TwaManifest into a TwaManifestJson.
|
|
@@ -318,7 +319,7 @@ class TwaManifest {
|
|
|
318
319
|
}
|
|
319
320
|
}
|
|
320
321
|
catch (err) {
|
|
321
|
-
TwaManifest.log.warn(`Skipping shortcut[${i}] for ${err
|
|
322
|
+
TwaManifest.log.warn(`Skipping shortcut[${i}] for ${err}.`);
|
|
322
323
|
}
|
|
323
324
|
if (shortcuts.length === 4) {
|
|
324
325
|
break;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.ArCoreFeature = void 0;
|
|
19
|
+
const EmptyFeature_1 = require("./EmptyFeature");
|
|
20
|
+
const Feature_1 = require("./Feature");
|
|
21
|
+
class ArCoreFeature extends EmptyFeature_1.EmptyFeature {
|
|
22
|
+
constructor() {
|
|
23
|
+
super('ArCoreFeature');
|
|
24
|
+
this.androidManifest.applicationMetadata.push(new Feature_1.Metadata('com.google.ar.core', 'required'));
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
exports.ArCoreFeature = ArCoreFeature;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Feature } from './Feature';
|
|
1
|
+
import { Feature, Metadata } from './Feature';
|
|
2
2
|
export declare class EmptyFeature implements Feature {
|
|
3
3
|
name: string;
|
|
4
4
|
buildGradle: {
|
|
@@ -8,6 +8,7 @@ export declare class EmptyFeature implements Feature {
|
|
|
8
8
|
androidManifest: {
|
|
9
9
|
permissions: string[];
|
|
10
10
|
components: string[];
|
|
11
|
+
applicationMetadata: Metadata[];
|
|
11
12
|
};
|
|
12
13
|
applicationClass: {
|
|
13
14
|
imports: string[];
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
export declare class Metadata {
|
|
2
|
+
readonly name: string;
|
|
3
|
+
readonly value: string;
|
|
4
|
+
constructor(name: string, value: string);
|
|
5
|
+
}
|
|
1
6
|
/**
|
|
2
7
|
* Specifies a set of customizations to be applied when generating the Android project
|
|
3
8
|
* in order to enable a feature.
|
|
@@ -44,6 +49,10 @@ export interface Feature {
|
|
|
44
49
|
* ```
|
|
45
50
|
*/
|
|
46
51
|
components: string[];
|
|
52
|
+
/**
|
|
53
|
+
* Additional meta-data items to be added into the `application` tag.
|
|
54
|
+
*/
|
|
55
|
+
applicationMetadata: Metadata[];
|
|
47
56
|
};
|
|
48
57
|
/**
|
|
49
58
|
* Customizations to be added to `app/src/main/java/<app-package>/Application.java`.
|
|
@@ -15,3 +15,12 @@
|
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.Metadata = void 0;
|
|
19
|
+
class Metadata {
|
|
20
|
+
constructor(name, value) {
|
|
21
|
+
this.name = name;
|
|
22
|
+
this.value = value;
|
|
23
|
+
}
|
|
24
|
+
;
|
|
25
|
+
}
|
|
26
|
+
exports.Metadata = Metadata;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Metadata } from './Feature';
|
|
1
2
|
import { TwaManifest } from '../TwaManifest';
|
|
2
3
|
import { Log } from '../Log';
|
|
3
4
|
/**
|
|
@@ -12,6 +13,7 @@ export declare class FeatureManager {
|
|
|
12
13
|
androidManifest: {
|
|
13
14
|
permissions: Set<string>;
|
|
14
15
|
components: string[];
|
|
16
|
+
applicationMetadata: Metadata[];
|
|
15
17
|
};
|
|
16
18
|
applicationClass: {
|
|
17
19
|
imports: Set<string>;
|
|
@@ -21,6 +21,7 @@ const LocationDelegationFeature_1 = require("./LocationDelegationFeature");
|
|
|
21
21
|
const PlayBillingFeature_1 = require("./PlayBillingFeature");
|
|
22
22
|
const FirstRunFlagFeature_1 = require("./FirstRunFlagFeature");
|
|
23
23
|
const Log_1 = require("../Log");
|
|
24
|
+
const ArCoreFeature_1 = require("./ArCoreFeature");
|
|
24
25
|
const ANDROID_BROWSER_HELPER_VERSIONS = {
|
|
25
26
|
stable: 'com.google.androidbrowserhelper:androidbrowserhelper:2.3.0',
|
|
26
27
|
alpha: 'com.google.androidbrowserhelper:androidbrowserhelper:2.3.0',
|
|
@@ -34,7 +35,7 @@ class FeatureManager {
|
|
|
34
35
|
* Builds a new intance from a TwaManifest.
|
|
35
36
|
*/
|
|
36
37
|
constructor(twaManifest, log = new Log_1.ConsoleLog('FeatureManager')) {
|
|
37
|
-
var _a, _b, _c, _d, _e, _f;
|
|
38
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
38
39
|
this.buildGradle = {
|
|
39
40
|
repositories: new Set(),
|
|
40
41
|
dependencies: new Set(),
|
|
@@ -42,6 +43,7 @@ class FeatureManager {
|
|
|
42
43
|
this.androidManifest = {
|
|
43
44
|
permissions: new Set(),
|
|
44
45
|
components: new Array(),
|
|
46
|
+
applicationMetadata: new Array(),
|
|
45
47
|
};
|
|
46
48
|
this.applicationClass = {
|
|
47
49
|
imports: new Set(),
|
|
@@ -86,6 +88,9 @@ class FeatureManager {
|
|
|
86
88
|
else {
|
|
87
89
|
this.buildGradle.dependencies.add(ANDROID_BROWSER_HELPER_VERSIONS.stable);
|
|
88
90
|
}
|
|
91
|
+
if ((_g = twaManifest.features.arCore) === null || _g === void 0 ? void 0 : _g.enabled) {
|
|
92
|
+
this.addFeature(new ArCoreFeature_1.ArCoreFeature());
|
|
93
|
+
}
|
|
89
94
|
}
|
|
90
95
|
addFeature(feature) {
|
|
91
96
|
// Adds properties to build.
|
|
@@ -112,6 +117,9 @@ class FeatureManager {
|
|
|
112
117
|
feature.androidManifest.components.forEach((component) => {
|
|
113
118
|
this.androidManifest.components.push(component);
|
|
114
119
|
});
|
|
120
|
+
feature.androidManifest.applicationMetadata.forEach((metadata) => {
|
|
121
|
+
this.androidManifest.applicationMetadata.push(metadata);
|
|
122
|
+
});
|
|
115
123
|
// Adds properties to launcherActivity.
|
|
116
124
|
feature.launcherActivity.imports.forEach((imp) => {
|
|
117
125
|
this.launcherActivity.imports.add(imp);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bubblewrap/core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.15.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": "cf5b2a9a6586d77a5cc051f43b0969cec541833e"
|
|
60
60
|
}
|
|
@@ -18,9 +18,6 @@ import groovy.xml.MarkupBuilder
|
|
|
18
18
|
|
|
19
19
|
plugins {
|
|
20
20
|
id 'com.android.application'
|
|
21
|
-
<% if (serviceAccountJsonFile) { %>
|
|
22
|
-
id("com.github.triplet.play") version "3.4.0"
|
|
23
|
-
<% } %>
|
|
24
21
|
}
|
|
25
22
|
|
|
26
23
|
def twaManifest = [
|
|
@@ -154,12 +151,6 @@ android {
|
|
|
154
151
|
}
|
|
155
152
|
}
|
|
156
153
|
|
|
157
|
-
<% if (serviceAccountJsonFile) { %>
|
|
158
|
-
play {
|
|
159
|
-
serviceAccountCredentials.set(file("<%= serviceAccountJsonFile %>"))
|
|
160
|
-
}
|
|
161
|
-
<% } %>
|
|
162
|
-
|
|
163
154
|
task generateShorcutsFile {
|
|
164
155
|
assert twaManifest.shortcuts.size() < 5, "You can have at most 4 shortcuts."
|
|
165
156
|
twaManifest.shortcuts.eachWithIndex { s, i ->
|
|
@@ -55,6 +55,12 @@
|
|
|
55
55
|
android:name="twa_generator"
|
|
56
56
|
android:value="@string/generatorApp" />
|
|
57
57
|
|
|
58
|
+
<% for (const metadata of androidManifest.applicationMetadata) {%>
|
|
59
|
+
<meta-data
|
|
60
|
+
android:name="<%= metadata.name %>"
|
|
61
|
+
android:value="<%= metadata.value %>" />
|
|
62
|
+
<% } %>
|
|
63
|
+
|
|
58
64
|
<% if (enableSiteSettingsShortcut) { %>
|
|
59
65
|
<activity android:name="com.google.androidbrowserhelper.trusted.ManageDataLauncherActivity">
|
|
60
66
|
<meta-data
|