one
Version:
One is a React framework for web, iOS, and Android apps.
113 lines (110 loc) • 2.65 kB
JavaScript
import { DEFAULT_ACTION_IDENTIFIER, assertCategoryActions, assertCategoryIdentifier, assertCategoryOptions, toNativeImportance } from "./types.mjs";
const denied = {
status: "denied",
granted: false,
canAskAgain: false
};
async function getPermissions() {
return { ...denied };
}
async function requestPermissions(_options = {}) {
return { ...denied };
}
function setCategory(identifier, actions, options) {
assertCategoryIdentifier(identifier, "setCategory");
assertCategoryActions(actions, "setCategory");
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) {
assertCategoryIdentifier(identifier, "deleteCategory");
return false;
}
async function getBadgeCount() {
return 0;
}
async function setBadgeCount(_count) {
return false;
}
async function setChannel(_channelId, channel) {
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
});
export { Notifications };
//# sourceMappingURL=index.mjs.map