Skip to content

Commit

Permalink
Fixes #1654 - Improve UX after location access is denied
Browse files Browse the repository at this point in the history
  • Loading branch information
HarelM committed Nov 20, 2021
1 parent e186b47 commit 18dd7b5
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 8 deletions.
26 changes: 21 additions & 5 deletions IsraelHiking.Web/src/application/services/geo-location.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,11 +166,27 @@ export class GeoLocationService {
this.isBackground = false;
await this.onLocationUpdate();
});
BackgroundGeolocation.on("error").subscribe((error) => {
this.loggingService.error(`[GeoLocation] Failed to start background tracking ${error.message}`);
this.toastService.warning(this.resources.unableToFindYourLocation);
this.disable();
})

BackgroundGeolocation.on("authorization").subscribe(
(status) => {
if (status === BackgroundGeolocation.NOT_AUTHORIZED) {
this.loggingService.error("[GeoLocation] Failed to start background tracking - unauthorized");
this.disable();
this.toastService.confirm({
message: this.resources.noLocationPermissionOpenAppSettings,
type: "OkCancel",
confirmAction: () => BackgroundGeolocation.showAppSettings(),
declineAction: () => { }
});
}
});

BackgroundGeolocation.on("error").subscribe(
(error) => {
this.loggingService.error(`[GeoLocation] Failed to start background tracking ${error.message}`);
this.toastService.warning(this.resources.unableToFindYourLocation);
this.disable();
});
BackgroundGeolocation.start();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@ export class ResourcesService {
public thisWillDeteleAllCurrentRoutesAreYouSure: string;
public pleaseFillReport: string;
public hiddenRoutesWillNotBeSaved: string;
public noLocationPermissionOpenAppSettings: string;
// Info
public infoSubheader: string;
public infoHelpfulLinks: string;
Expand Down Expand Up @@ -466,7 +467,7 @@ export class ResourcesService {
}

private async setLanguageInternal(language: Language): Promise<void> {
await this.gettextCatalog.loadRemote(Urls.translations + language.code + ".json?sign=1635511838323");
await this.gettextCatalog.loadRemote(Urls.translations + language.code + ".json?sign=1637440747439");
this.about = this.gettextCatalog.getString("About");
this.legend = this.gettextCatalog.getString("Legend");
this.clear = this.gettextCatalog.getString("Clear");
Expand Down Expand Up @@ -757,6 +758,8 @@ export class ResourcesService {
this.pleaseFillReport = this.gettextCatalog
.getString("Please fill in the details of the issue in the e-mail message that will be shown soon and send it");
this.hiddenRoutesWillNotBeSaved = this.gettextCatalog.getString("Hidden routes will not be saved...");
this.noLocationPermissionOpenAppSettings = this.gettextCatalog.getString("There's no permission to use your location. " +
"Would you like to open the app settings?");
// Info
this.infoHelpfulLinks = this.gettextCatalog.getString("Helpful links:");
this.infoSubheader = this.gettextCatalog
Expand Down
3 changes: 2 additions & 1 deletion IsraelHiking.Web/src/translations/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@
"Terms of Service": "Terms of Service",
"Tertiary": "Tertiary",
"Thank you for your support!": "Thank you for your support!",
"Thanks for purchasing! download instructions here...": "Thanks for purchasing! Press the button above to start downloading the latest offline version.",
"Thanks for purchasing! download instructions here...": "Thanks for purchasing! Press the green button above to start downloading the latest offline maps.",
"The data was updated successfully!": "The data was updated successfully!",
"The data was updated successfully! It will take time to see it on the map...": "The data was updated successfully! It will take time to see it on the map...",
"The download may take several minutes, and afterwards you can enjoy the map with no need for a network connection.": "The download may take several minutes, and afterwards you can view the map with no need for a network connection.",
Expand All @@ -339,6 +339,7 @@
"The route's name was altered since it is in use...": "The route's name was altered since it is in use...",
"The title for your share.": "The title for your saved work.",
"There's no description :-(. To add one you'll need to login to OSM first, please use the button in the upper right corner to login.": "There's no description :-(. To add one you'll need to login to OSM first, please use the button in the upper right corner to login.",
"There's no permission to use your location. Would you like to open the app settings?": "There's no permission to use your location. Would you like to open the app settings?",
"There's so much more you can do with our app": "There's so much more you can do with our app",
"This map was generated from {{link}}Open Street Map (OSM){{linkend}} data which is free for all to use and edit.": "This map was generated from {{link}}Open Street Map (OSM){{linkend}} data which is open for all to use and edit.",
"This name is already in use": "This name is already in use",
Expand Down
3 changes: 2 additions & 1 deletion IsraelHiking.Web/src/translations/he.json
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@
"Terms of Service": "תנאי שימוש",
"Tertiary": "כביש צדדי",
"Thank you for your support!": "תודה על תרומתכם!",
"Thanks for purchasing! download instructions here...": "איזה כיף שקניתם! על מנת להוריד את הגרסה החדשה ביותר יש ללחוץ על הכפתור הנ\"ל.",
"Thanks for purchasing! download instructions here...": "איזה כיף שקניתם! על מנת להוריד את המפות החדשות ביותר יש ללחוץ על הכפתור הירוק למעלה.",
"The data was updated successfully!": "המידע נשמר בהצלחה!",
"The data was updated successfully! It will take time to see it on the map...": "המידע נשמר בהצלחה! אבל ייקח עוד קצת זמן עד שהמפה תתעדכן...",
"The download may take several minutes, and afterwards you can enjoy the map with no need for a network connection.": "ההורדה עלולה לקחת דקות ארוכות, ולאחר מכן תוכלו לצפות במפה ללא צורך בחיבור לרשת.",
Expand All @@ -339,6 +339,7 @@
"The route's name was altered since it is in use...": "שם המסלול שונה מאחר והוא כבר בשימוש...",
"The title for your share.": "הכותרת לשמירה הזו בענן.",
"There's no description :-(. To add one you'll need to login to OSM first, please use the button in the upper right corner to login.": "אין תיאור :-( יש צורך להתחבר לחשבון ה- OSM, אנא לחצו על הכפתור בפינה הימנית עליונה על מנת להתחבר.",
"There's no permission to use your location. Would you like to open the app settings?": "אין הרשאה להציג את מיקומך. האם ברצונך לפתוח את הגדרות האפליקציה?",
"There's so much more you can do with our app": "אפשר לעשות עוד כל כך הרבה בעזרת האפליקציה שלנו",
"This map was generated from {{link}}Open Street Map (OSM){{linkend}} data which is free for all to use and edit.": "המפה הזו נוצרה בעזרת מידע מ- {{link}}Open Street Map (OSM){{linkend}} והוא פתוח לשימוש ועריכה של כולם.",
"This name is already in use": "השם כבר בשימוש",
Expand Down

0 comments on commit 18dd7b5

Please sign in to comment.