Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allows disable update tip #41

Merged
merged 2 commits into from
Dec 31, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions DarockBili Watch App/InMain/MainView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,15 @@ struct MainView: View {
@AppStorage("DedeUserID__ckMd5") var dedeUserID__ckMd5 = ""
@AppStorage("SESSDATA") var sessdata = ""
@AppStorage("bili_jct") var biliJct = ""
@AppStorage("UpdateTipIgnoreVersion") var updateTipIgnoreVersion = ""
@State var videos = [[String: String]]()
@State var isSearchPresented = false
@State var notice = ""
@State var isNetworkFixPresented = false
@State var isFirstLoaded = false
@State var newMajorVer = ""
@State var newBuildVer = ""
@State var isShowDisableNewVerTip = false
@State var isLoadingNew = false
@State var isFailedToLoad = false
var body: some View {
Expand All @@ -84,8 +86,22 @@ struct MainView: View {
if newMajorVer != "" && newBuildVer != "" {
let nowMajorVer = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as! String
let nowBuildVer = Bundle.main.infoDictionary?["CFBundleVersion"] as! String
if nowMajorVer < newMajorVer || nowBuildVer < newBuildVer {
Text("喵哩喵哩新版本(v\(newMajorVer) Build \(newBuildVer))已发布!现可更新")
if (nowMajorVer < newMajorVer || nowBuildVer < newBuildVer) && updateTipIgnoreVersion != "\(newMajorVer)\(newBuildVer)" {
VStack {
Text("喵哩喵哩新版本(v\(newMajorVer) Build \(newBuildVer))已发布!现可更新")
if isShowDisableNewVerTip {
Text("再次轻触以在下次更新前禁用此提示")
.font(.system(size: 12))
.foregroundColor(.gray)
}
}
.onTapGesture {
if isShowDisableNewVerTip {
updateTipIgnoreVersion = "\(newMajorVer)\(newBuildVer)"
} else {
isShowDisableNewVerTip = true
}
}
}
}
}
Expand Down