Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use translated channel name strings where possible to update them when language changes #4833

Merged
merged 2 commits into from
Nov 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -215,16 +215,12 @@ class WebsocketManager(
*/
private suspend fun createNotification(): Boolean {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
var notificationChannel =
notificationManager.getNotificationChannel(CHANNEL_WEBSOCKET)
if (notificationChannel == null) {
notificationChannel = NotificationChannel(
CHANNEL_WEBSOCKET,
applicationContext.getString(R.string.websocket_setting_name),
NotificationManager.IMPORTANCE_LOW
)
notificationManager.createNotificationChannel(notificationChannel)
}
val notificationChannel = NotificationChannel(
CHANNEL_WEBSOCKET,
applicationContext.getString(R.string.websocket_setting_name),
NotificationManager.IMPORTANCE_LOW
)
notificationManager.createNotificationChannel(notificationChannel)
}

val intent = WebViewActivity.newInstance(applicationContext)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ fun handleChannel(
): String {
// Define some values for a default channel
var channelID = CHANNEL_GENERAL
var channelName = "General"
var channelName = context.getString(R.string.general)

if (!data[NotificationData.CHANNEL].isNullOrEmpty()) {
channelID = createChannelID(data[NotificationData.CHANNEL].toString())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,16 +92,12 @@ abstract class SensorWorkerBase(

protected fun createNotificationChannel() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
var notificationChannel =
notificationManager.getNotificationChannel(CHANNEL_SENSOR_WORKER)
if (notificationChannel == null) {
notificationChannel = NotificationChannel(
CHANNEL_SENSOR_WORKER,
TAG,
NotificationManager.IMPORTANCE_LOW
)
notificationManager.createNotificationChannel(notificationChannel)
}
val notificationChannel = NotificationChannel(
CHANNEL_SENSOR_WORKER,
appContext.getString(commonR.string.sensor_updates),
NotificationManager.IMPORTANCE_LOW
)
notificationManager.createNotificationChannel(notificationChannel)
}
}
}
2 changes: 2 additions & 0 deletions common/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1313,4 +1313,6 @@
<string name="sensor_description_steps">Total steps taken since midnight from Health Connect</string>
<string name="basic_sensor_name_blood_glucose">Blood glucose</string>
<string name="sensor_description_blood_glucose">Last recorded blood glucose reading in milligrams per deciliter from Health Connect</string>
<string name="general">General</string>
<string name="sensor_updates">Sensor updates</string>
</resources>