@bubblewrap/core 1.20.1 → 1.22.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.
Files changed (37) hide show
  1. package/dist/lib/Config.js +6 -4
  2. package/dist/lib/FetchUtils.d.ts +2 -2
  3. package/dist/lib/FetchUtils.js +4 -4
  4. package/dist/lib/GooglePlay.d.ts +1 -1
  5. package/dist/lib/GooglePlay.js +3 -3
  6. package/dist/lib/GradleWrapper.d.ts +0 -1
  7. package/dist/lib/GradleWrapper.js +1 -1
  8. package/dist/lib/ImageHelper.js +2 -2
  9. package/dist/lib/ShortcutInfo.js +5 -5
  10. package/dist/lib/TwaGenerator.d.ts +1 -1
  11. package/dist/lib/TwaGenerator.js +10 -8
  12. package/dist/lib/TwaManifest.d.ts +10 -7
  13. package/dist/lib/TwaManifest.js +26 -19
  14. package/dist/lib/androidSdk/AndroidSdkTools.d.ts +1 -2
  15. package/dist/lib/androidSdk/AndroidSdkTools.js +17 -12
  16. package/dist/lib/errors/ValidatePathError.d.ts +1 -1
  17. package/dist/lib/features/AppsFlyerFeature.d.ts +1 -1
  18. package/dist/lib/features/LocationDelegationFeature.d.ts +1 -1
  19. package/dist/lib/features/LocationDelegationFeature.js +1 -1
  20. package/dist/lib/features/PlayBillingFeature.d.ts +1 -1
  21. package/dist/lib/features/PlayBillingFeature.js +1 -1
  22. package/dist/lib/jdk/JarSigner.js +1 -1
  23. package/dist/lib/jdk/JdkHelper.d.ts +0 -1
  24. package/dist/lib/jdk/JdkHelper.js +4 -4
  25. package/dist/lib/jdk/KeyTool.js +12 -12
  26. package/dist/lib/types/WebManifest.d.ts +2 -2
  27. package/dist/lib/util.d.ts +0 -1
  28. package/dist/lib/util.js +21 -22
  29. package/dist/lib/wrappers/svg2img.d.ts +0 -1
  30. package/dist/lib/wrappers/svg2img.js +4 -4
  31. package/package.json +4 -4
  32. package/template_project/app/build.gradle +9 -2
  33. package/template_project/app/src/main/AndroidManifest.xml +4 -0
  34. package/template_project/build.gradle +1 -1
  35. package/template_project/gradle/wrapper/gradle-wrapper.properties +3 -1
  36. package/template_project/gradlew +172 -111
  37. package/template_project/gradlew.bat +25 -33
@@ -27,7 +27,7 @@ class Config {
27
27
  return JSON.stringify(this);
28
28
  }
29
29
  async saveConfig(path) {
30
- await fs_1.promises.mkdir(path_1.dirname(path), { recursive: true });
30
+ await fs_1.promises.mkdir((0, path_1.dirname)(path), { recursive: true });
31
31
  await fs_1.promises.writeFile(path, this.serialize());
32
32
  }
33
33
  static deserialize(data) {
@@ -40,9 +40,11 @@ class Config {
40
40
  return Config.deserialize(data);
41
41
  }
42
42
  catch (err) {
43
- // If config file does not exist
44
- if (err.code === 'ENOENT')
45
- return undefined;
43
+ if (err instanceof Error) {
44
+ // If config file does not exist
45
+ if (err.code === 'ENOENT')
46
+ return undefined;
47
+ }
46
48
  throw err;
47
49
  }
48
50
  }
@@ -1,7 +1,7 @@
1
1
  import { Response as FetchH2Response } from 'fetch-h2';
2
2
  import { Response as NodeFetchResponse } from 'node-fetch';
3
- export declare type FetchEngine = 'node-fetch' | 'fetch-h2';
4
- export declare type NodeFetchOrFetchH2Response = FetchH2Response | NodeFetchResponse;
3
+ export type FetchEngine = 'node-fetch' | 'fetch-h2';
4
+ export type NodeFetchOrFetchH2Response = FetchH2Response | NodeFetchResponse;
5
5
  declare class FetchUtils {
6
6
  private fetchEngine;
7
7
  setFetchEngine(newFetchEngine: FetchEngine): void;
@@ -21,7 +21,7 @@ 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
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 });
24
+ const fetchh2Ctx = (0, fetch_h2_1.context)({ userAgent: userAgent, overwriteUserAgent: true });
25
25
  const fetchh2 = fetchh2Ctx.fetch;
26
26
  class FetchUtils {
27
27
  constructor() {
@@ -32,7 +32,7 @@ class FetchUtils {
32
32
  }
33
33
  async fetch(input) {
34
34
  if (this.fetchEngine == 'node-fetch') {
35
- return await node_fetch_1.default(input, { redirect: 'follow', headers: { 'User-Agent': userAgent } });
35
+ return await (0, node_fetch_1.default)(input, { redirect: 'follow', headers: { 'User-Agent': userAgent } });
36
36
  }
37
37
  else {
38
38
  return await fetchh2(input, { redirect: 'follow' });
@@ -47,7 +47,7 @@ class FetchUtils {
47
47
  let result;
48
48
  let readableStream;
49
49
  if (this.fetchEngine === 'node-fetch') {
50
- result = await node_fetch_1.default(url);
50
+ result = await (0, node_fetch_1.default)(url);
51
51
  readableStream = result.body;
52
52
  }
53
53
  else {
@@ -73,7 +73,7 @@ class FetchUtils {
73
73
  reject(err);
74
74
  });
75
75
  fileStream.on('finish', () => {
76
- resolve();
76
+ resolve({});
77
77
  });
78
78
  });
79
79
  }
@@ -1,5 +1,5 @@
1
1
  declare const TRACK_VALUES: string[];
2
- export declare type PlayStoreTrack = typeof TRACK_VALUES[number];
2
+ export type PlayStoreTrack = typeof TRACK_VALUES[number];
3
3
  export declare const PlayStoreTracks: PlayStoreTrack[];
4
4
  export declare function asPlayStoreTrack(input?: string): PlayStoreTrack | null;
5
5
  export declare class GooglePlay {
@@ -15,7 +15,8 @@
15
15
  * limitations under the License.
16
16
  */
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.GooglePlay = exports.asPlayStoreTrack = exports.PlayStoreTracks = void 0;
18
+ exports.GooglePlay = exports.PlayStoreTracks = void 0;
19
+ exports.asPlayStoreTrack = asPlayStoreTrack;
19
20
  const googleapis_1 = require("googleapis");
20
21
  const fs_1 = require("fs");
21
22
  // Possible values for release tracks
@@ -28,7 +29,6 @@ function asPlayStoreTrack(input) {
28
29
  }
29
30
  return TRACK_VALUES.includes(input) ? input : null;
30
31
  }
31
- exports.asPlayStoreTrack = asPlayStoreTrack;
32
32
  class GooglePlay {
33
33
  /**
34
34
  * Constructs a Google Play object with the gradleWrapper so we can use a
@@ -80,7 +80,7 @@ class GooglePlay {
80
80
  editId: editId,
81
81
  packageName: packageName,
82
82
  media: {
83
- body: fs_1.createReadStream(filepath),
83
+ body: (0, fs_1.createReadStream)(filepath),
84
84
  },
85
85
  }, {
86
86
  timeout: PLAY_API_TIMEOUT_MS,
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import { AndroidSdkTools } from './androidSdk/AndroidSdkTools';
3
2
  /**
4
3
  * A Wrapper around the Gradle commands.
@@ -56,7 +56,7 @@ class GradleWrapper {
56
56
  */
57
57
  async executeGradleCommand(args) {
58
58
  const env = this.androidSdkTools.getEnv();
59
- await util_1.executeFile(this.gradleCmd, args, env, undefined, this.projectLocation);
59
+ await (0, util_1.executeFile)(this.gradleCmd, args, env, undefined, this.projectLocation);
60
60
  }
61
61
  }
62
62
  exports.GradleWrapper = GradleWrapper;
@@ -24,7 +24,7 @@ const FetchUtils_1 = require("./FetchUtils");
24
24
  const util_1 = require("util");
25
25
  const svg2img_1 = require("./wrappers/svg2img");
26
26
  // fs.promises is marked as experimental. This should be replaced when stable.
27
- const fsMkDir = util_1.promisify(fs.mkdir);
27
+ const fsMkDir = (0, util_1.promisify)(fs.mkdir);
28
28
  class ImageHelper {
29
29
  async saveIcon(icon, size, fileName, backgroundColor) {
30
30
  const image = await Jimp.read(icon.data);
@@ -104,7 +104,7 @@ class ImageHelper {
104
104
  if (contentType.startsWith('image/svg')) {
105
105
  const textDecoder = new TextDecoder();
106
106
  try {
107
- body = await svg2img_1.svg2img(textDecoder.decode(body));
107
+ body = await (0, svg2img_1.svg2img)(textDecoder.decode(body));
108
108
  }
109
109
  catch (error) {
110
110
  throw new Error(`Problem reading ${iconUrl}: ${error}`);
@@ -45,8 +45,8 @@ class ShortcutInfo {
45
45
  }
46
46
  }
47
47
  toString(index) {
48
- return `[name:'${util_1.escapeGradleString(this.name)}', ` +
49
- `short_name:'${util_1.escapeGradleString(this.shortName)}', ` +
48
+ return `[name:'${(0, util_1.escapeGradleString)(this.name)}', ` +
49
+ `short_name:'${(0, util_1.escapeGradleString)(this.shortName)}', ` +
50
50
  `url:'${this.url}', ` +
51
51
  `icon:'${this.assetName(index)}']`;
52
52
  }
@@ -66,9 +66,9 @@ class ShortcutInfo {
66
66
  if (!shortcut.icons || !shortcut.url || !name) {
67
67
  throw new Error('missing metadata');
68
68
  }
69
- const suitableIcon = util_1.findSuitableIcon(shortcut.icons, 'any', MIN_SHORTCUT_ICON_SIZE);
70
- const suitableMaskableIcon = util_1.findSuitableIcon(shortcut.icons, 'maskable', MIN_SHORTCUT_ICON_SIZE);
71
- const suitableMonochromeIcon = util_1.findSuitableIcon(shortcut.icons, 'monochrome', MIN_SHORTCUT_ICON_SIZE);
69
+ const suitableIcon = (0, util_1.findSuitableIcon)(shortcut.icons, 'any', MIN_SHORTCUT_ICON_SIZE);
70
+ const suitableMaskableIcon = (0, util_1.findSuitableIcon)(shortcut.icons, 'maskable', MIN_SHORTCUT_ICON_SIZE);
71
+ const suitableMonochromeIcon = (0, util_1.findSuitableIcon)(shortcut.icons, 'monochrome', MIN_SHORTCUT_ICON_SIZE);
72
72
  if (!suitableIcon && !suitableMonochromeIcon) {
73
73
  // maskable icons also need an equivalent any icon for lower API versions.
74
74
  // any and monochrome icons work on all API versions.
@@ -1,6 +1,6 @@
1
1
  import { TwaManifest } from './TwaManifest';
2
2
  import { Log } from './Log';
3
- export declare type twaGeneratorProgress = (progress: number, total: number) => void;
3
+ export type twaGeneratorProgress = (progress: number, total: number) => void;
4
4
  /**
5
5
  * Generates TWA Projects from a TWA Manifest
6
6
  */
@@ -114,10 +114,10 @@ function shortcutImages(assetName) {
114
114
  ];
115
115
  }
116
116
  // fs.promises is marked as experimental. This should be replaced when stable.
117
- const fsMkDir = util_1.promisify(fs.mkdir);
118
- const fsCopyFile = util_1.promisify(fs.copyFile);
119
- const fsWriteFile = util_1.promisify(fs.writeFile);
120
- const fsReadFile = util_1.promisify(fs.readFile);
117
+ const fsMkDir = (0, util_1.promisify)(fs.mkdir);
118
+ const fsCopyFile = (0, util_1.promisify)(fs.copyFile);
119
+ const fsWriteFile = (0, util_1.promisify)(fs.writeFile);
120
+ const fsReadFile = (0, util_1.promisify)(fs.readFile);
121
121
  // eslint-disable-next-line @typescript-eslint/no-empty-function
122
122
  const noOpProgress = () => { };
123
123
  /**
@@ -176,7 +176,7 @@ class TwaGenerator {
176
176
  async applyTemplate(sourceFile, destFile, args) {
177
177
  await fsMkDir(path.dirname(destFile), { recursive: true });
178
178
  const templateFile = await fsReadFile(sourceFile, 'utf-8');
179
- const output = lodash_1.template(templateFile)(args);
179
+ const output = (0, lodash_1.template)(templateFile)(args);
180
180
  await fsWriteFile(destFile, output);
181
181
  }
182
182
  async applyTemplateList(sourceDir, targetDir, fileList, args) {
@@ -191,7 +191,7 @@ class TwaGenerator {
191
191
  const destFile = path.join(targetDir, JAVA_DIR, packageName.split('.').join('/'), filename);
192
192
  await fsMkDir(path.dirname(destFile), { recursive: true });
193
193
  const templateFile = await fsReadFile(sourceFile, 'utf-8');
194
- const output = lodash_1.template(templateFile)(args);
194
+ const output = (0, lodash_1.template)(templateFile)(args);
195
195
  await fsWriteFile(destFile, output);
196
196
  }
197
197
  applyJavaTemplates(sourceDir, targetDir, packageName, fileList, args) {
@@ -274,7 +274,9 @@ class TwaGenerator {
274
274
  actions: ['android.intent.action.SEND'],
275
275
  mimeTypes: [],
276
276
  };
277
- if (((_b = (_a = twaManifest.shareTarget) === null || _a === void 0 ? void 0 : _a.params) === null || _b === void 0 ? void 0 : _b.url) || ((_d = (_c = twaManifest.shareTarget) === null || _c === void 0 ? void 0 : _c.params) === null || _d === void 0 ? void 0 : _d.title) || ((_f = (_e = twaManifest.shareTarget) === null || _e === void 0 ? void 0 : _e.params) === null || _f === void 0 ? void 0 : _f.text)) {
277
+ if (((_b = (_a = twaManifest.shareTarget) === null || _a === void 0 ? void 0 : _a.params) === null || _b === void 0 ? void 0 : _b.url) ||
278
+ ((_d = (_c = twaManifest.shareTarget) === null || _c === void 0 ? void 0 : _c.params) === null || _d === void 0 ? void 0 : _d.title) ||
279
+ ((_f = (_e = twaManifest.shareTarget) === null || _e === void 0 ? void 0 : _e.params) === null || _f === void 0 ? void 0 : _f.text)) {
278
280
  shareTargetIntentFilter.mimeTypes.push('text/plain');
279
281
  }
280
282
  if ((_h = (_g = twaManifest.shareTarget) === null || _g === void 0 ? void 0 : _g.params) === null || _h === void 0 ? void 0 : _h.files) {
@@ -356,7 +358,7 @@ class TwaGenerator {
356
358
  * @param targetDirectory the directory where the project was created.
357
359
  */
358
360
  async removeTwaProject(targetDirectory) {
359
- await Promise.all(DELETE_PROJECT_FILE_LIST.map((entry) => util_2.rmdir(path.join(targetDirectory, entry))));
361
+ await Promise.all(DELETE_PROJECT_FILE_LIST.map((entry) => (0, util_2.rmdir)(path.join(targetDirectory, entry))));
360
362
  }
361
363
  }
362
364
  exports.TwaGenerator = TwaGenerator;
@@ -7,22 +7,22 @@ import { PlayBillingConfig } from './features/PlayBillingFeature';
7
7
  import { FirstRunFlagConfig } from './features/FirstRunFlagFeature';
8
8
  import { ArCoreConfig } from './features/ArCoreFeature';
9
9
  declare const DISPLAY_MODE_VALUES: string[];
10
- export declare type DisplayMode = typeof DISPLAY_MODE_VALUES[number];
10
+ export type DisplayMode = typeof DISPLAY_MODE_VALUES[number];
11
11
  export declare const DisplayModes: DisplayMode[];
12
12
  export declare function asDisplayMode(input: string): DisplayMode | null;
13
13
  declare const ORIENTATION_VALUES: string[];
14
- export declare type Orientation = typeof ORIENTATION_VALUES[number];
14
+ export type Orientation = typeof ORIENTATION_VALUES[number];
15
15
  export declare const Orientations: Orientation[];
16
16
  export declare function asOrientation(input?: string): Orientation | null;
17
- export declare type FallbackType = 'customtabs' | 'webview';
18
- declare type Features = {
17
+ export type FallbackType = 'customtabs' | 'webview';
18
+ type Features = {
19
19
  appsFlyer?: AppsFlyerConfig;
20
20
  locationDelegation?: LocationDelegationConfig;
21
21
  playBilling?: PlayBillingConfig;
22
22
  firstRunFlag?: FirstRunFlagConfig;
23
23
  arCore?: ArCoreConfig;
24
24
  };
25
- declare type alphaDependencies = {
25
+ type alphaDependencies = {
26
26
  enabled: boolean;
27
27
  };
28
28
  /**
@@ -34,7 +34,8 @@ declare type alphaDependencies = {
34
34
  * name: '<%= name %>', // The name shown on the Android Launcher.
35
35
  * display: '<%= display %>', // The display mode for the TWA.
36
36
  * themeColor: '<%= themeColor %>', // The color used for the status bar.
37
- * navigationColor: '<%= themeColor %>', // The color used for the navigation bar.
37
+ * themeColorDark: '<%= themeColorDark %>', // The color used for the dark status bar.
38
+ * navigationColor: '<%= navigationColor %>', // The color used for the navigation bar.
38
39
  * navigationColorDark: '<%= navigationColorDark %>', // The color used for the dark navbar.
39
40
  * navigationDividerColor: '<%= navigationDividerColor %>', // The color used for the
40
41
  * navbar divider.
@@ -68,6 +69,7 @@ export declare class TwaManifest {
68
69
  launcherName: string;
69
70
  display: DisplayMode;
70
71
  themeColor: Color;
72
+ themeColorDark: Color;
71
73
  navigationColor: Color;
72
74
  navigationColorDark: Color;
73
75
  navigationDividerColor: Color;
@@ -195,6 +197,7 @@ export interface TwaManifestJson {
195
197
  launcherName?: string;
196
198
  display?: string;
197
199
  themeColor: string;
200
+ themeColorDark?: string;
198
201
  navigationColor: string;
199
202
  navigationColorDark?: string;
200
203
  navigationDividerColor?: string;
@@ -239,7 +242,7 @@ export interface SigningKeyInfo {
239
242
  path: string;
240
243
  alias: string;
241
244
  }
242
- export declare type Fingerprint = {
245
+ export type Fingerprint = {
243
246
  name?: string;
244
247
  value: string;
245
248
  };
@@ -15,7 +15,9 @@
15
15
  */
16
16
  'use strict';
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.TwaManifest = exports.asOrientation = exports.Orientations = exports.asDisplayMode = exports.DisplayModes = void 0;
18
+ exports.TwaManifest = exports.Orientations = exports.DisplayModes = void 0;
19
+ exports.asDisplayMode = asDisplayMode;
20
+ exports.asOrientation = asOrientation;
19
21
  const fs = require("fs");
20
22
  const FetchUtils_1 = require("./FetchUtils");
21
23
  const util_1 = require("./util");
@@ -34,7 +36,6 @@ exports.DisplayModes = [...DISPLAY_MODE_VALUES];
34
36
  function asDisplayMode(input) {
35
37
  return DISPLAY_MODE_VALUES.includes(input) ? input : null;
36
38
  }
37
- exports.asDisplayMode = asDisplayMode;
38
39
  // Possible values for screen orientation, as defined in `android-browser-helper`:
39
40
  // https://github.com/GoogleChrome/android-browser-helper/blob/alpha/androidbrowserhelper/src/main/java/com/google/androidbrowserhelper/trusted/LauncherActivityMetadata.java#L191-L216
40
41
  const ORIENTATION_VALUES = ['default', 'any', 'natural', 'landscape', 'portrait',
@@ -46,12 +47,12 @@ function asOrientation(input) {
46
47
  }
47
48
  return ORIENTATION_VALUES.includes(input) ? input : null;
48
49
  }
49
- exports.asOrientation = asOrientation;
50
50
  // Default values used on the Twa Manifest
51
51
  const DEFAULT_SPLASHSCREEN_FADEOUT_DURATION = 300;
52
52
  const DEFAULT_APP_NAME = 'My TWA';
53
53
  const DEFAULT_DISPLAY_MODE = 'standalone';
54
54
  const DEFAULT_THEME_COLOR = '#FFFFFF';
55
+ const DEFAULT_THEME_COLOR_DARK = '#000000';
55
56
  const DEFAULT_NAVIGATION_COLOR = '#000000';
56
57
  const DEFAULT_NAVIGATION_DIVIDER_COLOR = '#00000000';
57
58
  const DEFAULT_BACKGROUND_COLOR = '#FFFFFF';
@@ -72,7 +73,8 @@ const DEFAULT_ORIENTATION = 'default';
72
73
  * name: '<%= name %>', // The name shown on the Android Launcher.
73
74
  * display: '<%= display %>', // The display mode for the TWA.
74
75
  * themeColor: '<%= themeColor %>', // The color used for the status bar.
75
- * navigationColor: '<%= themeColor %>', // The color used for the navigation bar.
76
+ * themeColorDark: '<%= themeColorDark %>', // The color used for the dark status bar.
77
+ * navigationColor: '<%= navigationColor %>', // The color used for the navigation bar.
76
78
  * navigationColorDark: '<%= navigationColorDark %>', // The color used for the dark navbar.
77
79
  * navigationDividerColor: '<%= navigationDividerColor %>', // The color used for the
78
80
  * navbar divider.
@@ -101,7 +103,7 @@ const DEFAULT_ORIENTATION = 'default';
101
103
  */
102
104
  class TwaManifest {
103
105
  constructor(data) {
104
- var _a, _b, _c;
106
+ var _a, _b, _c, _d;
105
107
  this.packageId = data.packageId;
106
108
  this.host = data.host;
107
109
  this.name = data.name;
@@ -110,10 +112,11 @@ class TwaManifest {
110
112
  // Older manifests may not have this field:
111
113
  this.display = asDisplayMode(data.display) || DEFAULT_DISPLAY_MODE;
112
114
  this.themeColor = new Color(data.themeColor);
115
+ this.themeColorDark = new Color((_a = data.themeColorDark) !== null && _a !== void 0 ? _a : DEFAULT_THEME_COLOR_DARK);
113
116
  this.navigationColor = new Color(data.navigationColor);
114
- this.navigationColorDark = new Color((_a = data.navigationColorDark) !== null && _a !== void 0 ? _a : DEFAULT_NAVIGATION_COLOR);
115
- this.navigationDividerColor = new Color((_b = data.navigationDividerColor) !== null && _b !== void 0 ? _b : DEFAULT_NAVIGATION_DIVIDER_COLOR);
116
- this.navigationDividerColorDark = new Color((_c = data.navigationDividerColorDark) !== null && _c !== void 0 ? _c : DEFAULT_NAVIGATION_COLOR);
117
+ this.navigationColorDark = new Color((_b = data.navigationColorDark) !== null && _b !== void 0 ? _b : DEFAULT_NAVIGATION_COLOR);
118
+ this.navigationDividerColor = new Color((_c = data.navigationDividerColor) !== null && _c !== void 0 ? _c : DEFAULT_NAVIGATION_DIVIDER_COLOR);
119
+ this.navigationDividerColorDark = new Color((_d = data.navigationDividerColorDark) !== null && _d !== void 0 ? _d : DEFAULT_NAVIGATION_COLOR);
117
120
  this.backgroundColor = new Color(data.backgroundColor);
118
121
  this.enableNotifications = data.enableNotifications;
119
122
  this.startUrl = data.startUrl;
@@ -153,6 +156,7 @@ class TwaManifest {
153
156
  toJson() {
154
157
  return Object.assign({}, this, {
155
158
  themeColor: this.themeColor.hex(),
159
+ themeColorDark: this.themeColorDark.hex(),
156
160
  navigationColor: this.navigationColor.hex(),
157
161
  navigationColorDark: this.navigationColorDark.hex(),
158
162
  navigationDividerColor: this.navigationDividerColor.hex(),
@@ -180,22 +184,22 @@ class TwaManifest {
180
184
  */
181
185
  validate() {
182
186
  let error;
183
- error = util_1.validateNotEmpty(this.host, 'host');
187
+ error = (0, util_1.validateNotEmpty)(this.host, 'host');
184
188
  if (error != null) {
185
189
  return error;
186
190
  }
187
- error = util_1.validateNotEmpty(this.name, 'name');
191
+ error = (0, util_1.validateNotEmpty)(this.name, 'name');
188
192
  if (error != null) {
189
193
  return error;
190
194
  }
191
- error = util_1.validateNotEmpty(this.startUrl, 'startUrl');
195
+ error = (0, util_1.validateNotEmpty)(this.startUrl, 'startUrl');
192
196
  if (error != null) {
193
197
  return error;
194
198
  }
195
199
  if (!this.iconUrl) {
196
200
  return 'iconUrl cannot be empty';
197
201
  }
198
- error = util_1.validateNotEmpty(this.iconUrl, 'iconUrl');
202
+ error = (0, util_1.validateNotEmpty)(this.iconUrl, 'iconUrl');
199
203
  if (error != null) {
200
204
  return error;
201
205
  }
@@ -214,9 +218,9 @@ class TwaManifest {
214
218
  */
215
219
  static fromWebManifestJson(webManifestUrl, webManifest) {
216
220
  var _a;
217
- const icon = util_1.findSuitableIcon(webManifest.icons, 'any', MIN_ICON_SIZE);
218
- const maskableIcon = util_1.findSuitableIcon(webManifest.icons, 'maskable', MIN_ICON_SIZE);
219
- const monochromeIcon = util_1.findSuitableIcon(webManifest.icons, 'monochrome', MIN_NOTIFICATION_ICON_SIZE);
221
+ const icon = (0, util_1.findSuitableIcon)(webManifest.icons, 'any', MIN_ICON_SIZE);
222
+ const maskableIcon = (0, util_1.findSuitableIcon)(webManifest.icons, 'maskable', MIN_ICON_SIZE);
223
+ const monochromeIcon = (0, util_1.findSuitableIcon)(webManifest.icons, 'monochrome', MIN_NOTIFICATION_ICON_SIZE);
220
224
  const fullStartUrl = new URL(webManifest['start_url'] || '/', webManifestUrl);
221
225
  const fullScopeUrl = new URL(webManifest['scope'] || '.', webManifestUrl);
222
226
  const shortcuts = this.getShortcuts(webManifestUrl, webManifest);
@@ -224,12 +228,14 @@ class TwaManifest {
224
228
  return icon ? new URL(icon.src, webManifestUrl).toString() : undefined;
225
229
  }
226
230
  const twaManifest = new TwaManifest({
227
- packageId: util_1.generatePackageId(webManifestUrl.host) || '',
231
+ packageId: (0, util_1.generatePackageId)(webManifestUrl.host) || '',
228
232
  host: webManifestUrl.host,
229
233
  name: webManifest['name'] || webManifest['short_name'] || DEFAULT_APP_NAME,
230
- launcherName: webManifest['short_name'] || ((_a = webManifest['name']) === null || _a === void 0 ? void 0 : _a.substring(0, SHORT_NAME_MAX_SIZE)) || DEFAULT_APP_NAME,
234
+ launcherName: webManifest['short_name'] ||
235
+ ((_a = webManifest['name']) === null || _a === void 0 ? void 0 : _a.substring(0, SHORT_NAME_MAX_SIZE)) || DEFAULT_APP_NAME,
231
236
  display: asDisplayMode(webManifest['display']) || DEFAULT_DISPLAY_MODE,
232
237
  themeColor: webManifest['theme_color'] || DEFAULT_THEME_COLOR,
238
+ themeColorDark: DEFAULT_THEME_COLOR_DARK,
233
239
  navigationColor: DEFAULT_NAVIGATION_COLOR,
234
240
  navigationColorDark: DEFAULT_NAVIGATION_COLOR,
235
241
  navigationDividerColor: DEFAULT_NAVIGATION_DIVIDER_COLOR,
@@ -350,7 +356,7 @@ class TwaManifest {
350
356
  return icon ? new URL(icon.src, webManifestUrl).toString() : undefined;
351
357
  }
352
358
  return (fieldsToIgnore.includes(fieldName)) ? oldUrl :
353
- resolveIconUrl(util_1.findSuitableIcon(icons, iconType, iconSize));
359
+ resolveIconUrl((0, util_1.findSuitableIcon)(icons, iconType, iconSize));
354
360
  }
355
361
  /**
356
362
  * Merges the Twa Manifest with the web manifest. Ignores the specified fields.
@@ -377,7 +383,8 @@ class TwaManifest {
377
383
  const twaManifest = new TwaManifest({
378
384
  ...oldTwaManifestJson,
379
385
  name: this.getNewFieldValue('name', fieldsToIgnore, oldTwaManifest.name, webManifest['name'] || webManifest['short_name']),
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))),
386
+ launcherName: this.getNewFieldValue('short_name', fieldsToIgnore, oldTwaManifest.launcherName, webManifest['short_name'] ||
387
+ ((_a = webManifest['name']) === null || _a === void 0 ? void 0 : _a.substring(0, SHORT_NAME_MAX_SIZE))),
381
388
  display: this.getNewFieldValue('display', fieldsToIgnore, oldTwaManifest.display, asDisplayMode(webManifest['display'])),
382
389
  fullScopeUrl: this.getNewFieldValue('fullScopeUrl', fieldsToIgnore, (_b = oldTwaManifest.fullScopeUrl) === null || _b === void 0 ? void 0 : _b.toString(), fullScopeUrl.toString()),
383
390
  themeColor: this.getNewFieldValue('themeColor', fieldsToIgnore, oldTwaManifest.themeColor.hex(), webManifest['theme_color']),
@@ -1,10 +1,9 @@
1
- /// <reference types="node" />
2
1
  import { Config } from '../Config';
3
2
  import { JdkHelper } from '../jdk/JdkHelper';
4
3
  import { Log } from '../../lib/Log';
5
4
  import { Result } from '../../lib/Result';
6
5
  import { ValidatePathError } from '../errors/ValidatePathError';
7
- export declare const BUILD_TOOLS_VERSION = "33.0.2";
6
+ export declare const BUILD_TOOLS_VERSION = "34.0.0";
8
7
  /**
9
8
  * Wraps functionality of the Android SDK Tools and allows them to be invoked programatically.
10
9
  */
@@ -22,11 +22,26 @@ const util = require("../util");
22
22
  const Log_1 = require("../../lib/Log");
23
23
  const Result_1 = require("../../lib/Result");
24
24
  const ValidatePathError_1 = require("../errors/ValidatePathError");
25
- exports.BUILD_TOOLS_VERSION = '33.0.2';
25
+ exports.BUILD_TOOLS_VERSION = '34.0.0';
26
26
  /**
27
27
  * Wraps functionality of the Android SDK Tools and allows them to be invoked programatically.
28
28
  */
29
29
  class AndroidSdkTools {
30
+ static async create(process, config, jdkHelper, log = new Log_1.ConsoleLog('AndroidSdkTools')) {
31
+ // unwrap will throw an error in case that the the path is valid and else will do nothing.
32
+ (await AndroidSdkTools.validatePath(config.androidSdkPath)).unwrap();
33
+ try {
34
+ return new AndroidSdkTools(process, config, jdkHelper, log);
35
+ }
36
+ catch (error) {
37
+ if (typeof error === 'string') {
38
+ throw new Error(error);
39
+ }
40
+ else {
41
+ throw error;
42
+ }
43
+ }
44
+ }
30
45
  /**
31
46
  * Constructs a new instance of AndroidSdkTools.
32
47
  *
@@ -46,16 +61,6 @@ class AndroidSdkTools {
46
61
  this.pathJoin = path.posix.join;
47
62
  }
48
63
  }
49
- static async create(process, config, jdkHelper, log = new Log_1.ConsoleLog('AndroidSdkTools')) {
50
- // unwrap will throw an error in case that the the path is valid and else will do nothing.
51
- (await AndroidSdkTools.validatePath(config.androidSdkPath)).unwrap();
52
- try {
53
- return new AndroidSdkTools(process, config, jdkHelper, log);
54
- }
55
- catch (error) {
56
- throw new Error(error);
57
- }
58
- }
59
64
  /**
60
65
  * Installs the build tools into the the Android SDK. Equivalent to running
61
66
  *
@@ -200,7 +205,7 @@ class AndroidSdkTools {
200
205
  const installCmd = [
201
206
  `"${this.pathJoin(this.getAndroidHome(), '/platform-tools/adb')}"`,
202
207
  'install',
203
- '-r',
208
+ '-r', // Replace app if another with the same package id already installed.
204
209
  ...passthroughArgs,
205
210
  apkFilePath,
206
211
  ];
@@ -1,4 +1,4 @@
1
- export declare type ErrorCode = 'PathIsNotCorrect' | 'PathIsNotSupported';
1
+ export type ErrorCode = 'PathIsNotCorrect' | 'PathIsNotSupported';
2
2
  /**
3
3
  * Extends Error type to have an error code in addition to the Error's message.
4
4
  */
@@ -1,5 +1,5 @@
1
1
  import { EmptyFeature } from './EmptyFeature';
2
- export declare type AppsFlyerConfig = {
2
+ export type AppsFlyerConfig = {
3
3
  enabled: boolean;
4
4
  appsFlyerId: string;
5
5
  };
@@ -1,5 +1,5 @@
1
1
  import { EmptyFeature } from './EmptyFeature';
2
- export declare type LocationDelegationConfig = {
2
+ export type LocationDelegationConfig = {
3
3
  enabled: boolean;
4
4
  };
5
5
  export declare class LocationDelegationFeature extends EmptyFeature {
@@ -20,7 +20,7 @@ const EmptyFeature_1 = require("./EmptyFeature");
20
20
  class LocationDelegationFeature extends EmptyFeature_1.EmptyFeature {
21
21
  constructor() {
22
22
  super('locationDelegation');
23
- this.buildGradle.dependencies.push('com.google.androidbrowserhelper:locationdelegation:1.0.1');
23
+ this.buildGradle.dependencies.push('com.google.androidbrowserhelper:locationdelegation:1.1.1');
24
24
  this.androidManifest.components.push(`<activity android:name=
25
25
  "com.google.androidbrowserhelper.locationdelegation.PermissionRequestActivity"/>`);
26
26
  this.delegationService.imports.push('com.google.androidbrowserhelper.locationdelegation' +
@@ -1,5 +1,5 @@
1
1
  import { EmptyFeature } from './EmptyFeature';
2
- export declare type PlayBillingConfig = {
2
+ export type PlayBillingConfig = {
3
3
  enabled: boolean;
4
4
  };
5
5
  export declare class PlayBillingFeature extends EmptyFeature {
@@ -20,7 +20,7 @@ const EmptyFeature_1 = require("./EmptyFeature");
20
20
  class PlayBillingFeature extends EmptyFeature_1.EmptyFeature {
21
21
  constructor() {
22
22
  super('playbilling');
23
- this.buildGradle.dependencies.push('com.google.androidbrowserhelper:billing:1.0.0-alpha10');
23
+ this.buildGradle.dependencies.push('com.google.androidbrowserhelper:billing:1.0.0-alpha11');
24
24
  this.androidManifest.components.push(`
25
25
  <activity
26
26
  android:name="com.google.androidbrowserhelper.playbilling.provider.PaymentActivity"
@@ -32,7 +32,7 @@ class JarSigner {
32
32
  */
33
33
  async sign(signingKeyInfo, storepass, keypass, inputFile, outputFile) {
34
34
  const env = this.jdkHelper.getEnv();
35
- await util_1.executeFile(JARSIGNER_CMD, [
35
+ await (0, util_1.executeFile)(JARSIGNER_CMD, [
36
36
  '-verbose',
37
37
  '-sigalg',
38
38
  SIGNATURE_ALGORITHM,
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import { Config } from '../Config';
3
2
  import { Result } from '../Result';
4
3
  import { ValidatePathError } from '../errors/ValidatePathError';
@@ -52,7 +52,7 @@ class JdkHelper {
52
52
  async runJava(args) {
53
53
  const java = this.process.platform === 'win32' ? '/bin/java.exe' : '/bin/java';
54
54
  const runJavaCmd = this.joinPath(this.getJavaHome(), java);
55
- return await util_1.executeFile(runJavaCmd, args, this.getEnv());
55
+ return await (0, util_1.executeFile)(runJavaCmd, args, this.getEnv());
56
56
  }
57
57
  /**
58
58
  * Returns information from the JAVA_HOME, based on the config and platform.
@@ -87,7 +87,7 @@ class JdkHelper {
87
87
  */
88
88
  static async validatePath(jdkPath, currentProcess = process) {
89
89
  const join = JdkHelper.getJoinPath(currentProcess);
90
- if (!fs_1.existsSync(jdkPath)) {
90
+ if (!(0, fs_1.existsSync)(jdkPath)) {
91
91
  return Result_1.Result.error(new ValidatePathError_1.ValidatePathError(`jdkPath "${jdkPath}" does not exist.`, 'PathIsNotCorrect'));
92
92
  }
93
93
  ;
@@ -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="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'));
98
+ if (file.indexOf('JAVA_VERSION="17.0') < 0) { // Checks if the jdk's version is 17 as needed
99
+ return Result_1.Result.error(new ValidatePathError_1.ValidatePathError('JDK version not supported. JDK version 17 is required.', 'PathIsNotSupported'));
100
100
  }
101
101
  }
102
102
  catch (e) {