one
Version:
One is a React framework for web, iOS, and Android apps.
132 lines (131 loc) • 3.55 kB
JavaScript
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all) __defProp(target, name, {
get: all[name],
enumerable: true
});
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
get: () => from[key],
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
});
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var notifications_exports = {};
__export(notifications_exports, { Notifications: () => Notifications });
module.exports = __toCommonJS(notifications_exports);
var import_types = require("./types.cjs");
const denied = {
status: "denied",
granted: false,
canAskAgain: false
};
async function getPermissions() {
return { ...denied };
}
async function requestPermissions(_options = {}) {
return { ...denied };
}
function setCategory(identifier, actions, options) {
(0, import_types.assertCategoryIdentifier)(identifier, "setCategory");
(0, import_types.assertCategoryActions)(actions, "setCategory");
(0, import_types.assertCategoryOptions)(options, "setCategory");
const category = {
identifier,
actions: actions.map((action) => ({ ...action }))
};
if (options !== void 0) {
category.options = { ...options };
}
return Promise.resolve(category);
}
async function getCategories() {
return [];
}
async function deleteCategory(identifier) {
(0, import_types.assertCategoryIdentifier)(identifier, "deleteCategory");
return false;
}
async function getBadgeCount() {
return 0;
}
async function setBadgeCount(_count) {
return false;
}
async function setChannel(_channelId, channel) {
(0, import_types.toNativeImportance)(channel.importance);
return null;
}
async function getChannel(_channelId) {
return null;
}
async function getChannels() {
return [];
}
async function deleteChannel(_channelId) {}
const inert = { remove: () => {} };
function addReceivedListener(_listener) {
return inert;
}
function addResponseReceivedListener(_listener) {
return inert;
}
async function getDevicePushToken() {
throw new Error("Notifications.getDevicePushToken needs an iOS or Android build");
}
function addPushTokenListener(_listener) {
return inert;
}
function setHandler(_handler) {}
function getLastResponse() {
return null;
}
function clearLastResponse() {}
async function schedule(_request) {
throw new Error("Notifications.schedule needs an iOS or Android build");
}
async function cancelScheduled(_identifier) {}
async function cancelAllScheduled() {}
async function getAllScheduled() {
return [];
}
async function getPresented() {
return [];
}
async function dismiss(_identifier) {}
async function dismissAll() {}
const Notifications = Object.freeze({
getPermissions,
requestPermissions,
getBadgeCount,
setBadgeCount,
setCategory,
getCategories,
deleteCategory,
setChannel,
getChannel,
getChannels,
deleteChannel,
addReceivedListener,
addResponseReceivedListener,
getDevicePushToken,
addPushTokenListener,
setHandler,
getLastResponse,
clearLastResponse,
schedule,
cancelScheduled,
cancelAllScheduled,
getAllScheduled,
getPresented,
dismiss,
dismissAll,
DEFAULT_ACTION_IDENTIFIER: import_types.DEFAULT_ACTION_IDENTIFIER
});