Skip to content

Commit

Permalink
New version available support (#2018)
Browse files Browse the repository at this point in the history
* Add app update check when the app starts

* Add app update check when the app starts

* Add translation, update podfile lock

* Move app initiazlize check to after the text resources are loaded...

* Update translations according to review
  • Loading branch information
HarelM authored Aug 7, 2024
1 parent 095a114 commit 7640d68
Show file tree
Hide file tree
Showing 14 changed files with 79 additions and 3 deletions.
1 change: 1 addition & 0 deletions IsraelHiking.Web/android/app/capacitor.build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ dependencies {
implementation project(':capacitor-camera')
implementation project(':capacitor-device')
implementation project(':capacitor-text-zoom')
implementation project(':capawesome-capacitor-app-update')
implementation project(':capgo-native-audio')
implementation "com.google.android.gms:play-services-location:17+"
implementation "androidx.core:core:1.1.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@
"pkg": "@capacitor/text-zoom",
"classpath": "com.capacitorjs.plugins.textzoom.TextZoomPlugin"
},
{
"pkg": "@capawesome/capacitor-app-update",
"classpath": "io.capawesome.capacitorjs.plugins.appupdate.AppUpdatePlugin"
},
{
"pkg": "@capgo/native-audio",
"classpath": "ee.forgr.audio.NativeAudio"
Expand Down
3 changes: 3 additions & 0 deletions IsraelHiking.Web/android/capacitor.settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,8 @@ project(':capacitor-device').projectDir = new File('../node_modules/@capacitor/d
include ':capacitor-text-zoom'
project(':capacitor-text-zoom').projectDir = new File('../node_modules/@capacitor/text-zoom/android')

include ':capawesome-capacitor-app-update'
project(':capawesome-capacitor-app-update').projectDir = new File('../node_modules/@capawesome/capacitor-app-update/android')

include ':capgo-native-audio'
project(':capgo-native-audio').projectDir = new File('../node_modules/@capgo/native-audio/android')
2 changes: 2 additions & 0 deletions IsraelHiking.Web/ios/App/App/capacitor.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
"CAPCameraPlugin",
"DevicePlugin",
"TextZoomPlugin",
"AppUpdatePlugin",
"AppUpdatePlugin",
"NativeAudio",
"NativeAudio",
"CDVPlugin"
Expand Down
1 change: 1 addition & 0 deletions IsraelHiking.Web/ios/App/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ def capacitor_pods
pod 'CapacitorCamera', :path => '../../node_modules/@capacitor/camera'
pod 'CapacitorDevice', :path => '../../node_modules/@capacitor/device'
pod 'CapacitorTextZoom', :path => '../../node_modules/@capacitor/text-zoom'
pod 'CapawesomeCapacitorAppUpdate', :path => '../../node_modules/@capawesome/capacitor-app-update'
pod 'CapgoNativeAudio', :path => '../../node_modules/@capgo/native-audio'
pod 'CordovaPlugins', :path => '../capacitor-cordova-ios-plugins'
end
Expand Down
10 changes: 8 additions & 2 deletions IsraelHiking.Web/ios/App/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ PODS:
- Capacitor
- CapacitorTextZoom (6.0.0):
- Capacitor
- CapawesomeCapacitorAppUpdate (6.0.0):
- Capacitor
- CapgoNativeAudio (6.4.3):
- Capacitor
- CordovaPlugins (6.0.0):
Expand All @@ -28,6 +30,7 @@ DEPENDENCIES:
- "CapacitorCordova (from `../../node_modules/@capacitor/ios`)"
- "CapacitorDevice (from `../../node_modules/@capacitor/device`)"
- "CapacitorTextZoom (from `../../node_modules/@capacitor/text-zoom`)"
- "CapawesomeCapacitorAppUpdate (from `../../node_modules/@capawesome/capacitor-app-update`)"
- "CapgoNativeAudio (from `../../node_modules/@capgo/native-audio`)"
- CordovaPlugins (from `../capacitor-cordova-ios-plugins`)

Expand All @@ -48,6 +51,8 @@ EXTERNAL SOURCES:
:path: "../../node_modules/@capacitor/device"
CapacitorTextZoom:
:path: "../../node_modules/@capacitor/text-zoom"
CapawesomeCapacitorAppUpdate:
:path: "../../node_modules/@capawesome/capacitor-app-update"
CapgoNativeAudio:
:path: "../../node_modules/@capgo/native-audio"
CordovaPlugins:
Expand All @@ -62,9 +67,10 @@ SPEC CHECKSUMS:
CapacitorCordova: 8c4bfdf69368512e85b1d8b724dd7546abeb30af
CapacitorDevice: f8fd88f9edd1261c55a109f32015b09bbbfdc4a0
CapacitorTextZoom: 696722e5c479b364f2429584f11ad386d609bd1a
CapawesomeCapacitorAppUpdate: 3c05b5c8e42f9c6a88d666093406e9336d9bfdb1
CapgoNativeAudio: 569bfe2955e4bc58d9c44f14590ea985854f7f9b
CordovaPlugins: 1f2794134a8c57f6b5112e89cc7afd07dc0f7bef

PODFILE CHECKSUM: 0c32ad6bc2ae562b3fa0cf7a399eddd792459d18
PODFILE CHECKSUM: 6ae88e6f813ac1f24c30d9c87142329696a5d43d

COCOAPODS: 1.12.1
COCOAPODS: 1.15.2
19 changes: 19 additions & 0 deletions IsraelHiking.Web/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions IsraelHiking.Web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"@capacitor/device": "^6.0.0",
"@capacitor/ios": "^6.0.0",
"@capacitor/text-zoom": "^6.0.0",
"@capawesome/capacitor-app-update": "^6.0.0",
"@capgo/native-audio": "^6.4.3",
"@mapbox/mapbox-gl-rtl-text": "0.2.3",
"@mapbox/polyline": "^1.2.1",
Expand Down
2 changes: 2 additions & 0 deletions IsraelHiking.Web/src/application/application.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ import { GlobalErrorHandler } from "./services/global-error.handler";
import { OverpassTurboService } from "./services/overpass-turbo.service";
import { ImageAttributionService } from "./services/image-attribution.service";
import { PmTilesService } from "./services/pmtiles.service";
import { ApplicationUpdateService } from "./services/application-update.service";
// interactions
import { RouteEditPoiInteraction } from "./components/intercations/route-edit-poi.interaction";
import { RouteEditRouteInteraction } from "./components/intercations/route-edit-route.interaction";
Expand Down Expand Up @@ -309,6 +310,7 @@ const initializeApplication = (injector: Injector) => async () => {
OverpassTurboService,
ImageAttributionService,
PmTilesService,
ApplicationUpdateService,
AudioPlayerFactory,
FileSystemWrapper,
// eslint-disable-next-line
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import { GeoLocationService } from "./geo-location.service";
import { OverpassTurboService } from "./overpass-turbo.service";
import { AuthorizationService } from "./authorization.service";
import { ToastService } from "./toast.service";
import { ApplicationUpdateService } from "./application-update.service";
import type { ApplicationState } from "../models/models";

@Injectable()
Expand All @@ -47,6 +48,7 @@ export class ApplicationInitializeService {
private readonly geoLocationService: GeoLocationService,
private readonly overpassTurboService: OverpassTurboService,
private readonly authorizationService: AuthorizationService,
private readonly applicationUpdateService: ApplicationUpdateService,
private readonly toastService: ToastService,
private readonly store: Store
) {
Expand All @@ -62,6 +64,7 @@ export class ApplicationInitializeService {
this.screenService.initialize();
await this.resources.initialize();
this.applicationExitService.initialize();
await this.applicationUpdateService.initialize();
this.openWithService.initialize();
await this.purchaseService.initialize();
this.geoLocationService.initialize();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { Injectable } from "@angular/core";
import { AppUpdate, AppUpdateAvailability } from '@capawesome/capacitor-app-update';

import { RunningContextService } from "./running-context.service";
import { ToastService } from "./toast.service";
import { ResourcesService } from "./resources.service";

@Injectable()
export class ApplicationUpdateService {
constructor(private readonly resourcesService: ResourcesService,
private readonly runningContextSerive: RunningContextService,
private readonly toastService: ToastService) {}

public async initialize() {
if (!this.runningContextSerive.isCapacitor) {
return;
}
const result = await AppUpdate.getAppUpdateInfo();
if (result.updateAvailability !== AppUpdateAvailability.UPDATE_AVAILABLE) {
return;
}
this.toastService.confirm({
type: "YesNo",
message: this.resourcesService.newVersionAvailable,
confirmAction: () => {
AppUpdate.openAppStore();
}
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,7 @@ export class ResourcesService {
public editingRouteWhileTracking: string;
public loginTokenExpiredPleaseLoginAgain: string;
public jammedPositionReceived: string;
public newVersionAvailable: string;
// Info
public infoSubheader: string;
public infoHelpfulLinks: string;
Expand Down Expand Up @@ -484,7 +485,7 @@ export class ResourcesService {
}

private async setLanguageInternal(language: Language): Promise<void> {
await this.gettextCatalog.loadRemote(Urls.translations + language.code + ".json?sign=1716145116367");
await this.gettextCatalog.loadRemote(Urls.translations + language.code + ".json?sign=1722974337771");
this.about = this.gettextCatalog.getString("About");
this.legend = this.gettextCatalog.getString("Legend");
this.clear = this.gettextCatalog.getString("Clear");
Expand Down Expand Up @@ -796,6 +797,7 @@ export class ResourcesService {
"in order to avoid map centering to current location please click the cross icon on the top left corner");
this.loginTokenExpiredPleaseLoginAgain = this.gettextCatalog.getString("Login token expired, please login again");
this.jammedPositionReceived = this.gettextCatalog.getString("Jammed position received...");
this.newVersionAvailable = this.gettextCatalog.getString("New version available, do you want to update?");
// Info
this.infoHelpfulLinks = this.gettextCatalog.getString("Helpful links:");
this.infoSubheader = this.gettextCatalog
Expand Down
1 change: 1 addition & 0 deletions IsraelHiking.Web/src/translations/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@
"Nature Reserve, National Park": "Nature Reserve, National Park",
"Navigate Here": "Navigate Here",
"Navigate with Waze": "Navigate with Waze",
"New version available, do you want to update?": "A new app version is available. Do you want to update?",
"Next": "Next",
"No": "No",
"No legend for this map...": "No legend for this map...",
Expand Down
1 change: 1 addition & 0 deletions IsraelHiking.Web/src/translations/he.json
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@
"Nature Reserve, National Park": "שמורת טבע, גן לאומי",
"Navigate Here": "נווט לכאן",
"Navigate with Waze": "ניווט בעזרת וויז",
"New version available, do you want to update?": "שחררנו גרסה חדשה של האפליקציה. רוצים לעדכן?",
"Next": "הבא",
"No": "לא",
"No legend for this map...": "אין מקרא עבור מפה זו...",
Expand Down

0 comments on commit 7640d68

Please sign in to comment.