From 406cdfc88ff5a901bfa19980c171765e0836e90b Mon Sep 17 00:00:00 2001 From: WindowsMEMZ Date: Fri, 9 Aug 2024 15:55:36 +0800 Subject: [PATCH] fix: Crash when loading dynamics --- DarockBili.xcodeproj/project.pbxproj | 25 ------------------- .../xcshareddata/swiftpm/Package.resolved | 11 +------- Localizable.xcstrings | 5 ++++ MeowBili/MeowBiliApp.swift | 24 ------------------ MeowBili/Others/SettingsView.swift | 23 ----------------- .../UserDynamic/UserDynamicMainView.swift | 6 +++-- MeowBili/Video/VideoDetailView.swift | 11 -------- 7 files changed, 10 insertions(+), 95 deletions(-) diff --git a/DarockBili.xcodeproj/project.pbxproj b/DarockBili.xcodeproj/project.pbxproj index 59cb5c707..276acbf65 100644 --- a/DarockBili.xcodeproj/project.pbxproj +++ b/DarockBili.xcodeproj/project.pbxproj @@ -50,8 +50,6 @@ 8C9776092BCECBC3006EDB58 /* Audio.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8C9776072BCECBC3006EDB58 /* Audio.swift */; }; 8CA1BA112BD2AF9E009BCDFB /* PrivateSymbols.m in Sources */ = {isa = PBXBuildFile; fileRef = 8CA1BA102BD2AF9E009BCDFB /* PrivateSymbols.m */; }; 8CA1BA122BD2AF9E009BCDFB /* PrivateSymbols.m in Sources */ = {isa = PBXBuildFile; fileRef = 8CA1BA102BD2AF9E009BCDFB /* PrivateSymbols.m */; }; - 8CA370D42B82690700CE0E9E /* Mixpanel in Frameworks */ = {isa = PBXBuildFile; productRef = 8CA370D32B82690700CE0E9E /* Mixpanel */; }; - 8CA370D62B82691100CE0E9E /* Mixpanel in Frameworks */ = {isa = PBXBuildFile; productRef = 8CA370D52B82691100CE0E9E /* Mixpanel */; }; 8CA370DB2B82724400CE0E9E /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = 8CA370D92B82724400CE0E9E /* PrivacyInfo.xcprivacy */; }; 8CA370DC2B82724400CE0E9E /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = 8CA370D92B82724400CE0E9E /* PrivacyInfo.xcprivacy */; }; 8CA370DF2B827AAD00CE0E9E /* AlertToast in Frameworks */ = {isa = PBXBuildFile; platformFilters = (ios, maccatalyst, ); productRef = 8CA370DE2B827AAD00CE0E9E /* AlertToast */; settings = {ATTRIBUTES = (Required, ); }; }; @@ -412,7 +410,6 @@ 8CA7CC172B77AC93008E587F /* SDWebImageSVGCoder in Frameworks */, 8CC3D5632B7CCE57005636DC /* ScreenshotableView in Frameworks */, 8C8578B72C5BAC0100AF93D1 /* MarkdownUI in Frameworks */, - 8CA370D42B82690700CE0E9E /* Mixpanel in Frameworks */, 8CA7CC092B77AC93008E587F /* Marquee in Frameworks */, 8C0557DF2B791B84009D9CD0 /* AZVideoPlayer in Frameworks */, 8CA7CC0B2B77AC93008E587F /* SwiftDate in Frameworks */, @@ -435,7 +432,6 @@ 8CA7CBF72B77AC8A008E587F /* SDWebImagePDFCoder in Frameworks */, 8C03B6DE2C280BAA000770B4 /* Cepheus in Frameworks */, 8CA7CBF52B77AC8A008E587F /* SDWebImageSVGCoder in Frameworks */, - 8CA370D62B82691100CE0E9E /* Mixpanel in Frameworks */, 8CA7CBE72B77AC8A008E587F /* Marquee in Frameworks */, 8CA7CBE92B77AC8A008E587F /* SwiftDate in Frameworks */, 8CA7CBFD2B77AC8A008E587F /* Dynamic in Frameworks */, @@ -875,7 +871,6 @@ 8CA3889E2B78B1E300F5F91F /* AZVideoPlayer */, 8C0557DE2B791B84009D9CD0 /* AZVideoPlayer */, 8CC3D5622B7CCE57005636DC /* ScreenshotableView */, - 8CA370D32B82690700CE0E9E /* Mixpanel */, 8CA370DE2B827AAD00CE0E9E /* AlertToast */, 8CB176A42BB8188700CEC05C /* SDWebImageSwiftUI */, 8CB176AD2BB8420B00CEC05C /* DarockKit */, @@ -910,7 +905,6 @@ 8CA7CBF62B77AC8A008E587F /* SDWebImagePDFCoder */, 8CA7CBF82B77AC8A008E587F /* SwiftSoup */, 8CA7CBFC2B77AC8A008E587F /* Dynamic */, - 8CA370D52B82691100CE0E9E /* Mixpanel */, 8CB176A62BB8189300CEC05C /* SDWebImageSwiftUI */, 8CB176AF2BB8421300CEC05C /* DarockKit */, 8C03B6DD2C280BAA000770B4 /* Cepheus */, @@ -997,7 +991,6 @@ 8CA7CCDD2B77BB5A008E587F /* XCRemoteSwiftPackageReference "AlertKit" */, 8C0557DD2B791B84009D9CD0 /* XCRemoteSwiftPackageReference "AZVideoPlayer" */, 8CC3D5612B7CCE57005636DC /* XCRemoteSwiftPackageReference "ScreenshotableView" */, - 8CA370D22B82690700CE0E9E /* XCRemoteSwiftPackageReference "mixpanel-swift" */, 8CA370DD2B827AAD00CE0E9E /* XCRemoteSwiftPackageReference "AlertToast" */, 8CB176A32BB8188600CEC05C /* XCRemoteSwiftPackageReference "SDWebImageSwiftUI" */, 8CB176AC2BB8420A00CEC05C /* XCRemoteSwiftPackageReference "DarockKit" */, @@ -2124,14 +2117,6 @@ minimumVersion = 2.3.1; }; }; - 8CA370D22B82690700CE0E9E /* XCRemoteSwiftPackageReference "mixpanel-swift" */ = { - isa = XCRemoteSwiftPackageReference; - repositoryURL = "https://github.com/mixpanel/mixpanel-swift"; - requirement = { - branch = master; - kind = branch; - }; - }; 8CA370DD2B827AAD00CE0E9E /* XCRemoteSwiftPackageReference "AlertToast" */ = { isa = XCRemoteSwiftPackageReference; repositoryURL = "https://github.com/elai950/AlertToast"; @@ -2275,16 +2260,6 @@ package = 8C8578B32C5BABF000AF93D1 /* XCRemoteSwiftPackageReference "swift-markdown-ui" */; productName = MarkdownUI; }; - 8CA370D32B82690700CE0E9E /* Mixpanel */ = { - isa = XCSwiftPackageProductDependency; - package = 8CA370D22B82690700CE0E9E /* XCRemoteSwiftPackageReference "mixpanel-swift" */; - productName = Mixpanel; - }; - 8CA370D52B82691100CE0E9E /* Mixpanel */ = { - isa = XCSwiftPackageProductDependency; - package = 8CA370D22B82690700CE0E9E /* XCRemoteSwiftPackageReference "mixpanel-swift" */; - productName = Mixpanel; - }; 8CA370DE2B827AAD00CE0E9E /* AlertToast */ = { isa = XCSwiftPackageProductDependency; package = 8CA370DD2B827AAD00CE0E9E /* XCRemoteSwiftPackageReference "AlertToast" */; diff --git a/DarockBili.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/DarockBili.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index 83e4f6ffa..c06fad891 100644 --- a/DarockBili.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/DarockBili.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -1,5 +1,5 @@ { - "originHash" : "d28be4d892e241813e1562f4d95d6d86cacedeb289d4f3c74fadfba503aba62d", + "originHash" : "6dafa41a67c3277a909bef0c6c2644adb4ba78f5af49155074ffdd3bc494af0d", "pins" : [ { "identity" : "alamofire", @@ -91,15 +91,6 @@ "version" : "0.3.0" } }, - { - "identity" : "mixpanel-swift", - "kind" : "remoteSourceControl", - "location" : "https://github.com/mixpanel/mixpanel-swift", - "state" : { - "branch" : "master", - "revision" : "e7869c433ee01cdc52aa14abf636fe0b412d72f8" - } - }, { "identity" : "networkimage", "kind" : "remoteSourceControl", diff --git a/Localizable.xcstrings b/Localizable.xcstrings index f57e5dc3c..ff54d051c 100644 --- a/Localizable.xcstrings +++ b/Localizable.xcstrings @@ -8158,6 +8158,7 @@ } }, "允许收集使用信息" : { + "extractionState" : "stale", "localizations" : { "en" : { "stringUnit" : { @@ -8209,6 +8210,7 @@ } }, "分析与改进" : { + "extractionState" : "stale", "localizations" : { "en" : { "stringUnit" : { @@ -8550,6 +8552,7 @@ } }, "喵哩喵哩为完整开源项目,欢迎检查代码以确认无隐私问题" : { + "extractionState" : "stale", "localizations" : { "en" : { "stringUnit" : { @@ -8560,6 +8563,7 @@ } }, "喵哩喵哩开源页" : { + "extractionState" : "stale", "localizations" : { "en" : { "stringUnit" : { @@ -8570,6 +8574,7 @@ } }, "喵哩喵哩收集使用信息仅用以帮助改进质量,不会用于广告、个人画像之类,收集的信息不会关联到个人。此更改立即生效,不会影响哔哩哔哩官方对您的数据收集。" : { + "extractionState" : "stale", "localizations" : { "en" : { "stringUnit" : { diff --git a/MeowBili/MeowBiliApp.swift b/MeowBili/MeowBiliApp.swift index 78219c8a3..b1b786882 100644 --- a/MeowBili/MeowBiliApp.swift +++ b/MeowBili/MeowBiliApp.swift @@ -18,7 +18,6 @@ import Darwin import SwiftUI -import Mixpanel import DarockKit import SwiftyJSON import SDWebImage @@ -485,17 +484,6 @@ public func tipWithText(_ text: String, symbol: String = "", time: Double = 3.0) #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 } @@ -548,21 +536,9 @@ func signalErrorRecord(_ errorNum: Int32, _ errorSignal: String) { #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) - SDImageCache.shared.config.maxMemoryCost = 1024 * 1024 * 10 SDImageCache.shared.config.shouldCacheImagesInMemory = false SDImageCache.shared.config.shouldUseWeakMemoryCache = true SDImageCache.shared.clearMemory() diff --git a/MeowBili/Others/SettingsView.swift b/MeowBili/Others/SettingsView.swift index 3069b9393..be7dadcfc 100644 --- a/MeowBili/Others/SettingsView.swift +++ b/MeowBili/Others/SettingsView.swift @@ -1154,11 +1154,6 @@ struct PrivacySettingsView: View { #if os(watchOS) Toggle("垂下手腕时隐藏内容", isOn: $blurWhenScreenSleep) #endif - Section { - NavigationLink(destination: { AnalyzeAImprove() }, label: { - Text("分析与改进") - }) - } Section { NavigationLink(destination: { FileLocker() }, label: { Text("文件保险箱") @@ -1167,24 +1162,6 @@ struct PrivacySettingsView: View { } } - struct AnalyzeAImprove: View { - @AppStorage("IsAllowMixpanel") var isAllowMixpanel = true - var body: some View { - List { - Section { - Toggle("允许收集使用信息", isOn: $isAllowMixpanel) - } footer: { - Text("喵哩喵哩收集使用信息仅用以帮助改进质量,不会用于广告、个人画像之类,收集的信息不会关联到个人。此更改立即生效,不会影响哔哩哔哩官方对您的数据收集。") - } - Section { - Link("喵哩喵哩开源页", destination: URL(string: "https://github.com/Darock-Studio/Darock-Bili")!) - } footer: { - Text("喵哩喵哩为完整开源项目,欢迎检查代码以确认无隐私问题") - } - } - .navigationTitle("分析与改进") - } - } struct FileLocker: View { @State var isFileLockerEnabled = false @State var isSetPasswdPresented = false diff --git a/MeowBili/UserDynamic/UserDynamicMainView.swift b/MeowBili/UserDynamic/UserDynamicMainView.swift index 48f4684de..4a399d8e9 100644 --- a/MeowBili/UserDynamic/UserDynamicMainView.swift +++ b/MeowBili/UserDynamic/UserDynamicMainView.swift @@ -487,8 +487,10 @@ struct UserDynamicMainView: View { ]) itemForCount += 1 } - lastDynamicID = dynamics.last?["DynamicID"] as! String - nextLoadPage += 1 + if let dynamicLast = dynamics.last { + lastDynamicID = dynamicLast["DynamicID"] as! String + nextLoadPage += 1 + } isLoadingNew = false } } diff --git a/MeowBili/Video/VideoDetailView.swift b/MeowBili/Video/VideoDetailView.swift index 8a57556f7..f4bdec0c0 100644 --- a/MeowBili/Video/VideoDetailView.swift +++ b/MeowBili/Video/VideoDetailView.swift @@ -20,7 +20,6 @@ import UIKit import AVKit import SwiftUI import Marquee -import Mixpanel import EFQRCode import DarockKit import Alamofire @@ -41,7 +40,6 @@ struct VideoDetailView: View { @AppStorage("bili_jct") var biliJct = "" @AppStorage("VideoGetterSource") var videoGetterSource = "official" @AppStorage("IsDanmakuEnabled") var isDanmakuEnabled = true - @AppStorage("IsAllowMixpanel") var isAllowMixpanel = true @AppStorage("IsUseExtHaptic") var isUseExtHaptic = true #if os(watchOS) @AppStorage("RecordHistoryTime") var recordHistoryTime = "into" @@ -784,15 +782,6 @@ struct VideoDetailView: View { isFirstLoaded = true #endif - - if isAllowMixpanel { - Mixpanel.mainInstance().time(event: "Watch Video") - } - } - .onDisappear { - if isAllowMixpanel { - Mixpanel.mainInstance().track(event: "Watch Video", properties: videoDetails) - } } #if !os(watchOS) .toolbar {