parent
d0be006776
commit
b730c34923
@ -1,116 +1,116 @@
|
|||||||
{
|
{
|
||||||
"images" : [
|
"images": [
|
||||||
{
|
{
|
||||||
"size" : "20x20",
|
"size": "20x20",
|
||||||
"idiom" : "iphone",
|
"idiom": "iphone",
|
||||||
"filename" : "AppIcon-20x20@2x.png",
|
"filename": "AppIcon-20x20@2x.png",
|
||||||
"scale" : "2x"
|
"scale": "2x"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"size" : "20x20",
|
"size": "20x20",
|
||||||
"idiom" : "iphone",
|
"idiom": "iphone",
|
||||||
"filename" : "AppIcon-20x20@3x.png",
|
"filename": "AppIcon-20x20@3x.png",
|
||||||
"scale" : "3x"
|
"scale": "3x"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"size" : "29x29",
|
"size": "29x29",
|
||||||
"idiom" : "iphone",
|
"idiom": "iphone",
|
||||||
"filename" : "AppIcon-29x29@2x-1.png",
|
"filename": "AppIcon-29x29@2x-1.png",
|
||||||
"scale" : "2x"
|
"scale": "2x"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"size" : "29x29",
|
"size": "29x29",
|
||||||
"idiom" : "iphone",
|
"idiom": "iphone",
|
||||||
"filename" : "AppIcon-29x29@3x.png",
|
"filename": "AppIcon-29x29@3x.png",
|
||||||
"scale" : "3x"
|
"scale": "3x"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"size" : "40x40",
|
"size": "40x40",
|
||||||
"idiom" : "iphone",
|
"idiom": "iphone",
|
||||||
"filename" : "AppIcon-40x40@2x.png",
|
"filename": "AppIcon-40x40@2x.png",
|
||||||
"scale" : "2x"
|
"scale": "2x"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"size" : "40x40",
|
"size": "40x40",
|
||||||
"idiom" : "iphone",
|
"idiom": "iphone",
|
||||||
"filename" : "AppIcon-40x40@3x.png",
|
"filename": "AppIcon-40x40@3x.png",
|
||||||
"scale" : "3x"
|
"scale": "3x"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"size" : "60x60",
|
"size": "60x60",
|
||||||
"idiom" : "iphone",
|
"idiom": "iphone",
|
||||||
"filename" : "AppIcon-60x60@2x.png",
|
"filename": "AppIcon-60x60@2x.png",
|
||||||
"scale" : "2x"
|
"scale": "2x"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"size" : "60x60",
|
"size": "60x60",
|
||||||
"idiom" : "iphone",
|
"idiom": "iphone",
|
||||||
"filename" : "AppIcon-60x60@3x.png",
|
"filename": "AppIcon-60x60@3x.png",
|
||||||
"scale" : "3x"
|
"scale": "3x"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"size" : "20x20",
|
"size": "20x20",
|
||||||
"idiom" : "ipad",
|
"idiom": "ipad",
|
||||||
"filename" : "AppIcon-20x20@1x.png",
|
"filename": "AppIcon-20x20@1x.png",
|
||||||
"scale" : "1x"
|
"scale": "1x"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"size" : "20x20",
|
"size": "20x20",
|
||||||
"idiom" : "ipad",
|
"idiom": "ipad",
|
||||||
"filename" : "AppIcon-20x20@2x-1.png",
|
"filename": "AppIcon-20x20@2x-1.png",
|
||||||
"scale" : "2x"
|
"scale": "2x"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"size" : "29x29",
|
"size": "29x29",
|
||||||
"idiom" : "ipad",
|
"idiom": "ipad",
|
||||||
"filename" : "AppIcon-29x29@1x.png",
|
"filename": "AppIcon-29x29@1x.png",
|
||||||
"scale" : "1x"
|
"scale": "1x"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"size" : "29x29",
|
"size": "29x29",
|
||||||
"idiom" : "ipad",
|
"idiom": "ipad",
|
||||||
"filename" : "AppIcon-29x29@2x.png",
|
"filename": "AppIcon-29x29@2x.png",
|
||||||
"scale" : "2x"
|
"scale": "2x"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"size" : "40x40",
|
"size": "40x40",
|
||||||
"idiom" : "ipad",
|
"idiom": "ipad",
|
||||||
"filename" : "AppIcon-40x40@1x.png",
|
"filename": "AppIcon-40x40@1x.png",
|
||||||
"scale" : "1x"
|
"scale": "1x"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"size" : "40x40",
|
"size": "40x40",
|
||||||
"idiom" : "ipad",
|
"idiom": "ipad",
|
||||||
"filename" : "AppIcon-40x40@2x-1.png",
|
"filename": "AppIcon-40x40@2x-1.png",
|
||||||
"scale" : "2x"
|
"scale": "2x"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"size" : "76x76",
|
"size": "76x76",
|
||||||
"idiom" : "ipad",
|
"idiom": "ipad",
|
||||||
"filename" : "AppIcon-76x76@1x.png",
|
"filename": "AppIcon-76x76@1x.png",
|
||||||
"scale" : "1x"
|
"scale": "1x"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"size" : "76x76",
|
"size": "76x76",
|
||||||
"idiom" : "ipad",
|
"idiom": "ipad",
|
||||||
"filename" : "AppIcon-76x76@2x.png",
|
"filename": "AppIcon-76x76@2x.png",
|
||||||
"scale" : "2x"
|
"scale": "2x"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"size" : "83.5x83.5",
|
"size": "83.5x83.5",
|
||||||
"idiom" : "ipad",
|
"idiom": "ipad",
|
||||||
"filename" : "AppIcon-83.5x83.5@2x.png",
|
"filename": "AppIcon-83.5x83.5@2x.png",
|
||||||
"scale" : "2x"
|
"scale": "2x"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"size" : "1024x1024",
|
"size": "1024x1024",
|
||||||
"idiom" : "ios-marketing",
|
"idiom": "ios-marketing",
|
||||||
"filename" : "AppIcon-512@2x.png",
|
"filename": "AppIcon-512@2x.png",
|
||||||
"scale" : "1x"
|
"scale": "1x"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"info" : {
|
"info": {
|
||||||
"version" : 1,
|
"version": 1,
|
||||||
"author" : "xcode"
|
"author": "xcode"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"info" : {
|
"info": {
|
||||||
"version" : 1,
|
"version": 1,
|
||||||
"author" : "xcode"
|
"author": "xcode"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,71 +1,71 @@
|
|||||||
(function () {
|
(function () {
|
||||||
let permissionSettable = false
|
let permissionSettable = false;
|
||||||
let permissionValue = 'default'
|
let permissionValue = "default";
|
||||||
|
|
||||||
function isPermissionGranted() {
|
function isPermissionGranted() {
|
||||||
if (window.Notification.permission !== 'default') {
|
if (window.Notification.permission !== "default") {
|
||||||
return Promise.resolve(window.Notification.permission === 'granted')
|
return Promise.resolve(window.Notification.permission === "granted");
|
||||||
}
|
}
|
||||||
return __TAURI__.invoke('plugin:notification|is_permission_granted')
|
return __TAURI__.invoke("plugin:notification|is_permission_granted");
|
||||||
}
|
}
|
||||||
|
|
||||||
function setNotificationPermission(value) {
|
function setNotificationPermission(value) {
|
||||||
permissionSettable = true
|
permissionSettable = true;
|
||||||
// @ts-expect-error we can actually set this value on the webview
|
// @ts-expect-error we can actually set this value on the webview
|
||||||
window.Notification.permission = value
|
window.Notification.permission = value;
|
||||||
permissionSettable = false
|
permissionSettable = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function requestPermission() {
|
function requestPermission() {
|
||||||
return __TAURI__.invoke('plugin:notification|request_permission')
|
return __TAURI__
|
||||||
|
.invoke("plugin:notification|request_permission")
|
||||||
.then(function (permission) {
|
.then(function (permission) {
|
||||||
setNotificationPermission(permission)
|
setNotificationPermission(permission);
|
||||||
return permission
|
return permission;
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function sendNotification(options) {
|
function sendNotification(options) {
|
||||||
if (typeof options === 'object') {
|
if (typeof options === "object") {
|
||||||
Object.freeze(options)
|
Object.freeze(options);
|
||||||
}
|
}
|
||||||
|
|
||||||
return __TAURI__.invoke('plugin:notification|notify', {
|
return __TAURI__.invoke("plugin:notification|notify", {
|
||||||
options: typeof options === 'string'
|
options:
|
||||||
? {
|
typeof options === "string"
|
||||||
title: options
|
? {
|
||||||
}
|
title: options,
|
||||||
: options
|
}
|
||||||
})
|
: options,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// @ts-expect-error unfortunately we can't implement the whole type, so we overwrite it with our own version
|
// @ts-expect-error unfortunately we can't implement the whole type, so we overwrite it with our own version
|
||||||
window.Notification = function (title, options) {
|
window.Notification = function (title, options) {
|
||||||
const opts = options || {}
|
const opts = options || {};
|
||||||
sendNotification(
|
sendNotification(Object.assign(opts, { title }));
|
||||||
Object.assign(opts, { title })
|
};
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
window.Notification.requestPermission = requestPermission
|
window.Notification.requestPermission = requestPermission;
|
||||||
|
|
||||||
Object.defineProperty(window.Notification, 'permission', {
|
Object.defineProperty(window.Notification, "permission", {
|
||||||
enumerable: true,
|
enumerable: true,
|
||||||
get: function () {
|
get: function () {
|
||||||
return permissionValue
|
return permissionValue;
|
||||||
},
|
},
|
||||||
set: function (v) {
|
set: function (v) {
|
||||||
if (!permissionSettable) {
|
if (!permissionSettable) {
|
||||||
throw new Error('Readonly property')
|
throw new Error("Readonly property");
|
||||||
}
|
}
|
||||||
permissionValue = v
|
permissionValue = v;
|
||||||
}
|
},
|
||||||
})
|
});
|
||||||
|
|
||||||
isPermissionGranted().then(function (response) {
|
isPermissionGranted().then(function (response) {
|
||||||
if (response === null) {
|
if (response === null) {
|
||||||
setNotificationPermission('default')
|
setNotificationPermission("default");
|
||||||
} else {
|
} else {
|
||||||
setNotificationPermission(response ? 'granted' : 'denied')
|
setNotificationPermission(response ? "granted" : "denied");
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
})()
|
})();
|
||||||
|
@ -1,20 +1,20 @@
|
|||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"allowSyntheticDefaultImports": true,
|
"allowSyntheticDefaultImports": true,
|
||||||
"esModuleInterop": true,
|
"esModuleInterop": true,
|
||||||
"lib": ["ES2019", "ES2020.Promise", "ES2020.String", "DOM", "DOM.Iterable"],
|
"lib": ["ES2019", "ES2020.Promise", "ES2020.String", "DOM", "DOM.Iterable"],
|
||||||
"module": "ESNext",
|
"module": "ESNext",
|
||||||
"moduleResolution": "node",
|
"moduleResolution": "node",
|
||||||
"noEmit": true,
|
"noEmit": true,
|
||||||
"noEmitOnError": false,
|
"noEmitOnError": false,
|
||||||
"noUnusedLocals": true,
|
"noUnusedLocals": true,
|
||||||
"noUnusedParameters": true,
|
"noUnusedParameters": true,
|
||||||
"pretty": true,
|
"pretty": true,
|
||||||
"sourceMap": true,
|
"sourceMap": true,
|
||||||
"strict": true,
|
"strict": true,
|
||||||
"target": "ES2019",
|
"target": "ES2019",
|
||||||
"declaration": true,
|
"declaration": true,
|
||||||
"declarationDir": "./"
|
"declarationDir": "./"
|
||||||
},
|
},
|
||||||
"exclude": ["dist-js", "node_modules", "test/types"]
|
"exclude": ["dist-js", "node_modules", "test/types"]
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in new issue