Skip to content

Commit

Permalink
fix: fix assert when launch (#296)
Browse files Browse the repository at this point in the history
* feat: Dynamic Update

* Update installation for iOS

* Fixed issues

* fix: fix assert when launch
  • Loading branch information
WindowsMEMZ authored Mar 2, 2024
1 parent 21de1b9 commit 227e9cd
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 66 deletions.
48 changes: 15 additions & 33 deletions DarockBili.dynamic/AppMain.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -415,47 +416,28 @@ 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
}
}
}
}

#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 {
Expand Down
24 changes: 12 additions & 12 deletions DarockBili.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down
6 changes: 6 additions & 0 deletions Localizable.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -9393,6 +9393,9 @@
}
}
}
},
"请不要让Apple Watch熄屏,可以通过保持滚动表冠以使屏幕常亮" : {

},
"超大" : {
"extractionState" : "stale",
Expand Down Expand Up @@ -9513,6 +9516,9 @@
}
}
}
},
"顺便了解一些知识来打发时间吧!\n\n- 为什么要下载资源包?\n 喵哩喵哩通过资源包运行主要代码,这也就意味着您无需经常使用iPhone更新App。\n- 获取新功能的方法?\n 在设置->软件更新中可以更新资源包,无论iPhone是否在身边\n- 使用技巧?\n - 保持良好的网络环境,最好不连接iPhone或在设置中关闭iPhone上的无线局域网与蓝牙\n - 遇到问题在用户群内反馈效率最高\n - 登录账号以获取最佳体验\n- 开源!\n 喵哩喵哩为开源项目,您可以在GitHub上找到我们的源代码" : {

},
"颜色" : {
"extractionState" : "stale",
Expand Down
22 changes: 1 addition & 21 deletions MeowBili/MeowBiliApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -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)
Expand Down

0 comments on commit 227e9cd

Please sign in to comment.