Finalize banner

This commit is contained in:
Philipp Heckel 2022-03-20 15:04:26 -04:00
parent 0bdcd3f85f
commit 85704a1275
5 changed files with 15 additions and 24 deletions

View file

@ -256,16 +256,10 @@ class Repository(private val sharedPrefs: SharedPreferences, private val databas
} }
fun setConnectionProtocol(connectionProtocol: String) { fun setConnectionProtocol(connectionProtocol: String) {
if (connectionProtocol == CONNECTION_PROTOCOL_JSONHTTP) {
sharedPrefs.edit()
.remove(SHARED_PREFS_CONNECTION_PROTOCOL)
.apply()
} else {
sharedPrefs.edit() sharedPrefs.edit()
.putString(SHARED_PREFS_CONNECTION_PROTOCOL, connectionProtocol) .putString(SHARED_PREFS_CONNECTION_PROTOCOL, connectionProtocol)
.apply() .apply()
} }
}
fun getConnectionProtocol(): String { fun getConnectionProtocol(): String {
return sharedPrefs.getString(SHARED_PREFS_CONNECTION_PROTOCOL, null) ?: CONNECTION_PROTOCOL_JSONHTTP return sharedPrefs.getString(SHARED_PREFS_CONNECTION_PROTOCOL, null) ?: CONNECTION_PROTOCOL_JSONHTTP

View file

@ -248,7 +248,6 @@ class MainActivity : AppCompatActivity(), ActionMode.Callback, AddFragment.Subsc
workManager!!.enqueueUniquePeriodicWork(PollWorker.WORK_NAME_PERIODIC_ALL, workPolicy, work) workManager!!.enqueueUniquePeriodicWork(PollWorker.WORK_NAME_PERIODIC_ALL, workPolicy, work)
} }
private fun schedulePeriodicDeleteWorker() { private fun schedulePeriodicDeleteWorker() {
val workerVersion = repository.getDeleteWorkerVersion() val workerVersion = repository.getDeleteWorkerVersion()
val workPolicy = if (workerVersion == DeleteWorker.VERSION) { val workPolicy = if (workerVersion == DeleteWorker.VERSION) {

View file

@ -108,7 +108,7 @@
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
android:layout_marginEnd="15dp" android:layout_marginTop="15dp" android:layout_marginEnd="15dp" android:layout_marginTop="15dp"
app:layout_constraintStart_toEndOf="@+id/main_banner_json_stream_image" app:layout_constraintStart_toEndOf="@+id/main_banner_json_stream_image"
android:layout_marginStart="10dp"/> android:layout_marginStart="10dp" android:autoLink="web"/>
<com.google.android.material.button.MaterialButton <com.google.android.material.button.MaterialButton
android:id="@+id/main_banner_json_stream_remind_later" android:id="@+id/main_banner_json_stream_remind_later"

View file

@ -69,16 +69,17 @@
<!-- Main activity: Battery banner --> <!-- Main activity: Battery banner -->
<string name="main_banner_battery_text">Battery optimization should be disabled to avoid issues with notification delivery.</string> <string name="main_banner_battery_text">Battery optimization should be disabled to avoid issues with notification delivery.</string>
<string name="main_banner_battery_button_remind_later">Remind later</string> <string name="main_banner_battery_button_remind_later">Ask later</string>
<string name="main_banner_battery_button_dismiss">Dismiss</string> <string name="main_banner_battery_button_dismiss">Dismiss</string>
<string name="main_banner_battery_button_fix_now">Fix now</string> <string name="main_banner_battery_button_fix_now">Fix now</string>
<!-- Main activity: JSON stream banner --> <!-- Main activity: JSON stream banner -->
<string name="main_banner_json_stream_text">Starting June 2022, WebSockets will be used to communicate with the server. Be sure get your selfhosted server ready.</string> <string name="main_banner_json_stream_text">Starting June 2022, WebSockets will be used to communicate with the ntfy servers. Be sure to configure your selfhosted server to support it. To check if WebSocket support is working, enable it in the Settings under Connection protocol.</string>
<string name="main_banner_json_stream_button_remind_later">Remind later</string> <string name="main_banner_json_stream_button_remind_later">Ask later</string>
<string name="main_banner_json_stream_button_dismiss">Dismiss</string> <string name="main_banner_json_stream_button_dismiss">Dismiss</string>
<string name="main_banner_json_stream_button_learn_more">Learn more</string> <string name="main_banner_json_stream_button_learn_more">Learn more</string>
<string name="main_banner_json_stream_button_learn_more_url">https://ntfy.sh/docs/deprecations</string> <string name="main_banner_json_stream_button_learn_more_url">https://ntfy.sh/docs/deprecations</string>
<string name="main_banner_json_stream_button_enable_ws">Enable now</string>
<!-- Add dialog --> <!-- Add dialog -->
<string name="add_dialog_title">Subscribe to topic</string> <string name="add_dialog_title">Subscribe to topic</string>
@ -331,13 +332,12 @@
<string name="settings_advanced_clear_logs_title">Clear logs</string> <string name="settings_advanced_clear_logs_title">Clear logs</string>
<string name="settings_advanced_clear_logs_summary">Delete previously recorded logs, and start over</string> <string name="settings_advanced_clear_logs_summary">Delete previously recorded logs, and start over</string>
<string name="settings_advanced_clear_logs_deleted_toast">Logs successfully deleted</string> <string name="settings_advanced_clear_logs_deleted_toast">Logs successfully deleted</string>
<string name="settings_experimental_header">Experimental</string>
<string name="settings_advanced_connection_protocol_key">ConnectionProtocol</string> <string name="settings_advanced_connection_protocol_key">ConnectionProtocol</string>
<string name="settings_advanced_connection_protocol_title">Connection protocol</string> <string name="settings_advanced_connection_protocol_title">Connection protocol</string>
<string name="settings_advanced_connection_protocol_summary_jsonhttp">Use a JSON stream over HTTP to connect to the server. This is the tried and true method, though it may consume more battery.</string> <string name="settings_advanced_connection_protocol_summary_jsonhttp">Use a JSON stream over HTTP to connect to the server. This is the tried and true method, though it may consume more battery.</string>
<string name="settings_advanced_connection_protocol_summary_ws">Use WebSockets to connect to the server. This option is experimental. Let us know if it consumes less battery or is unstable.</string> <string name="settings_advanced_connection_protocol_summary_ws">Use WebSockets to connect to the server. This option is experimental. Let us know if it consumes less battery or is unstable.</string>
<string name="settings_advanced_connection_protocol_entry_jsonhttp">JSON stream over HTTP</string> <string name="settings_advanced_connection_protocol_entry_jsonhttp">JSON stream over HTTP</string>
<string name="settings_advanced_connection_protocol_entry_ws">WebSockets (experimental)</string> <string name="settings_advanced_connection_protocol_entry_ws">WebSockets</string>
<string name="settings_about_header">About</string> <string name="settings_about_header">About</string>
<string name="settings_about_version_key">Version</string> <string name="settings_about_version_key">Version</string>
<string name="settings_about_version_title">Version</string> <string name="settings_about_version_title">Version</string>

View file

@ -58,6 +58,12 @@
app:summary="@string/settings_backup_restore_restore_summary"/> app:summary="@string/settings_backup_restore_restore_summary"/>
</PreferenceCategory> </PreferenceCategory>
<PreferenceCategory app:title="@string/settings_advanced_header"> <PreferenceCategory app:title="@string/settings_advanced_header">
<ListPreference
app:key="@string/settings_advanced_connection_protocol_key"
app:title="@string/settings_advanced_connection_protocol_title"
app:entries="@array/settings_advanced_connection_protocol_entries"
app:entryValues="@array/settings_advanced_connection_protocol_values"
app:defaultValue="jsonhttp"/>
<SwitchPreference <SwitchPreference
app:key="@string/settings_advanced_broadcast_key" app:key="@string/settings_advanced_broadcast_key"
app:title="@string/settings_advanced_broadcast_title" app:title="@string/settings_advanced_broadcast_title"
@ -78,14 +84,6 @@
app:title="@string/settings_advanced_clear_logs_title" app:title="@string/settings_advanced_clear_logs_title"
app:summary="@string/settings_advanced_clear_logs_summary"/> app:summary="@string/settings_advanced_clear_logs_summary"/>
</PreferenceCategory> </PreferenceCategory>
<PreferenceCategory app:title="@string/settings_experimental_header">
<ListPreference
app:key="@string/settings_advanced_connection_protocol_key"
app:title="@string/settings_advanced_connection_protocol_title"
app:entries="@array/settings_advanced_connection_protocol_entries"
app:entryValues="@array/settings_advanced_connection_protocol_values"
app:defaultValue="jsonhttp"/>
</PreferenceCategory>
<PreferenceCategory app:title="@string/settings_about_header"> <PreferenceCategory app:title="@string/settings_about_header">
<Preference <Preference
app:key="@string/settings_about_version_key" app:key="@string/settings_about_version_key"