Skip to content

Commit 6e0d6b5

Browse files
committed
[ui] add notification settings
1 parent 176bd0a commit 6e0d6b5

File tree

5 files changed

+62
-13
lines changed

5 files changed

+62
-13
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<vector xmlns:android="http://schemas.android.com/apk/res/android"
2+
android:width="24dp"
3+
android:height="24dp"
4+
android:viewportWidth="24"
5+
android:viewportHeight="24">
6+
<path
7+
android:fillColor="?attr/colorControlNormal"
8+
android:pathData="M12,22c1.1,0 2,-0.9 2,-2h-4c0,1.1 0.89,2 2,2zM18,16v-5c0,-3.07 -1.64,-5.64 -4.5,-6.32L13.5,4c0,-0.83 -0.67,-1.5 -1.5,-1.5s-1.5,0.67 -1.5,1.5v0.68C7.63,5.36 6,7.92 6,11v5l-2,2v1h16v-1l-2,-2z" />
9+
</vector>

app/src/main/res/values/arrays.xml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,14 @@
2929
<item>LIFO</item>
3030
<item>FIFO</item>
3131
</string-array>
32+
<string-array name="notification_modes_titles">
33+
<item>Auto</item>
34+
<item>FCM Only</item>
35+
<item>SSE Only</item>
36+
</string-array>
37+
<string-array name="notification_modes_values" translatable="false">
38+
<item>AUTO</item>
39+
<item>FCM_ONLY</item>
40+
<item>SSE_ONLY</item>
41+
</string-array>
3242
</resources>

app/src/main/res/values/strings.xml

Lines changed: 34 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,17 @@
55
<string name="app_name">SMSGate</string>
66
<string name="app_version_build">App version (build)</string>
77
<string name="battery_optimization_already_disabled">Battery optimization already disabled</string>
8-
<string name="battery_optimization_is_not_supported_on_this_device">Battery optimization is not supported on this device</string>
8+
<string name="battery_optimization_is_not_supported_on_this_device">Battery optimization is not
9+
supported on this device</string>
910
<string name="battery_optimization">Battery optimization</string>
1011
<string name="btn_cancel">Cancel</string>
1112
<string name="btn_continue">Continue</string>
1213
<string name="by_code">By Code</string>
1314
<string name="can_affect_battery_life">can affect battery life</string>
14-
<string name="click_continue_to_create_an_account_no_personal_information_is_required_nby_continuing_you_agree_to_our_privacy_policy_at_https_docs_sms_gate_app_privacy_policy">Click Continue to create an account. No personal information is required.\nBy continuing, you agree to our Privacy Policy at https://docs.sms-gate.app/privacy/policy/</string>
15+
<string
16+
name="click_continue_to_create_an_account_no_personal_information_is_required_nby_continuing_you_agree_to_our_privacy_policy_at_https_docs_sms_gate_app_privacy_policy">Click
17+
Continue to create an account. No personal information is required.\nBy continuing, you
18+
agree to our Privacy Policy at https://docs.sms-gate.app/privacy/policy/</string>
1519
<string name="cloud_server_dotdotdot">Cloud server…</string>
1620
<string name="cloud_server">Cloud server</string>
1721
<string name="cloud">Cloud</string>
@@ -37,7 +41,8 @@
3741
<string name="internet_connection_unavailable">Internet connection: unavailable</string>
3842
<string name="interval_seconds">Interval (seconds)</string>
3943
<string name="invalid_url">Invalid URL</string>
40-
<string name="is_not_a_valid_port_must_be_between_1024_and_65535">%1$s is not a valid port. Must be between 1024 and 65535.</string>
44+
<string name="is_not_a_valid_port_must_be_between_1024_and_65535">%1$s is not a valid port. Must
45+
be between 1024 and 65535.</string>
4146
<string name="label_password">Password</string>
4247
<string name="label_username">Username</string>
4348
<string name="limits">Limits</string>
@@ -62,7 +67,16 @@
6267
<string name="not_registered">not registered</string>
6368
<string name="not_set">Not set</string>
6469
<string name="notification_title">SMSGate</string>
65-
<string name="online_status_at_the_cost_of_battery_life">Online status at the cost of battery life</string>
70+
<string name="notification_mode">Notification mode</string>
71+
<string name="notification_mode_auto_description">Uses FCM when available, falls back to SSE
72+
when not.</string>
73+
<string name="notification_mode_fcm_only_description">Uses only Firebase Cloud Messaging for
74+
notifications.</string>
75+
<string name="notification_mode_sse_only_description">Uses only Server-Sent Events for
76+
notifications.</string>
77+
<string name="notifications">Notifications</string>
78+
<string name="online_status_at_the_cost_of_battery_life">Online status at the cost of battery
79+
life</string>
6680
<string name="passphrase">Passphrase</string>
6781
<string name="password_changed_successfully">Password changed successfully</string>
6882
<string name="password_must_be_at_least_14_characters">Password must be at least 14 characters</string>
@@ -71,7 +85,8 @@
7185
<string name="period">Period</string>
7286
<string name="ping_service_is_active">Ping service is active</string>
7387
<string name="ping">Ping</string>
74-
<string name="please_enter_one_time_code_displayed_on_already_registered_device">Please enter the one-time code displayed on the already-registered device</string>
88+
<string name="please_enter_one_time_code_displayed_on_already_registered_device">Please enter
89+
the one-time code displayed on the already-registered device</string>
7590
<string name="port_credentials_etc">Port, credentials, etc.</string>
7691
<string name="port">Port</string>
7792
<string name="private_token">Private Token</string>
@@ -87,7 +102,8 @@
87102
<string name="server">Server</string>
88103
<string name="set_maximum_value_to_activate">Set maximum value to activate</string>
89104
<string name="settings_address_is_sms_capcom_me" translatable="false">api.sms-gate.app</string>
90-
<string name="settings_changed_via_api_restart_the_app_to_apply_changes">Settings changed via API. Restart the app to apply changes.</string>
105+
<string name="settings_changed_via_api_restart_the_app_to_apply_changes">Settings changed via
106+
API. Restart the app to apply changes.</string>
91107
<string name="settings_local_address_is">&lt;a href>%1$s:%2$d&lt;/a></string>
92108
<string name="settings_local_address_not_found">Not available</string>
93109
<string name="settings_local_server">Local server</string>
@@ -107,11 +123,15 @@
107123
<string name="tab_text_home">Home</string>
108124
<string name="tab_text_messages">MESSAGES</string>
109125
<string name="tab_text_settings">SETTINGS</string>
110-
<string name="the_webhook_request_will_wait_for_an_internet_connection">The webhook request will wait for an internet connection</string>
111-
<string name="to_add_a_device_to_an_existing_account_please_fill_in_the_credentials_below">To add a device to an existing account, please fill in the credentials below.</string>
112-
<string name="to_apply_the_changes_restart_the_app_using_the_button_below">To apply the changes, restart the app using the button below.</string>
126+
<string name="the_webhook_request_will_wait_for_an_internet_connection">The webhook request will
127+
wait for an internet connection</string>
128+
<string name="to_add_a_device_to_an_existing_account_please_fill_in_the_credentials_below">To
129+
add a device to an existing account, please fill in the credentials below.</string>
130+
<string name="to_apply_the_changes_restart_the_app_using_the_button_below">To apply the changes,
131+
restart the app using the button below.</string>
113132
<string name="use_empty_to_disable">Use empty to disable</string>
114-
<string name="use_this_code_to_sign_in_on_another_device">Use this code to sign in on another device</string>
133+
<string name="use_this_code_to_sign_in_on_another_device">Use this code to sign in on another
134+
device</string>
115135
<string name="username_must_be_at_least_3_characters">Username must be at least 3 characters</string>
116136
<string name="username">Username</string>
117137
<string name="view">View</string>
@@ -121,8 +141,10 @@
121141
<string name="webhooks_dotdotdot">Webhooks…</string>
122142
<string name="webhooks">Webhooks</string>
123143
<plurals name="review_incoming_sms_webhooks">
124-
<item quantity="one">You have %1$d incoming SMS webhook registered. Please review it to avoid any security risks.</item>
125-
<item quantity="other">You have %1$d incoming SMS webhooks registered. Please review them to avoid any security risks.</item>
144+
<item quantity="one">You have %1$d incoming SMS webhook registered. Please review it to
145+
avoid any security risks.</item>
146+
<item quantity="other">You have %1$d incoming SMS webhooks registered. Please review them to
147+
avoid any security risks.</item>
126148
</plurals>
127149
<string name="processing">Processing</string>
128150
<string name="processing_order_title">Processing order</string>

app/src/main/res/xml/cloud_server_preferences.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,14 @@
1212
app:key="gateway.private_token"
1313
app:summary="@string/ignored_for_public_server"
1414
app:title="@string/private_token" />
15+
<ListPreference
16+
app:icon="@drawable/ic_notifications"
17+
app:key="gateway.notification_mode"
18+
app:defaultValue="AUTO"
19+
app:entries="@array/notification_modes_titles"
20+
app:entryValues="@array/notification_modes_values"
21+
app:title="@string/notification_mode"
22+
app:useSimpleSummaryProvider="true" />
1523
</PreferenceCategory>
1624
<PreferenceCategory app:title="@string/credentials">
1725
<EditTextPreference

app/src/main/res/xml/root_preferences.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
android:icon="@drawable/ic_messages"
1616
app:fragment="me.capcom.smsgateway.ui.settings.MessagesSettingsFragment"
1717
app:title="@string/messages"
18-
app:summary="@string/delays_limits_etc"/>
18+
app:summary="@string/delays_limits_etc" />
1919

2020
<Preference
2121
android:icon="@drawable/ic_webhook"

0 commit comments

Comments
 (0)