From 227e9cd9c51ad1f932f1d83fea95dca5710bd118 Mon Sep 17 00:00:00 2001 From: Mark Chan <45706356+WindowsMEMZ@users.noreply.github.com> Date: Sun, 3 Mar 2024 04:50:12 +0800 Subject: [PATCH] fix: fix assert when launch (#296) * feat: Dynamic Update * Update installation for iOS * Fixed issues * fix: fix assert when launch --- DarockBili.dynamic/AppMain.swift | 48 +++++++++------------------- DarockBili.xcodeproj/project.pbxproj | 24 +++++++------- Localizable.xcstrings | 6 ++++ MeowBili/MeowBiliApp.swift | 22 +------------ 4 files changed, 34 insertions(+), 66 deletions(-) diff --git a/DarockBili.dynamic/AppMain.swift b/DarockBili.dynamic/AppMain.swift index d03c6f540..2c62ea61a 100644 --- a/DarockBili.dynamic/AppMain.swift +++ b/DarockBili.dynamic/AppMain.swift @@ -95,6 +95,7 @@ struct AppMainView: View { // Navigators @State var isUrlOpenVideoPresented = false @State var urlOpenVideoDetails = [String: String]() + @State var isFirstOpen = false #if os(watchOS) @State var isMemoryWarningPresented = false #else @@ -415,6 +416,20 @@ struct AppMainView: View { } } } + + if !isFirstOpen { + Mixpanel.initialize(token: "37d4aaecc64cae16353c2fe7dbb0513c", trackAutomaticEvents: false) + // ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // Wow you see a token there, I'm not forget to hide it because you are no able to + // do anything important by this token >_- + if (UserDefaults.standard.object(forKey: "IsAllowMixpanel") as? Bool) ?? true { + Mixpanel.mainInstance().track(event: "Open App") + if let uid = UserDefaults.standard.string(forKey: "DedeUserId") { + Mixpanel.mainInstance().registerSuperPropertiesOnce(["DedeUserId": uid]) + } + } + isFirstOpen = true + } @unknown default: break } @@ -422,40 +437,7 @@ struct AppMainView: View { } } -#if os(watchOS) || os(visionOS) -public func tipWithText(_ text: String, symbol: String = "", time: Double = 3.0) { - pShowTipText = text - pShowTipSymbol = symbol - pTipBoxOffset = 7 - Timer.scheduledTimer(withTimeInterval: time, repeats: false) { timer in - pTipBoxOffset = 80 - timer.invalidate() - } -} -#endif - #if !os(watchOS) -class AppDelegate: NSObject, UIApplicationDelegate { - func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool { - Mixpanel.initialize(token: "37d4aaecc64cae16353c2fe7dbb0513c", trackAutomaticEvents: false) - // ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // Wow you see a token there, I'm not forget to hide it because you are no able to - // do anything important by this token >_- - if (UserDefaults.standard.object(forKey: "IsAllowMixpanel") as? Bool) ?? true { - Mixpanel.mainInstance().track(event: "Open App") - if let uid = UserDefaults.standard.string(forKey: "DedeUserId") { - Mixpanel.mainInstance().registerSuperPropertiesOnce(["DedeUserId": uid]) - } - } - - return true - } - - func applicationDidReceiveMemoryWarning(_ application: UIApplication) { - //AlertKitAPI.present(title: "低内存警告", subtitle: "喵哩喵哩收到了低内存警告", icon: .error, style: .iOS17AppleMusic, haptic: .warning) - } -} - func signalErrorRecord(_ errorNum: Int32, _ errorSignal: String) { var symbols = "" for symbol in Thread.callStackSymbols { diff --git a/DarockBili.xcodeproj/project.pbxproj b/DarockBili.xcodeproj/project.pbxproj index a4ef9b676..b5fbdd165 100644 --- a/DarockBili.xcodeproj/project.pbxproj +++ b/DarockBili.xcodeproj/project.pbxproj @@ -1676,7 +1676,7 @@ isa = XCBuildConfiguration; buildSettings = { CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 926; + CURRENT_PROJECT_VERSION = 929; DEVELOPMENT_TEAM = B57D8PP775; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = SafariExtension/Info.plist; @@ -1707,7 +1707,7 @@ isa = XCBuildConfiguration; buildSettings = { CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 926; + CURRENT_PROJECT_VERSION = 929; DEVELOPMENT_TEAM = B57D8PP775; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = SafariExtension/Info.plist; @@ -1743,7 +1743,7 @@ ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = NO; CODE_SIGN_ENTITLEMENTS = "MeowBili/MeowBili Vision App.entitlements"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 926; + CURRENT_PROJECT_VERSION = 929; DEVELOPMENT_ASSET_PATHS = "\"MeowBili/Preview Content\""; DEVELOPMENT_TEAM = B57D8PP775; ENABLE_PREVIEWS = YES; @@ -1778,7 +1778,7 @@ ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = NO; CODE_SIGN_ENTITLEMENTS = "MeowBili/MeowBili Vision App.entitlements"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 926; + CURRENT_PROJECT_VERSION = 929; DEVELOPMENT_ASSET_PATHS = "\"MeowBili/Preview Content\""; DEVELOPMENT_TEAM = B57D8PP775; ENABLE_PREVIEWS = YES; @@ -1859,7 +1859,7 @@ CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = MeowBili/MeowBili.entitlements; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 926; + CURRENT_PROJECT_VERSION = 929; DEVELOPMENT_ASSET_PATHS = "\"MeowBili/Preview Content\""; DEVELOPMENT_TEAM = B57D8PP775; ENABLE_PREVIEWS = YES; @@ -1906,7 +1906,7 @@ CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = MeowBili/MeowBili.entitlements; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 926; + CURRENT_PROJECT_VERSION = 929; DEVELOPMENT_ASSET_PATHS = "\"MeowBili/Preview Content\""; DEVELOPMENT_TEAM = B57D8PP775; ENABLE_PREVIEWS = YES; @@ -1950,7 +1950,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIconWatch; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 926; + CURRENT_PROJECT_VERSION = 929; DEVELOPMENT_ASSET_PATHS = "\"MeowBili/Preview\\ Content\""; DEVELOPMENT_TEAM = B57D8PP775; ENABLE_PREVIEWS = YES; @@ -1986,7 +1986,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIconWatch; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 926; + CURRENT_PROJECT_VERSION = 929; DEVELOPMENT_ASSET_PATHS = "\"MeowBili/Preview\\ Content\""; DEVELOPMENT_TEAM = B57D8PP775; ENABLE_PREVIEWS = YES; @@ -2025,7 +2025,7 @@ CODE_SIGN_ENTITLEMENTS = "MeowBili/MeowBili Mac App.entitlements"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 926; + CURRENT_PROJECT_VERSION = 929; DEVELOPMENT_ASSET_PATHS = "\"MeowBili/Preview Content\""; DEVELOPMENT_TEAM = B57D8PP775; ENABLE_HARDENED_RUNTIME = YES; @@ -2058,7 +2058,7 @@ CODE_SIGN_ENTITLEMENTS = "MeowBili/MeowBili Mac App.entitlements"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 926; + CURRENT_PROJECT_VERSION = 929; DEVELOPMENT_ASSET_PATHS = "\"MeowBili/Preview Content\""; DEVELOPMENT_TEAM = B57D8PP775; ENABLE_HARDENED_RUNTIME = YES; @@ -2087,7 +2087,7 @@ isa = XCBuildConfiguration; buildSettings = { CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 926; + CURRENT_PROJECT_VERSION = 929; DEVELOPMENT_TEAM = B57D8PP775; GENERATE_INFOPLIST_FILE = YES; IPHONEOS_DEPLOYMENT_TARGET = 16.0; @@ -2110,7 +2110,7 @@ isa = XCBuildConfiguration; buildSettings = { CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 926; + CURRENT_PROJECT_VERSION = 929; DEVELOPMENT_TEAM = B57D8PP775; GENERATE_INFOPLIST_FILE = YES; IPHONEOS_DEPLOYMENT_TARGET = 16.0; diff --git a/Localizable.xcstrings b/Localizable.xcstrings index 73acbe80d..5fe2a45ba 100644 --- a/Localizable.xcstrings +++ b/Localizable.xcstrings @@ -9393,6 +9393,9 @@ } } } + }, + "请不要让Apple Watch熄屏,可以通过保持滚动表冠以使屏幕常亮" : { + }, "超大" : { "extractionState" : "stale", @@ -9513,6 +9516,9 @@ } } } + }, + "顺便了解一些知识来打发时间吧!\n\n- 为什么要下载资源包?\n 喵哩喵哩通过资源包运行主要代码,这也就意味着您无需经常使用iPhone更新App。\n- 获取新功能的方法?\n 在设置->软件更新中可以更新资源包,无论iPhone是否在身边\n- 使用技巧?\n - 保持良好的网络环境,最好不连接iPhone或在设置中关闭iPhone上的无线局域网与蓝牙\n - 遇到问题在用户群内反馈效率最高\n - 登录账号以获取最佳体验\n- 开源!\n 喵哩喵哩为开源项目,您可以在GitHub上找到我们的源代码" : { + }, "颜色" : { "extractionState" : "stale", diff --git a/MeowBili/MeowBiliApp.swift b/MeowBili/MeowBiliApp.swift index 8850a8ff1..e95e3d1a0 100644 --- a/MeowBili/MeowBiliApp.swift +++ b/MeowBili/MeowBiliApp.swift @@ -137,16 +137,7 @@ struct DarockBili_Watch_AppApp: App { #if !os(watchOS) class AppDelegate: NSObject, UIApplicationDelegate { func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool { - Mixpanel.initialize(token: "37d4aaecc64cae16353c2fe7dbb0513c", trackAutomaticEvents: false) - // ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // Wow you see a token there, I'm not forget to hide it because you are no able to - // do anything important by this token >_- - if (UserDefaults.standard.object(forKey: "IsAllowMixpanel") as? Bool) ?? true { - Mixpanel.mainInstance().track(event: "Open App") - if let uid = UserDefaults.standard.string(forKey: "DedeUserId") { - Mixpanel.mainInstance().registerSuperPropertiesOnce(["DedeUserId": uid]) - } - } + return true } @@ -158,17 +149,6 @@ class AppDelegate: NSObject, UIApplicationDelegate { #else class AppDelegate: NSObject, WKApplicationDelegate { func applicationDidFinishLaunching() { - Mixpanel.initialize(token: "37d4aaecc64cae16353c2fe7dbb0513c") - // ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // Wow you see a token there, I'm not forget to hide it because you are no able to - // do anything important by this token >_- - if (UserDefaults.standard.object(forKey: "IsAllowMixpanel") as? Bool) ?? true { - Mixpanel.mainInstance().track(event: "Open App") - if let uid = UserDefaults.standard.string(forKey: "DedeUserId") { - Mixpanel.mainInstance().registerSuperPropertiesOnce(["DedeUserId": uid]) - } - } - SDImageCodersManager.shared.addCoder(SDImageWebPCoder.shared) SDImageCodersManager.shared.addCoder(SDImageSVGCoder.shared) SDImageCodersManager.shared.addCoder(SDImagePDFCoder.shared)