tisfeng / Easydict

一个简洁优雅的词典翻译 macOS App。开箱即用,支持离线 OCR 识别,支持有道词典,🍎 苹果系统词典,🍎 苹果系统翻译,OpenAI,Gemini,DeepL,Google,Bing,腾讯,百度,阿里,小牛,彩云和火山翻译。A concise and elegant Dictionary and Translator macOS App for looking up words and translating text.
GNU General Public License v3.0
6.38k stars 324 forks source link

dev: 优化 Easydict 启动代码,改进崩溃日志记录 #553

Closed tisfeng closed 4 weeks ago

tisfeng commented 1 month ago

起因

看到一些用户反馈 https://github.com/tisfeng/Easydict/issues/547#issuecomment-2109165560 ,明明发生了程序崩溃,却获取不到有用的日志信息。

很奇怪,我打断点发现应用启动会先执行 SwiftUI 中的 @main 入口,然后才会执行 AppDelegate 中的代理方法(到这里才启动崩溃日志捕获),因此如果某些特殊情况下,应用启动后就在 SwiftUI 入口崩溃,可能获取不到崩溃日志。(存疑 🤔)

改进

优化 Easydict 启动代码,尽早开启崩溃日志捕获。

@main
enum EasydictCmpatibilityEntry {
    static func main() {
        parseArmguments()
        if Configuration.shared.enableBetaNewApp {
            EasydictApp.main()
        } else {
            _ = NSApplicationMain(CommandLine.argc, CommandLine.unsafeArgv)
        }
    }
}
image
tisfeng commented 1 month ago

既然这个 issue https://github.com/tisfeng/Easydict/issues/534 已经改为支持 macOS 13.0,那旧的启动页 Main.storyboard 也可以移除了,这个也一并给你吧 @AkaShark

AkaShark commented 1 month ago

既然这个 issue #534 已经改为支持 macOS 13.0,那旧的启动页 Main.storyboard 也可以移除了,这个也一并给你吧 @AkaShark

okay