@bubblewrap/core 1.14.0-alpha.3 → 1.16.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.
@@ -20,6 +20,9 @@ const fs = require("fs");
20
20
  const fetch_h2_1 = require("fetch-h2");
21
21
  const node_fetch_1 = require("node-fetch");
22
22
  const DEFAULT_FETCH_ENGINE = 'fetch-h2';
23
+ const userAgent = 'Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/81.0';
24
+ const fetchh2Ctx = fetch_h2_1.context({ userAgent: userAgent, overwriteUserAgent: true });
25
+ const fetchh2 = fetchh2Ctx.fetch;
23
26
  class FetchUtils {
24
27
  constructor() {
25
28
  this.fetchEngine = DEFAULT_FETCH_ENGINE;
@@ -29,10 +32,10 @@ class FetchUtils {
29
32
  }
30
33
  async fetch(input) {
31
34
  if (this.fetchEngine == 'node-fetch') {
32
- return await node_fetch_1.default(input, { redirect: 'follow' });
35
+ return await node_fetch_1.default(input, { redirect: 'follow', headers: { 'User-Agent': userAgent } });
33
36
  }
34
37
  else {
35
- return await fetch_h2_1.fetch(input, { redirect: 'follow' });
38
+ return await fetchh2(input, { redirect: 'follow' });
36
39
  }
37
40
  }
38
41
  /**
@@ -48,7 +51,7 @@ class FetchUtils {
48
51
  readableStream = result.body;
49
52
  }
50
53
  else {
51
- result = await fetch_h2_1.fetch(url, { redirect: 'follow' });
54
+ result = await fetchh2(url, { redirect: 'follow' });
52
55
  readableStream = await result.readable();
53
56
  }
54
57
  // Try to determine the file size via the `Content-Length` header. This may not be available
@@ -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 gradleWrapper;
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 gradleWrapper This is the gradle wrapper object that supplies
14
- * hooks into Gradle.
11
+ * @param serviceAccountJsonFilePath This is the service account file to communicate with the
12
+ * play publisher API.
15
13
  */
16
- constructor(gradleWrapper: GradleWrapper);
14
+ constructor(serviceAccountJsonFilePath: string);
17
15
  /**
18
- * Initialized Google Play and loads the existing configruation from Google Play.
19
- * The resulting files are stored in the play folder in the src directory.
20
- * https://github.com/Triple-T/gradle-play-publisher#quickstart
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
- initPlay(): Promise<void>;
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
- * https://github.com/Triple-T/gradle-play-publisher#uploading-a-pre-existing-artifact
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
- getLargestVersionCode(packageName: string, serviceAccountJsonFilePath: string): Promise<number>;
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
  }
@@ -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 gradleWrapper This is the gradle wrapper object that supplies
36
- * hooks into Gradle.
37
+ * @param serviceAccountJsonFilePath This is the service account file to communicate with the
38
+ * play publisher API.
37
39
  */
38
- constructor(gradleWrapper) {
39
- this.gradleWrapper = gradleWrapper;
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
- * Initialized Google Play and loads the existing configruation from Google Play.
43
- * The resulting files are stored in the play folder in the src directory.
44
- * https://github.com/Triple-T/gradle-play-publisher#quickstart
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 initPlay() {
47
- await this.gradleWrapper.executeGradleCommand(['bootstrap']);
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
- * https://github.com/Triple-T/gradle-play-publisher#uploading-a-pre-existing-artifact
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
- // Uploads the artifact to the default internal track.
57
- await this.gradleWrapper.executeGradleCommand(['publishBundle', '--artifact-dir', filepath, '--track', track]);
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, serviceAccountJsonFilePath) {
65
- if (!this._googlePlayApi) {
66
- this._googlePlayApi = this.getAndroidClient(serviceAccountJsonFilePath);
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
- const bundleResponse = await this._googlePlayApi.edits.bundles.list({ packageName: packageName, editId: editId });
71
- const versionCode = Math.max(...bundleResponse.data.bundles.map((bundle) => bundle.versionCode));
72
- // cleanup
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
- return versionCode;
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
@@ -105,7 +105,12 @@ class ImageHelper {
105
105
  throw new Error(`This installation doesn't support image/svg. Please, ensure the optional
106
106
  "svg2img" library is installed or use an alternative image format.`);
107
107
  }
108
- body = await svg2img_1.svg2img(iconUrl);
108
+ try {
109
+ body = await svg2img_1.svg2img(iconUrl);
110
+ }
111
+ catch (error) {
112
+ throw new Error(`Problem reading ${iconUrl}: ${error.message}`);
113
+ }
109
114
  }
110
115
  return {
111
116
  url: iconUrl,
@@ -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;
@@ -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.message}.`);
322
+ TwaManifest.log.warn(`Skipping shortcut[${i}] for ${err}.`);
322
323
  }
323
324
  if (shortcuts.length === 4) {
324
325
  break;
@@ -0,0 +1,7 @@
1
+ import { EmptyFeature } from './EmptyFeature';
2
+ export interface ArCoreConfig {
3
+ enabled: boolean;
4
+ }
5
+ export declare class ArCoreFeature extends EmptyFeature {
6
+ constructor();
7
+ }
@@ -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[];
@@ -25,6 +25,7 @@ class EmptyFeature {
25
25
  this.androidManifest = {
26
26
  permissions: new Array(),
27
27
  components: new Array(),
28
+ applicationMetadata: new Array(),
28
29
  };
29
30
  this.applicationClass = {
30
31
  imports: new Array(),
@@ -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);
@@ -95,8 +95,8 @@ class JdkHelper {
95
95
  try {
96
96
  const releaseFilePath = join(javaHome, 'release');
97
97
  const file = await fs_1.promises.readFile(releaseFilePath, 'utf-8');
98
- if (file.indexOf('JAVA_VERSION="1.8') < 0) { // Checks if the jdk's version is 8 as needed
99
- return Result_1.Result.error(new ValidatePathError_1.ValidatePathError('JDK version not supported. JDK version 1.8 is required.', 'PathIsNotSupported'));
98
+ if (file.indexOf('JAVA_VERSION="11.0') < 0) { // Checks if the jdk's version is 11 as needed
99
+ return Result_1.Result.error(new ValidatePathError_1.ValidatePathError('JDK version not supported. JDK version 11 is required.', 'PathIsNotSupported'));
100
100
  }
101
101
  }
102
102
  catch (e) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bubblewrap/core",
3
- "version": "1.14.0-alpha.3+ece2905",
3
+ "version": "1.16.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": "ece2905b25fd5c3748a3f202fbb19651699c5402"
59
+ "gitHead": "8936e332adbbc33b3a5d398cce14947cd6c290d5"
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