use plurals for missed call strings

This commit is contained in:
Daniel Gultsch 2022-11-19 08:14:50 +01:00
parent d51682a9bc
commit 8fb2c11771
3 changed files with 38 additions and 20 deletions

View file

@ -987,12 +987,17 @@ public class NotificationService {
(totalCalls == 1) (totalCalls == 1)
? mXmppConnectionService.getString(R.string.missed_call) ? mXmppConnectionService.getString(R.string.missed_call)
: (mMissedCalls.size() == 1) : (mMissedCalls.size() == 1)
? mXmppConnectionService.getString( ? mXmppConnectionService
R.string.n_missed_calls, totalCalls) .getResources()
: mXmppConnectionService.getString( .getQuantityString(
R.string.n_missed_calls_from_m_contacts, R.plurals.n_missed_calls, totalCalls, totalCalls)
totalCalls, : mXmppConnectionService
mMissedCalls.size()); .getResources()
.getQuantityString(
R.plurals.n_missed_calls_from_m_contacts,
mMissedCalls.size(),
totalCalls,
mMissedCalls.size());
builder.setContentTitle(title); builder.setContentTitle(title);
builder.setTicker(title); builder.setTicker(title);
if (!publicVersion) { if (!publicVersion) {
@ -1027,21 +1032,25 @@ public class NotificationService {
final String title = final String title =
(info.getNumberOfCalls() == 1) (info.getNumberOfCalls() == 1)
? mXmppConnectionService.getString(R.string.missed_call) ? mXmppConnectionService.getString(R.string.missed_call)
: mXmppConnectionService.getString( : mXmppConnectionService
R.string.n_missed_calls, info.getNumberOfCalls()); .getResources()
.getQuantityString(
R.plurals.n_missed_calls,
info.getNumberOfCalls(),
info.getNumberOfCalls());
builder.setContentTitle(title); builder.setContentTitle(title);
final String name = conversation.getContact().getDisplayName(); final String name = conversation.getContact().getDisplayName();
if (publicVersion) { if (publicVersion) {
builder.setTicker(title); builder.setTicker(title);
} else { } else {
if (info.getNumberOfCalls() == 1) { builder.setTicker(
builder.setTicker( mXmppConnectionService
mXmppConnectionService.getString(R.string.missed_call_from_x, name)); .getResources()
} else { .getQuantityString(
builder.setTicker( R.plurals.n_missed_calls_from_x,
mXmppConnectionService.getString( info.getNumberOfCalls(),
R.string.n_missed_calls_from_x, info.getNumberOfCalls(), name)); info.getNumberOfCalls(),
} name));
builder.setContentText(name); builder.setContentText(name);
} }
builder.setSmallIcon(R.drawable.ic_call_missed_white_24db); builder.setSmallIcon(R.drawable.ic_call_missed_white_24db);

View file

@ -1291,6 +1291,7 @@ public class JingleRtpConnection extends AbstractJingleConnection
SessionDescription.parse(webRTCSessionDescription.description); SessionDescription.parse(webRTCSessionDescription.description);
final RtpContentMap rtpContentMap = RtpContentMap.of(sessionDescription); final RtpContentMap rtpContentMap = RtpContentMap.of(sessionDescription);
this.initiatorRtpContentMap = rtpContentMap; this.initiatorRtpContentMap = rtpContentMap;
//TODO delay ready to receive ice until after session-init
this.webRTCWrapper.setIsReadyToReceiveIceCandidates(true); this.webRTCWrapper.setIsReadyToReceiveIceCandidates(true);
final ListenableFuture<RtpContentMap> outgoingContentMapFuture = final ListenableFuture<RtpContentMap> outgoingContentMapFuture =
encryptSessionInitiate(rtpContentMap); encryptSessionInitiate(rtpContentMap);

View file

@ -936,10 +936,18 @@
<string name="outgoing_call">Outgoing call</string> <string name="outgoing_call">Outgoing call</string>
<string name="outgoing_call_duration">Outgoing call · %s</string> <string name="outgoing_call_duration">Outgoing call · %s</string>
<string name="missed_call">Missed call</string> <string name="missed_call">Missed call</string>
<string name="missed_call_from_x">Missed call from %s</string> <plurals name="n_missed_calls_from_x">
<string name="n_missed_calls_from_x">%1$d missed calls from %2$s</string> <item quantity="one">%1$d missed call from %2$s</item>
<string name="n_missed_calls">%d missed calls</string> <item quantity="other">%1$d missed calls from %2$s</item>
<string name="n_missed_calls_from_m_contacts">%1$d missed calls from %2$d contacts</string> </plurals>
<plurals name="n_missed_calls">
<item quantity="one">%d missed call</item>
<item quantity="other">%d missed calls</item>
</plurals>
<plurals name="n_missed_calls_from_m_contacts">
<item quantity="one">%1$d missed calls from %2$d contact</item>
<item quantity="other">%1$d missed calls from %2$d contacts</item>
</plurals>
<string name="audio_call">Audio call</string> <string name="audio_call">Audio call</string>
<string name="video_call">Video call</string> <string name="video_call">Video call</string>
<string name="help">Help</string> <string name="help">Help</string>