From bbc7549d7a198113421a9d70c129dc573c2673f1 Mon Sep 17 00:00:00 2001 From: Hunter Kehoe Date: Fri, 24 Jun 2022 09:15:22 -0600 Subject: [PATCH 01/17] custom display names fixes binwiederhier/ntfy#313 fixes binwiederhier/ntfy#291 (at least the android portion) --- .../io.heckel.ntfy.db.Database/12.json | 12 +++++-- .../java/io/heckel/ntfy/backup/Backuper.kt | 9 +++-- .../main/java/io/heckel/ntfy/db/Database.kt | 17 ++++++---- .../main/java/io/heckel/ntfy/db/Repository.kt | 2 ++ .../io/heckel/ntfy/msg/NotificationService.kt | 1 + .../java/io/heckel/ntfy/ui/DetailActivity.kt | 19 +++++++++-- .../heckel/ntfy/ui/DetailSettingsActivity.kt | 33 +++++++++++++++++-- .../java/io/heckel/ntfy/ui/MainActivity.kt | 5 ++- .../java/io/heckel/ntfy/ui/MainAdapter.kt | 4 +-- .../io/heckel/ntfy/up/BroadcastReceiver.kt | 1 + app/src/main/java/io/heckel/ntfy/util/Util.kt | 6 +++- app/src/main/res/values/strings.xml | 2 ++ app/src/main/res/values/values.xml | 1 + app/src/main/res/xml/detail_preferences.xml | 5 +++ 14 files changed, 95 insertions(+), 22 deletions(-) diff --git a/app/schemas/io.heckel.ntfy.db.Database/12.json b/app/schemas/io.heckel.ntfy.db.Database/12.json index 9743a78..8b1a443 100644 --- a/app/schemas/io.heckel.ntfy.db.Database/12.json +++ b/app/schemas/io.heckel.ntfy.db.Database/12.json @@ -2,11 +2,11 @@ "formatVersion": 1, "database": { "version": 12, - "identityHash": "b439720b55cf5e6bfdec2b56dd46103d", + "identityHash": "9363ad5196e88862acceb1bb9ee91124", "entities": [ { "tableName": "Subscription", - "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `baseUrl` TEXT NOT NULL, `topic` TEXT NOT NULL, `instant` INTEGER NOT NULL, `mutedUntil` INTEGER NOT NULL, `minPriority` INTEGER NOT NULL, `autoDelete` INTEGER NOT NULL, `lastNotificationId` TEXT, `icon` TEXT, `upAppId` TEXT, `upConnectorToken` TEXT, PRIMARY KEY(`id`))", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `baseUrl` TEXT NOT NULL, `topic` TEXT NOT NULL, `instant` INTEGER NOT NULL, `mutedUntil` INTEGER NOT NULL, `minPriority` INTEGER NOT NULL, `autoDelete` INTEGER NOT NULL, `lastNotificationId` TEXT, `icon` TEXT, `upAppId` TEXT, `upConnectorToken` TEXT, `displayName` TEXT, PRIMARY KEY(`id`))", "fields": [ { "fieldPath": "id", @@ -73,6 +73,12 @@ "columnName": "upConnectorToken", "affinity": "TEXT", "notNull": false + }, + { + "fieldPath": "displayName", + "columnName": "displayName", + "affinity": "TEXT", + "notNull": false } ], "primaryKey": { @@ -320,7 +326,7 @@ "views": [], "setupQueries": [ "CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)", - "INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, 'b439720b55cf5e6bfdec2b56dd46103d')" + "INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, '9363ad5196e88862acceb1bb9ee91124')" ] } } \ No newline at end of file diff --git a/app/src/main/java/io/heckel/ntfy/backup/Backuper.kt b/app/src/main/java/io/heckel/ntfy/backup/Backuper.kt index 120f41e..9ce3069 100644 --- a/app/src/main/java/io/heckel/ntfy/backup/Backuper.kt +++ b/app/src/main/java/io/heckel/ntfy/backup/Backuper.kt @@ -100,7 +100,8 @@ class Backuper(val context: Context) { lastNotificationId = s.lastNotificationId, icon = s.icon, upAppId = s.upAppId, - upConnectorToken = s.upConnectorToken + upConnectorToken = s.upConnectorToken, + displayName = s.displayName, )) } catch (e: Exception) { Log.w(TAG, "Unable to restore subscription ${s.id} (${topicUrl(s.baseUrl, s.topic)}): ${e.message}. Ignoring.", e) @@ -224,7 +225,8 @@ class Backuper(val context: Context) { lastNotificationId = s.lastNotificationId, icon = s.icon, upAppId = s.upAppId, - upConnectorToken = s.upConnectorToken + upConnectorToken = s.upConnectorToken, + displayName = s.displayName ) } } @@ -331,7 +333,8 @@ data class Subscription( val lastNotificationId: String?, val icon: String?, val upAppId: String?, - val upConnectorToken: String? + val upConnectorToken: String?, + val displayName: String? ) data class Notification( diff --git a/app/src/main/java/io/heckel/ntfy/db/Database.kt b/app/src/main/java/io/heckel/ntfy/db/Database.kt index eba9cb9..f5ddb44 100644 --- a/app/src/main/java/io/heckel/ntfy/db/Database.kt +++ b/app/src/main/java/io/heckel/ntfy/db/Database.kt @@ -22,13 +22,14 @@ data class Subscription( @ColumnInfo(name = "icon") val icon: String?, // content://-URI (or later other identifier) @ColumnInfo(name = "upAppId") val upAppId: String?, // UnifiedPush application package name @ColumnInfo(name = "upConnectorToken") val upConnectorToken: String?, // UnifiedPush connector token + @ColumnInfo(name = "displayName") val displayName: String?, @Ignore val totalCount: Int = 0, // Total notifications @Ignore val newCount: Int = 0, // New notifications @Ignore val lastActive: Long = 0, // Unix timestamp @Ignore val state: ConnectionState = ConnectionState.NOT_APPLICABLE ) { - constructor(id: Long, baseUrl: String, topic: String, instant: Boolean, mutedUntil: Long, minPriority: Int, autoDelete: Long, lastNotificationId: String, icon: String, upAppId: String, upConnectorToken: String) : - this(id, baseUrl, topic, instant, mutedUntil, minPriority, autoDelete, lastNotificationId, icon, upAppId, upConnectorToken, 0, 0, 0, ConnectionState.NOT_APPLICABLE) + constructor(id: Long, baseUrl: String, topic: String, instant: Boolean, mutedUntil: Long, minPriority: Int, autoDelete: Long, lastNotificationId: String, icon: String, upAppId: String, upConnectorToken: String, displayName: String?) : + this(id, baseUrl, topic, instant, mutedUntil, minPriority, autoDelete, lastNotificationId, icon, upAppId, upConnectorToken, displayName, 0, 0, 0, ConnectionState.NOT_APPLICABLE) } enum class ConnectionState { @@ -47,6 +48,7 @@ data class SubscriptionWithMetadata( val icon: String?, val upAppId: String?, val upConnectorToken: String?, + val displayName: String?, val totalCount: Int, val newCount: Int, val lastActive: Long @@ -266,6 +268,7 @@ abstract class Database : RoomDatabase() { private val MIGRATION_11_12 = object : Migration(11, 12) { override fun migrate(db: SupportSQLiteDatabase) { db.execSQL("ALTER TABLE Subscription ADD COLUMN lastNotificationId TEXT") + db.execSQL("ALTER TABLE Subscription ADD COLUMN displayName TEXT") } } } @@ -275,7 +278,7 @@ abstract class Database : RoomDatabase() { interface SubscriptionDao { @Query(""" SELECT - s.id, s.baseUrl, s.topic, s.instant, s.mutedUntil, s.minPriority, s.autoDelete, s.lastNotificationId, s.icon, s.upAppId, s.upConnectorToken, + s.id, s.baseUrl, s.topic, s.instant, s.mutedUntil, s.minPriority, s.autoDelete, s.lastNotificationId, s.icon, s.upAppId, s.upConnectorToken, s.displayName, COUNT(n.id) totalCount, COUNT(CASE n.notificationId WHEN 0 THEN NULL ELSE n.id END) newCount, IFNULL(MAX(n.timestamp),0) AS lastActive @@ -288,7 +291,7 @@ interface SubscriptionDao { @Query(""" SELECT - s.id, s.baseUrl, s.topic, s.instant, s.mutedUntil, s.minPriority, s.autoDelete, s.lastNotificationId, s.icon, s.upAppId, s.upConnectorToken, + s.id, s.baseUrl, s.topic, s.instant, s.mutedUntil, s.minPriority, s.autoDelete, s.lastNotificationId, s.icon, s.upAppId, s.upConnectorToken, s.displayName, COUNT(n.id) totalCount, COUNT(CASE n.notificationId WHEN 0 THEN NULL ELSE n.id END) newCount, IFNULL(MAX(n.timestamp),0) AS lastActive @@ -301,7 +304,7 @@ interface SubscriptionDao { @Query(""" SELECT - s.id, s.baseUrl, s.topic, s.instant, s.mutedUntil, s.minPriority, s.autoDelete, s.lastNotificationId, s.icon, s.upAppId, s.upConnectorToken, + s.id, s.baseUrl, s.topic, s.instant, s.mutedUntil, s.minPriority, s.autoDelete, s.lastNotificationId, s.icon, s.upAppId, s.upConnectorToken, s.displayName, COUNT(n.id) totalCount, COUNT(CASE n.notificationId WHEN 0 THEN NULL ELSE n.id END) newCount, IFNULL(MAX(n.timestamp),0) AS lastActive @@ -314,7 +317,7 @@ interface SubscriptionDao { @Query(""" SELECT - s.id, s.baseUrl, s.topic, s.instant, s.mutedUntil, s.minPriority, s.autoDelete, s.lastNotificationId, s.icon, s.upAppId, s.upConnectorToken, + s.id, s.baseUrl, s.topic, s.instant, s.mutedUntil, s.minPriority, s.autoDelete, s.lastNotificationId, s.icon, s.upAppId, s.upConnectorToken, s.displayName, COUNT(n.id) totalCount, COUNT(CASE n.notificationId WHEN 0 THEN NULL ELSE n.id END) newCount, IFNULL(MAX(n.timestamp),0) AS lastActive @@ -327,7 +330,7 @@ interface SubscriptionDao { @Query(""" SELECT - s.id, s.baseUrl, s.topic, s.instant, s.mutedUntil, s.minPriority, s.autoDelete, s.lastNotificationId, s.icon, s.upAppId, s.upConnectorToken, + s.id, s.baseUrl, s.topic, s.instant, s.mutedUntil, s.minPriority, s.autoDelete, s.lastNotificationId, s.icon, s.upAppId, s.upConnectorToken, s.displayName, COUNT(n.id) totalCount, COUNT(CASE n.notificationId WHEN 0 THEN NULL ELSE n.id END) newCount, IFNULL(MAX(n.timestamp),0) AS lastActive diff --git a/app/src/main/java/io/heckel/ntfy/db/Repository.kt b/app/src/main/java/io/heckel/ntfy/db/Repository.kt index d35a25d..9f13656 100644 --- a/app/src/main/java/io/heckel/ntfy/db/Repository.kt +++ b/app/src/main/java/io/heckel/ntfy/db/Repository.kt @@ -384,6 +384,7 @@ class Repository(private val sharedPrefs: SharedPreferences, private val databas icon = s.icon, upAppId = s.upAppId, upConnectorToken = s.upConnectorToken, + displayName = s.displayName, totalCount = s.totalCount, newCount = s.newCount, lastActive = s.lastActive, @@ -408,6 +409,7 @@ class Repository(private val sharedPrefs: SharedPreferences, private val databas icon = s.icon, upAppId = s.upAppId, upConnectorToken = s.upConnectorToken, + displayName = s.displayName, totalCount = s.totalCount, newCount = s.newCount, lastActive = s.lastActive, diff --git a/app/src/main/java/io/heckel/ntfy/msg/NotificationService.kt b/app/src/main/java/io/heckel/ntfy/msg/NotificationService.kt index 06b8ad1..846e10b 100644 --- a/app/src/main/java/io/heckel/ntfy/msg/NotificationService.kt +++ b/app/src/main/java/io/heckel/ntfy/msg/NotificationService.kt @@ -300,6 +300,7 @@ class NotificationService(val context: Context) { putExtra(MainActivity.EXTRA_SUBSCRIPTION_ID, subscription.id) putExtra(MainActivity.EXTRA_SUBSCRIPTION_BASE_URL, subscription.baseUrl) putExtra(MainActivity.EXTRA_SUBSCRIPTION_TOPIC, subscription.topic) + putExtra(MainActivity.EXTRA_SUBSCRIPTION_DISPLAY_NAME, displayName(subscription)) putExtra(MainActivity.EXTRA_SUBSCRIPTION_INSTANT, subscription.instant) putExtra(MainActivity.EXTRA_SUBSCRIPTION_MUTED_UNTIL, subscription.mutedUntil) } diff --git a/app/src/main/java/io/heckel/ntfy/ui/DetailActivity.kt b/app/src/main/java/io/heckel/ntfy/ui/DetailActivity.kt index cfa4553..aff1ba6 100644 --- a/app/src/main/java/io/heckel/ntfy/ui/DetailActivity.kt +++ b/app/src/main/java/io/heckel/ntfy/ui/DetailActivity.kt @@ -54,6 +54,7 @@ class DetailActivity : AppCompatActivity(), ActionMode.Callback, NotificationFra private var subscriptionId: Long = 0L // Set in onCreate() private var subscriptionBaseUrl: String = "" // Set in onCreate() private var subscriptionTopic: String = "" // Set in onCreate() + private var subscriptionDisplayName: String = "" // Set in onCreate() & updated by options menu! private var subscriptionInstant: Boolean = false // Set in onCreate() & updated by options menu! private var subscriptionMutedUntil: Long = 0L // Set in onCreate() & updated by options menu! @@ -97,7 +98,6 @@ class DetailActivity : AppCompatActivity(), ActionMode.Callback, NotificationFra val secure = url.getBooleanQueryParameter("secure", true) val baseUrl = if (secure) "https://${url.host}" else "http://${url.host}" val topic = url.pathSegments.first() - title = topicShortUrl(baseUrl, topic) // Subscribe to topic if it doesn't already exist lifecycleScope.launch(Dispatchers.IO) { @@ -116,6 +116,7 @@ class DetailActivity : AppCompatActivity(), ActionMode.Callback, NotificationFra icon = null, upAppId = null, upConnectorToken = null, + displayName = null, totalCount = 0, newCount = 0, lastActive = Date().time/1000 @@ -143,10 +144,13 @@ class DetailActivity : AppCompatActivity(), ActionMode.Callback, NotificationFra } } + title = displayName(subscription) + // Add extras needed in loadView(); normally these are added in MainActivity intent.putExtra(MainActivity.EXTRA_SUBSCRIPTION_ID, subscription.id) intent.putExtra(MainActivity.EXTRA_SUBSCRIPTION_BASE_URL, subscription.baseUrl) intent.putExtra(MainActivity.EXTRA_SUBSCRIPTION_TOPIC, subscription.topic) + intent.putExtra(MainActivity.EXTRA_SUBSCRIPTION_DISPLAY_NAME, displayName(subscription)) intent.putExtra(MainActivity.EXTRA_SUBSCRIPTION_INSTANT, subscription.instant) intent.putExtra(MainActivity.EXTRA_SUBSCRIPTION_MUTED_UNTIL, subscription.mutedUntil) @@ -161,13 +165,14 @@ class DetailActivity : AppCompatActivity(), ActionMode.Callback, NotificationFra subscriptionId = intent.getLongExtra(MainActivity.EXTRA_SUBSCRIPTION_ID, 0) subscriptionBaseUrl = intent.getStringExtra(MainActivity.EXTRA_SUBSCRIPTION_BASE_URL) ?: return subscriptionTopic = intent.getStringExtra(MainActivity.EXTRA_SUBSCRIPTION_TOPIC) ?: return + subscriptionDisplayName = intent.getStringExtra(MainActivity.EXTRA_SUBSCRIPTION_DISPLAY_NAME) ?: return subscriptionInstant = intent.getBooleanExtra(MainActivity.EXTRA_SUBSCRIPTION_INSTANT, false) subscriptionMutedUntil = intent.getLongExtra(MainActivity.EXTRA_SUBSCRIPTION_MUTED_UNTIL, 0L) // Set title val subscriptionBaseUrl = intent.getStringExtra(MainActivity.EXTRA_SUBSCRIPTION_BASE_URL) ?: return val topicUrl = topicShortUrl(subscriptionBaseUrl, subscriptionTopic) - title = topicUrl + title = subscriptionDisplayName // Set "how to instructions" val howToExample: TextView = findViewById(R.id.detail_how_to_example) @@ -263,9 +268,11 @@ class DetailActivity : AppCompatActivity(), ActionMode.Callback, NotificationFra val subscription = repository.getSubscription(subscriptionId) ?: return@launch subscriptionInstant = subscription.instant subscriptionMutedUntil = subscription.mutedUntil + subscriptionDisplayName = displayName(subscription) showHideInstantMenuItems(subscriptionInstant) showHideMutedUntilMenuItems(subscriptionMutedUntil) + updateTitle(subscriptionDisplayName) } } @@ -543,6 +550,12 @@ class DetailActivity : AppCompatActivity(), ActionMode.Callback, NotificationFra } } + private fun updateTitle(subscriptionDisplayName: String) { + runOnUiThread { + title = subscriptionDisplayName + } + } + private fun onClearClick() { Log.d(TAG, "Clearing all notifications for ${topicShortUrl(subscriptionBaseUrl, subscriptionTopic)}") @@ -571,6 +584,7 @@ class DetailActivity : AppCompatActivity(), ActionMode.Callback, NotificationFra intent.putExtra(EXTRA_SUBSCRIPTION_ID, subscriptionId) intent.putExtra(EXTRA_SUBSCRIPTION_BASE_URL, subscriptionBaseUrl) intent.putExtra(EXTRA_SUBSCRIPTION_TOPIC, subscriptionTopic) + intent.putExtra(EXTRA_SUBSCRIPTION_DISPLAY_NAME, subscriptionDisplayName) startActivity(intent) } @@ -747,5 +761,6 @@ class DetailActivity : AppCompatActivity(), ActionMode.Callback, NotificationFra const val EXTRA_SUBSCRIPTION_ID = "subscriptionId" const val EXTRA_SUBSCRIPTION_BASE_URL = "baseUrl" const val EXTRA_SUBSCRIPTION_TOPIC = "topic" + const val EXTRA_SUBSCRIPTION_DISPLAY_NAME = "displayName" } } diff --git a/app/src/main/java/io/heckel/ntfy/ui/DetailSettingsActivity.kt b/app/src/main/java/io/heckel/ntfy/ui/DetailSettingsActivity.kt index f4c39e8..757745a 100644 --- a/app/src/main/java/io/heckel/ntfy/ui/DetailSettingsActivity.kt +++ b/app/src/main/java/io/heckel/ntfy/ui/DetailSettingsActivity.kt @@ -55,9 +55,8 @@ class DetailSettingsActivity : AppCompatActivity() { } // Title - val baseUrl = intent.getStringExtra(DetailActivity.EXTRA_SUBSCRIPTION_BASE_URL) ?: return - val topic = intent.getStringExtra(DetailActivity.EXTRA_SUBSCRIPTION_TOPIC) ?: return - title = topicShortUrl(baseUrl, topic) + val displayName = intent.getStringExtra(DetailActivity.EXTRA_SUBSCRIPTION_DISPLAY_NAME) ?: return + title = displayName // Show 'Back' button supportActionBar?.setDisplayHomeAsUpEnabled(true) @@ -108,6 +107,7 @@ class DetailSettingsActivity : AppCompatActivity() { loadAutoDeletePref() loadIconSetPref() loadIconRemovePref() + loadDisplayNamePref() } private fun loadInstantPref() { @@ -276,6 +276,33 @@ class DetailSettingsActivity : AppCompatActivity() { } } + private fun loadDisplayNamePref() { + val prefId = context?.getString(R.string.detail_settings_appearance_display_name_key) ?: return + val pref: EditTextPreference? = findPreference(prefId) + pref?.isVisible = true // Hack: Show all settings at once, because subscription is loaded asynchronously + pref?.text = subscription.displayName + pref?.preferenceDataStore = object : PreferenceDataStore() { + override fun putString(key: String?, value: String?) { + val displayName: String? = if (value == "") { + null + } else { + value + } + val newSubscription = subscription.copy(displayName = displayName) + save(newSubscription) // TODO: does this need refresh=true? + activity?.runOnUiThread { + activity?.title = displayName(newSubscription) + } + } + override fun getString(key: String?, defValue: String?): String { + return subscription.displayName ?: "" + } + } + pref?.summaryProvider = Preference.SummaryProvider { _ -> + getString(R.string.detail_settings_appearance_display_name_summary, displayName(subscription), topicShortUrl(subscription.baseUrl, subscription.topic)) + } + } + private fun createIconPickLauncher(): ActivityResultLauncher { return registerForActivityResult(ActivityResultContracts.GetContent()) { inputUri -> if (inputUri == null) { diff --git a/app/src/main/java/io/heckel/ntfy/ui/MainActivity.kt b/app/src/main/java/io/heckel/ntfy/ui/MainActivity.kt index 5321a85..10b7228 100644 --- a/app/src/main/java/io/heckel/ntfy/ui/MainActivity.kt +++ b/app/src/main/java/io/heckel/ntfy/ui/MainActivity.kt @@ -438,6 +438,7 @@ class MainActivity : AppCompatActivity(), ActionMode.Callback, AddFragment.Subsc icon = null, upAppId = null, upConnectorToken = null, + displayName = null, totalCount = 0, newCount = 0, lastActive = Date().time/1000 @@ -509,7 +510,7 @@ class MainActivity : AppCompatActivity(), ActionMode.Callback, AddFragment.Subsc } } } catch (e: Exception) { - val topic = topicShortUrl(subscription.baseUrl, subscription.topic) + val topic = displayName(subscription) if (errorMessage == "") errorMessage = "$topic: ${e.message}" errors++ } @@ -536,6 +537,7 @@ class MainActivity : AppCompatActivity(), ActionMode.Callback, AddFragment.Subsc intent.putExtra(EXTRA_SUBSCRIPTION_ID, subscription.id) intent.putExtra(EXTRA_SUBSCRIPTION_BASE_URL, subscription.baseUrl) intent.putExtra(EXTRA_SUBSCRIPTION_TOPIC, subscription.topic) + intent.putExtra(EXTRA_SUBSCRIPTION_DISPLAY_NAME, displayName(subscription)) intent.putExtra(EXTRA_SUBSCRIPTION_INSTANT, subscription.instant) intent.putExtra(EXTRA_SUBSCRIPTION_MUTED_UNTIL, subscription.mutedUntil) startActivity(intent) @@ -662,6 +664,7 @@ class MainActivity : AppCompatActivity(), ActionMode.Callback, AddFragment.Subsc const val EXTRA_SUBSCRIPTION_ID = "subscriptionId" const val EXTRA_SUBSCRIPTION_BASE_URL = "subscriptionBaseUrl" const val EXTRA_SUBSCRIPTION_TOPIC = "subscriptionTopic" + const val EXTRA_SUBSCRIPTION_DISPLAY_NAME = "subscriptionDisplayName" const val EXTRA_SUBSCRIPTION_INSTANT = "subscriptionInstant" const val EXTRA_SUBSCRIPTION_MUTED_UNTIL = "subscriptionMutedUntil" const val ANIMATION_DURATION = 80L diff --git a/app/src/main/java/io/heckel/ntfy/ui/MainAdapter.kt b/app/src/main/java/io/heckel/ntfy/ui/MainAdapter.kt index 0ffa4fa..bb78468 100644 --- a/app/src/main/java/io/heckel/ntfy/ui/MainAdapter.kt +++ b/app/src/main/java/io/heckel/ntfy/ui/MainAdapter.kt @@ -20,7 +20,7 @@ import io.heckel.ntfy.db.Subscription import io.heckel.ntfy.msg.NotificationService import io.heckel.ntfy.util.Log import io.heckel.ntfy.util.readBitmapFromUriOrNull -import io.heckel.ntfy.util.topicShortUrl +import io.heckel.ntfy.util.displayName import java.text.DateFormat import java.util.* @@ -101,7 +101,7 @@ class MainAdapter(private val repository: Repository, private val onClick: (Subs if (subscription.icon != null) { imageView.setImageBitmap(subscription.icon.readBitmapFromUriOrNull(context)) } - nameView.text = topicShortUrl(subscription.baseUrl, subscription.topic) + nameView.text = displayName(subscription) statusView.text = statusMessage dateView.text = dateText dateView.visibility = if (isUnifiedPush) View.GONE else View.VISIBLE diff --git a/app/src/main/java/io/heckel/ntfy/up/BroadcastReceiver.kt b/app/src/main/java/io/heckel/ntfy/up/BroadcastReceiver.kt index 6906399..9119e15 100644 --- a/app/src/main/java/io/heckel/ntfy/up/BroadcastReceiver.kt +++ b/app/src/main/java/io/heckel/ntfy/up/BroadcastReceiver.kt @@ -79,6 +79,7 @@ class BroadcastReceiver : android.content.BroadcastReceiver() { icon = null, upAppId = appId, upConnectorToken = connectorToken, + displayName = null, totalCount = 0, newCount = 0, lastActive = Date().time/1000 diff --git a/app/src/main/java/io/heckel/ntfy/util/Util.kt b/app/src/main/java/io/heckel/ntfy/util/Util.kt index aa23f55..a6a3197 100644 --- a/app/src/main/java/io/heckel/ntfy/util/Util.kt +++ b/app/src/main/java/io/heckel/ntfy/util/Util.kt @@ -53,6 +53,10 @@ fun topicUrlAuth(baseUrl: String, topic: String) = "${topicUrl(baseUrl, topic)}/ fun topicUrlJsonPoll(baseUrl: String, topic: String, since: String) = "${topicUrl(baseUrl, topic)}/json?poll=1&since=$since" fun topicShortUrl(baseUrl: String, topic: String) = shortUrl(topicUrl(baseUrl, topic)) +fun displayName(subscription: Subscription) : String { + return subscription.displayName ?: topicShortUrl(subscription.baseUrl, subscription.topic) +} + fun shortUrl(url: String) = url .replace("http://", "") .replace("https://", "") @@ -176,7 +180,7 @@ fun formatTitle(subscription: Subscription, notification: Notification): String return if (notification.title != "") { formatTitle(notification) } else { - topicShortUrl(subscription.baseUrl, subscription.topic) + displayName(subscription) } } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 10cb1a3..ea80adb 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -353,6 +353,8 @@ Subscription icon (tap to remove) Icon displayed in notifications for this topic Unable to save icon: %1$s + Display name + Set a custom display name for this subscription. Leave empty for default\nCurrent: %1$s\nDefault: %2$s Use global setting using global setting diff --git a/app/src/main/res/values/values.xml b/app/src/main/res/values/values.xml index e199f8d..d5b4859 100644 --- a/app/src/main/res/values/values.xml +++ b/app/src/main/res/values/values.xml @@ -36,6 +36,7 @@ SubscriptionAutoDelete SubscriptionIconSet SubscriptionIconRemove + SubscriptionDisplayName diff --git a/app/src/main/res/xml/detail_preferences.xml b/app/src/main/res/xml/detail_preferences.xml index 660635d..b398170 100644 --- a/app/src/main/res/xml/detail_preferences.xml +++ b/app/src/main/res/xml/detail_preferences.xml @@ -38,5 +38,10 @@ app:title="@string/detail_settings_appearance_icon_remove_title" app:summary="@string/detail_settings_appearance_icon_remove_summary" app:isPreferenceVisible="false"/> + From f18285a17086f8c49db2a2cc83212b0eba3287b4 Mon Sep 17 00:00:00 2001 From: Hunter Kehoe Date: Fri, 24 Jun 2022 10:08:33 -0600 Subject: [PATCH 02/17] use custom dialog with display name preference --- .../java/io/heckel/ntfy/ui/DetailSettingsActivity.kt | 12 ++++++++++-- app/src/main/res/values/strings.xml | 3 ++- app/src/main/res/xml/detail_preferences.xml | 3 ++- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/io/heckel/ntfy/ui/DetailSettingsActivity.kt b/app/src/main/java/io/heckel/ntfy/ui/DetailSettingsActivity.kt index 757745a..e6df89b 100644 --- a/app/src/main/java/io/heckel/ntfy/ui/DetailSettingsActivity.kt +++ b/app/src/main/java/io/heckel/ntfy/ui/DetailSettingsActivity.kt @@ -4,6 +4,7 @@ import android.content.ContentResolver import android.graphics.BitmapFactory import android.net.Uri import android.os.Bundle +import android.text.TextUtils import android.widget.Toast import androidx.activity.result.ActivityResultLauncher import androidx.activity.result.contract.ActivityResultContracts @@ -298,8 +299,15 @@ class DetailSettingsActivity : AppCompatActivity() { return subscription.displayName ?: "" } } - pref?.summaryProvider = Preference.SummaryProvider { _ -> - getString(R.string.detail_settings_appearance_display_name_summary, displayName(subscription), topicShortUrl(subscription.baseUrl, subscription.topic)) + pref?.summaryProvider = Preference.SummaryProvider { provider -> + if (TextUtils.isEmpty(provider.text)) { + getString( + R.string.detail_settings_appearance_display_name_default_summary, + displayName(subscription) + ) + } else { + provider.text + } } } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index ea80adb..1691d49 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -354,7 +354,8 @@ Icon displayed in notifications for this topic Unable to save icon: %1$s Display name - Set a custom display name for this subscription. Leave empty for default\nCurrent: %1$s\nDefault: %2$s + Set a custom display name for this subscription. Leave empty for default + %1$s (default) Use global setting using global setting diff --git a/app/src/main/res/xml/detail_preferences.xml b/app/src/main/res/xml/detail_preferences.xml index b398170..184bdb4 100644 --- a/app/src/main/res/xml/detail_preferences.xml +++ b/app/src/main/res/xml/detail_preferences.xml @@ -41,7 +41,8 @@ From e69692fe9e6cedf01dd55ab067f94cae4c2b550d Mon Sep 17 00:00:00 2001 From: Hunter Kehoe Date: Fri, 24 Jun 2022 10:19:53 -0600 Subject: [PATCH 03/17] remove TODO --- app/src/main/java/io/heckel/ntfy/ui/DetailSettingsActivity.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/io/heckel/ntfy/ui/DetailSettingsActivity.kt b/app/src/main/java/io/heckel/ntfy/ui/DetailSettingsActivity.kt index e6df89b..8ccfad8 100644 --- a/app/src/main/java/io/heckel/ntfy/ui/DetailSettingsActivity.kt +++ b/app/src/main/java/io/heckel/ntfy/ui/DetailSettingsActivity.kt @@ -290,7 +290,7 @@ class DetailSettingsActivity : AppCompatActivity() { value } val newSubscription = subscription.copy(displayName = displayName) - save(newSubscription) // TODO: does this need refresh=true? + save(newSubscription) activity?.runOnUiThread { activity?.title = displayName(newSubscription) } From c5496c3f8c54940cd29baf133649bff1e0161c54 Mon Sep 17 00:00:00 2001 From: Hunter Kehoe Date: Fri, 24 Jun 2022 10:32:48 -0600 Subject: [PATCH 04/17] fix problem with deep links --- app/src/main/java/io/heckel/ntfy/ui/DetailActivity.kt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/src/main/java/io/heckel/ntfy/ui/DetailActivity.kt b/app/src/main/java/io/heckel/ntfy/ui/DetailActivity.kt index aff1ba6..4fc9ec7 100644 --- a/app/src/main/java/io/heckel/ntfy/ui/DetailActivity.kt +++ b/app/src/main/java/io/heckel/ntfy/ui/DetailActivity.kt @@ -98,6 +98,7 @@ class DetailActivity : AppCompatActivity(), ActionMode.Callback, NotificationFra val secure = url.getBooleanQueryParameter("secure", true) val baseUrl = if (secure) "https://${url.host}" else "http://${url.host}" val topic = url.pathSegments.first() + title = topicShortUrl(baseUrl, topic) // Subscribe to topic if it doesn't already exist lifecycleScope.launch(Dispatchers.IO) { @@ -144,8 +145,6 @@ class DetailActivity : AppCompatActivity(), ActionMode.Callback, NotificationFra } } - title = displayName(subscription) - // Add extras needed in loadView(); normally these are added in MainActivity intent.putExtra(MainActivity.EXTRA_SUBSCRIPTION_ID, subscription.id) intent.putExtra(MainActivity.EXTRA_SUBSCRIPTION_BASE_URL, subscription.baseUrl) From a89ae4929df5e1a4b0ee7ff5c68f116ac16a3111 Mon Sep 17 00:00:00 2001 From: Christian Meis Date: Mon, 20 Jun 2022 07:03:06 +0000 Subject: [PATCH 05/17] Translated using Weblate (German) Currently translated at 100.0% (311 of 311 strings) Translation: ntfy/Android app Translate-URL: https://hosted.weblate.org/projects/ntfy/android/de/ --- app/src/main/res/values-de/strings.xml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index eb9e63f..a92fa22 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -211,9 +211,9 @@ Vorhandene Logs löschen und neu beginnen Logs gelöscht Verbindungs-Protokoll - JSON-over-HTTP-Stream für die Serververbindung nutzen. Diese Methode ist veraltet und wird im Juni 2022 entfernt. + JSON-over-HTTP-Stream für die Serververbindung nutzen. Diese Methode ist bewährt, benötigt aber evtl. mehr Akku. Nachrichten broadcasten - WebSockets für die Server-Verbindung nutzen. Diese Methode wird im Juni 2022 der Standard. + WebSockets für die Server-Verbindung nutzen. Diese Methode wird empfohlen, benötigt aber evtl. zusätzliche Konfiguration in Deinem Proxy. JSON-over-HTTP-Stream WebSockets Über @@ -317,4 +317,8 @@ Sofortnachrichten Icon, das in Benachrichtigungen zu diesem Thema angezeigt wird Benachrichtigungen werden sofort zugestellt. Benötigt einen Vordergrund-Dienst und verbraucht mehr Akku. - + Der Umstieg auf WebSockets ist die empfohlene Verbindungsweise zu Deinem Server und benötigt möglicherweise weniger Akkuleistung. Es könnte aber eine zusätzliche Konfiguration im Proxy nötig sein. Die Verbindungmethode kann in den Einstellungen gewählt werden. + Jetzt aktivieren + Service-URL wählen + Service-URL löschen + \ No newline at end of file From b5bfd008d1e94a10dab8b40ead39ae3220167ee9 Mon Sep 17 00:00:00 2001 From: 109247019824 Date: Mon, 20 Jun 2022 13:13:39 +0000 Subject: [PATCH 06/17] Translated using Weblate (Bulgarian) Currently translated at 100.0% (311 of 311 strings) Translation: ntfy/Android app Translate-URL: https://hosted.weblate.org/projects/ntfy/android/bg/ --- app/src/main/res/values-bg/strings.xml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/src/main/res/values-bg/strings.xml b/app/src/main/res/values-bg/strings.xml index 2e36282..22bc0f2 100644 --- a/app/src/main/res/values-bg/strings.xml +++ b/app/src/main/res/values-bg/strings.xml @@ -174,7 +174,7 @@ Добавяне на потребител Разширени Отказ - Използвайте WebSockets за свързване със сървъра. Това е експериментална възможност. Дайте ни обратна връзка дали се изразходва по-малко батерия или е нестабилна. + Използва се WebSockets за свързване със сървъра. Това е препоръчителния метод, но могат да се наложат настройки на сървъра за прокси. Копиране или изпращане на дневник Копиране в междинната памет Добре @@ -183,7 +183,7 @@ След три месеца След един месец Копиране в междинната памет (цензурирано) - За свързване със сървъра се използва поток от JSON през HTTP. Методът е остарял и ще бъде премахнат през месец юни 2022 год. + За свързване със сървъра се използва поток от JSON през HTTP. Методът е изпитан, но може да използва повече батерия. Това е пробно известие от приложението ntfy за Android. То е с приоритет %1$d. Ако изпратите друго, то може да изглежда по различен начин. Проба: Ако желаете можете да сложите заглавие Грешка при изпращане: Потребителят „%1$s“ няма достъп. @@ -319,4 +319,6 @@ от общите настройки Изберете адрес на услугата Изчистване на адреса на услугата - + WebSockets е препоръчителния начин за свързване с услугата и може да подобри използването на батерията, но могат да се наложат допълнителни настройки на сървъра за прокси. Промяната може да бъде направена в настройките. + Включване + \ No newline at end of file From f48c2de651c0bfc6ab0a35b26d21e0c75a0482d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?O=C4=9Fuz=20Ersen?= Date: Sun, 19 Jun 2022 18:54:11 +0000 Subject: [PATCH 07/17] Translated using Weblate (Turkish) Currently translated at 100.0% (311 of 311 strings) Translation: ntfy/Android app Translate-URL: https://hosted.weblate.org/projects/ntfy/android/tr/ --- app/src/main/res/values-tr/strings.xml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xml index 1197767..d7c3c6a 100644 --- a/app/src/main/res/values-tr/strings.xml +++ b/app/src/main/res/values-tr/strings.xml @@ -172,8 +172,8 @@ Önceden kaydedilen günlükleri silin ve baştan başlayın Günlükler silindi Bağlantı protokolü - Sunucuya bağlanmak için HTTP üzerinden bir JSON akışı kullanın. Bu yöntem kullanım dışıdır ve Haziran 2022\'de kaldırılacaktır. - Sunucuya bağlanmak için WebSockets kullanın. Bu, Haziran 2022\'de öntanımlı olacaktır. + Sunucuya bağlanmak için HTTP üzerinden bir JSON akışı kullanın. Bu yöntem iyi test edilmiştir, ancak daha fazla pil tüketebilir. + Sunucuya bağlanmak için WebSockets kullanın. Bu tavsiye edilen yöntemdir, ancak vekilinizde ek yapılandırma gerektirebilir. Bildirimler (en yüksek öncelik) İki konuya abone olundu Abonelik ekle @@ -319,4 +319,6 @@ Genel ayarı kullan Hizmet URL\'sini temizle Hizmet URL\'sini seç - + Şimdi etkinleştir + WebSockets\'e geçmek sunucunuza bağlanmak için tavsiye edilen yoldur ve pil ömrünü artırabilir, ancak vekilinizde ek yapılandırma gerektirebilir. Bu, ayarlardan değiştirilebilir. + \ No newline at end of file From 271be8f6f7080bab3aae0d377035a3d53d2b50b3 Mon Sep 17 00:00:00 2001 From: Mayeul Cantan Date: Tue, 21 Jun 2022 08:33:35 +0000 Subject: [PATCH 08/17] Translated using Weblate (French) Currently translated at 100.0% (311 of 311 strings) Translation: ntfy/Android app Translate-URL: https://hosted.weblate.org/projects/ntfy/android/fr/ --- app/src/main/res/values-fr/strings.xml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index 86ad97a..9d3b554 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -286,8 +286,8 @@ Journaux copiés dans le presse-papier Copier les journaux dans le presse-papier ou les télécharger sur nopaste.net (détenu par l\'auteur de ntfy). Les noms d\'hôtes et les sujets peuvent être censurés, les notifications ne le seront jamais. Journaux téléchargés et URL copiée - Utiliser un flux JSON en HTTP pour se connecter au serveur. Cette méthode est dépréciée et sera retirée en juin 2022. - Utiliser des WebSockets pour se connecter au serveur. Cela deviendra la valeur par défaut en juin 2022. + Utiliser un flux JSON en HTTP pour se connecter au serveur. Cette méthode est éprouvée, mais peut consommer plus de batterie. + Utiliser des WebSockets pour se connecter au serveur. Il s\'agit de la méthode recommandée, mais peut requérir une configuration supplémentaire de votre proxy. Copié dans le presse-papier Enregistrer les journaux Vous pouvez ajouter un utilisateur ici. Tous les sujets du serveur sélectionné utiliseront cet utilisateur. @@ -317,4 +317,8 @@ Choisir une icône à afficher pour les notifications Utiliser le paramètre global utilisation du paramètre global - + Il est recommandé d\'utiliser les WebSockets pour vous connecter à votre serveur, ce qui peut également économiser la batterie, mais peut requérir une configuration additionnelle de votre proxy. Cela peut être changé dans les paramètres. + Choisir l\'URL du service + Supprimer l\'URL du service + Activer maintenant + \ No newline at end of file From cb37487b3f2559f78e80b103245e4359e1e0ea66 Mon Sep 17 00:00:00 2001 From: Linerly Date: Mon, 20 Jun 2022 10:29:27 +0000 Subject: [PATCH 09/17] Translated using Weblate (Indonesian) Currently translated at 100.0% (311 of 311 strings) Translation: ntfy/Android app Translate-URL: https://hosted.weblate.org/projects/ntfy/android/id/ --- app/src/main/res/values-in/strings.xml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/app/src/main/res/values-in/strings.xml b/app/src/main/res/values-in/strings.xml index 986418d..9d674d4 100644 --- a/app/src/main/res/values-in/strings.xml +++ b/app/src/main/res/values-in/strings.xml @@ -198,8 +198,8 @@ Hapus catatan yang direkam sebelumnya, dan mulai ulang Catatan dihapus Protokol koneksi - Gunakan aliran JSON melalui HTTP untuk menghubungkan ke server. Mode ini usang dan akan dihilangkan di Juni 2022. - Gunakan WebSockets untuk menghubungkan ke server. Ini adalah sebagai bawaan di Juni 2022. + Gunakan aliran JSON melalui HTTP untuk menyambung ke server. Metode ini sudah teruji, tetapi mungkin menghabiskan lebih banyak baterai. + Gunakan WebSockets untuk menyambung ke server. Ini adalah metode yang disarankan, tetapi mungkin memerlukan konfigurasi tambahan dalam proksi Anda. Aliran JSON melalui HTTP WebSockets Tentang @@ -306,8 +306,7 @@ Berlangganan ke enam topik pengiriman instan Berlangganan ke lima topik Berlangganan ke enam topik - Notifikasi dikirim secara instan. -\nMembutuhkan sebuah layanan latar depan dan mengkonsumsi lebih banyak baterai. + Notifikasi dikirim secara instan. Membutuhkan sebuah layanan latar depan dan mengkonsumsi lebih banyak baterai. Tampilan Tetapkan sebuah ikon untuk ditampilkan di notifikasi Ikon langganan (ketuk untuk menghapus) @@ -320,4 +319,6 @@ Ikon langganan Pilih URL layanan Hapus URL layanan - + Beralih ke WebSockets adalah cara yang disarankan untuk terhubung ke server Anda, dan dapat meningkatkan masa pakai baterai, tetapi mungkin memerlukan konfigurasi tambahan di proksi Anda. Ini dapat diubah di Pengaturan. + Aktifkan sekarang + \ No newline at end of file From 43e57911a0de023a8b7bf607ca28528826bc0e78 Mon Sep 17 00:00:00 2001 From: Linerly Date: Mon, 20 Jun 2022 10:31:23 +0000 Subject: [PATCH 10/17] Translated using Weblate (Indonesian) Currently translated at 100.0% (3 of 3 strings) Translation: ntfy/Android app (Fastlane metadata) Translate-URL: https://hosted.weblate.org/projects/ntfy/android-fastlane/id/ --- .../metadata/android/id/full_description.txt | 17 +++++++++++++++++ .../metadata/android/id/short_description.txt | 1 + fastlane/metadata/android/id/title.txt | 1 + 3 files changed, 19 insertions(+) create mode 100644 fastlane/metadata/android/id/full_description.txt create mode 100644 fastlane/metadata/android/id/short_description.txt create mode 100644 fastlane/metadata/android/id/title.txt diff --git a/fastlane/metadata/android/id/full_description.txt b/fastlane/metadata/android/id/full_description.txt new file mode 100644 index 0000000..7f9498c --- /dev/null +++ b/fastlane/metadata/android/id/full_description.txt @@ -0,0 +1,17 @@ +Kirim notifikasi ke ponsel Anda dari skrip Bash atau PowerShell, atau dari aplikasi Anda sendiri menggunakan permintaan PUT/POST, misalnya melalui curl di Linux atau Invoke-WebRequest. + +ntfy adalah klien Android untuk https://ntfy.sh, sebuah layanan pub-sub berbasis HTTP bebas dan sumber terbuka. Anda dapat berlangganan topik di aplikasi ini, dan kemudian mempublikasikan pesan melalui HTTP API sederhana. + +Kegunaan: +* Memberitahu diri Anda sendiri saat proses yang berjalan lama selesai +* Ping ponsel Anda ketika pencadangan gagal +* Memberi peringatan ketika seseorang masuk ke server Anda + +Contoh: + +$ curl -d "Pencadangan Anda telah selesai" ntfy.sh/topiksaya + +Temukan lebih banyak contoh dan instruksi penggunaan di sini: +* Situs web: https://ntfy.sh +* GitHub (server): https://github.com/binwiederhier/ntfy +* GitHub (aplikasi Android): https://github.com/binwiederhier/ntfy-android diff --git a/fastlane/metadata/android/id/short_description.txt b/fastlane/metadata/android/id/short_description.txt new file mode 100644 index 0000000..91775fc --- /dev/null +++ b/fastlane/metadata/android/id/short_description.txt @@ -0,0 +1 @@ +Kirim notifikasi ke ponsel Anda dari skrip memakai permintaan PUT/POST diff --git a/fastlane/metadata/android/id/title.txt b/fastlane/metadata/android/id/title.txt new file mode 100644 index 0000000..5fdda5a --- /dev/null +++ b/fastlane/metadata/android/id/title.txt @@ -0,0 +1 @@ +ntfy — PUT/POST ke ponsel Anda From d43cd4c728e742e39619c0bcfbca214c3bd65afb Mon Sep 17 00:00:00 2001 From: brianchul Date: Tue, 21 Jun 2022 17:06:43 +0200 Subject: [PATCH 11/17] Added translation using Weblate (Chinese (Traditional)) --- app/src/main/res/values-zh-rTW/strings.xml | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 app/src/main/res/values-zh-rTW/strings.xml diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml new file mode 100644 index 0000000..a6b3dae --- /dev/null +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file From cd61eba95592e1039a579a3a879957f85fc3a986 Mon Sep 17 00:00:00 2001 From: Eric Date: Wed, 22 Jun 2022 00:53:51 +0000 Subject: [PATCH 12/17] Translated using Weblate (Chinese (Simplified)) Currently translated at 98.7% (307 of 311 strings) Translation: ntfy/Android app Translate-URL: https://hosted.weblate.org/projects/ntfy/android/zh_Hans/ --- app/src/main/res/values-zh-rCN/strings.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index b569d48..8865739 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -241,8 +241,8 @@ 日志已上传,URL 已复制到剪贴板 无法上传日志:%1$s 确认 - 使用通过 HTTP 传输的 JSON 数据流。该方式已废弃并将在 2022 年 6 月移除。 - 使用 WebSockets 连接到服务器。该方式将在 2022 年 6 月成为默认选项。 + 使用通过 HTTP 传输的 JSON 数据流来连接至服务器。该方式经过实战检验但可能消耗更多电量。 + 使用 WebSockets 连接到服务器。这是推荐的方法,但可能需要在你的代理中进行额外配置。 HTTP 传输的 JSON 数据流 关于 下载中 %1$s, %2$d%% @@ -317,4 +317,4 @@ 无法保存图标:%1$s 使用全局设置 使用全局设置 - + \ No newline at end of file From c711ac39525bd7c782d20624acda1bcd0425ec7b Mon Sep 17 00:00:00 2001 From: brianchul Date: Tue, 21 Jun 2022 15:25:48 +0000 Subject: [PATCH 13/17] Translated using Weblate (Chinese (Traditional)) Currently translated at 19.6% (61 of 311 strings) Translation: ntfy/Android app Translate-URL: https://hosted.weblate.org/projects/ntfy/android/zh_Hant/ --- app/src/main/res/values-zh-rTW/strings.xml | 67 +++++++++++++++++++++- 1 file changed, 66 insertions(+), 1 deletion(-) diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index a6b3dae..482aab8 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -1,2 +1,67 @@ - \ No newline at end of file + + 已訂閱6個主題 + 通知(預設優先) + 回報bug + 監聽傳入通知 + 已訂閱即時推送主題 + 已訂閱1個即時推送主題 + 已訂閱2個即時推送主題 + 已訂閱4個即時推送主題 + 已訂閱5個即時推送主題 + 已訂閱6個即時推送主題 + 已訂閱%1$d個即時推送主題 + 已訂閱主題 + 收到%1$d個通知 + 已同步到最新 + 有%1$d個訂閱無法更新 +\n +\n%2$s + 訂閱無法更新:%1$s + 已訂閱主題 + 通知已開啟 + 通知已靜音 + 設定 + 幫我們評個分⭐ + 取消訂閱 + 取消訂閱已選取的主題且永久刪除所有通知? + 永久刪除 + 取消 + %1$d個通知 + %1$d個通知 + 昨天 + 新增訂閱 + 看來你還沒有訂閱任何主題。 + 點擊 + 來新增或訂閱一個主題。當透過 PUT 或 POST 來發送訊息你將會接收到通知。 + 更多資訊請上 ntfy.sh,docs會有更多說明。 + 此訂閱已由 %1$s 透過 UnifiedPush 管理 + %1$s (UnifiedPush) + 為了避免通知傳送問題,電池最佳化必須關閉。 + 稍後詢問我 + 略過 + 立即修正 + 稍後詢問我 + 略過 + 立即啟用 + 訂閱主題 + 因為主題不能受密碼保護,請盡量取一個難以猜測的主題名稱。在訂閱之後你就可以使用 PUT/POST 來發送通知。 + 使用其他伺服器 + 在下方輸入自訂的網址來訂閱主題。 + 通知(最低優先) + 通知(低優先) + 通知(高優先) + 通知(最高優先) + 訂閱服務 + 已訂閱3個即時推送主題 + 閱讀文件 + 建議使用 WebSockets 來連線你的伺服器,此動作可以有效增加電池續航,但需要對proxy進行更多設定。這個動作可以在設定中進行。 + 已訂閱3個主題 + 已訂閱%1$d個主題 + 已訂閱1個主題 + 已訂閱2個主題 + 已訂閱4個主題 + 已訂閱5個主題 + 重新連線中 … + 通知靜音到%1$s + 主題名稱(例如:phils_alerts) + \ No newline at end of file From 1dab1c1c98f815047b98b0a59f89e625f0914587 Mon Sep 17 00:00:00 2001 From: Serge Date: Thu, 23 Jun 2022 17:13:42 +0000 Subject: [PATCH 14/17] Translated using Weblate (Polish) Currently translated at 2.5% (8 of 311 strings) Translation: ntfy/Android app Translate-URL: https://hosted.weblate.org/projects/ntfy/android/pl/ --- app/src/main/res/values-pl/strings.xml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml index e931f35..9e94b4d 100644 --- a/app/src/main/res/values-pl/strings.xml +++ b/app/src/main/res/values-pl/strings.xml @@ -1,11 +1,11 @@ - Notyfikacje (Minimalny Priorytet) - Notyfikacje (Niski priorytet) - Notyfikacje (domyślny priorytet) - Notyfikacje (Maksymalny priorytet) - Oczekiwanie powiadomień przychodzących + Powiadomienia (minimalny priorytet) + Powiadomienia (niski priorytet) + Powiadomienia (domyślny priorytet) + Powiadomienia (maksymalny priorytet) + Oczekiwanie na przychodzące powiadomienia Subskrybujesz tematy z natychmiastową dostawą - Notyfikacje (Wysoki Priorytet) - Usługa Subskrypcji + Powiadomienia (wysoki priorytet) + Usługa subskrypcji \ No newline at end of file From dc0762cbb9aa04cd18f18aa0503a321f8d3a68d9 Mon Sep 17 00:00:00 2001 From: poi Date: Thu, 23 Jun 2022 13:33:01 +0000 Subject: [PATCH 15/17] Translated using Weblate (Chinese (Simplified)) Currently translated at 99.0% (308 of 311 strings) Translation: ntfy/Android app Translate-URL: https://hosted.weblate.org/projects/ntfy/android/zh_Hans/ --- app/src/main/res/values-zh-rCN/strings.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index 8865739..701943a 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -317,4 +317,5 @@ 无法保存图标:%1$s 使用全局设置 使用全局设置 + 选择服务 URL \ No newline at end of file From 808ba55882adc495dbc498fd312d8b38789307eb Mon Sep 17 00:00:00 2001 From: Philipp Heckel Date: Fri, 24 Jun 2022 12:40:12 -0400 Subject: [PATCH 16/17] Changelog --- fastlane/metadata/android/en-US/changelog/28.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/fastlane/metadata/android/en-US/changelog/28.txt b/fastlane/metadata/android/en-US/changelog/28.txt index fa1e1af..1b5cb16 100644 --- a/fastlane/metadata/android/en-US/changelog/28.txt +++ b/fastlane/metadata/android/en-US/changelog/28.txt @@ -1,4 +1,5 @@ Features: +* Subscriptions can now have a display name (#313, thanks to @wunter8) * Polling is now done with since= API, which makes deduping easier (#165) * Turned JSON stream deprecation banner into "Use WebSockets" banner (no ticket) From 240834e3a574f7cecb8435b5695ecce380282219 Mon Sep 17 00:00:00 2001 From: Philipp Heckel Date: Fri, 24 Jun 2022 12:47:27 -0400 Subject: [PATCH 17/17] Dot --- app/src/main/res/values/strings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 1691d49..8cf0cba 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -354,7 +354,7 @@ Icon displayed in notifications for this topic Unable to save icon: %1$s Display name - Set a custom display name for this subscription. Leave empty for default + Set a custom display name for this subscription. Leave empty for default. %1$s (default) Use global setting using global setting