UNPKG

@markvivanco/app-version-checker

Version:

React App version checking and update prompts for React, React Native, and web applications

78 lines (75 loc) 2 kB
'use strict'; // src/providers/data-provider.interface.ts var BaseVersionDataProvider = class { getCurrentPlatform() { if (typeof window !== "undefined" && !("ReactNativeWebView" in window)) { return "web"; } return "web"; } async initialize() { } async dispose() { } }; // src/providers/storage-provider.interface.ts var BaseStorageProvider = class { async getDismissCount() { return 0; } async incrementDismissCount() { } async initialize() { } async dispose() { } }; var InMemoryStorageProvider = class extends BaseStorageProvider { constructor() { super(...arguments); this.storage = /* @__PURE__ */ new Map(); } async getLastCheckTime() { return this.storage.get("lastCheckTime") || null; } async setLastCheckTime(timestamp) { this.storage.set("lastCheckTime", timestamp); } async getRemindLaterTime() { return this.storage.get("remindLaterTime") || null; } async setRemindLaterTime(timestamp) { this.storage.set("remindLaterTime", timestamp); } async clearRemindLaterTime() { this.storage.delete("remindLaterTime"); } async getDismissCount() { return this.storage.get("dismissCount") || 0; } async incrementDismissCount() { const current = await this.getDismissCount(); this.storage.set("dismissCount", current + 1); } async getLastShownVersion() { return this.storage.get("lastShownVersion") || null; } async setLastShownVersion(version) { this.storage.set("lastShownVersion", version); } async clearAll() { this.storage.clear(); } async getAllPreferences() { const preferences = {}; this.storage.forEach((value, key) => { preferences[key] = value; }); return preferences; } }; exports.BaseStorageProvider = BaseStorageProvider; exports.BaseVersionDataProvider = BaseVersionDataProvider; exports.InMemoryStorageProvider = InMemoryStorageProvider; //# sourceMappingURL=index.js.map //# sourceMappingURL=index.js.map