diff --git a/apps/mobile/app/components/sheets/github/issue.js b/apps/mobile/app/components/sheets/github/issue.js
index eea3bd819..7c719eeb0 100644
--- a/apps/mobile/app/components/sheets/github/issue.js
+++ b/apps/mobile/app/components/sheets/github/issue.js
@@ -20,6 +20,7 @@ along with this program. If not, see .
import Clipboard from "@react-native-clipboard/clipboard";
import React, { useRef, useState } from "react";
import { Linking, Platform, Text, TextInput, View } from "react-native";
+import { getVersion } from "react-native-device-info";
import { db } from "../../../common/database";
import { eSendEvent, ToastEvent } from "../../../services/event-manager";
import PremiumService from "../../../services/premium";
@@ -29,7 +30,6 @@ import { eCloseProgressDialog } from "../../../utils/events";
import { openLinkInBrowser } from "../../../utils/functions";
import { SIZE } from "../../../utils/size";
import { sleep } from "../../../utils/time";
-import { APP_VERSION } from "../../../version";
import DialogHeader from "../../dialog/dialog-header";
import { presentDialog } from "../../dialog/functions";
import { Button } from "../../ui/button";
@@ -59,7 +59,7 @@ export const Issue = ({ defaultTitle, defaultBody, issueTitle }) => {
body.current +
`\n_______________
**Device information:**
-App version: ${APP_VERSION}
+App version: ${getVersion()}
Platform: ${Platform.OS}
Model: ${Platform.constants.Brand || ""}-${Platform.constants.Model || ""}-${
Platform.constants.Version || ""
@@ -187,7 +187,9 @@ For example:
{`App version: ${APP_VERSION} Platform: ${Platform.OS} Model: ${Platform.constants.Brand}-${Platform.constants.Model}-${Platform.constants.Version}`}
+ >{`App version: ${getVersion()} Platform: ${Platform.OS} Model: ${
+ Platform.constants.Brand
+ }-${Platform.constants.Model}-${Platform.constants.Version}`}
.
*/
+import React from "react";
import { Platform, View } from "react-native";
-import { APP_VERSION } from "../../../version";
+import { getVersion } from "react-native-device-info";
+import { features } from "../../../features";
import { eSendEvent, presentSheet } from "../../../services/event-manager";
import SettingsService from "../../../services/settings";
import { useThemeStore } from "../../../stores/use-theme-store";
@@ -28,8 +30,6 @@ import { Button } from "../../ui/button";
import Seperator from "../../ui/seperator";
import Heading from "../../ui/typography/heading";
import Paragraph from "../../ui/typography/paragraph";
-import { features } from "../../../features";
-import React from "react";
export type FeatureType = {
title: string;
body: string;
@@ -89,13 +89,13 @@ NewFeature.present = () => {
const { version, introCompleted } = SettingsService.get();
if (!introCompleted) {
SettingsService.set({
- version: APP_VERSION
+ version: getVersion()
});
return;
}
- if (version && version === APP_VERSION) return false;
+ if (version && version === getVersion()) return false;
SettingsService.set({
- version: APP_VERSION
+ version: getVersion()
});
const _features = features?.filter(
(feature) => !feature.platform || feature.platform === Platform.OS
diff --git a/apps/mobile/app/screens/settings/settings-data.tsx b/apps/mobile/app/screens/settings/settings-data.tsx
index a1a0da677..ea1667638 100644
--- a/apps/mobile/app/screens/settings/settings-data.tsx
+++ b/apps/mobile/app/screens/settings/settings-data.tsx
@@ -59,13 +59,14 @@ import {
eOpenRestoreDialog
} from "../../utils/events";
import { sleep } from "../../utils/time";
-import { APP_VERSION } from "../../version";
import { MFARecoveryCodes, MFASheet } from "./2fa";
import AppLock from "./app-lock";
import { useDragState } from "./editor/state";
import { verifyUser } from "./functions";
import { SettingSection } from "./types";
import { getTimeLeft } from "./user-section";
+import { getVersion } from "react-native-device-info";
+
const format = (ver: number) => {
const parts = ver.toString().split("");
return `v${parts[0]}.${parts[1]}.${
@@ -1014,7 +1015,7 @@ export const settingsGroups: SettingSection[] = [
console.error(e);
}
},
- description: format(APP_VERSION)
+ description: getVersion()
}
]
}
diff --git a/apps/mobile/app/stores/use-message-store.ts b/apps/mobile/app/stores/use-message-store.ts
index 042996ab8..6eb59e55f 100644
--- a/apps/mobile/app/stores/use-message-store.ts
+++ b/apps/mobile/app/stores/use-message-store.ts
@@ -18,12 +18,12 @@ along with this program. If not, see .
*/
import { Platform } from "react-native";
+import { getVersion } from "react-native-device-info";
import create, { State } from "zustand";
-import { APP_VERSION } from "../version";
-import PremiumService from "../services/premium";
-import { SUBSCRIPTION_STATUS } from "../utils/constants";
import { db } from "../common/database";
import { MMKV } from "../common/database/mmkv";
+import PremiumService from "../services/premium";
+import { SUBSCRIPTION_STATUS } from "../utils/constants";
import layoutmanager from "../utils/layout-manager";
export interface MessageStore extends State {
message: Message;
@@ -167,7 +167,7 @@ async function shouldShowAnnouncement(announcement: Announcement) {
);
if (announcement.appVersion) {
- return announcement.appVersion === APP_VERSION;
+ return announcement.appVersion === (getVersion() as unknown as number);
}
if (!show) return false;
diff --git a/apps/mobile/app/stores/use-setting-store.ts b/apps/mobile/app/stores/use-setting-store.ts
index 4e2f48021..a1a659514 100644
--- a/apps/mobile/app/stores/use-setting-store.ts
+++ b/apps/mobile/app/stores/use-setting-store.ts
@@ -60,7 +60,7 @@ export type Settings = {
lastRecoveryEmailTime?: number;
lastVerificationEmailTime?: number;
sessionExpired: boolean;
- version: number | null;
+ version: string | null;
doubleSpacedLines?: boolean;
};
diff --git a/apps/mobile/app/version.js b/apps/mobile/app/version.js
deleted file mode 100644
index 450a1db3c..000000000
--- a/apps/mobile/app/version.js
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
-This file is part of the Notesnook project (https://notesnook.com/)
-
-Copyright (C) 2022 Streetwriters (Private) Limited
-
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see .
-*/
-
-export const APP_VERSION = 217;