Skip to content

Commit

Permalink
Merge pull request #396 from Darock-Studio/fix/dynamic-crash
Browse files Browse the repository at this point in the history
fix: Crash when loading dynamics
  • Loading branch information
Mark Chan authored Aug 9, 2024
2 parents 11f9e3c + 406cdfc commit 2a2543c
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 95 deletions.
25 changes: 0 additions & 25 deletions DarockBili.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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, ); }; };
Expand Down Expand Up @@ -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 */,
Expand All @@ -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 */,
Expand Down Expand Up @@ -875,7 +871,6 @@
8CA3889E2B78B1E300F5F91F /* AZVideoPlayer */,
8C0557DE2B791B84009D9CD0 /* AZVideoPlayer */,
8CC3D5622B7CCE57005636DC /* ScreenshotableView */,
8CA370D32B82690700CE0E9E /* Mixpanel */,
8CA370DE2B827AAD00CE0E9E /* AlertToast */,
8CB176A42BB8188700CEC05C /* SDWebImageSwiftUI */,
8CB176AD2BB8420B00CEC05C /* DarockKit */,
Expand Down Expand Up @@ -910,7 +905,6 @@
8CA7CBF62B77AC8A008E587F /* SDWebImagePDFCoder */,
8CA7CBF82B77AC8A008E587F /* SwiftSoup */,
8CA7CBFC2B77AC8A008E587F /* Dynamic */,
8CA370D52B82691100CE0E9E /* Mixpanel */,
8CB176A62BB8189300CEC05C /* SDWebImageSwiftUI */,
8CB176AF2BB8421300CEC05C /* DarockKit */,
8C03B6DD2C280BAA000770B4 /* Cepheus */,
Expand Down Expand Up @@ -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" */,
Expand Down Expand Up @@ -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";
Expand Down Expand Up @@ -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" */;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"originHash" : "d28be4d892e241813e1562f4d95d6d86cacedeb289d4f3c74fadfba503aba62d",
"originHash" : "6dafa41a67c3277a909bef0c6c2644adb4ba78f5af49155074ffdd3bc494af0d",
"pins" : [
{
"identity" : "alamofire",
Expand Down Expand Up @@ -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",
Expand Down
5 changes: 5 additions & 0 deletions Localizable.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -8158,6 +8158,7 @@
}
},
"允许收集使用信息" : {
"extractionState" : "stale",
"localizations" : {
"en" : {
"stringUnit" : {
Expand Down Expand Up @@ -8209,6 +8210,7 @@
}
},
"分析与改进" : {
"extractionState" : "stale",
"localizations" : {
"en" : {
"stringUnit" : {
Expand Down Expand Up @@ -8550,6 +8552,7 @@
}
},
"喵哩喵哩为完整开源项目,欢迎检查代码以确认无隐私问题" : {
"extractionState" : "stale",
"localizations" : {
"en" : {
"stringUnit" : {
Expand All @@ -8560,6 +8563,7 @@
}
},
"喵哩喵哩开源页" : {
"extractionState" : "stale",
"localizations" : {
"en" : {
"stringUnit" : {
Expand All @@ -8570,6 +8574,7 @@
}
},
"喵哩喵哩收集使用信息仅用以帮助改进质量,不会用于广告、个人画像之类,收集的信息不会关联到个人。此更改立即生效,不会影响哔哩哔哩官方对您的数据收集。" : {
"extractionState" : "stale",
"localizations" : {
"en" : {
"stringUnit" : {
Expand Down
24 changes: 0 additions & 24 deletions MeowBili/MeowBiliApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

import Darwin
import SwiftUI
import Mixpanel
import DarockKit
import SwiftyJSON
import SDWebImage
Expand Down Expand Up @@ -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
}

Expand Down Expand Up @@ -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()
Expand Down
23 changes: 0 additions & 23 deletions MeowBili/Others/SettingsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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("文件保险箱")
Expand All @@ -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
Expand Down
6 changes: 4 additions & 2 deletions MeowBili/UserDynamic/UserDynamicMainView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Expand Down
11 changes: 0 additions & 11 deletions MeowBili/Video/VideoDetailView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import UIKit
import AVKit
import SwiftUI
import Marquee
import Mixpanel
import EFQRCode
import DarockKit
import Alamofire
Expand All @@ -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"
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 2a2543c

Please sign in to comment.