Skip to content

Commit

Permalink
disable local notifications for desctop app
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmdadl committed Apr 14, 2021
1 parent 7d0b570 commit 790b0ad
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 8 deletions.
5 changes: 4 additions & 1 deletion src/components/FirstTimeSlides.vue
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,9 @@
azkarCount: 0,
});
// local notifications not working with electron
if (!isPlatform('hybrid')) return;
// iniate notifications
await this.addNotification(
1,
Expand Down Expand Up @@ -254,7 +257,7 @@
// @ts-ignore
const perm = (await LocalNotifications.requestPermissions()) as {
results: string[];
};
};
if (!perm || perm.results[0] === 'granted') {
return;
Expand Down
7 changes: 6 additions & 1 deletion src/views/items/Index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
{{ $t(`${type}.toolbar`) }}
</span>
</ion-title>
<template v-if="type === 'zikr'">
<template v-if="isHybrid && type === 'zikr'">
<ion-buttons slot="end">
<ion-button
type="button"
Expand Down Expand Up @@ -90,6 +90,7 @@
IonRippleEffect,
IonIcon,
IonLabel,
isPlatform
} from '@ionic/vue';
import getCategoryIcon, { CategoryIcon } from '@/utils/getCategoryIcon';
import { CategoryEntity, CategoryType } from '@/schema/CategoryEntity';
Expand Down Expand Up @@ -118,6 +119,7 @@
export default class ZikrIndex extends Vue.with(Props) {
categories: Category[] = [];
icons: CategoryIcon[] = getCategoryIcon();
isHybrid = true;
async loadCategories() {
const con = await db();
Expand All @@ -134,6 +136,9 @@
if (this.type === CategoryType.Du3a) {
this.icons = this.icons.slice(10);
}
this.isHybrid = isPlatform('hybrid');
this.loadCategories();
}
}
Expand Down
30 changes: 24 additions & 6 deletions src/views/setting/Index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@
<ion-item
@click.prevent="goTo('/settings/app')"
class="hover:cursor-pointer item"
:color="active === '/settings/app' ? 'primary' : ''"
:color="
active === '/settings/app' ? 'primary' : ''
"
>
<ion-label>{{
$t('setup.list.app')
Expand All @@ -45,7 +47,11 @@
<ion-item
@click.prevent="goTo('/settings/control')"
class="hover:cursor-pointer item"
:color="active === '/settings/control' ? 'primary' : ''"
:color="
active === '/settings/control'
? 'primary'
: ''
"
>
<ion-label>{{
$t('setup.list.control')
Expand All @@ -61,9 +67,14 @@
/>
</ion-item>
<ion-item
v-if="isHybrid"
@click.prevent="goTo('/settings/azkar')"
class="hover:cursor-pointer item"
:color="active === '/settings/azkar' ? 'primary' : ''"
:color="
active === '/settings/azkar'
? 'primary'
: ''
"
>
<ion-label>{{
$t('setup.list.azkar')
Expand All @@ -81,11 +92,15 @@
<ion-item
@click.prevent="goTo('/settings/sebha')"
class="hover:cursor-pointer item"
:color="active === '/settings/sebha' ? 'primary' : ''"
:color="
active === '/settings/sebha'
? 'primary'
: ''
"
>
<ion-label>{{
$t('setup.list.sebha')
}}</ion-label>
}}</ion-label>
<ion-icon
:icon="chevronForwardOutline"
slot="end"
Expand Down Expand Up @@ -122,6 +137,7 @@
IonButtons,
IonButton,
menuController,
isPlatform,
} from '@ionic/vue';
import { chevronForwardOutline, cogOutline, home } from 'ionicons/icons';
Expand All @@ -148,12 +164,13 @@
export default class SettingIndex extends Vue {
dir = 'rtl';
active = '/settings/app';
isHybrid = true;
chevronForwardOutline = chevronForwardOutline;
cogOutline = cogOutline;
home = home;
async goTo(page: string) {
async goTo(page: string) {
this.active = page;
this.$router.replace(page);
await menuController.close();
Expand All @@ -164,6 +181,7 @@
}
mounted() {
this.isHybrid = isPlatform('hybrid');
this.active = location.pathname;
}
}
Expand Down

0 comments on commit 790b0ad

Please sign in to comment.