Release note view

This commit is contained in:
Lumaa 2024-02-20 22:31:44 +01:00
parent de220435cc
commit f9dbcf5cd1
6 changed files with 153 additions and 0 deletions

View File

@ -21,6 +21,7 @@
B93B677A2B42EC51000892E9 /* MetaPicker.swift in Sources */ = {isa = PBXBuildFile; fileRef = B93B67792B42EC51000892E9 /* MetaPicker.swift */; };
B93B677C2B433A6E000892E9 /* PostingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B93B677B2B433A6E000892E9 /* PostingView.swift */; };
B97491E32B6E96700098BC48 /* SymbolWidth.swift in Sources */ = {isa = PBXBuildFile; fileRef = B97491E22B6E96700098BC48 /* SymbolWidth.swift */; };
B97798892B853E6600DC869F /* UpdateView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B97798882B853E6600DC869F /* UpdateView.swift */; };
B97BCE242B3DD8400044756D /* HapticManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = B97BCE232B3DD8400044756D /* HapticManager.swift */; };
B97BCE262B3DE5A10044756D /* AccountView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B97BCE252B3DE5A10044756D /* AccountView.swift */; };
B97BCE282B3ED2A80044756D /* .gitignore in Resources */ = {isa = PBXBuildFile; fileRef = B97BCE272B3ED2A80044756D /* .gitignore */; };
@ -130,6 +131,7 @@
B93B67792B42EC51000892E9 /* MetaPicker.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MetaPicker.swift; sourceTree = "<group>"; };
B93B677B2B433A6E000892E9 /* PostingView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PostingView.swift; sourceTree = "<group>"; };
B97491E22B6E96700098BC48 /* SymbolWidth.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SymbolWidth.swift; sourceTree = "<group>"; };
B97798882B853E6600DC869F /* UpdateView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UpdateView.swift; sourceTree = "<group>"; };
B97BCE232B3DD8400044756D /* HapticManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HapticManager.swift; sourceTree = "<group>"; };
B97BCE252B3DE5A10044756D /* AccountView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountView.swift; sourceTree = "<group>"; };
B97BCE272B3ED2A80044756D /* .gitignore */ = {isa = PBXFileReference; lastKnownFileType = text; path = .gitignore; sourceTree = "<group>"; };
@ -402,6 +404,7 @@
B9FB94962B2EDABF00D81C07 /* SupportView.swift */,
B9CC45B72B40A2D6001E4FA5 /* AboutView.swift */,
B98BC7482B46CEDA00595441 /* AppearenceView.swift */,
B97798882B853E6600DC869F /* UpdateView.swift */,
);
path = Settings;
sourceTree = "<group>";
@ -580,6 +583,7 @@
B9FB94992B2EEB9400D81C07 /* AddInstanceView.swift in Sources */,
B9FB94972B2EDABF00D81C07 /* SupportView.swift in Sources */,
B9F8FA162B5D3AC30044DAB4 /* SafariView.swift in Sources */,
B97798892B853E6600DC869F /* UpdateView.swift in Sources */,
B9842C142B2F310C00D9F3C1 /* FetchTimeline.swift in Sources */,
B9842C162B2F363600D9F3C1 /* TimelineFilter.swift in Sources */,
B9B63B232B447B8000BBC82D /* PostCardView.swift in Sources */,

View File

@ -74,6 +74,7 @@ public enum SheetDestination: Identifiable {
case post(content: String = "", replyId: String? = nil, editId: String? = nil)
case safari(url: URL)
case shareImage(image: UIImage, status: Status)
case update
public var id: String {
switch self {
@ -92,6 +93,8 @@ public enum SheetDestination: Identifiable {
return "safari"
case .shareImage:
return "shareImage"
case .update:
return "update"
}
}
@ -112,6 +115,8 @@ public enum SheetDestination: Identifiable {
return false
case .shareImage:
return false
case .update:
return false
}
}
}
@ -198,6 +203,8 @@ extension View {
.ignoresSafeArea()
case let .shareImage(image, status):
ShareSheet(image: image, status: status)
case .update:
UpdateView()
default:
EmptySheetView(destId: destination.id)
}

View File

@ -2641,6 +2641,38 @@
}
}
}
},
"update.hide" : {
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Continue"
}
},
"fr" : {
"stringUnit" : {
"state" : "translated",
"value" : "Continuer"
}
}
}
},
"update.title" : {
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "What's new?"
}
},
"fr" : {
"stringUnit" : {
"state" : "translated",
"value" : "Quoi de neuf ?"
}
}
}
}
},
"version" : "1.0"

View File

@ -15,6 +15,7 @@ struct ThreadedApp: App {
.task {
#if DEBUG
Tips.showAllTipsForTesting()
UserDefaults.standard.removeObject(forKey: "lastVersion")
#endif
try? Tips.configure([

View File

@ -54,6 +54,8 @@ struct ContentView: View {
.environmentObject(preferences)
.navigationBarTitleDisplayMode(.inline)
.onAppear {
showNew()
do {
preferences = try UserPreferences.loadAsCurrent() ?? .defaultPreferences
} catch {
@ -100,6 +102,14 @@ struct ContentView: View {
}
}
func showNew() {
let lastVersion = UserDefaults.standard.string(forKey: "lastVersion")
if lastVersion == nil || lastVersion != AppInfo.appVersion {
UserDefaults.standard.setValue(AppInfo.appVersion, forKey: "lastVersion")
uniNavigator.presentedSheet = .update
}
}
init() {
let appearance = UITabBarAppearance()
appearance.configureWithTransparentBackground()

View File

@ -0,0 +1,99 @@
//Made by Lumaa
import SwiftUI
struct UpdateView: View {
@Environment(\.dismiss) private var dismiss
var body: some View {
ZStack {
Color.appBackground
.ignoresSafeArea()
VStack(alignment: .center) {
Text("update.title")
.font(.title.bold())
.padding(.top)
Text("about.version-\(AppInfo.appVersion)")
.font(.caption)
.foregroundStyle(Color.gray)
Spacer()
features
Spacer()
Button {
dismiss()
} label: {
Text("update.hide")
}
.buttonStyle(LargeButton(filled: true))
}
}
}
var features: some View {
VStack(spacing: 40) {
newFeature(systemImage: "sparkle.magnifyingglass", title: "Account officials", text: "In the Discovery tab, A new section \"\(String(localized: "discovery.app"))\" displays official accounts")
newFeature(systemImage: "accessibility", title: "Accessibility interactors", text: "The like, repost, bookmark, and share buttons are now displayed at the same font size")
newFeature(systemImage: "photo.on.rectangle", title: "Attachments viewer", text: "Tapping on an attachment will display a brand new screen, with ALT text and downloading")
}
.frame(height: 500)
}
@ViewBuilder
private func newFeature(systemImage: String, title: String, text: String) -> some View {
ViewThatFits {
HStack(alignment: .center) {
Image(systemName: systemImage)
.resizable()
.scaledToFit()
.frame(width: 60, height: 60)
.foregroundStyle(Color(uiColor: UIColor.label))
Spacer()
.frame(width: 30)
VStack(alignment: .leading) {
Text(title)
.bold()
.foregroundStyle(Color(uiColor: UIColor.label))
.multilineTextAlignment(.leading)
.lineLimit(1)
Text(text)
.foregroundStyle(Color(uiColor: UIColor.label).opacity(0.7))
.font(.callout)
.multilineTextAlignment(.leading)
.lineLimit(4)
}
Spacer()
}
.frame(width: 330)
VStack(alignment: .leading) {
Text(title)
.bold()
.foregroundStyle(Color(uiColor: UIColor.label))
.multilineTextAlignment(.leading)
.lineLimit(1)
Text(text)
.foregroundStyle(Color(uiColor: UIColor.label))
.multilineTextAlignment(.leading)
.lineLimit(4)
}
.padding(.horizontal)
}
}
}
#Preview {
UpdateView()
}