Small improvements

This commit is contained in:
lumaa-dev 2024-10-05 14:11:53 +02:00
parent 05080b689d
commit 58dae8d392
4 changed files with 46 additions and 25 deletions

View File

@ -40,30 +40,6 @@ struct PostMenu: View {
} }
Divider() Divider()
Menu {
Button {
openURL(URL(string: AltClients.IvoryApp.createPost(status.reblogAsAsStatus?.content.asRawText ?? status.content.asRawText))!)
} label: {
Text(AltClients.IvoryApp.name)
}
Button {
openURL(URL(string: AltClients.ThreadsApp.createPost(status.reblogAsAsStatus?.content.asRawText ?? status.content.asRawText))!)
} label: {
Text(AltClients.ThreadsApp.name)
}
Button {
openURL(URL(string: AltClients.XApp.createPost(status.reblogAsAsStatus?.content.asRawText ?? status.content.asRawText))!)
} label: {
Text(AltClients.XApp.name)
}
} label: {
Label("status.cross-post.alts", systemImage: "shuffle")
}
Divider()
} }
Menu { Menu {
@ -86,6 +62,10 @@ struct PostMenu: View {
} label: { } label: {
Label("status.menu.copy-text", systemImage: "list.clipboard") Label("status.menu.copy-text", systemImage: "list.clipboard")
} }
if isOwner {
altClients
}
} label: { } label: {
Label("status.menu.share", systemImage: "paperplane") Label("status.menu.share", systemImage: "paperplane")
} }
@ -99,6 +79,30 @@ struct PostMenu: View {
} }
} }
private var altClients: some View {
Menu {
Button {
openURL(URL(string: AltClients.IvoryApp.createPost(status.reblogAsAsStatus?.content.asRawText ?? status.content.asRawText))!)
} label: {
Text(AltClients.IvoryApp.name)
}
Button {
openURL(URL(string: AltClients.ThreadsApp.createPost(status.reblogAsAsStatus?.content.asRawText ?? status.content.asRawText))!)
} label: {
Text(AltClients.ThreadsApp.name)
}
Button {
openURL(URL(string: AltClients.XApp.createPost(status.reblogAsAsStatus?.content.asRawText ?? status.content.asRawText))!)
} label: {
Text(AltClients.XApp.name)
}
} label: {
Label("status.cross-post.alts", systemImage: "shuffle")
}
}
@MainActor @MainActor
private func createImage() { private func createImage() {
let view = HStack { let view = HStack {

View File

@ -1,6 +1,7 @@
//Made by Lumaa //Made by Lumaa
import Foundation import Foundation
import SwiftUI
public enum AppInfo { public enum AppInfo {
public static let scopes = "read write follow push" public static let scopes = "read write follow push"
@ -20,6 +21,7 @@ extension AppInfo {
case contentFilter case contentFilter
case downloadAttachment case downloadAttachment
case moreAccounts case moreAccounts
case subClub
case experimentalSettings case experimentalSettings
case vip case vip
@ -36,6 +38,8 @@ extension AppInfo {
return .init("shop.features.download-atchmnt", description: "shop.features.download-atchmnt.description", systemImage: "photo.badge.arrow.down") return .init("shop.features.download-atchmnt", description: "shop.features.download-atchmnt.description", systemImage: "photo.badge.arrow.down")
case .moreAccounts: case .moreAccounts:
return .init("shop.features.more-accounts", description: "shop.features.more-accounts.description", systemImage: "person.fill.badge.plus") return .init("shop.features.more-accounts", description: "shop.features.more-accounts.description", systemImage: "person.fill.badge.plus")
case .subClub:
return .init(LocalizedStringKey(String("sub.club")), description: "info.subclub.description", systemImage: "person.crop.square.filled.and.at.rectangle.fill")
case .experimentalSettings: case .experimentalSettings:
return .init("shop.features.experimental", description: "shop.features.experimental.description", systemImage: "gearshape.fill") return .init("shop.features.experimental", description: "shop.features.experimental.description", systemImage: "gearshape.fill")
case .vip: case .vip:

View File

@ -84,6 +84,7 @@ extension Navigator {
} }
} else { } else {
print("deeplink detected") print("deeplink detected")
// available: update, new?text, plus
let actions: [String] = path.split(separator: /\/+/).map({ $0.lowercased().replacing(/\?(.)+$/, with: "") }) let actions: [String] = path.split(separator: /\/+/).map({ $0.lowercased().replacing(/\?(.)+$/, with: "") })
if !actions.isEmpty, let mainAction: String = actions.first { if !actions.isEmpty, let mainAction: String = actions.first {
if mainAction == "update" { if mainAction == "update" {

View File

@ -447,6 +447,18 @@ extension ShopView {
} }
} }
extension LocalizedStringKey {
func toString() -> String {
let mirror = Mirror(reflecting: self)
for child in mirror.children {
if let value = child.value as? String {
return value
}
}
return ""
}
}
#Preview { #Preview {
ShopView() ShopView()
.environment(AppDelegate()) .environment(AppDelegate())