From 6de87a20069a88c77665c3f83f0cf87bcc21028c Mon Sep 17 00:00:00 2001
From: Neil Wang <weili.wang@highsoft.ltd>
Date: Fri, 3 Mar 2023 05:52:46 +0000
Subject: [PATCH] =?UTF-8?q?feat:=20#743=20=E7=94=A8=E6=88=B7=E6=9F=A5?=
 =?UTF-8?q?=E7=9C=8B=20OS=20=E5=8D=87=E7=BA=A7=E6=8F=90=E7=A4=BA=EF=BC=88?=
 =?UTF-8?q?=E6=96=87=E6=A1=88=E8=B0=83=E6=95=B4=EF=BC=89?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 lib/core/system_version_detector.dart               | 4 +++-
 lib/l10n/intl_en.arb                                | 4 ++--
 lib/l10n/intl_zh.arb                                | 4 ++--
 test/core/widgets/low_system_version_view_test.dart | 7 ++++---
 4 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/lib/core/system_version_detector.dart b/lib/core/system_version_detector.dart
index d9d7e13d2..88861f6c8 100644
--- a/lib/core/system_version_detector.dart
+++ b/lib/core/system_version_detector.dart
@@ -15,6 +15,7 @@ enum SystemType {
 
   static String version = '';
   static String maxVersion = '';
+  static String maintainVersion = '';
 
   const SystemType(this.iosVersionRange, this.androidVersionRange);
 
@@ -24,6 +25,7 @@ enum SystemType {
 
   static SystemType _match(String? version, VersionRange Function(SystemType systemType) mapper) {
     SystemType.maxVersion = '${mapper(SystemType.latest).name} ${mapper(SystemType.latest).highest}';
+    SystemType.maintainVersion = '${mapper(SystemType.latest).name} ${mapper(SystemType.maintainable).min}';
     if (version == null || version.isEmpty) {
       SystemType.version = '';
       return SystemType.unmaintainable;
@@ -38,7 +40,7 @@ enum SystemType {
     if (this == SystemType.maintainable && isForGeek) {
       return JiHuLocalizations.dictionary().versionNotSupportForGeekHint(version, SystemType.maxVersion);
     }
-    return JiHuLocalizations.dictionary().versionNotSupportHint(version, SystemType.maxVersion);
+    return JiHuLocalizations.dictionary().versionNotSupportHint(version, SystemType.maintainVersion);
   }
 }
 
diff --git a/lib/l10n/intl_en.arb b/lib/l10n/intl_en.arb
index 48345268d..9995172c8 100644
--- a/lib/l10n/intl_en.arb
+++ b/lib/l10n/intl_en.arb
@@ -258,7 +258,7 @@
   "noChanges": "No Changes",
   "versionUpgradeRemind": "Version Upgrade Remind",
   "doNotAllowViewContent": "Access Forbidden",
-  "versionNotSupportHint": "You are using a discontinued {version}\nThere is a security vulnerability\nPlease upgrade to the latest version of {maxVersion}",
-  "versionNotSupportForGeekHint": "You are using an outdated {version}\nProbably not a geek\nPlease upgrade to the latest version of {maxVersion}",
+  "versionNotSupportHint": "You are using a discontinued OS: {version}\nIt has security vulnerabilities\nShould upgrade to maintained versions: {maintainVersion}+",
+  "versionNotSupportForGeekHint": "You are using an outdated OS: {version}\nPlease upgrade to the latest version: {maxVersion}",
   "defaultVersion": "system version"
 }
diff --git a/lib/l10n/intl_zh.arb b/lib/l10n/intl_zh.arb
index 273db05e3..c3b4e451f 100644
--- a/lib/l10n/intl_zh.arb
+++ b/lib/l10n/intl_zh.arb
@@ -258,7 +258,7 @@
   "noChanges": "没有变更",
   "versionUpgradeRemind": "版本升级提示",
   "doNotAllowViewContent": "禁止访问",
-  "versionNotSupportHint": "你正在使用废弃的 {version}\n存在安全漏洞\n请升级至最新的 {maxVersion}",
-  "versionNotSupportForGeekHint": "你正在使用落后的 {version}\n可能不是极客\n请升级至最新的 {maxVersion}",
+  "versionNotSupportHint": "你正在使用废弃的 {version}\n存在安全漏洞\n请升级至 {maintainVersion}+",
+  "versionNotSupportForGeekHint": "你正在使用落后的 {version}\n请升级至最新的 {maxVersion}",
   "defaultVersion": "系统版本"
 }
diff --git a/test/core/widgets/low_system_version_view_test.dart b/test/core/widgets/low_system_version_view_test.dart
index cca86eaf4..4667a910f 100644
--- a/test/core/widgets/low_system_version_view_test.dart
+++ b/test/core/widgets/low_system_version_view_test.dart
@@ -8,13 +8,13 @@ void main() {
   JiHuLocalizations.init();
   var testCases = [
     {
-      "alert": JiHuLocalizations.dictionary().versionNotSupportHint("iOS 16", "17"),
+      "alert": JiHuLocalizations.dictionary().versionNotSupportHint("iOS 16", "16"),
       "currentVersion": "iOS 16",
       "matchResult": SystemType.maintainable,
       "forGeek": false,
     },
     {
-      "alert": JiHuLocalizations.dictionary().versionNotSupportHint("iOS 13", "17"),
+      "alert": JiHuLocalizations.dictionary().versionNotSupportHint("iOS 13", "16"),
       "currentVersion": "iOS 13",
       "matchResult": SystemType.unmaintainable,
       "forGeek": false,
@@ -26,7 +26,7 @@ void main() {
       "forGeek": true,
     },
     {
-      "alert": JiHuLocalizations.dictionary().versionNotSupportHint("iOS 13", "17"),
+      "alert": JiHuLocalizations.dictionary().versionNotSupportHint("iOS 13", "16"),
       "currentVersion": "iOS 13",
       "matchResult": SystemType.unmaintainable,
       "forGeek": true,
@@ -34,6 +34,7 @@ void main() {
   ];
   group('Should user see low system version warnings by low system version phone.', () {
     SystemType.maxVersion = "17";
+    SystemType.maintainVersion = "16";
     for (var testCase in testCases) {
       String alertContent = testCase['alert'] as String;
       String currentMobileVersion = testCase['currentVersion'] as String;
-- 
GitLab