@bubblewrap/core 1.18.1 → 1.19.1
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/ImageHelper.js +3 -6
- package/dist/lib/ShortcutInfo.js +4 -2
- package/dist/lib/features/FeatureManager.js +4 -0
- package/dist/lib/wrappers/svg2img.d.ts +1 -9
- package/dist/lib/wrappers/svg2img.js +13 -29
- package/package.json +3 -5
- package/template_project/app/build.gradle +3 -3
- package/template_project/app/src/main/AndroidManifest.xml +4 -0
package/dist/lib/ImageHelper.js
CHANGED
|
@@ -101,15 +101,12 @@ class ImageHelper {
|
|
|
101
101
|
}
|
|
102
102
|
let body = await response.arrayBuffer();
|
|
103
103
|
if (contentType.startsWith('image/svg')) {
|
|
104
|
-
|
|
105
|
-
throw new Error(`This installation doesn't support image/svg. Please, ensure the optional
|
|
106
|
-
"svg2img" library is installed or use an alternative image format.`);
|
|
107
|
-
}
|
|
104
|
+
const textDecoder = new TextDecoder();
|
|
108
105
|
try {
|
|
109
|
-
body = await svg2img_1.svg2img(
|
|
106
|
+
body = await svg2img_1.svg2img(textDecoder.decode(body));
|
|
110
107
|
}
|
|
111
108
|
catch (error) {
|
|
112
|
-
throw new Error(`Problem reading ${iconUrl}: ${error
|
|
109
|
+
throw new Error(`Problem reading ${iconUrl}: ${error}`);
|
|
113
110
|
}
|
|
114
111
|
}
|
|
115
112
|
return {
|
package/dist/lib/ShortcutInfo.js
CHANGED
|
@@ -45,8 +45,10 @@ class ShortcutInfo {
|
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
toString(index) {
|
|
48
|
-
return `[name:'${this.name}',
|
|
49
|
-
`
|
|
48
|
+
return `[name:'${util_1.escapeGradleString(this.name)}', ` +
|
|
49
|
+
`short_name:'${util_1.escapeGradleString(this.shortName)}', ` +
|
|
50
|
+
`url:'${this.url}', ` +
|
|
51
|
+
`icon:'${this.assetName(index)}']`;
|
|
50
52
|
}
|
|
51
53
|
assetName(index) {
|
|
52
54
|
return `shortcut_${index}`;
|
|
@@ -91,6 +91,10 @@ class FeatureManager {
|
|
|
91
91
|
if ((_g = twaManifest.features.arCore) === null || _g === void 0 ? void 0 : _g.enabled) {
|
|
92
92
|
this.addFeature(new ArCoreFeature_1.ArCoreFeature());
|
|
93
93
|
}
|
|
94
|
+
// Android T+ needs permission to request sending notifications.
|
|
95
|
+
if (twaManifest.enableNotifications) {
|
|
96
|
+
this.androidManifest.permissions.add('android.permission.POST_NOTIFICATIONS');
|
|
97
|
+
}
|
|
94
98
|
}
|
|
95
99
|
addFeature(feature) {
|
|
96
100
|
// Adds properties to build.
|
|
@@ -4,12 +4,4 @@ export declare enum Format {
|
|
|
4
4
|
jpg = "jpg",
|
|
5
5
|
png = "png"
|
|
6
6
|
}
|
|
7
|
-
export
|
|
8
|
-
width?: number;
|
|
9
|
-
height?: number;
|
|
10
|
-
preserveAspectRatio?: boolean | string;
|
|
11
|
-
format?: Format;
|
|
12
|
-
quality?: number;
|
|
13
|
-
}
|
|
14
|
-
export declare function isSvgSupported(): boolean;
|
|
15
|
-
export declare function svg2img(svg: string, options?: Svg2imgOptions): Promise<Buffer>;
|
|
7
|
+
export declare function svg2img(svg: string): Promise<Buffer>;
|
|
@@ -15,40 +15,24 @@
|
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.svg2img = exports.
|
|
19
|
-
|
|
20
|
-
// once it will, there is no need for this class.
|
|
21
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
22
|
-
let _svg2img;
|
|
23
|
-
try {
|
|
24
|
-
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
25
|
-
_svg2img = require('svg2img');
|
|
26
|
-
}
|
|
27
|
-
catch (e) {
|
|
28
|
-
console.debug('Unable to load the "svg2img" library. SVGs are not supported');
|
|
29
|
-
}
|
|
18
|
+
exports.svg2img = exports.Format = void 0;
|
|
19
|
+
const resvg_js_1 = require("@resvg/resvg-js");
|
|
30
20
|
var Format;
|
|
31
21
|
(function (Format) {
|
|
32
22
|
Format["jpeg"] = "jpeg";
|
|
33
23
|
Format["jpg"] = "jpg";
|
|
34
24
|
Format["png"] = "png";
|
|
35
25
|
})(Format = exports.Format || (exports.Format = {}));
|
|
36
|
-
function
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
if (error) {
|
|
48
|
-
return reject(error);
|
|
49
|
-
}
|
|
50
|
-
return resolve(buffer);
|
|
51
|
-
});
|
|
52
|
-
});
|
|
26
|
+
async function svg2img(svg) {
|
|
27
|
+
const opt = {
|
|
28
|
+
fitTo: {
|
|
29
|
+
mode: 'width',
|
|
30
|
+
value: 1200,
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
const resvg = new resvg_js_1.Resvg(svg, opt);
|
|
34
|
+
const pngData = resvg.render();
|
|
35
|
+
const pngBuffer = pngData.asPng();
|
|
36
|
+
return pngBuffer;
|
|
53
37
|
}
|
|
54
38
|
exports.svg2img = svg2img;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bubblewrap/core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.19.1",
|
|
4
4
|
"description": "Core Library to generate, build and sign TWA projects",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "tsc",
|
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
"author": "",
|
|
31
31
|
"license": "Apache-2.0",
|
|
32
32
|
"dependencies": {
|
|
33
|
+
"@resvg/resvg-js": "^2.2.0",
|
|
33
34
|
"@types/color": "^3.0.0",
|
|
34
35
|
"@types/extract-zip": "^1.6.2",
|
|
35
36
|
"@types/gapi.client.androidpublisher": "^3.0.0",
|
|
@@ -53,8 +54,5 @@
|
|
|
53
54
|
"tar": "^6.1.0",
|
|
54
55
|
"valid-url": "^1.0.9"
|
|
55
56
|
},
|
|
56
|
-
"
|
|
57
|
-
"svg2img": "^0.9.3"
|
|
58
|
-
},
|
|
59
|
-
"gitHead": "ce4579232bfb1a211e7c5cf2328fa52bdb26020d"
|
|
57
|
+
"gitHead": "0214f23544fd43aab07b7963a16d2d8fe25be7b4"
|
|
60
58
|
}
|
|
@@ -42,7 +42,7 @@ def twaManifest = [
|
|
|
42
42
|
// The duration of fade out animation in milliseconds to be played when removing splash screen.
|
|
43
43
|
splashScreenFadeOutDuration: <%= splashScreenFadeOutDuration %>,
|
|
44
44
|
generatorApp: '<%= generatorApp %>', // Application that generated the Android Project
|
|
45
|
-
// The fallback strategy for when Trusted Web Activity is not
|
|
45
|
+
// The fallback strategy for when Trusted Web Activity is not available. Possible values are
|
|
46
46
|
// 'customtabs' and 'webview'.
|
|
47
47
|
fallbackType: '<%= fallbackType %>',
|
|
48
48
|
enableSiteSettingsShortcut: '<%= enableSiteSettingsShortcut %>',
|
|
@@ -86,7 +86,7 @@ android {
|
|
|
86
86
|
<% } %>
|
|
87
87
|
|
|
88
88
|
// The hostname is used when building the intent-filter, so the TWA is able to
|
|
89
|
-
// handle Intents to open
|
|
89
|
+
// handle Intents to open host url of the application.
|
|
90
90
|
resValue "string", "hostName", twaManifest.hostName
|
|
91
91
|
|
|
92
92
|
// This attribute sets the status bar color for the TWA. It can be either set here or in
|
|
@@ -118,7 +118,7 @@ android {
|
|
|
118
118
|
// Trusted Web Activity.
|
|
119
119
|
resValue "color", "backgroundColor", twaManifest.backgroundColor
|
|
120
120
|
|
|
121
|
-
// Defines a provider authority
|
|
121
|
+
// Defines a provider authority for the Splash Screen
|
|
122
122
|
resValue "string", "providerAuthority", twaManifest.applicationId + '.fileprovider'
|
|
123
123
|
|
|
124
124
|
// The enableNotification resource is used to enable or disable the
|
|
@@ -233,6 +233,10 @@
|
|
|
233
233
|
</intent-filter>
|
|
234
234
|
</service>
|
|
235
235
|
|
|
236
|
+
<% if (enableNotifications) { %>
|
|
237
|
+
<activity android:name="com.google.androidbrowserhelper.trusted.NotificationPermissionRequestActivity" />
|
|
238
|
+
<% } %>
|
|
239
|
+
|
|
236
240
|
<% for(const component of androidManifest.components) { %>
|
|
237
241
|
<%= component %>
|
|
238
242
|
<% } %>
|