Skip to content

Commit

Permalink
Merge pull request #43 from Resgrid/develop
Browse files Browse the repository at this point in the history
CU-86862jmua minor bug fix for web
  • Loading branch information
ucswift authored Dec 10, 2023
2 parents 43b5727 + af57b7c commit 851f74e
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 26 deletions.
45 changes: 25 additions & 20 deletions src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export class AppComponent {

if (this.platform.is('ios')) {
}

const prefersDark = window.matchMedia('(prefers-color-scheme: dark)');
this.toggleDarkTheme(prefersDark.matches);
prefersDark.addListener((mediaQuery) =>
Expand Down Expand Up @@ -122,37 +122,42 @@ export class AppComponent {
}

if (!this.$themePreferenceSub || this.$themePreferenceSub.closed) {
this.$themePreferenceSub = this.themePreference$.subscribe((themePref) => {
const prefersDark = window.matchMedia('(prefers-color-scheme: dark)');
this.toggleDarkTheme(prefersDark)
});
this.$themePreferenceSub = this.themePreference$.subscribe(
(themePref) => {
const prefersDark = window.matchMedia(
'(prefers-color-scheme: dark)'
);
this.toggleDarkTheme(prefersDark);
}
);
}

setTimeout(function () {
that.store.dispatch(new SettingsActions.PrimeSettings());
}, 1000);

try
{
await PushNotifications.removeAllDeliveredNotifications();
} catch (e) {
console.log(e);
if (this.platform.is('ios') || this.platform.is('android')) {
try {
await PushNotifications.removeAllDeliveredNotifications();
} catch (e) {
console.log(e);
}
}
});
}

// Add or remove the "dark" class based on if the media query matches
private toggleDarkTheme(shouldAdd) {
this.themePreference$.pipe(take(1)).subscribe((enableDarkMode) => {
if (enableDarkMode === -1) {
document.body.classList.toggle('dark', shouldAdd);
} else if (enableDarkMode === 0) {
document.body.classList.toggle('dark', false);
} else if (enableDarkMode === 1) {
document.body.classList.toggle('dark', true);
}
});
}
this.themePreference$.pipe(take(1)).subscribe((enableDarkMode) => {
if (enableDarkMode === -1) {
document.body.classList.toggle('dark', shouldAdd);
} else if (enableDarkMode === 0) {
document.body.classList.toggle('dark', false);
} else if (enableDarkMode === 1) {
document.body.classList.toggle('dark', true);
}
});
}

public triggerSelectCallModal() {
this.store.dispatch(new SettingsActions.ShowSetActiveCallModal());
Expand Down
7 changes: 1 addition & 6 deletions src/app/features/home/pages/map/map.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,7 @@ export class MapPage {
if (
location &&
location.Latitude &&
location.Longitude //&&
//(!this.lastMapUpdateTimestamp ||
// this.utilsProvider.getMinutesBetweenDates(
// this.lastMapUpdateTimestamp,
// currentDate
// ) > 1)
location.Longitude
) {
if (this.map) {
if (!this.userMovedMap) {
Expand Down

0 comments on commit 851f74e

Please sign in to comment.