|
|
@@ -31,8 +31,20 @@ export function checkVersion(fetchedVersion: { version: string; isActive: boolea
|
|
|
// Prevent any further code execution
|
|
|
throw new Error('MAINTENANCE_MODE');
|
|
|
}
|
|
|
- // if (currentVersion && currentVersion !== '1.2.9') {
|
|
|
- if (currentVersion && currentVersion !== fetchedVersion.version) {
|
|
|
+
|
|
|
+ function compareVersions(v1: string, v2: string): boolean {
|
|
|
+ const v1Parts = v1.split('.').map(Number);
|
|
|
+ const v2Parts = v2.split('.').map(Number);
|
|
|
+
|
|
|
+ for (let i = 0; i < v1Parts.length; i++) {
|
|
|
+ if (v1Parts[i] < v2Parts[i]) return true;
|
|
|
+ if (v1Parts[i] > v2Parts[i]) return false;
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ // if (currentVersion && currentVersion < fetchedVersion.version) {
|
|
|
+ if (currentVersion && compareVersions(currentVersion, fetchedVersion.version)) {
|
|
|
Alert.alert(
|
|
|
'請更新到最新版本',
|
|
|
'Please update to the latest version of the app to continue.',
|