mirror of
https://github.com/Dimillian/IceCubesApp.git
synced 2024-11-30 04:01:02 +00:00
Add muting duration submenu (#662)
* Add muting duration submenu * set japanese localizations
This commit is contained in:
parent
b792d2cf16
commit
c7f22d5022
18 changed files with 186 additions and 11 deletions
|
@ -23,6 +23,14 @@
|
|||
"enum.avatar-position.top" = "Dalt";
|
||||
"enum.avatar-shape.circle" = "Cercle";
|
||||
"enum.avatar-shape.rounded" = "Arrodonida";
|
||||
"enum.durations.infinite" = "infinite";
|
||||
"enum.durations.fiveMinutes" = "5 minutes";
|
||||
"enum.durations.thirtyMinutes" = "30 minutes";
|
||||
"enum.durations.oneHour" = "1 hour";
|
||||
"enum.durations.sixHours" = "6 hours";
|
||||
"enum.durations.oneDay" = "1 day";
|
||||
"enum.durations.threeDays" = "3 days";
|
||||
"enum.durations.sevenDays" = "7 days";
|
||||
"enum.status-actions-display.all" = "Tots";
|
||||
"enum.status-actions-display.no-buttons" = "Sense botons";
|
||||
"enum.status-actions-display.only-buttons" = "Només els botons";
|
||||
|
|
|
@ -24,6 +24,14 @@
|
|||
"enum.avatar-position.top" = "Oben";
|
||||
"enum.avatar-shape.circle" = "Kreis";
|
||||
"enum.avatar-shape.rounded" = "Abgerundet";
|
||||
"enum.durations.infinite" = "unbegrenzt";
|
||||
"enum.durations.fiveMinutes" = "5 Minuten";
|
||||
"enum.durations.thirtyMinutes" = "30 Minuten";
|
||||
"enum.durations.oneHour" = "1 Stunde";
|
||||
"enum.durations.sixHours" = "6 Stunden";
|
||||
"enum.durations.oneDay" = "1 Tag";
|
||||
"enum.durations.threeDays" = "3 Tage";
|
||||
"enum.durations.sevenDays" = "7 Tage";
|
||||
"enum.status-actions-display.all" = "Alle";
|
||||
"enum.status-actions-display.no-buttons" = "Keine Buttons";
|
||||
"enum.status-actions-display.only-buttons" = "Nur Buttons";
|
||||
|
|
|
@ -24,6 +24,14 @@
|
|||
"enum.avatar-position.top" = "Top";
|
||||
"enum.avatar-shape.circle" = "Circle";
|
||||
"enum.avatar-shape.rounded" = "Rounded";
|
||||
"enum.durations.infinite" = "infinite";
|
||||
"enum.durations.fiveMinutes" = "5 minutes";
|
||||
"enum.durations.thirtyMinutes" = "30 minutes";
|
||||
"enum.durations.oneHour" = "1 hour";
|
||||
"enum.durations.sixHours" = "6 hours";
|
||||
"enum.durations.oneDay" = "1 day";
|
||||
"enum.durations.threeDays" = "3 days";
|
||||
"enum.durations.sevenDays" = "7 days";
|
||||
"enum.status-actions-display.all" = "All";
|
||||
"enum.status-actions-display.no-buttons" = "No buttons";
|
||||
"enum.status-actions-display.only-buttons" = "Only buttons";
|
||||
|
|
|
@ -24,6 +24,14 @@
|
|||
"enum.avatar-position.top" = "Top";
|
||||
"enum.avatar-shape.circle" = "Circle";
|
||||
"enum.avatar-shape.rounded" = "Rounded";
|
||||
"enum.durations.infinite" = "infinite";
|
||||
"enum.durations.fiveMinutes" = "5 minutes";
|
||||
"enum.durations.thirtyMinutes" = "30 minutes";
|
||||
"enum.durations.oneHour" = "1 hour";
|
||||
"enum.durations.sixHours" = "6 hours";
|
||||
"enum.durations.oneDay" = "1 day";
|
||||
"enum.durations.threeDays" = "3 days";
|
||||
"enum.durations.sevenDays" = "7 days";
|
||||
"enum.status-actions-display.all" = "All";
|
||||
"enum.status-actions-display.no-buttons" = "No buttons";
|
||||
"enum.status-actions-display.only-buttons" = "Only buttons";
|
||||
|
|
|
@ -24,6 +24,14 @@
|
|||
"enum.avatar-position.top" = "Arriba";
|
||||
"enum.avatar-shape.circle" = "Círculo";
|
||||
"enum.avatar-shape.rounded" = "Redondeado";
|
||||
"enum.durations.infinite" = "infinite";
|
||||
"enum.durations.fiveMinutes" = "5 minutes";
|
||||
"enum.durations.thirtyMinutes" = "30 minutes";
|
||||
"enum.durations.oneHour" = "1 hour";
|
||||
"enum.durations.sixHours" = "6 hours";
|
||||
"enum.durations.oneDay" = "1 day";
|
||||
"enum.durations.threeDays" = "3 days";
|
||||
"enum.durations.sevenDays" = "7 days";
|
||||
"enum.status-actions-display.all" = "Todo";
|
||||
"enum.status-actions-display.no-buttons" = "Sin botones";
|
||||
"enum.status-actions-display.only-buttons" = "Sólo botones";
|
||||
|
|
|
@ -24,6 +24,14 @@
|
|||
"enum.avatar-position.top" = "En haut";
|
||||
"enum.avatar-shape.circle" = "Rond";
|
||||
"enum.avatar-shape.rounded" = "Arrondi";
|
||||
"enum.durations.infinite" = "infinite";
|
||||
"enum.durations.fiveMinutes" = "5 minutes";
|
||||
"enum.durations.thirtyMinutes" = "30 minutes";
|
||||
"enum.durations.oneHour" = "1 hour";
|
||||
"enum.durations.sixHours" = "6 hours";
|
||||
"enum.durations.oneDay" = "1 day";
|
||||
"enum.durations.threeDays" = "3 days";
|
||||
"enum.durations.sevenDays" = "7 days";
|
||||
"enum.status-actions-display.all" = "Tout";
|
||||
"enum.status-actions-display.no-buttons" = "Pas de boutons";
|
||||
"enum.status-actions-display.only-buttons" = "Seulement les boutons";
|
||||
|
|
|
@ -24,6 +24,14 @@
|
|||
"enum.avatar-position.top" = "In alto";
|
||||
"enum.avatar-shape.circle" = "Cerchio";
|
||||
"enum.avatar-shape.rounded" = "Arrotondata";
|
||||
"enum.durations.infinite" = "infinite";
|
||||
"enum.durations.fiveMinutes" = "5 minutes";
|
||||
"enum.durations.thirtyMinutes" = "30 minutes";
|
||||
"enum.durations.oneHour" = "1 hour";
|
||||
"enum.durations.sixHours" = "6 hours";
|
||||
"enum.durations.oneDay" = "1 day";
|
||||
"enum.durations.threeDays" = "3 days";
|
||||
"enum.durations.sevenDays" = "7 days";
|
||||
"enum.status-actions-display.all" = "Tutti";
|
||||
"enum.status-actions-display.no-buttons" = "Nessun bottone";
|
||||
"enum.status-actions-display.only-buttons" = "Solo bottoni";
|
||||
|
|
|
@ -24,6 +24,14 @@
|
|||
"enum.avatar-position.top" = "トップ";
|
||||
"enum.avatar-shape.circle" = "サークル";
|
||||
"enum.avatar-shape.rounded" = "ラウンド";
|
||||
"enum.durations.infinite" = "無期限";
|
||||
"enum.durations.fiveMinutes" = "5分間";
|
||||
"enum.durations.thirtyMinutes" = "30分間";
|
||||
"enum.durations.oneHour" = "1時間";
|
||||
"enum.durations.sixHours" = "6時間";
|
||||
"enum.durations.oneDay" = "1日間";
|
||||
"enum.durations.threeDays" = "3日間";
|
||||
"enum.durations.sevenDays" = "7日間";
|
||||
"enum.status-actions-display.all" = "すべて表示";
|
||||
"enum.status-actions-display.no-buttons" = "ボタン無し";
|
||||
"enum.status-actions-display.only-buttons" = "ボタンのみ";
|
||||
|
|
|
@ -24,6 +24,14 @@
|
|||
"enum.avatar-position.top" = "본문 위";
|
||||
"enum.avatar-shape.circle" = "원";
|
||||
"enum.avatar-shape.rounded" = "둥근 사각형";
|
||||
"enum.durations.infinite" = "infinite";
|
||||
"enum.durations.fiveMinutes" = "5 minutes";
|
||||
"enum.durations.thirtyMinutes" = "30 minutes";
|
||||
"enum.durations.oneHour" = "1 hour";
|
||||
"enum.durations.sixHours" = "6 hours";
|
||||
"enum.durations.oneDay" = "1 day";
|
||||
"enum.durations.threeDays" = "3 days";
|
||||
"enum.durations.sevenDays" = "7 days";
|
||||
"enum.status-actions-display.all" = "모두 표시";
|
||||
"enum.status-actions-display.no-buttons" = "표시하지 않음";
|
||||
"enum.status-actions-display.only-buttons" = "버튼만 표시";
|
||||
|
|
|
@ -24,6 +24,14 @@
|
|||
"enum.avatar-position.top" = "Topp";
|
||||
"enum.avatar-shape.circle" = "Sirkel";
|
||||
"enum.avatar-shape.rounded" = "Avrundet";
|
||||
"enum.durations.infinite" = "infinite";
|
||||
"enum.durations.fiveMinutes" = "5 minutes";
|
||||
"enum.durations.thirtyMinutes" = "30 minutes";
|
||||
"enum.durations.oneHour" = "1 hour";
|
||||
"enum.durations.sixHours" = "6 hours";
|
||||
"enum.durations.oneDay" = "1 day";
|
||||
"enum.durations.threeDays" = "3 days";
|
||||
"enum.durations.sevenDays" = "7 days";
|
||||
"enum.status-actions-display.all" = "Alle";
|
||||
"enum.status-actions-display.no-buttons" = "Ingen knapper";
|
||||
"enum.status-actions-display.only-buttons" = "Bare knapper";
|
||||
|
|
|
@ -24,6 +24,14 @@
|
|||
"enum.avatar-position.top" = "Boven";
|
||||
"enum.avatar-shape.circle" = "Cirkel";
|
||||
"enum.avatar-shape.rounded" = "Afgerond";
|
||||
"enum.durations.infinite" = "infinite";
|
||||
"enum.durations.fiveMinutes" = "5 minutes";
|
||||
"enum.durations.thirtyMinutes" = "30 minutes";
|
||||
"enum.durations.oneHour" = "1 hour";
|
||||
"enum.durations.sixHours" = "6 hours";
|
||||
"enum.durations.oneDay" = "1 day";
|
||||
"enum.durations.threeDays" = "3 days";
|
||||
"enum.durations.sevenDays" = "7 days";
|
||||
"enum.status-actions-display.all" = "Met tekst";
|
||||
"enum.status-actions-display.no-buttons" = "Geen knoppen";
|
||||
"enum.status-actions-display.only-buttons" = "Zonder tekst";
|
||||
|
|
|
@ -24,6 +24,14 @@
|
|||
"enum.avatar-position.top" = "Na górze";
|
||||
"enum.avatar-shape.circle" = "Okrągły";
|
||||
"enum.avatar-shape.rounded" = "Zaokrąglony";
|
||||
"enum.durations.infinite" = "infinite";
|
||||
"enum.durations.fiveMinutes" = "5 minutes";
|
||||
"enum.durations.thirtyMinutes" = "30 minutes";
|
||||
"enum.durations.oneHour" = "1 hour";
|
||||
"enum.durations.sixHours" = "6 hours";
|
||||
"enum.durations.oneDay" = "1 day";
|
||||
"enum.durations.threeDays" = "3 days";
|
||||
"enum.durations.sevenDays" = "7 days";
|
||||
"enum.status-actions-display.all" = "Wszystko";
|
||||
"enum.status-actions-display.no-buttons" = "Bez przycisków";
|
||||
"enum.status-actions-display.only-buttons" = "Tylko przyciski";
|
||||
|
|
|
@ -24,6 +24,14 @@
|
|||
"enum.avatar-position.top" = "Topo";
|
||||
"enum.avatar-shape.circle" = "Círculo";
|
||||
"enum.avatar-shape.rounded" = "Arredondado";
|
||||
"enum.durations.infinite" = "infinite";
|
||||
"enum.durations.fiveMinutes" = "5 minutes";
|
||||
"enum.durations.thirtyMinutes" = "30 minutes";
|
||||
"enum.durations.oneHour" = "1 hour";
|
||||
"enum.durations.sixHours" = "6 hours";
|
||||
"enum.durations.oneDay" = "1 day";
|
||||
"enum.durations.threeDays" = "3 days";
|
||||
"enum.durations.sevenDays" = "7 days";
|
||||
"enum.status-actions-display.all" = "Todos";
|
||||
"enum.status-actions-display.no-buttons" = "Sem botões";
|
||||
"enum.status-actions-display.only-buttons" = "Somente botões";
|
||||
|
|
|
@ -24,6 +24,14 @@
|
|||
"enum.avatar-position.top" = "Üstte";
|
||||
"enum.avatar-shape.circle" = "Çember";
|
||||
"enum.avatar-shape.rounded" = "Yuvarlak";
|
||||
"enum.durations.infinite" = "infinite";
|
||||
"enum.durations.fiveMinutes" = "5 minutes";
|
||||
"enum.durations.thirtyMinutes" = "30 minutes";
|
||||
"enum.durations.oneHour" = "1 hour";
|
||||
"enum.durations.sixHours" = "6 hours";
|
||||
"enum.durations.oneDay" = "1 day";
|
||||
"enum.durations.threeDays" = "3 days";
|
||||
"enum.durations.sevenDays" = "7 days";
|
||||
"enum.status-actions-display.all" = "Hepsi";
|
||||
"enum.status-actions-display.no-buttons" = "Butonsuz";
|
||||
"enum.status-actions-display.only-buttons" = "Sadece Butonlar";
|
||||
|
|
|
@ -24,6 +24,14 @@
|
|||
"enum.avatar-position.top" = "顶部";
|
||||
"enum.avatar-shape.circle" = "圆形";
|
||||
"enum.avatar-shape.rounded" = "圆角";
|
||||
"enum.durations.infinite" = "infinite";
|
||||
"enum.durations.fiveMinutes" = "5 minutes";
|
||||
"enum.durations.thirtyMinutes" = "30 minutes";
|
||||
"enum.durations.oneHour" = "1 hour";
|
||||
"enum.durations.sixHours" = "6 hours";
|
||||
"enum.durations.oneDay" = "1 day";
|
||||
"enum.durations.threeDays" = "3 days";
|
||||
"enum.durations.sevenDays" = "7 days";
|
||||
"enum.status-actions-display.all" = "图标和文本";
|
||||
"enum.status-actions-display.no-buttons" = "仅文本";
|
||||
"enum.status-actions-display.only-buttons" = "仅图标";
|
||||
|
|
|
@ -403,6 +403,7 @@ public struct AccountDetailView: View {
|
|||
Label("account.action.block", systemImage: "person.crop.circle.badge.xmark")
|
||||
}
|
||||
}
|
||||
|
||||
if viewModel.relationship?.muting == true {
|
||||
Button {
|
||||
Task {
|
||||
|
@ -416,14 +417,18 @@ public struct AccountDetailView: View {
|
|||
Label("account.action.unmute", systemImage: "speaker")
|
||||
}
|
||||
} else {
|
||||
Button {
|
||||
Menu {
|
||||
ForEach(MutingDurations.allCases, id: \.rawValue) { duration in
|
||||
Button (duration.description) {
|
||||
Task {
|
||||
do {
|
||||
viewModel.relationship = try await client.post(endpoint: Accounts.mute(id: account.id))
|
||||
viewModel.relationship = try await client.post(endpoint: Accounts.mute(id: account.id, json: MuteData(duration: duration.rawValue)))
|
||||
} catch {
|
||||
print("Error while muting: \(error.localizedDescription)")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} label: {
|
||||
Label("account.action.mute", systemImage: "speaker.slash")
|
||||
}
|
||||
|
|
33
Packages/Account/Sources/Account/MutingDurations.swift
Normal file
33
Packages/Account/Sources/Account/MutingDurations.swift
Normal file
|
@ -0,0 +1,33 @@
|
|||
import SwiftUI
|
||||
|
||||
enum MutingDurations: Int, CaseIterable {
|
||||
case infinite = 0
|
||||
case fiveMinutes = 300
|
||||
case thirtyMinutes = 1_800
|
||||
case oneHour = 3_600
|
||||
case sixHours = 21_600
|
||||
case oneDay = 86_400
|
||||
case threeDays = 259_200
|
||||
case sevenDays = 604_800
|
||||
|
||||
public var description: LocalizedStringKey {
|
||||
switch self {
|
||||
case .infinite:
|
||||
return "enum.durations.infinite"
|
||||
case .fiveMinutes:
|
||||
return "enum.durations.fiveMinutes"
|
||||
case .thirtyMinutes:
|
||||
return "enum.durations.thirtyMinutes"
|
||||
case .oneHour:
|
||||
return "enum.durations.oneHour"
|
||||
case .sixHours:
|
||||
return "enum.durations.sixHours"
|
||||
case .oneDay:
|
||||
return "enum.durations.oneDay"
|
||||
case .threeDays:
|
||||
return "enum.durations.threeDays"
|
||||
case .sevenDays:
|
||||
return "enum.durations.sevenDays"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -32,7 +32,7 @@ public enum Accounts: Endpoint {
|
|||
case preferences
|
||||
case block(id: String)
|
||||
case unblock(id: String)
|
||||
case mute(id: String)
|
||||
case mute(id: String, json: MuteData)
|
||||
case unmute(id: String)
|
||||
|
||||
public func path() -> String {
|
||||
|
@ -75,7 +75,7 @@ public enum Accounts: Endpoint {
|
|||
return "accounts/\(id)/block"
|
||||
case let .unblock(id):
|
||||
return "accounts/\(id)/unblock"
|
||||
case let .mute(id):
|
||||
case let .mute(id, _):
|
||||
return "accounts/\(id)/mute"
|
||||
case let .unmute(id):
|
||||
return "accounts/\(id)/unmute"
|
||||
|
@ -138,4 +138,21 @@ public enum Accounts: Endpoint {
|
|||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
public var jsonValue: Encodable? {
|
||||
switch self {
|
||||
case let .mute(_, json):
|
||||
return json
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public struct MuteData: Encodable {
|
||||
public let duration: Int
|
||||
|
||||
public init(duration: Int) {
|
||||
self.duration = duration
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue