Replaced privacy with support view

This commit is contained in:
Lumaa 2024-02-12 02:42:56 +01:00
parent 3ce7e01e25
commit 7acdb303df
8 changed files with 576 additions and 18 deletions

View File

@ -48,6 +48,7 @@
B9BF54072B6B6823004B24E7 /* KeychainSwift in Frameworks */ = {isa = PBXBuildFile; productRef = B9BF54062B6B6823004B24E7 /* KeychainSwift */; };
B9CC45B82B40A2D6001E4FA5 /* AboutView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B9CC45B72B40A2D6001E4FA5 /* AboutView.swift */; };
B9CFC43B2B4F08C9004CFCB7 /* LaunchStoryboard.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = B9CFC43A2B4F08C9004CFCB7 /* LaunchStoryboard.storyboard */; };
B9D365612B79A1BE004C1255 /* MailView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B9D365602B79A1BE004C1255 /* MailView.swift */; };
B9D9C6C12B6A56E000C26A41 /* Notification.swift in Sources */ = {isa = PBXBuildFile; fileRef = B9D9C6C02B6A56E000C26A41 /* Notification.swift */; };
B9D9C6C32B6A576C00C26A41 /* NotificationsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B9D9C6C22B6A576C00C26A41 /* NotificationsView.swift */; };
B9D9C6C52B6A587700C26A41 /* NotificationRow.swift in Sources */ = {isa = PBXBuildFile; fileRef = B9D9C6C42B6A587700C26A41 /* NotificationRow.swift */; };
@ -77,7 +78,7 @@
B9FB948E2B2E28E800D81C07 /* MediaTransferables.swift in Sources */ = {isa = PBXBuildFile; fileRef = B9FB948D2B2E28E800D81C07 /* MediaTransferables.swift */; };
B9FB94902B2E2B0E00D81C07 /* Localizable.xcstrings in Resources */ = {isa = PBXBuildFile; fileRef = B9FB948F2B2E2B0E00D81C07 /* Localizable.xcstrings */; };
B9FB94922B2E35D000D81C07 /* SettingsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B9FB94912B2E35D000D81C07 /* SettingsView.swift */; };
B9FB94972B2EDABF00D81C07 /* PrivacyView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B9FB94962B2EDABF00D81C07 /* PrivacyView.swift */; };
B9FB94972B2EDABF00D81C07 /* SupportView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B9FB94962B2EDABF00D81C07 /* SupportView.swift */; };
B9FB94992B2EEB9400D81C07 /* AddInstanceView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B9FB94982B2EEB9400D81C07 /* AddInstanceView.swift */; };
B9FB949B2B2EF09A00D81C07 /* Client.swift in Sources */ = {isa = PBXBuildFile; fileRef = B9FB949A2B2EF09A00D81C07 /* Client.swift */; };
B9FB949D2B2EF0D600D81C07 /* Instance.swift in Sources */ = {isa = PBXBuildFile; fileRef = B9FB949C2B2EF0D600D81C07 /* Instance.swift */; };
@ -151,6 +152,7 @@
B9CC45B72B40A2D6001E4FA5 /* AboutView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AboutView.swift; sourceTree = "<group>"; };
B9CC45B92B40AA1E001E4FA5 /* README.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = "<group>"; };
B9CFC43A2B4F08C9004CFCB7 /* LaunchStoryboard.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = LaunchStoryboard.storyboard; sourceTree = "<group>"; };
B9D365602B79A1BE004C1255 /* MailView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MailView.swift; sourceTree = "<group>"; };
B9D9C6C02B6A56E000C26A41 /* Notification.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Notification.swift; sourceTree = "<group>"; };
B9D9C6C22B6A576C00C26A41 /* NotificationsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationsView.swift; sourceTree = "<group>"; };
B9D9C6C42B6A587700C26A41 /* NotificationRow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationRow.swift; sourceTree = "<group>"; };
@ -180,7 +182,7 @@
B9FB948D2B2E28E800D81C07 /* MediaTransferables.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MediaTransferables.swift; sourceTree = "<group>"; };
B9FB948F2B2E2B0E00D81C07 /* Localizable.xcstrings */ = {isa = PBXFileReference; lastKnownFileType = text.json.xcstrings; path = Localizable.xcstrings; sourceTree = "<group>"; };
B9FB94912B2E35D000D81C07 /* SettingsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsView.swift; sourceTree = "<group>"; };
B9FB94962B2EDABF00D81C07 /* PrivacyView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PrivacyView.swift; sourceTree = "<group>"; };
B9FB94962B2EDABF00D81C07 /* SupportView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SupportView.swift; sourceTree = "<group>"; };
B9FB94982B2EEB9400D81C07 /* AddInstanceView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddInstanceView.swift; sourceTree = "<group>"; };
B9FB949A2B2EF09A00D81C07 /* Client.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Client.swift; sourceTree = "<group>"; };
B9FB949C2B2EF0D600D81C07 /* Instance.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Instance.swift; sourceTree = "<group>"; };
@ -372,6 +374,7 @@
B97491E22B6E96700098BC48 /* SymbolWidth.swift */,
B915C4412B6F908C00042DDB /* ProfileView.swift */,
B9DC69282B78D9A500E625B9 /* SearchResultView.swift */,
B9D365602B79A1BE004C1255 /* MailView.swift */,
);
path = Components;
sourceTree = "<group>";
@ -381,7 +384,7 @@
children = (
B9FB94912B2E35D000D81C07 /* SettingsView.swift */,
B98F47972B64670F0092000F /* ShopView.swift */,
B9FB94962B2EDABF00D81C07 /* PrivacyView.swift */,
B9FB94962B2EDABF00D81C07 /* SupportView.swift */,
B9CC45B72B40A2D6001E4FA5 /* AboutView.swift */,
B98BC7482B46CEDA00595441 /* AppearenceView.swift */,
);
@ -558,7 +561,7 @@
B98BC7492B46CEDA00595441 /* AppearenceView.swift in Sources */,
B9D9C6C52B6A587700C26A41 /* NotificationRow.swift in Sources */,
B9FB94992B2EEB9400D81C07 /* AddInstanceView.swift in Sources */,
B9FB94972B2EDABF00D81C07 /* PrivacyView.swift in Sources */,
B9FB94972B2EDABF00D81C07 /* SupportView.swift in Sources */,
B9F8FA162B5D3AC30044DAB4 /* SafariView.swift in Sources */,
B9842C142B2F310C00D9F3C1 /* FetchTimeline.swift in Sources */,
B9842C162B2F363600D9F3C1 /* TimelineFilter.swift in Sources */,
@ -601,6 +604,7 @@
B9FB948E2B2E28E800D81C07 /* MediaTransferables.swift in Sources */,
B98BC74D2B46CFCE00595441 /* UserPreferences.swift in Sources */,
B9FB94A22B2EF24A00D81C07 /* AppInfo.swift in Sources */,
B9D365612B79A1BE004C1255 /* MailView.swift in Sources */,
B9D9C6C12B6A56E000C26A41 /* Notification.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;

View File

@ -0,0 +1,54 @@
//Made by Lumaa
import SwiftUI
import UIKit
import MessageUI
struct MailView: UIViewControllerRepresentable {
@Environment(\.presentationMode) var presentation
@Binding var result: Result<MFMailComposeResult, Error>?
class Coordinator: NSObject, MFMailComposeViewControllerDelegate {
@Binding var presentation: PresentationMode
@Binding var result: Result<MFMailComposeResult, Error>?
init(presentation: Binding<PresentationMode>,
result: Binding<Result<MFMailComposeResult, Error>?>) {
_presentation = presentation
_result = result
}
func mailComposeController(_ controller: MFMailComposeViewController,
didFinishWith result: MFMailComposeResult,
error: Error?) {
defer {
$presentation.wrappedValue.dismiss()
}
guard error == nil else {
self.result = .failure(error!)
return
}
self.result = .success(result)
}
}
func makeCoordinator() -> Coordinator {
return Coordinator(presentation: presentation,
result: $result)
}
func makeUIViewController(context: UIViewControllerRepresentableContext<MailView>) -> MFMailComposeViewController {
let vc = MFMailComposeViewController()
vc.mailComposeDelegate = context.coordinator
vc.setSubject(String(localized: "support.mail.subject"))
vc.setToRecipients(["lumaa@lumaa.fr"])
return vc
}
func updateUIViewController(_ uiViewController: MFMailComposeViewController,
context: UIViewControllerRepresentableContext<MailView>) {
}
}

View File

@ -40,9 +40,9 @@ struct ProfileView: View {
if isCurrent {
HStack {
Button {
navigator.navigate(to: .privacy)
navigator.navigate(to: .support)
} label: {
Image(systemName: "globe")
Image(systemName: "info.bubble")
.font(.title2)
}

View File

@ -66,6 +66,7 @@ extension View {
.scrollContentBackground(.hidden)
.tint(tint)
.background(Color.appBackground)
.toolbarBackground(Color.appBackground, for: .navigationBar)
.listStyle(.inset)
}
func listRowThreaded() -> some View {

View File

@ -106,7 +106,7 @@ public enum SheetDestination: Identifiable {
public enum RouterDestination: Hashable {
case settings
case privacy
case support
case appearence
case account(acc: Account)
case post(status: Status)
@ -116,7 +116,7 @@ public enum RouterDestination: Hashable {
}
extension RouterDestination {
static let allSettings: [RouterDestination] = [.settings, .privacy, .about, .appearence]
static let allSettings: [RouterDestination] = [.settings, .support, .about, .appearence]
}
extension View {
@ -125,8 +125,8 @@ extension View {
switch destination {
case .settings:
SettingsView(navigator: navigator)
case .privacy:
PrivacyView()
case .support:
SupportView()
case .appearence:
AppearenceView()
case .account(let acc):

View File

@ -1108,18 +1108,18 @@
}
}
},
"setting.privacy" : {
"setting.support" : {
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Privacy"
"value" : "Support"
}
},
"fr" : {
"stringUnit" : {
"state" : "translated",
"value" : "Confidentialité"
"value" : "Aide"
}
}
}
@ -1172,18 +1172,98 @@
}
}
},
"shop.threaded-plus.description" : {
"shop.best" : {
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Threaded+ - Description"
"value" : "BEST"
}
},
"fr" : {
"stringUnit" : {
"state" : "translated",
"value" : "Threaded+ - Description"
"value" : "MEILLEUR"
}
}
}
},
"shop.threaded-plus.dismiss" : {
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Dismiss"
}
},
"fr" : {
"stringUnit" : {
"state" : "translated",
"value" : "Annuler"
}
}
}
},
"shop.threaded-plus.lifetime" : {
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Plus for a Lifetime"
}
},
"fr" : {
"stringUnit" : {
"state" : "translated",
"value" : "Plus à vie"
}
}
}
},
"shop.threaded-plus.lifetime.header" : {
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "A lifetime support"
}
},
"fr" : {
"stringUnit" : {
"state" : "translated",
"value" : "Un soutien à vie."
}
}
}
},
"shop.threaded-plus.subscription" : {
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Plus as a Subscription"
}
},
"fr" : {
"stringUnit" : {
"state" : "translated",
"value" : "Plus en tant qu'abonnement"
}
}
}
},
"shop.threaded-plus.subscription.description" : {
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "The Threaded+ subscription adds additional new and unique features to Threaded! It also supports the development ❤️"
}
},
"fr" : {
"stringUnit" : {
"state" : "translated",
"value" : "L'abonnement Threaded+ ajoute des nouvelles et uniques fonctionnalités à Threaded ! Cela permet aussi de contribuer à son développement ❤️"
}
}
}
@ -1588,6 +1668,214 @@
}
}
},
"support" : {
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Support"
}
},
"fr" : {
"stringUnit" : {
"state" : "translated",
"value" : "Aide"
}
}
}
},
"support.discord" : {
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Discord"
}
},
"fr" : {
"stringUnit" : {
"state" : "translated",
"value" : "Discord"
}
}
}
},
"support.discord.description" : {
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Join the Threaded Discord server to receive help, talk about the Fediverse, and many other things"
}
},
"fr" : {
"stringUnit" : {
"state" : "translated",
"value" : "Rejoignez le serveur Discord Threaded pour recevoir de l'aide, parler du fédivers, et autres"
}
}
}
},
"support.discord.join" : {
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Join Threaded"
}
},
"fr" : {
"stringUnit" : {
"state" : "translated",
"value" : "Rejoindre Threaded"
}
}
}
},
"support.email" : {
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Mail"
}
},
"fr" : {
"stringUnit" : {
"state" : "translated",
"value" : "Email"
}
}
}
},
"support.email.description" : {
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Send emails to the developer directly and instantly"
}
},
"fr" : {
"stringUnit" : {
"state" : "translated",
"value" : "Envoyez des emails directement et instantanément au développeur"
}
}
}
},
"support.mail.no-mail" : {
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "You cannot send e-mail via Threaded"
}
},
"fr" : {
"stringUnit" : {
"state" : "translated",
"value" : "Vous ne pouvez pas envoyer d'emails via Threaded"
}
}
}
},
"support.mail.send" : {
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Send an email"
}
},
"fr" : {
"stringUnit" : {
"state" : "translated",
"value" : "Envoyer un email"
}
}
}
},
"support.mail.subject" : {
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Threaded Support"
}
},
"fr" : {
"stringUnit" : {
"state" : "translated",
"value" : "Aide Threaded"
}
}
}
},
"support.matrix" : {
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Matrix"
}
},
"fr" : {
"stringUnit" : {
"state" : "translated",
"value" : "Matrix"
}
}
}
},
"support.matrix.description" : {
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Matrix is a decentralised and safe messaging platform, receive help about the app or Plus"
}
},
"fr" : {
"stringUnit" : {
"state" : "translated",
"value" : "Matrix est une plateforme de messagerie décentralisée et sécurisée, recevez de l'aide pour l'application ou Plus"
}
}
}
},
"support.matrix.join" : {
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Join #threadedapp:matrix.org"
}
},
"fr" : {
"stringUnit" : {
"state" : "translated",
"value" : "Rejoindre #threadedapp:matrix.org"
}
}
}
},
"support.platform" : {
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Choose your platform"
}
},
"fr" : {
"stringUnit" : {
"state" : "translated",
"value" : "Choisissez votre platforme"
}
}
}
},
"tag.posts-%lld" : {
"localizations" : {
"en" : {
@ -1758,6 +2046,22 @@
}
}
}
},
"tos.description" : {
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Threaded is not affiliated to Mastodon. Threaded does not take responsabilities for posting misinforming or illegal content. Read your Mastodon instance's Terms of Service for more information."
}
},
"fr" : {
"stringUnit" : {
"state" : "translated",
"value" : "Threaded n'est pas affilié à Mastodon. Threaded ne prend aucune responsabilité sur la publication de contenu ayant de la désinformation ou du contenu illégal. Lisez les Condition d'utilisation de votre instance Mastodon pour plus d'information."
}
}
}
}
},
"version" : "1.0"

View File

@ -25,9 +25,9 @@ struct SettingsView: View {
.listRowThreaded()
Button {
navigator.navigate(to: .privacy)
navigator.navigate(to: .support)
} label: {
Label("setting.privacy", systemImage: "lock")
Label("setting.support", systemImage: "person.line.dotted.person")
}
.listRowThreaded()

View File

@ -0,0 +1,195 @@
//Made by Lumaa
import SwiftUI
import MessageUI
struct SupportView: View {
@Environment(AppDelegate.self) private var appDelegate: AppDelegate
@Environment(\.openURL) private var openURL
@State private var mailComposer: Bool = false
@State private var mailResult: Result<MFMailComposeResult, Error>? = nil
var body: some View {
ScrollView {
VStack {
Text("support.platform")
.font(.largeTitle.bold())
.padding(.horizontal)
.minimumScaleFactor(0.5)
.multilineTextAlignment(.center)
ScrollView(.horizontal, showsIndicators: false) {
HStack(spacing: 10) {
discordSupport
.listRowThreaded()
matrixSupport
.listRowThreaded()
mailApp
.listRowThreaded()
}
.scrollTargetLayout()
.safeAreaPadding(25)
}
.scrollTargetBehavior(.viewAligned)
}
.padding(.vertical)
.frame(minWidth: appDelegate.windowWidth)
}
.listThreaded()
.navigationTitle(Text("support"))
.navigationBarTitleDisplayMode(.inline)
.sheet(isPresented: $mailComposer) {
MailView(result: $mailResult)
}
}
var discordSupport: some View {
VStack(alignment: .center) {
Image("DiscordMark")
.mark()
Text("support.discord")
.font(.title.bold())
Text("support.discord.description")
.padding(.horizontal)
.lineLimit(3, reservesSpace: true)
Button {
let discordUrl = URL(string: "https://lumaa.fr/")
openURL(discordUrl!)
} label: {
Text("support.discord.join")
.padding(.horizontal, 20)
.padding(.vertical, 10)
}
.zIndex(10.0)
.buttonStyle(.borderedProminent)
.tint(Color.blurple)
.padding(.vertical)
}
.boxify(appDelegate.windowWidth - 50, bgColor: Color.blurple)
}
var matrixSupport: some View {
VStack(alignment: .center) {
Image("ElementMark")
.mark()
Text("support.matrix")
.font(.title.bold())
Text("support.matrix.description")
.padding(.horizontal)
.lineLimit(3, reservesSpace: true)
Button {
let matrixUrl = URL(string: "https://matrix.to/#/#threadedapp:matrix.org")
openURL(matrixUrl!)
} label: {
Text("support.matrix.join")
.padding(.horizontal, 20)
.padding(.vertical, 10)
}
.zIndex(10.0)
.buttonStyle(.borderedProminent)
.tint(Color.mountainMeadow)
.padding(.vertical)
}
.boxify(appDelegate.windowWidth - 50,bgColor: Color.mountainMeadow)
}
var mailApp: some View {
VStack(alignment: .center) {
Image(systemName: "envelope.fill")
.mark()
.foregroundStyle(Color.blue)
Text("support.email")
.font(.title.bold())
Text("support.email.description")
.padding(.horizontal)
.lineLimit(3, reservesSpace: true)
Button {
mailComposer.toggle()
} label: {
Text("support.mail.send")
.padding(.horizontal, 20)
.padding(.vertical, 10)
}
.zIndex(10.0)
.disabled(!MFMailComposeViewController.canSendMail())
.buttonStyle(.borderedProminent)
.tint(Color.blue)
.padding(.vertical)
.overlay(alignment: .bottom) {
if !MFMailComposeViewController.canSendMail() {
Text("support.mail.no-mail")
.font(.caption)
.foregroundStyle(Color.gray)
.frame(width: 300)
.offset(y: 15.0)
}
}
}
.boxify(appDelegate.windowWidth - 50, bgColor: Color.blue)
}
}
#Preview("FR") {
NavigationStack {
SupportView()
}
.environment(\.locale, Locale(identifier: "fr-fr"))
.environment(AppDelegate())
}
#Preview("EN") {
NavigationStack {
SupportView()
}
.environment(\.locale, Locale(identifier: "en-us"))
.environment(AppDelegate())
}
private extension View {
@ViewBuilder
func boxify(_ width: CGFloat, bgColor: Color? = nil) -> some View {
self
.frame(width: width, height: 330)
.padding(.vertical)
.zIndex(5.0)
.overlay {
RoundedRectangle(cornerRadius: 15)
.stroke(Color(uiColor: UIColor.label).opacity(0.4))
.background() {
Rectangle()
.fill(bgColor != nil ? LinearGradient(colors: [bgColor!.opacity(0.15), bgColor!.opacity(0.3)], startPoint: .bottom, endPoint: .top) : LinearGradient(colors: [Color.clear], startPoint: .top, endPoint: .bottom))
.allowsHitTesting(false)
}
.clipShape(RoundedRectangle(cornerRadius: 15))
.zIndex(1.0)
}
}
}
private extension Image {
@ViewBuilder
func mark() -> some View {
self.resizable()
.scaledToFit()
.frame(width: 75, height: 75)
}
}
private extension Color {
static let blurple: Color = Color(red: 88 / 255, green: 101 / 255, blue: 242 / 255)
static let mountainMeadow: Color = Color(red: 13 / 255, green: 189 / 255, blue: 139 / 255)
}