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()
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 {
@ -86,6 +62,10 @@ struct PostMenu: View {
} label: {
Label("status.menu.copy-text", systemImage: "list.clipboard")
}
if isOwner {
altClients
}
} label: {
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
private func createImage() {
let view = HStack {

View File

@ -1,6 +1,7 @@
//Made by Lumaa
import Foundation
import SwiftUI
public enum AppInfo {
public static let scopes = "read write follow push"
@ -20,6 +21,7 @@ extension AppInfo {
case contentFilter
case downloadAttachment
case moreAccounts
case subClub
case experimentalSettings
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")
case .moreAccounts:
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:
return .init("shop.features.experimental", description: "shop.features.experimental.description", systemImage: "gearshape.fill")
case .vip:

View File

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