From 8fb2c11771d8e7a419682da7be8a38e5068c4460 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Sat, 19 Nov 2022 08:14:50 +0100 Subject: [PATCH] use plurals for missed call strings --- .../services/NotificationService.java | 41 +++++++++++-------- .../xmpp/jingle/JingleRtpConnection.java | 1 + src/main/res/values/strings.xml | 16 ++++++-- 3 files changed, 38 insertions(+), 20 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/services/NotificationService.java b/src/main/java/eu/siacs/conversations/services/NotificationService.java index 55e220f62..715cafe42 100644 --- a/src/main/java/eu/siacs/conversations/services/NotificationService.java +++ b/src/main/java/eu/siacs/conversations/services/NotificationService.java @@ -987,12 +987,17 @@ public class NotificationService { (totalCalls == 1) ? mXmppConnectionService.getString(R.string.missed_call) : (mMissedCalls.size() == 1) - ? mXmppConnectionService.getString( - R.string.n_missed_calls, totalCalls) - : mXmppConnectionService.getString( - R.string.n_missed_calls_from_m_contacts, - totalCalls, - mMissedCalls.size()); + ? mXmppConnectionService + .getResources() + .getQuantityString( + R.plurals.n_missed_calls, totalCalls, totalCalls) + : mXmppConnectionService + .getResources() + .getQuantityString( + R.plurals.n_missed_calls_from_m_contacts, + mMissedCalls.size(), + totalCalls, + mMissedCalls.size()); builder.setContentTitle(title); builder.setTicker(title); if (!publicVersion) { @@ -1027,21 +1032,25 @@ public class NotificationService { final String title = (info.getNumberOfCalls() == 1) ? mXmppConnectionService.getString(R.string.missed_call) - : mXmppConnectionService.getString( - R.string.n_missed_calls, info.getNumberOfCalls()); + : mXmppConnectionService + .getResources() + .getQuantityString( + R.plurals.n_missed_calls, + info.getNumberOfCalls(), + info.getNumberOfCalls()); builder.setContentTitle(title); final String name = conversation.getContact().getDisplayName(); if (publicVersion) { builder.setTicker(title); } else { - if (info.getNumberOfCalls() == 1) { - builder.setTicker( - mXmppConnectionService.getString(R.string.missed_call_from_x, name)); - } else { - builder.setTicker( - mXmppConnectionService.getString( - R.string.n_missed_calls_from_x, info.getNumberOfCalls(), name)); - } + builder.setTicker( + mXmppConnectionService + .getResources() + .getQuantityString( + R.plurals.n_missed_calls_from_x, + info.getNumberOfCalls(), + info.getNumberOfCalls(), + name)); builder.setContentText(name); } builder.setSmallIcon(R.drawable.ic_call_missed_white_24db); diff --git a/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleRtpConnection.java b/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleRtpConnection.java index c69fc6b02..e2832355d 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleRtpConnection.java +++ b/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleRtpConnection.java @@ -1291,6 +1291,7 @@ public class JingleRtpConnection extends AbstractJingleConnection SessionDescription.parse(webRTCSessionDescription.description); final RtpContentMap rtpContentMap = RtpContentMap.of(sessionDescription); this.initiatorRtpContentMap = rtpContentMap; + //TODO delay ready to receive ice until after session-init this.webRTCWrapper.setIsReadyToReceiveIceCandidates(true); final ListenableFuture outgoingContentMapFuture = encryptSessionInitiate(rtpContentMap); diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml index f668e3f25..d14a0c971 100644 --- a/src/main/res/values/strings.xml +++ b/src/main/res/values/strings.xml @@ -936,10 +936,18 @@ Outgoing call Outgoing call ยท %s Missed call - Missed call from %s - %1$d missed calls from %2$s - %d missed calls - %1$d missed calls from %2$d contacts + + %1$d missed call from %2$s + %1$d missed calls from %2$s + + + %d missed call + %d missed calls + + + %1$d missed calls from %2$d contact + %1$d missed calls from %2$d contacts + Audio call Video call Help