Skip to content

Commit

Permalink
Merge pull request #240 from IraSoro/hotfix-app-version-update
Browse files Browse the repository at this point in the history
hotfix: Replaced custom version check with `semver` package
  • Loading branch information
IraSoro authored Jun 28, 2024
2 parents 929c3a7 + 4596432 commit 1d701f5
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 30 deletions.
15 changes: 12 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ We welcome contributions for translating our application into various languages.
]);
```

6. Added language to resources like this:
6. Added language to `resources` like this:

```ts
resources: {
Expand All @@ -41,7 +41,16 @@ We welcome contributions for translating our application into various languages.
},
```

7. Open the file `./src/utils/datetime.ts`. Add the locale to the `locales` variable like this:
7. Added language to `fallbackLng` like this:

```ts
fallbackLng: {
ru: ["ru"],
default: [defaultLanguageCode],
},
```

8. Open the file `./src/utils/datetime.ts`. Add the locale to the `locales` variable like this:

```ts
const locales = new Map([
Expand All @@ -50,7 +59,7 @@ We welcome contributions for translating our application into various languages.
]);
```

8. Make a Pull Request with the translated file.
9. Make a Pull Request with the translated file.

### Guidelines

Expand Down
32 changes: 8 additions & 24 deletions package-lock.json

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

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "peri",
"version": "2.3.10",
"version": "2.3.11",
"author": {
"name": "Irina Sorokina",
"url": "https://github.com/IraSoro"
Expand Down Expand Up @@ -42,6 +42,7 @@
"react-router": "^5.3.4",
"react-router-dom": "^5.3.4",
"react-scripts": "^5.0.0",
"semver": "^7.6.2",
"typescript": "^4.9.5",
"web-vitals": "^3.3.2",
"workbox-background-sync": "^7.0.0",
Expand Down
5 changes: 3 additions & 2 deletions src/data/AppVersion.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { isPlatform } from "@ionic/core";
import semver from "semver";

export const appVersion = "v2.3.10";
export const appVersion = "v2.3.11";

export interface GithubReleaseAsset {
content_type: string;
Expand Down Expand Up @@ -59,7 +60,7 @@ export async function isNewVersionAvailable(): Promise<boolean> {
return false;
}

return (await getLatestReleaseInfo()).version > appVersion;
return semver.gt((await getLatestReleaseInfo()).version, appVersion);
}

export async function downloadLatestRelease() {
Expand Down
1 change: 1 addition & 0 deletions src/utils/translation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export async function init() {
lng: (await storage.getUnsafe.language()) || navigator.language,
fallbackLng: {
ru: ["ru"],
es: ["es"],
default: [defaultLanguageCode],
},
} satisfies InitOptions);
Expand Down

0 comments on commit 1d701f5

Please sign in to comment.