diff options
author | enahum <nahumhbl@gmail.com> | 2017-08-28 12:31:28 -0300 |
---|---|---|
committer | Corey Hulen <corey@hulen.com> | 2017-08-28 08:31:28 -0700 |
commit | 9e95af7809f3f19f9b53c4a1e875672db5c4eb63 (patch) | |
tree | f28acce0c44bf8a696c148a1203f657ee222628d | |
parent | 871b7eaa66b84fc260ef5406d63671e1869c993f (diff) | |
download | chat-9e95af7809f3f19f9b53c4a1e875672db5c4eb63.tar.gz chat-9e95af7809f3f19f9b53c4a1e875672db5c4eb63.tar.bz2 chat-9e95af7809f3f19f9b53c4a1e875672db5c4eb63.zip |
PLT-7221 differentiate between RN and Classic sessions (#7303)
-rw-r--r-- | webapp/components/activity_log_modal/activity_log_modal.jsx | 62 | ||||
-rwxr-xr-x | webapp/i18n/en.json | 2 |
2 files changed, 48 insertions, 16 deletions
diff --git a/webapp/components/activity_log_modal/activity_log_modal.jsx b/webapp/components/activity_log_modal/activity_log_modal.jsx index 7f16603f4..715b1fbb4 100644 --- a/webapp/components/activity_log_modal/activity_log_modal.jsx +++ b/webapp/components/activity_log_modal/activity_log_modal.jsx @@ -12,6 +12,7 @@ import PropTypes from 'prop-types'; import React from 'react'; import {Modal} from 'react-bootstrap'; import {FormattedMessage, FormattedTime, FormattedDate} from 'react-intl'; +import {General} from 'mattermost-redux/constants'; export default class ActivityLogModal extends React.Component { static propTypes = { @@ -90,6 +91,46 @@ export default class ActivityLogModal extends React.Component { this.setState({moreInfo: newMoreInfo}); } + isMobileSession = (session) => { + return session.device_id && (session.device_id.includes('apple') || session.device_id.includes('android')); + }; + + mobileSessionInfo = (session) => { + let deviceTypeId; + let deviceTypeMessage; + let devicePicture; + + if (session.device_id.includes('apple')) { + devicePicture = 'fa fa-apple'; + deviceTypeId = 'activity_log_modal.iphoneNativeClassicApp'; + deviceTypeMessage = 'iPhone Native Classic App'; + + if (session.device_id.includes(General.PUSH_NOTIFY_APPLE_REACT_NATIVE)) { + deviceTypeId = 'activity_log_modal.iphoneNativeApp'; + deviceTypeMessage = 'iPhone Native App'; + } + } else if (session.device_id.includes('android')) { + devicePicture = 'fa fa-android'; + deviceTypeId = 'activity_log_modal.androidNativeClassicApp'; + deviceTypeMessage = 'Android Native Classic App'; + + if (session.device_id.includes(General.PUSH_NOTIFY_ANDROID_REACT_NATIVE)) { + deviceTypeId = 'activity_log_modal.androidNativeApp'; + deviceTypeMessage = 'Android Native App'; + } + } + + return { + devicePicture, + devicePlatform: ( + <FormattedMessage + id={deviceTypeId} + defaultMessage={deviceTypeMessage} + /> + ) + }; + }; + render() { const activityList = []; @@ -102,22 +143,11 @@ export default class ActivityLogModal extends React.Component { if (currentSession.props.platform === 'Windows') { devicePicture = 'fa fa-windows'; - } else if (currentSession.device_id && currentSession.device_id.indexOf('apple') === 0) { - devicePicture = 'fa fa-apple'; - devicePlatform = ( - <FormattedMessage - id='activity_log_modal.iphoneNativeApp' - defaultMessage='iPhone Native App' - /> - ); - } else if (currentSession.device_id && currentSession.device_id.indexOf('android') === 0) { - devicePlatform = ( - <FormattedMessage - id='activity_log_modal.androidNativeApp' - defaultMessage='Android Native App' - /> - ); - devicePicture = 'fa fa-android'; + } else if (this.isMobileSession(currentSession)) { + const sessionInfo = this.mobileSessionInfo(currentSession); + + devicePicture = sessionInfo.devicePicture; + devicePlatform = sessionInfo.devicePlatform; } else if (currentSession.props.platform === 'Macintosh' || currentSession.props.platform === 'iPhone') { devicePicture = 'fa fa-apple'; diff --git a/webapp/i18n/en.json b/webapp/i18n/en.json index f345685e4..7fefb188d 100755 --- a/webapp/i18n/en.json +++ b/webapp/i18n/en.json @@ -28,8 +28,10 @@ "activity_log.sessionsDescription": "Sessions are created when you log in to a new browser on a device. Sessions let you use Mattermost without having to log in again for a time period specified by the System Admin. If you want to log out sooner, use the 'Logout' button below to end a session.", "activity_log_modal.android": "Android", "activity_log_modal.androidNativeApp": "Android Native App", + "activity_log_modal.androidNativeClassicApp": "Android Native Classic App", "activity_log_modal.desktop": "Native Desktop App", "activity_log_modal.iphoneNativeApp": "iPhone Native App", + "activity_log_modal.iphoneNativeClassicApp": "iPhone Native Classic App", "add_command.autocomplete": "Autocomplete", "add_command.autocomplete.help": "(Optional) Show slash command in autocomplete list.", "add_command.autocompleteDescription": "Autocomplete Description", |