diff --git a/package-lock.json b/package-lock.json index bc9e08ca..c4c59ecf 100644 --- a/package-lock.json +++ b/package-lock.json @@ -41,7 +41,6 @@ "cordova-plugin-email-composer": "^0.10.1", "cordova-plugin-ionic": "5.5.3", "cordova-sqlite-storage": "^6.1.0", - "eventemitter2": "^6.4.9", "ionicons": "^7.1.0", "jwt-decode": "^3.1.2", "pinia": "^2.0.33", @@ -8249,11 +8248,6 @@ "node": ">=6" } }, - "node_modules/eventemitter2": { - "version": "6.4.9", - "resolved": "https://registry.npmjs.org/eventemitter2/-/eventemitter2-6.4.9.tgz", - "integrity": "sha512-JEPTiaOt9f04oa6NOkc4aH+nVp5I3wEjpHbIPqfgCdD5v5bUzy7xQqwcVO2aDQgOWhI28da57HksMrzK9HlRxg==" - }, "node_modules/eventemitter3": { "version": "4.0.7", "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz", diff --git a/package.json b/package.json index a0192170..e3088874 100644 --- a/package.json +++ b/package.json @@ -53,7 +53,6 @@ "cordova-plugin-email-composer": "^0.10.1", "cordova-plugin-ionic": "5.5.3", "cordova-sqlite-storage": "^6.1.0", - "eventemitter2": "^6.4.9", "ionicons": "^7.1.0", "jwt-decode": "^3.1.2", "pinia": "^2.0.33", diff --git a/src/app/decks/shared/index.ts b/src/app/decks/shared/index.ts index 8e2d3cd2..0e0f3dde 100644 --- a/src/app/decks/shared/index.ts +++ b/src/app/decks/shared/index.ts @@ -1,5 +1,6 @@ export * from './composables/useLibraryCache' export * from './composables/useIndexedList' +export * from './tasks/useEnterFullscreenMode' export { default as VerseTextLines } from './components/VerseTextLines.vue' export { default as StackedFlipCardsDeck } from './components/StackedFlipCardsDeck.vue' diff --git a/src/app/shared/tasks/runEnterFullscreenMode.ts b/src/app/decks/shared/tasks/useEnterFullscreenMode.ts similarity index 69% rename from src/app/shared/tasks/runEnterFullscreenMode.ts rename to src/app/decks/shared/tasks/useEnterFullscreenMode.ts index 2f41dfd1..5cc8ac5b 100644 --- a/src/app/shared/tasks/runEnterFullscreenMode.ts +++ b/src/app/decks/shared/tasks/useEnterFullscreenMode.ts @@ -1,14 +1,14 @@ import { watch } from 'vue' import { storeToRefs } from 'pinia' +import { StatusBar } from '@capacitor/status-bar' +import { Capacitor } from '@capacitor/core' +import { useScreenOrientation , useAppStateStore } from '@/app/shared' import { useSettingsStore } from '@/app/settings' -import { useScreenOrientation } from '../composables/useScreenOrientation' -import { useAppStateStore } from '../stores/appStateStore' - /** * Enter fullscreen mode when in landscape mode and hide controls is enabled. */ -export function runEnterFullscreenMode() { +export function useEnterFullscreenMode() { /* -------------------------------------------------------------------------- */ /* Dependencies */ /* -------------------------------------------------------------------------- */ @@ -27,13 +27,15 @@ export function runEnterFullscreenMode() { /* -------------------------------------------------------------------------- */ - /* Init */ + /* Actions */ /* -------------------------------------------------------------------------- */ - watch( - [screenOrientation.isPortrait, routeName], - onChanged - ) + async function run() { + watch( + [screenOrientation.isPortrait, routeName], + onChanged + ) + } /* -------------------------------------------------------------------------- */ @@ -45,5 +47,16 @@ export function runEnterFullscreenMode() { const isFullscreenEligible = fullscrenEligibleRoutes.includes(routeName.value) const hideControls = hideControlsInLandscapeMode.value appStateStore.fullscreen = isLandscape && isFullscreenEligible && hideControls + + if (Capacitor.getPlatform() !== 'web') { + if (appStateStore.fullscreen) { await StatusBar.hide() } else { await StatusBar.show() } + } } + + + /* -------------------------------------------------------------------------- */ + /* Interface */ + /* -------------------------------------------------------------------------- */ + + return { run } } \ No newline at end of file diff --git a/src/app/settings/pages/AccountPage.vue b/src/app/settings/pages/AccountPage.vue index d1026517..aa26010d 100644 --- a/src/app/settings/pages/AccountPage.vue +++ b/src/app/settings/pages/AccountPage.vue @@ -91,7 +91,7 @@ import { import { mail, logoApple, logoGoogle } from 'ionicons/icons' import { computed, inject } from 'vue' import { Capacitor } from '@capacitor/core' -import { go, useAuthentication, useEmitter, useSync , BackgroundTasks } from '@/app/shared' +import { go, useAuthentication, useSync , BackgroundTasks } from '@/app/shared' import { useSettingsStore } from '@/app/settings' import { CouchDB } from '@/services/persistence' @@ -100,7 +100,6 @@ import { CouchDB } from '@/services/persistence' /* -------------------------------------------------------------------------- */ const userDataDb = inject('userData') as CouchDB -const emitter = useEmitter() const settings = useSettingsStore() const auth = useAuthentication() const router = useIonRouter() @@ -121,7 +120,6 @@ const isAuthenticated = computed(() => !!settings.authToken) async function onSync() { await syncTask.run({ force: true }) - emitter.emit('syncCompleted') } async function onSignIn(strategy: string) { @@ -152,6 +150,5 @@ async function onLogOut() { settings.syncCollectionId = '' settings.syncAt = 0 await userDataDb.destroy() - emitter.emit('syncCompleted') } diff --git a/src/app/settings/pages/EmailPage.vue b/src/app/settings/pages/EmailPage.vue index 24295b7e..fed0d717 100644 --- a/src/app/settings/pages/EmailPage.vue +++ b/src/app/settings/pages/EmailPage.vue @@ -77,7 +77,7 @@