Compare commits
6 Commits
remove-mys
...
localizati
| Author | SHA1 | Date | |
|---|---|---|---|
|
8ed2395865
|
|||
|
274d1035e0
|
|||
|
b41205729e
|
|||
|
2d7b77a7e0
|
|||
|
0ed2b4edec
|
|||
|
9a5fabfee5
|
@@ -7,16 +7,12 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
func bundleForLocale(locale: Locale?) -> Bundle {
|
||||
if locale == nil {
|
||||
return Bundle.main
|
||||
}
|
||||
|
||||
let path = Bundle.main.path(forResource: locale!.identifier, ofType: "lproj")
|
||||
func bundleForLocale(locale: Locale) -> Bundle {
|
||||
let path = Bundle.main.path(forResource: locale.identifier, ofType: "lproj")
|
||||
return path != nil ? (Bundle(path: path!) ?? Bundle.main) : Bundle.main
|
||||
}
|
||||
|
||||
func localizedStringFormat(key: String, locale: Locale?) -> String {
|
||||
func localizedStringFormat(key: String, locale: Locale) -> String {
|
||||
let bundle = bundleForLocale(locale: locale)
|
||||
let fallback = bundleForLocale(locale: Locale(identifier: "en-US")).localizedString(forKey: key, value: nil, table: nil)
|
||||
return bundle.localizedString(forKey: key, value: fallback, table: nil)
|
||||
|
||||
@@ -29,13 +29,18 @@ struct GradientFollowButton: View {
|
||||
.fontWeight(.medium)
|
||||
.padding([.top, .bottom], 10)
|
||||
.padding([.leading, .trailing], 12)
|
||||
.background(follow_state == .unfollows ? PinkGradient : GrayGradient)
|
||||
.cornerRadius(12)
|
||||
.overlay(
|
||||
RoundedRectangle(cornerRadius: 12)
|
||||
.stroke(grayBorder, lineWidth: follow_state == .unfollows ? 0 : 1)
|
||||
.frame(width: 100)
|
||||
)
|
||||
.frame(width: 100)
|
||||
.minimumScaleFactor(0.5)
|
||||
.lineLimit(1)
|
||||
}
|
||||
.background(follow_state == .unfollows ? PinkGradient : GrayGradient)
|
||||
.cornerRadius(12)
|
||||
.frame(width: 100)
|
||||
.onReceive(handle_notify(.followed)) { ref in
|
||||
guard target.follow_ref == ref else { return }
|
||||
self.follow_state = .follows
|
||||
|
||||
@@ -13,6 +13,10 @@ struct AddMuteItemView: View {
|
||||
|
||||
@Environment(\.dismiss) var dismiss
|
||||
|
||||
var trimmedText: String {
|
||||
new_text.trimmingCharacters(in: .whitespaces)
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
VStack {
|
||||
Text("Add mute item", comment: "Title text to indicate user to an add an item to their mutelist.")
|
||||
@@ -30,12 +34,13 @@ struct AddMuteItemView: View {
|
||||
Text("Duration", comment: "The duration in which to mute the given item.")
|
||||
}
|
||||
|
||||
let trimmedText = self.trimmedText
|
||||
|
||||
HStack {
|
||||
Label("", image: "copy2")
|
||||
.onTapGesture {
|
||||
if let pasted_text = UIPasteboard.general.string {
|
||||
self.new_text = pasted_text
|
||||
self.new_text = pasted_text.trimmingCharacters(in: .whitespaces)
|
||||
}
|
||||
}
|
||||
TextField(NSLocalizedString("npub, #hashtag, phrase", comment: "Placeholder example for relay server address."), text: $new_text)
|
||||
@@ -44,7 +49,7 @@ struct AddMuteItemView: View {
|
||||
|
||||
Label("", image: "close-circle")
|
||||
.foregroundColor(.accentColor)
|
||||
.opacity((new_text == "") ? 0.0 : 1.0)
|
||||
.opacity(trimmedText.isEmpty ? 0.0 : 1.0)
|
||||
.onTapGesture {
|
||||
self.new_text = ""
|
||||
}
|
||||
@@ -56,17 +61,17 @@ struct AddMuteItemView: View {
|
||||
Button(action: {
|
||||
let expiration_date: Date? = self.expiration.date_from_now
|
||||
let mute_item: MuteItem? = {
|
||||
if new_text.starts(with: "npub") {
|
||||
if let pubkey: Pubkey = bech32_pubkey_decode(new_text) {
|
||||
if trimmedText.starts(with: "npub") {
|
||||
if let pubkey: Pubkey = bech32_pubkey_decode(trimmedText) {
|
||||
return .user(pubkey, expiration_date)
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
} else if new_text.starts(with: "#") {
|
||||
} else if trimmedText.starts(with: "#") {
|
||||
// Remove the starting `#` character
|
||||
return .hashtag(Hashtag(hashtag: String("\(new_text)".dropFirst())), expiration_date)
|
||||
return .hashtag(Hashtag(hashtag: String("\(trimmedText)".dropFirst())), expiration_date)
|
||||
} else {
|
||||
return .word(new_text, expiration_date)
|
||||
return .word(trimmedText, expiration_date)
|
||||
}
|
||||
}()
|
||||
|
||||
@@ -99,6 +104,8 @@ struct AddMuteItemView: View {
|
||||
}
|
||||
.buttonStyle(GradientButtonStyle(padding: 10))
|
||||
.padding(.vertical)
|
||||
.opacity(trimmedText.isEmpty ? 0.5 : 1.0)
|
||||
.disabled(trimmedText.isEmpty)
|
||||
|
||||
Spacer()
|
||||
}
|
||||
|
||||
@@ -143,7 +143,7 @@ func event_group_unique_pubkeys(profiles: Profiles, group: EventGroupType) -> [P
|
||||
"zapped_your_profile_2" - returned when 2 zaps occurred to the current user's profile
|
||||
"zapped_your_profile_3" - returned when 3 or more zaps occurred to the current user's profile
|
||||
*/
|
||||
func reacting_to_text(profiles: Profiles, our_pubkey: Pubkey, group: EventGroupType, ev: NostrEvent?, pubkeys: [Pubkey], locale: Locale? = nil) -> String {
|
||||
func reacting_to_text(profiles: Profiles, our_pubkey: Pubkey, group: EventGroupType, ev: NostrEvent?, pubkeys: [Pubkey], locale: Locale = Locale.current) -> String {
|
||||
if group.events.count == 0 {
|
||||
return "??"
|
||||
}
|
||||
@@ -188,7 +188,8 @@ struct EventGroupView: View {
|
||||
let group: EventGroupType
|
||||
|
||||
func GroupDescription(_ pubkeys: [Pubkey]) -> some View {
|
||||
Text(verbatim: "\(reacting_to_text(profiles: state.profiles, our_pubkey: state.pubkey, group: group, ev: event, pubkeys: pubkeys))")
|
||||
let text = reacting_to_text(profiles: state.profiles, our_pubkey: state.pubkey, group: group, ev: event, pubkeys: pubkeys)
|
||||
return Text(text)
|
||||
}
|
||||
|
||||
func ZapIcon(_ zapgrp: ZapGroup) -> some View {
|
||||
|
||||
@@ -114,7 +114,10 @@ struct SuggestedUsersSectionHeader: View {
|
||||
let model: SuggestedUsersViewModel
|
||||
var body: some View {
|
||||
HStack {
|
||||
Text(group.title.uppercased())
|
||||
let locale = Locale.current
|
||||
let format = localizedStringFormat(key: group.category, locale: locale)
|
||||
let categoryName = String(format: format, locale: locale)
|
||||
Text(categoryName)
|
||||
Spacer()
|
||||
Button(NSLocalizedString("Follow All", comment: "Button to follow all users in this section")) {
|
||||
model.follow(pubkeys: group.users)
|
||||
|
||||
@@ -48,7 +48,10 @@ struct SuggestedUserView: View {
|
||||
.foregroundColor(.gray)
|
||||
.font(.caption)
|
||||
}
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
|
||||
Spacer()
|
||||
|
||||
GradientFollowButton(target: target, follows_you: false, follow_state: damus_state.contacts.follow_state(target.pubkey))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,11 +10,11 @@ import Combine
|
||||
|
||||
struct SuggestedUserGroup: Identifiable, Codable {
|
||||
let id = UUID()
|
||||
let title: String
|
||||
let category: String
|
||||
let users: [Pubkey]
|
||||
|
||||
enum CodingKeys: String, CodingKey {
|
||||
case title, users
|
||||
case category, users
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[
|
||||
{
|
||||
"title": "nostr",
|
||||
"category": "suggested_users_nostr",
|
||||
"users": [
|
||||
"ba2f394833658475e91680b898f9be0f1d850166c6a839dbe084d0266ad6e20a",
|
||||
"82341f882b6eabcd2ba7f1ef90aad961cf074af15b9ef44a09f9d2a8fbfbe6a2",
|
||||
@@ -9,7 +9,7 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"title": "permaculture & livestock & gardening",
|
||||
"category": "suggested_users_permaculture_livestock_gardening",
|
||||
"users": [
|
||||
"4b1804c90d59dff195ee0e8f692b98a7c762bf1793b3e126c546d730dcb04477",
|
||||
"2c24e1af571fb4ccfeca3981649c1b09c695cd83b129709eb3b41c7ad2854899",
|
||||
@@ -17,21 +17,21 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"title": "music",
|
||||
"category": "suggested_users_music",
|
||||
"users": [
|
||||
"23708a76e7090cb108d33e8801fd36262c475e5499b23eb87eee4a31f4f0144e",
|
||||
"ca9d68eb25620fc755e1b8c76b5f155f4c7e96d99c532c109a8b36d208bdce55"
|
||||
]
|
||||
},
|
||||
{
|
||||
"title": "books",
|
||||
"category": "suggested_users_books",
|
||||
"users": [
|
||||
"2652f3af10de63bc10a2628871a3fce62e08655e4fcf90a58be16f246bb65da3",
|
||||
"b83a28b7e4e5d20bd960c5faeb6625f95529166b8bdb045d42634a2f35919450"
|
||||
]
|
||||
},
|
||||
{
|
||||
"title": "art & photography",
|
||||
"category": "suggested_users_art_photography",
|
||||
"users": [
|
||||
"f96c3d76497074c4c83a7b3823380e77dc73d5a9494fd2e053e4a1453e17824b",
|
||||
"11b2d93b26d7e56fb57f0afce0d33bfa7fb35b913e4c0aeb7706464befb9ca97",
|
||||
@@ -49,7 +49,7 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"title": "ai art",
|
||||
"category": "suggested_users_ai_art",
|
||||
"users": [
|
||||
"431fa2f340f0adf8963d6d7c6e2c20d913278c691fe609fd3857db13d8f39feb",
|
||||
"9936a53def39d712f886ac7e2ed509ce223b534834dd29d95caba9f6bc01ef35",
|
||||
@@ -59,7 +59,7 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"title": "parenting",
|
||||
"category": "suggested_users_parenting",
|
||||
"users": [
|
||||
"c7c8f645fd45b09055fb6c26d148737ad7ed12ddecde0d4c877b88f8d4196865",
|
||||
"fa984bd7dbb282f07e16e7ae87b26a2a7b9b90b7246a44771f0cf5ae58018f52",
|
||||
@@ -69,7 +69,7 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"title": "food",
|
||||
"category": "suggested_users_food",
|
||||
"users": [
|
||||
"cbb2f023b6aa09626d51d2f4ea99fa9138ea80ec7d5ffdce9feef8dcd6352031"
|
||||
]
|
||||
|
||||
@@ -226,6 +226,8 @@ struct SideMenuView: View {
|
||||
.foregroundColor(DamusColors.adaptableBlack)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
.dynamicTypeSize(.xSmall)
|
||||
.minimumScaleFactor(0.5)
|
||||
.lineLimit(1)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
@@ -3021,6 +3021,46 @@ String indicating that a given timestamp just occurred</note>
|
||||
<target>self</target>
|
||||
<note>Part of a larger sentence 'Replying to self' in US English. 'self' indicates that the user is replying to themself and no one else.</note>
|
||||
</trans-unit>
|
||||
<trans-unit id="suggested_users_ai_art" xml:space="preserve">
|
||||
<source>AI ART</source>
|
||||
<target>AI ART</target>
|
||||
<note>Suggested users category for users who may post content about AI art</note>
|
||||
</trans-unit>
|
||||
<trans-unit id="suggested_users_art_photography" xml:space="preserve">
|
||||
<source>ART & PHOTOGRAPHY</source>
|
||||
<target>ART & PHOTOGRAPHY</target>
|
||||
<note>Suggested users category for users who may post content about art and photography</note>
|
||||
</trans-unit>
|
||||
<trans-unit id="suggested_users_books" xml:space="preserve">
|
||||
<source>BOOKS</source>
|
||||
<target>BOOKS</target>
|
||||
<note>Suggested users category for users who may post content about books</note>
|
||||
</trans-unit>
|
||||
<trans-unit id="suggested_users_food" xml:space="preserve">
|
||||
<source>FOOD</source>
|
||||
<target>FOOD</target>
|
||||
<note>Suggested users category for users who may post content about food</note>
|
||||
</trans-unit>
|
||||
<trans-unit id="suggested_users_music" xml:space="preserve">
|
||||
<source>MUSIC</source>
|
||||
<target>MUSIC</target>
|
||||
<note>Suggested users category for users who may post content about music</note>
|
||||
</trans-unit>
|
||||
<trans-unit id="suggested_users_nostr" xml:space="preserve">
|
||||
<source>NOSTR</source>
|
||||
<target>NOSTR</target>
|
||||
<note>Suggested users category for users who may post content about Nostr</note>
|
||||
</trans-unit>
|
||||
<trans-unit id="suggested_users_parenting" xml:space="preserve">
|
||||
<source>PARENTING</source>
|
||||
<target>PARENTING</target>
|
||||
<note>Suggested users category for users who may post content about parenting</note>
|
||||
</trans-unit>
|
||||
<trans-unit id="suggested_users_permaculture_livestock_gardening" xml:space="preserve">
|
||||
<source>PERMACULTURE, LIVESTOCK & GARDENING</source>
|
||||
<target>PERMACULTURE, LIVESTOCK & GARDENING</target>
|
||||
<note>Suggested users category for users who may post content about permaculture, livestock, and gardening</note>
|
||||
</trans-unit>
|
||||
<trans-unit id="translate.nostr.wine (DeepL, Pay with BTC)" xml:space="preserve">
|
||||
<source>translate.nostr.wine (DeepL, Pay with BTC)</source>
|
||||
<target>translate.nostr.wine (DeepL, Pay with BTC)</target>
|
||||
@@ -3451,6 +3491,28 @@ String indicating that a given timestamp just occurred</note>
|
||||
</body>
|
||||
</file>
|
||||
<file original="damus/InfoPlist.xcstrings" source-language="en-US" target-language="en-US" datatype="plaintext">
|
||||
<header>
|
||||
<tool tool-id="com.apple.dt.xcode" tool-name="Xcode" tool-version="16.1" build-num="16B40"/>
|
||||
</header>
|
||||
<body>
|
||||
<trans-unit id="CFBundleDisplayName" xml:space="preserve">
|
||||
<source>DamusNotificationService</source>
|
||||
<target state="new">DamusNotificationService</target>
|
||||
<note>Bundle display name</note>
|
||||
</trans-unit>
|
||||
<trans-unit id="CFBundleName" xml:space="preserve">
|
||||
<source>DamusNotificationService</source>
|
||||
<target state="new">DamusNotificationService</target>
|
||||
<note>Bundle name</note>
|
||||
</trans-unit>
|
||||
<trans-unit id="NSHumanReadableCopyright" xml:space="preserve">
|
||||
<source/>
|
||||
<target state="new"/>
|
||||
<note>Copyright (human-readable)</note>
|
||||
</trans-unit>
|
||||
</body>
|
||||
</file>
|
||||
<file original="damus/Resources/InfoPlist.xcstrings" source-language="en-US" target-language="en-US" datatype="plaintext">
|
||||
<header>
|
||||
<tool tool-id="com.apple.dt.xcode" tool-name="Xcode" tool-version="16.1" build-num="16B40"/>
|
||||
</header>
|
||||
@@ -3472,7 +3534,7 @@ String indicating that a given timestamp just occurred</note>
|
||||
</trans-unit>
|
||||
</body>
|
||||
</file>
|
||||
<file original="damus/Localizable.xcstrings" source-language="en-US" target-language="en-US" datatype="plaintext">
|
||||
<file original="damus/Resources/Localizable.xcstrings" source-language="en-US" target-language="en-US" datatype="plaintext">
|
||||
<header>
|
||||
<tool tool-id="com.apple.dt.xcode" tool-name="Xcode" tool-version="16.1" build-num="16B40"/>
|
||||
</header>
|
||||
@@ -6406,28 +6468,6 @@ String indicating that a given timestamp just occurred</note>
|
||||
</trans-unit>
|
||||
</body>
|
||||
</file>
|
||||
<file original="damus/Resources/InfoPlist.xcstrings" source-language="en-US" target-language="en-US" datatype="plaintext">
|
||||
<header>
|
||||
<tool tool-id="com.apple.dt.xcode" tool-name="Xcode" tool-version="16.1" build-num="16B40"/>
|
||||
</header>
|
||||
<body>
|
||||
<trans-unit id="CFBundleDisplayName" xml:space="preserve">
|
||||
<source>DamusNotificationService</source>
|
||||
<target state="new">DamusNotificationService</target>
|
||||
<note>Bundle display name</note>
|
||||
</trans-unit>
|
||||
<trans-unit id="CFBundleName" xml:space="preserve">
|
||||
<source>DamusNotificationService</source>
|
||||
<target state="new">DamusNotificationService</target>
|
||||
<note>Bundle name</note>
|
||||
</trans-unit>
|
||||
<trans-unit id="NSHumanReadableCopyright" xml:space="preserve">
|
||||
<source/>
|
||||
<target state="new"/>
|
||||
<note>Copyright (human-readable)</note>
|
||||
</trans-unit>
|
||||
</body>
|
||||
</file>
|
||||
<file original="highlighter action extension/InfoPlist.xcstrings" source-language="en-US" target-language="en-US" datatype="plaintext">
|
||||
<header>
|
||||
<tool tool-id="com.apple.dt.xcode" tool-name="Xcode" tool-version="16.1" build-num="16B40"/>
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
"en-US" : {
|
||||
"stringUnit" : {
|
||||
"state" : "new",
|
||||
"value" : "share extension"
|
||||
"value" : "DamusNotificationService"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -20,7 +20,7 @@
|
||||
"en-US" : {
|
||||
"stringUnit" : {
|
||||
"state" : "new",
|
||||
"value" : "ShareExtension"
|
||||
"value" : "DamusNotificationService"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
"en-US" : {
|
||||
"stringUnit" : {
|
||||
"state" : "new",
|
||||
"value" : "DamusNotificationService"
|
||||
"value" : "share extension"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -20,7 +20,7 @@
|
||||
"en-US" : {
|
||||
"stringUnit" : {
|
||||
"state" : "new",
|
||||
"value" : "DamusNotificationService"
|
||||
"value" : "ShareExtension"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user