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)
? 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);

View file

@ -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<RtpContentMap> outgoingContentMapFuture =
encryptSessionInitiate(rtpContentMap);

View file

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