Session timeout notification incorrectly says "Days" on iOS (#7629)
* Session timeout notification incorrectly says "Days" on iOS * Update index.ts * Update index.ts * Update index.ts * Update index.ts * Update index.ts * Update index.ts * Session timeout notification incorrectly says "Days" on iOS * Update index.ts * Update en.json * Update index.ts
This commit is contained in:
parent
1904dfa4d1
commit
a01fac4753
2 changed files with 23 additions and 6 deletions
|
|
@ -90,12 +90,27 @@ export const emitNotificationError = (type: 'Team' | 'Channel' | 'Post' | 'Conne
|
|||
|
||||
export const scheduleExpiredNotification = (serverUrl: string, session: Session, serverName: string, locale = DEFAULT_LOCALE) => {
|
||||
const expiresAt = session?.expires_at || 0;
|
||||
const expiresInDays = Math.ceil(Math.abs(moment.duration(moment().diff(moment(expiresAt))).asDays()));
|
||||
const expiresInHours = Math.ceil(Math.abs(moment.duration(moment().diff(moment(expiresAt))).asHours()));
|
||||
const expiresInDays = Math.floor(expiresInHours / 24); // Calculate expiresInDays
|
||||
const remainingHours = expiresInHours % 24; // Calculate remaining hours
|
||||
const intl = createIntl({locale, messages: getTranslations(locale)});
|
||||
const body = intl.formatMessage({
|
||||
id: 'mobile.session_expired',
|
||||
defaultMessage: 'Please log in to continue receiving notifications. Sessions for {siteName} are configured to expire every {daysCount, number} {daysCount, plural, one {day} other {days}}.',
|
||||
}, {siteName: serverName, daysCount: expiresInDays});
|
||||
let body = '';
|
||||
if (expiresInDays === 0) {
|
||||
body = intl.formatMessage({
|
||||
id: 'mobile.session_expired_hrs',
|
||||
defaultMessage: 'Please log in to continue receiving notifications. Sessions for {siteName} are configured to expire every {hoursCount, number} {hoursCount, plural, one {hour} other {hours}}.',
|
||||
}, {siteName: serverName, hoursCount: remainingHours});
|
||||
} else if (expiresInHours === 0) {
|
||||
body = intl.formatMessage({
|
||||
id: 'mobile.session_expired_days',
|
||||
defaultMessage: 'Please log in to continue receiving notifications. Sessions for {siteName} are configured to expire every {daysCount, number} {daysCount, plural, one {day} other {days}}.',
|
||||
}, {siteName: serverName, daysCount: expiresInDays});
|
||||
} else {
|
||||
body = intl.formatMessage({
|
||||
id: 'mobile.session_expired_days_hrs',
|
||||
defaultMessage: 'Please log in to continue receiving notifications. Sessions for {siteName} are configured to expire every {daysCount, number} {daysCount, plural, one {day} other {days}} and {hoursCount, number} {hoursCount, plural, one {hour} other {hours}}.',
|
||||
}, {siteName: serverName, daysCount: expiresInDays, hoursCount: remainingHours});
|
||||
}
|
||||
const title = intl.formatMessage({id: 'mobile.session_expired.title', defaultMessage: 'Session Expired'});
|
||||
|
||||
if (expiresAt) {
|
||||
|
|
|
|||
|
|
@ -710,7 +710,9 @@
|
|||
"mobile.server_url.deeplink.emm.denied": "This app is controlled by an EMM and the DeepLink server url does not match the EMM allowed server",
|
||||
"mobile.server_url.empty": "Please enter a valid server URL",
|
||||
"mobile.server_url.invalid_format": "URL must start with http:// or https://",
|
||||
"mobile.session_expired": "Please log in to continue receiving notifications. Sessions for {siteName} are configured to expire every {daysCount, number} {daysCount, plural, one {day} other {days}}.",
|
||||
"mobile.session_expired_days": "Please log in to continue receiving notifications. Sessions for {siteName} are configured to expire every {daysCount, number} {daysCount, plural, one {day} other {days}}.",
|
||||
"mobile.session_expired_days_hrs": "Please log in to continue receiving notifications. Sessions for {siteName} are configured to expire every {daysCount, number} {daysCount, plural, one {day} other {days}} and {hoursCount, number} {hoursCount, plural, one {hour} other {hours}}.",
|
||||
"mobile.session_expired_hrs": "Please log in to continue receiving notifications. Sessions for {siteName} are configured to expire every {hoursCount, number} {hoursCount, plural, one {hour} other {hours}}.",
|
||||
"mobile.session_expired.title": "Session Expired",
|
||||
"mobile.set_status.dnd": "Do Not Disturb",
|
||||
"mobile.storage_permission_denied_description": "Upload files to your server. Open Settings to grant {applicationName} Read and Write access to files on this device.",
|
||||
|
|
|
|||
Loading…
Reference in a new issue