This commit is contained in:
Thomas Ricouard 2023-01-22 15:58:49 +01:00
commit fc4524cef8
19 changed files with 209 additions and 18 deletions

View file

@ -8,6 +8,9 @@
/* Begin PBXBuildFile section */
639CDF9C296AC82F00C35E58 /* SafariRouteur.swift in Sources */ = {isa = PBXBuildFile; fileRef = 639CDF9B296AC82F00C35E58 /* SafariRouteur.swift */; };
7429BCE2297C55D00069A946 /* Localizable.stringsdict in Resources */ = {isa = PBXBuildFile; fileRef = 7429BCE4297C55D00069A946 /* Localizable.stringsdict */; };
7429BCE5297C5A750069A946 /* Localizable.stringsdict in Resources */ = {isa = PBXBuildFile; fileRef = 7429BCE4297C55D00069A946 /* Localizable.stringsdict */; };
7429BCE6297C5A750069A946 /* Localizable.stringsdict in Resources */ = {isa = PBXBuildFile; fileRef = 7429BCE4297C55D00069A946 /* Localizable.stringsdict */; };
9F24EEB829360C330042359D /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 9F24EEB729360C330042359D /* Preview Assets.xcassets */; };
9F295540292B6C3400E0E81B /* Timeline in Frameworks */ = {isa = PBXBuildFile; productRef = 9F29553F292B6C3400E0E81B /* Timeline */; };
9F2A540729699698009B2D7C /* SupportAppView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F2A540629699698009B2D7C /* SupportAppView.swift */; };
@ -103,6 +106,12 @@
/* Begin PBXFileReference section */
639CDF9B296AC82F00C35E58 /* SafariRouteur.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SafariRouteur.swift; sourceTree = "<group>"; };
7429BCE3297C55D00069A946 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = en; path = en.lproj/Localizable.stringsdict; sourceTree = "<group>"; };
7429BCE7297C5D010069A946 /* nl */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = nl; path = nl.lproj/Localizable.stringsdict; sourceTree = "<group>"; };
7429BCE8297C5D020069A946 /* de */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = de; path = de.lproj/Localizable.stringsdict; sourceTree = "<group>"; };
7429BCE9297C5D030069A946 /* es */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = es; path = es.lproj/Localizable.stringsdict; sourceTree = "<group>"; };
7429BCEB297D65380069A946 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = "zh-Hans"; path = "zh-Hans.lproj/Localizable.stringsdict"; sourceTree = "<group>"; };
7429BCEC297D65390069A946 /* it */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = it; path = it.lproj/Localizable.stringsdict; sourceTree = "<group>"; };
9606B7A1297AD2BB00C1FB75 /* es */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = es; path = es.lproj/Localizable.strings; sourceTree = "<group>"; };
9F24EEB729360C330042359D /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = "<group>"; };
9F29553D292B67B600E0E81B /* Network */ = {isa = PBXFileReference; lastKnownFileType = wrapper; name = Network; path = Packages/Network; sourceTree = "<group>"; };
@ -214,6 +223,14 @@
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
7429BCEA297C64CF0069A946 /* Plurals */ = {
isa = PBXGroup;
children = (
7429BCE4297C55D00069A946 /* Localizable.stringsdict */,
);
path = Plurals;
sourceTree = "<group>";
};
9F2A5417296AB631009B2D7C /* IceCubesNotifications */ = {
isa = PBXGroup;
children = (
@ -356,6 +373,7 @@
E9B576C029743F2A00BCE646 /* Localization */ = {
isa = PBXGroup;
children = (
7429BCEA297C64CF0069A946 /* Plurals */,
E9B576C529743F4C00BCE646 /* Localizable.strings */,
);
path = Localization;
@ -503,6 +521,7 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
7429BCE5297C5A750069A946 /* Localizable.stringsdict in Resources */,
9F8CA5982979B63D00481E8E /* Localizable.strings in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
@ -513,6 +532,7 @@
files = (
9FAD858E29743F7400496AB1 /* (null) in Resources */,
9F8CA5972979B61100481E8E /* Localizable.strings in Resources */,
7429BCE6297C5A750069A946 /* Localizable.stringsdict in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -523,6 +543,7 @@
9F2A542C296B1177009B2D7C /* glass.caf in Resources */,
E9B576C329743F4C00BCE646 /* Localizable.strings in Resources */,
9FD34823293D06E800DB0EE9 /* Assets.xcassets in Resources */,
7429BCE2297C55D00069A946 /* Localizable.stringsdict in Resources */,
9F24EEB829360C330042359D /* Preview Assets.xcassets in Resources */,
9FAD85832971BF7200496AB1 /* Secret.plist in Resources */,
9F2A542E296B1CC0009B2D7C /* glass.wav in Resources */,
@ -593,6 +614,19 @@
/* End PBXTargetDependency section */
/* Begin PBXVariantGroup section */
7429BCE4297C55D00069A946 /* Localizable.stringsdict */ = {
isa = PBXVariantGroup;
children = (
7429BCE3297C55D00069A946 /* en */,
7429BCE7297C5D010069A946 /* nl */,
7429BCE8297C5D020069A946 /* de */,
7429BCE9297C5D030069A946 /* es */,
7429BCEB297D65380069A946 /* zh-Hans */,
7429BCEC297D65390069A946 /* it */,
);
name = Localizable.stringsdict;
sourceTree = "<group>";
};
E9B576C529743F4C00BCE646 /* Localizable.strings */ = {
isa = PBXVariantGroup;
children = (

View file

@ -137,7 +137,7 @@ struct SettingsTabs: View {
if let reviewURL = URL(string: "https://apps.apple.com/app/id\(AppInfo.appStoreAppId)?action=write-review") {
Link(destination: reviewURL) {
Label("Rate Ice Cubes", systemImage: "link")
Label("settings.rate", systemImage: "link")
}
.tint(theme.labelColor)
}

View file

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>timeline-new-posts %lld</key>
<dict>
<key>NSStringLocalizedFormatKey</key>
<string>%#@timelineNewPosts@</string>
<key>timelineNewPosts</key>
<dict>
<key>NSStringFormatSpecTypeKey</key>
<string>NSStringPluralRuleType</string>
<key>NSStringFormatValueTypeKey</key>
<string>lld</string>
<key>one</key>
<string>ein neuer Post</string>
<key>other</key>
<string>%lld neue Posts</string>
</dict>
</dict>
</dict>
</plist>

View file

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>timeline-new-posts %lld</key>
<dict>
<key>NSStringLocalizedFormatKey</key>
<string>%#@timelineNewPosts@</string>
<key>timelineNewPosts</key>
<dict>
<key>NSStringFormatSpecTypeKey</key>
<string>NSStringPluralRuleType</string>
<key>NSStringFormatValueTypeKey</key>
<string>lld</string>
<key>one</key>
<string>%lld new post</string>
<key>other</key>
<string>%lld new posts</string>
</dict>
</dict>
</dict>
</plist>

View file

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>timeline-new-posts %lld</key>
<dict>
<key>NSStringLocalizedFormatKey</key>
<string>%#@timelineNewPosts@</string>
<key>timelineNewPosts</key>
<dict>
<key>NSStringFormatSpecTypeKey</key>
<string>NSStringPluralRuleType</string>
<key>NSStringFormatValueTypeKey</key>
<string>lld</string>
<key>one</key>
<string>%lld new post</string>
<key>other</key>
<string>%lld nuevas publicaciones</string>
</dict>
</dict>
</dict>
</plist>

View file

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>timeline-new-posts %lld</key>
<dict>
<key>NSStringLocalizedFormatKey</key>
<string>%#@timelineNewPosts@</string>
<key>timelineNewPosts</key>
<dict>
<key>NSStringFormatSpecTypeKey</key>
<string>NSStringPluralRuleType</string>
<key>NSStringFormatValueTypeKey</key>
<string>lld</string>
<key>one</key>
<string>%lld new post</string>
<key>other</key>
<string>%lld nuovi messaggi</string>
</dict>
</dict>
</dict>
</plist>

View file

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>timeline-new-posts %lld</key>
<dict>
<key>NSStringLocalizedFormatKey</key>
<string>%#@timelineNewPosts@</string>
<key>timelineNewPosts</key>
<dict>
<key>NSStringFormatSpecTypeKey</key>
<string>NSStringPluralRuleType</string>
<key>NSStringFormatValueTypeKey</key>
<string>lld</string>
<key>one</key>
<string>%lld new post</string>
<key>other</key>
<string>%lld nieuwe posts</string>
</dict>
</dict>
</dict>
</plist>

View file

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>timeline-new-posts %lld</key>
<dict>
<key>NSStringLocalizedFormatKey</key>
<string>%#@timelineNewPosts@</string>
<key>timelineNewPosts</key>
<dict>
<key>NSStringFormatSpecTypeKey</key>
<string>NSStringPluralRuleType</string>
<key>NSStringFormatValueTypeKey</key>
<string>lld</string>
<key>one</key>
<string>%lld new post</string>
<key>other</key>
<string>%lld 个新嘟文</string>
</dict>
</dict>
</dict>
</plist>

View file

@ -98,6 +98,7 @@
"settings.support.four.subtitle" = "It'll go a long way to keep Ice Cubes running!";
"settings.timeline.add" = "Lokale Timeline hinzufügen";
"settings.title" = "Einstellungen";
"settings.rate" = "Bewerte Ice Cubes";
// MARK: Tabs
"tab.explore" = "Entdecken";
@ -238,7 +239,6 @@
"notifications.tab.mentions" = "Erwähnungen";
// MARK: Package: Timeline
"timeline.n-new-posts %lld" = "%lld neue Posts";
"timeline.federated" = "Föderiert";
"timeline.home" = "Startseite";
"timeline.local" = "Lokal";

View file

@ -8,7 +8,7 @@
"alert.button.ok" = "Ok";
"alert.error" = "Error!";
"placeholder.loading.long" = "Loading, loading, loading ....";
"placeholder.loading.long" = "Loading, loading, loading ...";
"placeholder.loading.short" = "Loading ...";
"see-more" = "See more";
@ -68,12 +68,12 @@
"settings.general.browser.system" = "System Browser";
"settings.general.display" = "Display Settings";
"settings.general.instance" = "Instance Information";
"settings.general.push-notifications" = "Push notification";
"settings.general.push-notifications" = "Push Notification";
"settings.general.remote-timelines" = "Remote Local Timelines";
"settings.push.boosts" = "Boosts";
"settings.push.favorites" = "Favorites";
"settings.push.follows" = "Follows";
"settings.push.main-toggle" = "Push notifications";
"settings.push.main-toggle" = "Push Notifications";
"settings.push.main-toggle.description" = "Receive push notifications on new activities";
"settings.push.mentions" = "Mentions";
"settings.push.navigation-title" = "Push Notifications";
@ -98,6 +98,7 @@
"settings.support.four.subtitle" = "It'll go a long way to keep Ice Cubes running!";
"settings.timeline.add" = "Add a local timeline";
"settings.title" = "Settings";
"settings.rate" = "Rate Ice Cubes";
// MARK: Tabs
"tab.explore" = "Explore";
@ -238,7 +239,6 @@
"notifications.tab.mentions" = "Mentions";
// MARK: Package: Timeline
"timeline.n-new-posts %lld" = "%lld new posts";
"timeline.federated" = "Federated";
"timeline.home" = "Home";
"timeline.local" = "Local";

View file

@ -49,7 +49,7 @@
"settings.app.icon" = "Icono de la app";
"settings.app.icon.navigation-title" = "Iconos";
"settings.app.source" = "Código fuente (Enlace a GitHub)";
"settings.app.support" = "Apoya a esta app";
"settings.app.support" = "Apoya a Ice Cubes";
"settings.display.avatar.position" = "Posición del avatar";
"settings.display.avatar.shape" = "Forma del avatar";
"settings.display.navigation-title" = "Ajustes de apariencia";
@ -98,6 +98,7 @@
"settings.support.four.subtitle" = "It'll go a long way to keep Ice Cubes running!";
"settings.timeline.add" = "Añadir cronología local";
"settings.title" = "Ajustes";
"settings.rate" = "Valora Ice Cubes";
// MARK: Tabs
"tab.explore" = "Explorar";
@ -161,6 +162,7 @@
"account.post.pinned" = "Publicación fijada";
"account.posts" = "Publicaciones";
"account.relation.follows-you" = "Te sigue";
"account.joined" = "Se unió el";
// MARK: Package: Conversations
"conversations.action.delete" = "Borrar";
@ -237,7 +239,6 @@
"notifications.tab.mentions" = "Menciones";
// MARK: Package: Timeline
"timeline.n-new-posts %lld" = "%lld nuevas publicaciones";
"timeline.federated" = "Federado";
"timeline.home" = "Inicio";
"timeline.local" = "Local";

View file

@ -98,6 +98,7 @@
"settings.support.four.subtitle" = "It'll go a long way to keep Ice Cubes running!";
"settings.timeline.add" = "Aggiungi una timeline locale";
"settings.title" = "Impostazioni";
"settings.rate" = "Rate Ice Cubes";
// MARK: Tabs
"tab.explore" = "Esplora";
@ -238,7 +239,6 @@
"notifications.tab.mentions" = "Menzioni";
// MARK: Package: Timeline
"timeline.n-new-posts %lld" = "%lld nuovi messaggi";
"timeline.federated" = "Federazione";
"timeline.home" = "Home";
"timeline.local" = "Locale";

View file

@ -162,6 +162,7 @@
"account.posts" = "Posts";
"account.relation.follows-you" = "Volgt jou";
"account.joined" = "Lid geworden";
"settings.rate" = "Rate Ice Cubes";
// MARK: Package: Conversations
"conversations.action.delete" = "Verwijderen";
@ -238,9 +239,8 @@
"notifications.tab.mentions" = "Vermeldingen";
// MARK: Package: Timeline
"timeline.n-new-posts %lld" = "%lld nieuwe posts";
"timeline.federated" = "Gefedereerd";
"timeline.home" = "Thuis";
"timeline.home" = "Startpagina";
"timeline.local" = "Lokaal";
"timeline.n-recent-from-n-participants %lld %lld" = "%lld recente posts van %lld deelnemers";
"timeline.trending" = "Trending";

View file

@ -98,6 +98,7 @@
"settings.support.four.subtitle" = "It'll go a long way to keep Ice Cubes running!";
"settings.timeline.add" = "添加一个本地时间线";
"settings.title" = "设置";
"settings.rate" = "Rate Ice Cubes";
// MARK: Tabs
"tab.explore" = "探索";
@ -238,7 +239,6 @@
"notifications.tab.mentions" = "提及";
// MARK: Package: Timeline
"timeline.n-new-posts %lld" = "%lld 个新嘟文";
"timeline.federated" = "跨站";
"timeline.home" = "主页";
"timeline.local" = "本地";

View file

@ -7,11 +7,13 @@ import SwiftUI
public struct EmojiTextApp: View {
private let markdown: HTMLString
private let emojis: [any CustomEmoji]
private let language: String?
private let append: (() -> Text)?
public init(_ markdown: HTMLString, emojis: [Emoji], append: (() -> Text)? = nil) {
public init(_ markdown: HTMLString, emojis: [Emoji], language: String? = nil, append: (() -> Text)? = nil) {
self.markdown = markdown
self.emojis = emojis.map { RemoteEmoji(shortcode: $0.shortcode, url: $0.url) }
self.language = language
self.append = append
}
@ -23,8 +25,15 @@ public struct EmojiTextApp: View {
}
} else if emojis.isEmpty {
Text(markdown.asSafeMarkdownAttributedString)
.environment(\.layoutDirection, isRTL() ? .rightToLeft : .leftToRight)
} else {
EmojiText(markdown: markdown.asMarkdown, emojis: emojis)
.environment(\.layoutDirection, isRTL() ? .rightToLeft : .leftToRight)
}
}
private func isRTL() -> Bool {
// Arabic, Hebrew, Persian, Urdu, Kurdish, Azeri, Dhivehi
return ["ar", "he", "fa", "ur", "ku", "az", "dv"].contains(self.language)
}
}

View file

@ -125,7 +125,7 @@ public struct StatusEditorView: View {
}
ToolbarItem(placement: .navigationBarLeading) {
Button {
if !viewModel.statusText.string.isEmpty && !viewModel.mode.isInShareExtension {
if viewModel.shouldDisplayDismissWarning {
isDismissAlertPresented = true
} else {
dismiss()

View file

@ -60,6 +60,16 @@ public class StatusEditorViewModel: ObservableObject {
showPoll || !selectedMedias.isEmpty
}
var shouldDisplayDismissWarning: Bool {
var modifiedStatusText = statusText.string.trimmingCharacters(in: .whitespaces)
if let mentionString, modifiedStatusText.hasPrefix(mentionString) {
modifiedStatusText = String(modifiedStatusText.dropFirst(mentionString.count))
}
return !modifiedStatusText.isEmpty && !mode.isInShareExtension
}
@Published var visibility: Models.Visibility = .pub
@Published var mentionsSuggestions: [Account] = []
@ -68,9 +78,10 @@ public class StatusEditorViewModel: ObservableObject {
private var currentSuggestionRange: NSRange?
private var embeddedStatusURL: URL? {
return URL(string: embeddedStatus?.reblog?.url ?? embeddedStatus?.url ?? "")
URL(string: embeddedStatus?.reblog?.url ?? embeddedStatus?.url ?? "")
}
private var mentionString: String?
private var uploadTask: Task<Void, Never>?
init(mode: Mode) {
@ -171,6 +182,10 @@ public class StatusEditorViewModel: ObservableObject {
visibility = status.visibility
statusText = .init(string: mentionString)
selectedRange = .init(location: mentionString.utf16.count, length: 0)
if !mentionString.isEmpty {
self.mentionString = mentionString.trimmingCharacters(in: .whitespaces)
}
case let .mention(account, visibility):
statusText = .init(string: "@\(account.acct) ")
self.visibility = visibility

View file

@ -215,7 +215,7 @@ public struct StatusRowView: View {
private func makeStatusContentView(status: AnyStatus) -> some View {
Group {
if !status.spoilerText.asRawText.isEmpty {
EmojiTextApp(status.spoilerText, emojis: status.emojis)
EmojiTextApp(status.spoilerText, emojis: status.emojis, language: status.language)
.font(.scaledBody)
Button {
withAnimation {
@ -230,7 +230,7 @@ public struct StatusRowView: View {
if !viewModel.displaySpoiler {
HStack {
EmojiTextApp(status.content, emojis: status.emojis)
EmojiTextApp(status.content, emojis: status.emojis, language: status.language)
.font(.scaledBody)
.environment(\.openURL, OpenURLAction { url in
routerPath.handleStatus(status: status, url: url)

View file

@ -49,7 +49,7 @@ class TimelineViewModel: ObservableObject, StatusesFetcher {
var pendingStatusesButtonTitle: LocalizedStringKey {
switch pendingStatusesState {
case .stream, .refresh:
return "timeline.n-new-posts \(pendingStatuses.count)"
return "timeline-new-posts \(pendingStatuses.count)"
}
}