Skip to content

Commit

Permalink
refactor mode utils from misc utils
Browse files Browse the repository at this point in the history
  • Loading branch information
NyaomiDEV committed May 4, 2024
1 parent 70d0971 commit 414027e
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 21 deletions.
13 changes: 13 additions & 0 deletions src/lib/mode.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
export function getMode(): "ios" | "md" {
if (typeof (window as any) !== "undefined") {
const Ionic = (window as any).Ionic;
if (Ionic && Ionic.config) {
return Ionic.config.get("mode");
}
}
return "md";
}

export function isIOSMode(): boolean {
return getMode() === "ios";
}
14 changes: 0 additions & 14 deletions src/lib/util/misc.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,3 @@
export function getMode(): "ios" | "md" {
if (typeof (window as any) !== "undefined") {
const Ionic = (window as any).Ionic;
if (Ionic && Ionic.config) {
return Ionic.config.get("mode");
}
}
return "md";
}

export function isIOSMode(): boolean {
return getMode() === "ios";
}

export function getFiles(contentType?: string, multiple?: boolean): Promise<File[]> {
return new Promise(resolve => {
const i = document.createElement("input");
Expand Down
2 changes: 1 addition & 1 deletion src/views/options/About.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script setup lang="ts">
import { IonContent, IonHeader, IonList, IonPage, IonTitle, IonToolbar } from '@ionic/vue';
import { computed } from 'vue';
import { isIOSMode } from '../../lib/util/misc';
import { isIOSMode } from '../../lib/mode';
const isIOS = computed(isIOSMode);
</script>
Expand Down
2 changes: 1 addition & 1 deletion src/views/tabbed/Chats.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script setup lang="ts">
import { IonContent, IonHeader, IonList, IonPage, IonTitle, IonToolbar } from '@ionic/vue';
import { computed } from 'vue';
import { isIOSMode } from '../../lib/util/misc';
import { isIOSMode } from '../../lib/mode';
const isIOS = computed(isIOSMode);
</script>
Expand Down
2 changes: 1 addition & 1 deletion src/views/tabbed/Dashboard.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script setup lang="ts">
import { IonContent, IonHeader, IonList, IonPage, IonTitle, IonToolbar } from '@ionic/vue';
import { computed } from 'vue';
import { isIOSMode } from '../../lib/util/misc';
import { isIOSMode } from '../../lib/mode';
const isIOS = computed(isIOSMode);
</script>
Expand Down
2 changes: 1 addition & 1 deletion src/views/tabbed/Journal.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script setup lang="ts">
import { IonContent, IonHeader, IonList, IonPage, IonTitle, IonToolbar } from '@ionic/vue';
import { computed } from 'vue';
import { isIOSMode } from '../../lib/util/misc';
import { isIOSMode } from '../../lib/mode';
const isIOS = computed(isIOSMode);
</script>
Expand Down
2 changes: 1 addition & 1 deletion src/views/tabbed/Members.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script setup lang="ts">
import { IonContent, IonHeader, IonList, IonPage, IonTitle, IonToolbar } from '@ionic/vue';
import { computed } from 'vue';
import { isIOSMode } from '../../lib/util/misc';
import { isIOSMode } from '../../lib/mode';
const isIOS = computed(isIOSMode);
</script>
Expand Down
2 changes: 1 addition & 1 deletion src/views/tabbed/Options.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script setup lang="ts">
import { IonContent, IonHeader, IonList, IonItem, IonListHeader, IonLabel, IonPage, IonTitle, IonToolbar, IonIcon } from '@ionic/vue';
import { computed } from 'vue';
import { isIOSMode } from '../../lib/util/misc';
import { isIOSMode } from '../../lib/mode';
import {
person as SystemIOS,
Expand Down
3 changes: 2 additions & 1 deletion src/views/tabbed/TestingGrounds.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
IonAvatar
} from '@ionic/vue';
import { computed, ref } from 'vue';
import { getFiles, isIOSMode } from '../../lib/util/misc';
import { getFiles } from '../../lib/util/misc';
import { isIOSMode } from '../../lib/mode';
import { Member, getTable, newMember } from '../../lib/db/entities/members';
import { getBlobURL } from '../../lib/util/blob';
import { resizeImage } from '../../lib/util/image';
Expand Down

0 comments on commit 414027e

Please sign in to comment.