Bläddra i källkod

:art: Prompt when there is no normal exit https://github.com/siyuan-note/siyuan/issues/11054

Daniel 1 år sedan
förälder
incheckning
d004b601f2

+ 3 - 1
app/appearance/langs/en_US.json

@@ -1475,6 +1475,8 @@
     "240": "Drag heading under container blocks in the doc is not supported",
     "240": "Drag heading under container blocks in the doc is not supported",
     "241": "Drag to its subheading is not supported",
     "241": "Drag to its subheading is not supported",
     "242": "The binding block already exists in the current database",
     "242": "The binding block already exists in the current database",
-    "243": "Only list the first [%d] tags (including subtags), if you need to adjust, please modify [Settings - Doc Tree - Maximum number to list]"
+    "243": "Only list the first [%d] tags (including subtags), if you need to adjust, please modify [Settings - Doc Tree - Maximum number to list]",
+    "244": "It did not exit normally after the last use. It is recommended to execute [Doc Tree - Rebuild Index]",
+    "245": "It did not exit normally after the last use. It is recommended to execute [Doc Tree - Rebuild Index]. To exit normally, you need to use [Exit Application] in the right panel"
   }
   }
 }
 }

+ 3 - 1
app/appearance/langs/es_ES.json

@@ -1475,6 +1475,8 @@
     "240": "No se admite arrastrar encabezado debajo de los bloques contenedores en el documento",
     "240": "No se admite arrastrar encabezado debajo de los bloques contenedores en el documento",
     "241": "No se admite arrastrar a su subtítulo",
     "241": "No se admite arrastrar a su subtítulo",
     "242": "El bloque de enlace ya existe en la base de datos actual",
     "242": "El bloque de enlace ya existe en la base de datos actual",
-    "243": "Enumere solo las primeras [%d] etiquetas (incluidas las subetiquetas), modifique [Configuración - Árbol de documentos - Número máximo a listar]"
+    "243": "Enumere solo las primeras [%d] etiquetas (incluidas las subetiquetas), modifique [Configuración - Árbol de documentos - Número máximo a listar]",
+    "244": "No salió normalmente después del último uso. Se recomienda ejecutar [Árbol de documentos - Reconstruir índice]",
+    "245": "No salió normalmente después del último uso. Se recomienda ejecutar [Árbol de documentos - Reconstruir índice]. Para salir normalmente, necesita usar [Salir de la aplicación] en el panel derecho"
   }
   }
 }
 }

+ 3 - 1
app/appearance/langs/fr_FR.json

@@ -1475,6 +1475,8 @@
     "240": "Le déplacement du titre sous les blocs conteneurs dans la doc n'est pas pris en charge",
     "240": "Le déplacement du titre sous les blocs conteneurs dans la doc n'est pas pris en charge",
     "241": "Le glisser vers son sous-titre n'est pas pris en charge",
     "241": "Le glisser vers son sous-titre n'est pas pris en charge",
     "242": "Le bloc de liaison existe déjà dans la base de données actuelle",
     "242": "Le bloc de liaison existe déjà dans la base de données actuelle",
-    "243": "Répertorier uniquement les [%d] premières balises (y compris les sous-balises). veuillez modifier [Paramètres - Arbre des documents - Nombre maximum de documents à lister]."
+    "243": "Répertorier uniquement les [%d] premières balises (y compris les sous-balises). veuillez modifier [Paramètres - Arbre des documents - Nombre maximum de documents à lister].",
+    "244": "Il ne s'est pas terminé normalement après la dernière utilisation. Il est recommandé d'exécuter [Doc Tree - Rebuild Index]",
+    "245": "Il ne s'est pas terminé normalement après la dernière utilisation. Il est recommandé d'exécuter [Doc Tree - Rebuild Index]. Pour quitter normalement, vous devez utiliser [Quitter l'application] dans le panneau de droite"
   }
   }
 }
 }

+ 3 - 1
app/appearance/langs/zh_CHT.json

@@ -1475,6 +1475,8 @@
     "240": "不支援拖曳文件中容器區塊下的標題",
     "240": "不支援拖曳文件中容器區塊下的標題",
     "241": "不支持拖曳為自己的子標題",
     "241": "不支持拖曳為自己的子標題",
     "242": "目前資料庫中已經存在該綁定區塊",
     "242": "目前資料庫中已經存在該綁定區塊",
-    "243": "僅列出前 [%d] 個標籤(含子標籤),如需調整請修改 [設置 - 文檔樹 - 最大列出數量]"
+    "243": "僅列出前 [%d] 個標籤(含子標籤),如需調整請修改 [設置 - 文檔樹 - 最大列出數量]",
+    "244": "上次使用後未正常退出,建議執行一次 [文檔樹 - 重建索引]",
+    "245": "上次使用後未正常退出,建議執行一次 [文件樹 - 重建索引],正常退出需使用右側欄面板中的 [退出應用]"
   }
   }
 }
 }

+ 3 - 1
app/appearance/langs/zh_CN.json

@@ -1475,6 +1475,8 @@
     "240": "不支持拖拽文档中容器块下的标题",
     "240": "不支持拖拽文档中容器块下的标题",
     "241": "不支持拖拽为自己的子标题",
     "241": "不支持拖拽为自己的子标题",
     "242": "当前数据库中已经存在该绑定块",
     "242": "当前数据库中已经存在该绑定块",
-    "243": "仅列出前 [%d] 个标签(含子标签),如需调整请修改 [设置 - 文档树 - 最大列出数量]"
+    "243": "仅列出前 [%d] 个标签(含子标签),如需调整请修改 [设置 - 文档树 - 最大列出数量]",
+    "244": "上次使用后未正常退出,建议执行一次 [文档树 - 重建索引]",
+    "245": "上次使用后未正常退出,建议执行一次 [文档树 - 重建索引],正常退出需使用右侧栏面板中的 [退出应用]"
   }
   }
 }
 }

+ 17 - 0
kernel/model/conf.go

@@ -80,6 +80,7 @@ type AppConf struct {
 	ShowChangelog  bool             `json:"showChangelog"`  // 是否显示版本更新日志
 	ShowChangelog  bool             `json:"showChangelog"`  // 是否显示版本更新日志
 	CloudRegion    int              `json:"cloudRegion"`    // 云端区域,0:中国大陆,1:北美
 	CloudRegion    int              `json:"cloudRegion"`    // 云端区域,0:中国大陆,1:北美
 	Snippet        *conf.Snpt       `json:"snippet"`        // 代码片段
 	Snippet        *conf.Snpt       `json:"snippet"`        // 代码片段
+	State          int              `json:"state"`          // 运行状态,0:已经正常退出,1:运行中
 
 
 	m *sync.Mutex
 	m *sync.Mutex
 }
 }
@@ -464,6 +465,21 @@ func InitConf() {
 
 
 	Conf.LocalIPs = util.GetLocalIPs()
 	Conf.LocalIPs = util.GetLocalIPs()
 
 
+	if 1 == Conf.State {
+		// 上次未正常退出
+		go func() {
+			util.WaitForUILoaded()
+			time.Sleep(2 * time.Second)
+			if util.ContainerIOS == util.Container || util.ContainerAndroid == util.Container {
+				util.PushMsg(Conf.language(245), 15000)
+			} else {
+				util.PushMsg(Conf.language(244), 15000)
+			}
+		}()
+	}
+
+	Conf.State = 1 // 运行中
+
 	Conf.Save()
 	Conf.Save()
 	logging.SetLogLevel(Conf.LogLevel)
 	logging.SetLogLevel(Conf.LogLevel)
 
 
@@ -702,6 +718,7 @@ func (conf *AppConf) save0(data []byte) {
 }
 }
 
 
 func (conf *AppConf) Close() {
 func (conf *AppConf) Close() {
+	conf.State = 0 // 已经正常退出
 	conf.Save()
 	conf.Save()
 }
 }