Temporary import strings.
This commit is contained in:
parent
08fa22069b
commit
7cd78216b0
6 changed files with 95 additions and 35 deletions
|
|
@ -28,7 +28,6 @@ import io.element.android.libraries.di.ApplicationContext
|
|||
import io.element.android.libraries.di.DefaultPreferences
|
||||
import timber.log.Timber
|
||||
import javax.inject.Inject
|
||||
import io.element.android.libraries.ui.strings.R as StringR
|
||||
|
||||
/**
|
||||
* This class store the FCM token in SharedPrefs and ensure this token is retrieved.
|
||||
|
|
@ -69,7 +68,7 @@ class GoogleFcmHelper @Inject constructor(
|
|||
Timber.e(e, "## ensureFcmTokenIsRetrieved() : failed")
|
||||
}
|
||||
} else {
|
||||
Toast.makeText(context, StringR.string.no_valid_google_play_services_apk, Toast.LENGTH_SHORT).show()
|
||||
Toast.makeText(context, R.string.no_valid_google_play_services_apk, Toast.LENGTH_SHORT).show()
|
||||
Timber.e("No valid Google Play Services found. Cannot use FCM.")
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -134,8 +134,8 @@ class UnifiedPushHelper @Inject constructor(
|
|||
|
||||
fun getCurrentDistributorName(): String {
|
||||
return when {
|
||||
isEmbeddedDistributor() -> stringProvider.getString(StringR.string.unifiedpush_distributor_fcm_fallback)
|
||||
isBackgroundSync() -> stringProvider.getString(StringR.string.unifiedpush_distributor_background_sync)
|
||||
isEmbeddedDistributor() -> stringProvider.getString(R.string.unifiedpush_distributor_fcm_fallback)
|
||||
isBackgroundSync() -> stringProvider.getString(R.string.unifiedpush_distributor_background_sync)
|
||||
else -> context.getApplicationLabel(UnifiedPush.getDistributor(context))
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -145,11 +145,11 @@ class NotificationUtils @Inject constructor(
|
|||
*/
|
||||
notificationManager.createNotificationChannel(NotificationChannel(
|
||||
NOISY_NOTIFICATION_CHANNEL_ID,
|
||||
stringProvider.getString(StringR.string.notification_noisy_notifications).ifEmpty { "Noisy notifications" },
|
||||
stringProvider.getString(R.string.notification_noisy_notifications).ifEmpty { "Noisy notifications" },
|
||||
NotificationManager.IMPORTANCE_DEFAULT
|
||||
)
|
||||
.apply {
|
||||
description = stringProvider.getString(StringR.string.notification_noisy_notifications)
|
||||
description = stringProvider.getString(R.string.notification_noisy_notifications)
|
||||
enableVibration(true)
|
||||
enableLights(true)
|
||||
lightColor = accentColor
|
||||
|
|
@ -160,11 +160,11 @@ class NotificationUtils @Inject constructor(
|
|||
*/
|
||||
notificationManager.createNotificationChannel(NotificationChannel(
|
||||
SILENT_NOTIFICATION_CHANNEL_ID,
|
||||
stringProvider.getString(StringR.string.notification_silent_notifications).ifEmpty { "Silent notifications" },
|
||||
stringProvider.getString(R.string.notification_silent_notifications).ifEmpty { "Silent notifications" },
|
||||
NotificationManager.IMPORTANCE_LOW
|
||||
)
|
||||
.apply {
|
||||
description = stringProvider.getString(StringR.string.notification_silent_notifications)
|
||||
description = stringProvider.getString(R.string.notification_silent_notifications)
|
||||
setSound(null, null)
|
||||
enableLights(true)
|
||||
lightColor = accentColor
|
||||
|
|
@ -172,22 +172,22 @@ class NotificationUtils @Inject constructor(
|
|||
|
||||
notificationManager.createNotificationChannel(NotificationChannel(
|
||||
LISTENING_FOR_EVENTS_NOTIFICATION_CHANNEL_ID,
|
||||
stringProvider.getString(StringR.string.notification_listening_for_events).ifEmpty { "Listening for events" },
|
||||
stringProvider.getString(R.string.notification_listening_for_events).ifEmpty { "Listening for events" },
|
||||
NotificationManager.IMPORTANCE_MIN
|
||||
)
|
||||
.apply {
|
||||
description = stringProvider.getString(StringR.string.notification_listening_for_events)
|
||||
description = stringProvider.getString(R.string.notification_listening_for_events)
|
||||
setSound(null, null)
|
||||
setShowBadge(false)
|
||||
})
|
||||
|
||||
notificationManager.createNotificationChannel(NotificationChannel(
|
||||
CALL_NOTIFICATION_CHANNEL_ID,
|
||||
stringProvider.getString(StringR.string.call).ifEmpty { "Call" },
|
||||
stringProvider.getString(R.string.call).ifEmpty { "Call" },
|
||||
NotificationManager.IMPORTANCE_HIGH
|
||||
)
|
||||
.apply {
|
||||
description = stringProvider.getString(StringR.string.call)
|
||||
description = stringProvider.getString(R.string.call)
|
||||
setSound(null, null)
|
||||
enableLights(true)
|
||||
lightColor = accentColor
|
||||
|
|
@ -242,11 +242,11 @@ class NotificationUtils @Inject constructor(
|
|||
// Title for API < 16 devices.
|
||||
.setContentTitle(roomInfo.roomDisplayName)
|
||||
// Content for API < 16 devices.
|
||||
.setContentText(stringProvider.getString(StringR.string.notification_new_messages))
|
||||
.setContentText(stringProvider.getString(R.string.notification_new_messages))
|
||||
// Number of new notifications for API <24 (M and below) devices.
|
||||
.setSubText(
|
||||
stringProvider.getQuantityString(
|
||||
StringR.plurals.room_new_messages_notification,
|
||||
R.plurals.room_new_messages_notification,
|
||||
messageStyle.messages.size,
|
||||
messageStyle.messages.size
|
||||
)
|
||||
|
|
@ -292,7 +292,7 @@ class NotificationUtils @Inject constructor(
|
|||
|
||||
NotificationCompat.Action.Builder(
|
||||
R.drawable.ic_material_done_all_white,
|
||||
stringProvider.getString(StringR.string.action_mark_room_read), markRoomReadPendingIntent
|
||||
stringProvider.getString(R.string.action_mark_room_read), markRoomReadPendingIntent
|
||||
)
|
||||
.setSemanticAction(NotificationCompat.Action.SEMANTIC_ACTION_MARK_AS_READ)
|
||||
.setShowsUserInterface(false)
|
||||
|
|
@ -373,7 +373,7 @@ class NotificationUtils @Inject constructor(
|
|||
|
||||
addAction(
|
||||
R.drawable.vector_notification_reject_invitation,
|
||||
stringProvider.getString(StringR.string.action_reject),
|
||||
stringProvider.getString(R.string.action_reject),
|
||||
rejectIntentPendingIntent
|
||||
)
|
||||
|
||||
|
|
@ -390,7 +390,7 @@ class NotificationUtils @Inject constructor(
|
|||
)
|
||||
addAction(
|
||||
R.drawable.vector_notification_accept_invitation,
|
||||
stringProvider.getString(StringR.string.action_join),
|
||||
stringProvider.getString(R.string.action_join),
|
||||
joinIntentPendingIntent
|
||||
)
|
||||
|
||||
|
|
@ -693,7 +693,7 @@ class NotificationUtils @Inject constructor(
|
|||
888,
|
||||
NotificationCompat.Builder(context, NOISY_NOTIFICATION_CHANNEL_ID)
|
||||
.setContentTitle(buildMeta.applicationName)
|
||||
.setContentText(stringProvider.getString(StringR.string.settings_troubleshoot_test_push_notification_content))
|
||||
.setContentText(stringProvider.getString(R.string.settings_troubleshoot_test_push_notification_content))
|
||||
.setSmallIcon(R.drawable.ic_notification)
|
||||
.setLargeIcon(getBitmap(context, R.drawable.element_logo_green))
|
||||
.setColor(ContextCompat.getColor(context, R.color.notification_accent_color))
|
||||
|
|
|
|||
|
|
@ -19,13 +19,13 @@ package io.element.android.libraries.push.impl.notifications
|
|||
import android.graphics.Bitmap
|
||||
import androidx.core.app.NotificationCompat
|
||||
import androidx.core.app.Person
|
||||
import io.element.android.libraries.push.impl.R
|
||||
import io.element.android.libraries.push.impl.notifications.model.NotifiableMessageEvent
|
||||
import io.element.android.services.toolbox.api.strings.StringProvider
|
||||
import me.gujun.android.span.Span
|
||||
import me.gujun.android.span.span
|
||||
import timber.log.Timber
|
||||
import javax.inject.Inject
|
||||
import io.element.android.libraries.ui.strings.R as StringR
|
||||
|
||||
class RoomGroupMessageCreator @Inject constructor(
|
||||
private val bitmapLoader: NotificationBitmapLoader,
|
||||
|
|
@ -50,9 +50,9 @@ class RoomGroupMessageCreator @Inject constructor(
|
|||
}
|
||||
|
||||
val tickerText = if (roomIsGroup) {
|
||||
stringProvider.getString(StringR.string.notification_ticker_text_group, roomName, events.last().senderName, events.last().description)
|
||||
stringProvider.getString(R.string.notification_ticker_text_group, roomName, events.last().senderName, events.last().description)
|
||||
} else {
|
||||
stringProvider.getString(StringR.string.notification_ticker_text_dm, events.last().senderName, events.last().description)
|
||||
stringProvider.getString(R.string.notification_ticker_text_dm, events.last().senderName, events.last().description)
|
||||
}
|
||||
|
||||
val largeBitmap = getRoomBitmap(events)
|
||||
|
|
@ -99,7 +99,7 @@ class RoomGroupMessageCreator @Inject constructor(
|
|||
}
|
||||
when {
|
||||
event.isSmartReplyError() -> addMessage(
|
||||
stringProvider.getString(StringR.string.notification_inline_reply_failed),
|
||||
stringProvider.getString(R.string.notification_inline_reply_failed),
|
||||
event.timestamp,
|
||||
senderPerson
|
||||
)
|
||||
|
|
@ -121,7 +121,7 @@ class RoomGroupMessageCreator @Inject constructor(
|
|||
1 -> createFirstMessageSummaryLine(events.first(), roomName, roomIsDirect)
|
||||
else -> {
|
||||
stringProvider.getQuantityString(
|
||||
StringR.plurals.notification_compat_summary_line_for_room,
|
||||
R.plurals.notification_compat_summary_line_for_room,
|
||||
events.size,
|
||||
roomName,
|
||||
events.size
|
||||
|
|
|
|||
|
|
@ -18,11 +18,10 @@ package io.element.android.libraries.push.impl.notifications
|
|||
|
||||
import android.app.Notification
|
||||
import androidx.core.app.NotificationCompat
|
||||
import io.element.android.libraries.push.impl.R
|
||||
import io.element.android.services.toolbox.api.strings.StringProvider
|
||||
import javax.inject.Inject
|
||||
|
||||
import io.element.android.libraries.ui.strings.R as StringR
|
||||
|
||||
/**
|
||||
* ======== Build summary notification =========
|
||||
* On Android 7.0 (API level 24) and higher, the system automatically builds a summary for
|
||||
|
|
@ -66,10 +65,10 @@ class SummaryGroupMessageCreator @Inject constructor(
|
|||
|
||||
// FIXME roomIdToEventMap.size is not correct, this is the number of rooms
|
||||
val nbEvents = roomNotifications.size + simpleNotifications.size
|
||||
val sumTitle = stringProvider.getQuantityString(StringR.plurals.notification_compat_summary_title, nbEvents, nbEvents)
|
||||
val sumTitle = stringProvider.getQuantityString(R.plurals.notification_compat_summary_title, nbEvents, nbEvents)
|
||||
summaryInboxStyle.setBigContentTitle(sumTitle)
|
||||
// TODO get latest event?
|
||||
.setSummaryText(stringProvider.getQuantityString(StringR.plurals.notification_unread_notified_messages, nbEvents, nbEvents))
|
||||
.setSummaryText(stringProvider.getQuantityString(R.plurals.notification_unread_notified_messages, nbEvents, nbEvents))
|
||||
return if (useCompleteNotificationFormat) {
|
||||
notificationUtils.buildSummaryListNotification(
|
||||
summaryInboxStyle,
|
||||
|
|
@ -101,21 +100,21 @@ class SummaryGroupMessageCreator @Inject constructor(
|
|||
val messageNotificationCount = messageEventsCount + simpleEventsCount
|
||||
|
||||
val privacyTitle = if (invitationEventsCount > 0) {
|
||||
val invitationsStr = stringProvider.getQuantityString(StringR.plurals.notification_invitations, invitationEventsCount, invitationEventsCount)
|
||||
val invitationsStr = stringProvider.getQuantityString(R.plurals.notification_invitations, invitationEventsCount, invitationEventsCount)
|
||||
if (messageNotificationCount > 0) {
|
||||
// Invitation and message
|
||||
val messageStr = stringProvider.getQuantityString(
|
||||
StringR.plurals.room_new_messages_notification,
|
||||
R.plurals.room_new_messages_notification,
|
||||
messageNotificationCount, messageNotificationCount
|
||||
)
|
||||
if (roomCount > 1) {
|
||||
// In several rooms
|
||||
val roomStr = stringProvider.getQuantityString(
|
||||
StringR.plurals.notification_unread_notified_messages_in_room_rooms,
|
||||
R.plurals.notification_unread_notified_messages_in_room_rooms,
|
||||
roomCount, roomCount
|
||||
)
|
||||
stringProvider.getString(
|
||||
StringR.string.notification_unread_notified_messages_in_room_and_invitation,
|
||||
R.string.notification_unread_notified_messages_in_room_and_invitation,
|
||||
messageStr,
|
||||
roomStr,
|
||||
invitationsStr
|
||||
|
|
@ -123,7 +122,7 @@ class SummaryGroupMessageCreator @Inject constructor(
|
|||
} else {
|
||||
// In one room
|
||||
stringProvider.getString(
|
||||
StringR.string.notification_unread_notified_messages_and_invitation,
|
||||
R.string.notification_unread_notified_messages_and_invitation,
|
||||
messageStr,
|
||||
invitationsStr
|
||||
)
|
||||
|
|
@ -135,13 +134,13 @@ class SummaryGroupMessageCreator @Inject constructor(
|
|||
} else {
|
||||
// No invitation, only messages
|
||||
val messageStr = stringProvider.getQuantityString(
|
||||
StringR.plurals.room_new_messages_notification,
|
||||
R.plurals.room_new_messages_notification,
|
||||
messageNotificationCount, messageNotificationCount
|
||||
)
|
||||
if (roomCount > 1) {
|
||||
// In several rooms
|
||||
val roomStr = stringProvider.getQuantityString(StringR.plurals.notification_unread_notified_messages_in_room_rooms, roomCount, roomCount)
|
||||
stringProvider.getString(StringR.string.notification_unread_notified_messages_in_room, messageStr, roomStr)
|
||||
val roomStr = stringProvider.getQuantityString(R.plurals.notification_unread_notified_messages_in_room_rooms, roomCount, roomCount)
|
||||
stringProvider.getString(R.string.notification_unread_notified_messages_in_room, messageStr, roomStr)
|
||||
} else {
|
||||
// In one room
|
||||
messageStr
|
||||
|
|
|
|||
62
libraries/push/impl/src/main/res/values/temporary.xml
Normal file
62
libraries/push/impl/src/main/res/values/temporary.xml
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
~ Copyright (c) 2023 New Vector Ltd
|
||||
~
|
||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
~ you may not use this file except in compliance with the License.
|
||||
~ You may obtain a copy of the License at
|
||||
~
|
||||
~ http://www.apache.org/licenses/LICENSE-2.0
|
||||
~
|
||||
~ Unless required by applicable law or agreed to in writing, software
|
||||
~ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
~ See the License for the specific language governing permissions and
|
||||
~ limitations under the License.
|
||||
-->
|
||||
|
||||
<resources>
|
||||
<string name="no_valid_google_play_services_apk">No valid Google Play Services APK found. Notifications may not work properly.</string>
|
||||
<string name="unifiedpush_getdistributors_dialog_title">Choose how to receive notifications</string>
|
||||
<string name="unifiedpush_distributor_fcm_fallback">Google Services</string>
|
||||
<string name="unifiedpush_distributor_background_sync">Background synchronization</string>
|
||||
|
||||
<string name="notification_listening_for_events">Listening for events</string>
|
||||
<string name="notification_noisy_notifications">Noisy notifications</string>
|
||||
<string name="notification_silent_notifications">Silent notifications</string>
|
||||
<string name="call">Call</string>
|
||||
<string name="notification_new_messages">New Messages</string>
|
||||
<string name="action_mark_room_read">Mark as read</string>
|
||||
<string name="action_join">Join</string>
|
||||
<string name="action_reject">Reject</string>
|
||||
<string name="settings_troubleshoot_test_push_notification_content">You are viewing the notification! Click me!</string>
|
||||
<string name="notification_ticker_text_dm">%1$s: %2$s</string>
|
||||
<string name="notification_ticker_text_group">%1$s: %2$s %3$s</string>
|
||||
<string name="notification_inline_reply_failed">** Failed to send - please open room</string>
|
||||
<string name="notification_unread_notified_messages_in_room_and_invitation">%1$s in %2$s and %3$s"</string>
|
||||
<string name="notification_unread_notified_messages_and_invitation">%1$s and %2$s"</string>
|
||||
<string name="notification_unread_notified_messages_in_room">%1$s in %2$s"</string>
|
||||
<plurals name="room_new_messages_notification">
|
||||
<item quantity="one">%d new message</item>
|
||||
<item quantity="other">%d new messages</item>
|
||||
</plurals>
|
||||
<plurals name="notification_unread_notified_messages">
|
||||
<item quantity="one">%d unread notified message</item>
|
||||
<item quantity="other">%d unread notified messages</item>
|
||||
</plurals>
|
||||
<plurals name="notification_unread_notified_messages_in_room_rooms">
|
||||
<item quantity="one">%d room</item>
|
||||
<item quantity="other">%d rooms</item>
|
||||
</plurals>
|
||||
<plurals name="notification_invitations">
|
||||
<item quantity="one">%d invitation</item>
|
||||
<item quantity="other">%d invitations</item>
|
||||
</plurals>
|
||||
<plurals name="notification_compat_summary_line_for_room">
|
||||
<item quantity="one">%1$s: %2$d message</item>
|
||||
<item quantity="other">%1$s: %2$d messages</item>
|
||||
</plurals>
|
||||
<plurals name="notification_compat_summary_title">
|
||||
<item quantity="one">%d notification</item>
|
||||
<item quantity="other">%d notifications</item>
|
||||
</plurals>
|
||||
</resources>
|
||||
Loading…
Add table
Add a link
Reference in a new issue