Removed /shortcuts from mobile (#3753)

Этот коммит содержится в:
David Lu
2016-08-11 10:32:41 -04:00
коммит произвёл Joram Wilander
родитель 0cee02d4d3
Коммит bb0b895bad
4 изменённых файлов: 36 добавлений и 17 удалений

Просмотреть файл

@@ -7,6 +7,7 @@ import TeamStore from 'stores/team_store.jsx';
import UserStore from 'stores/user_store.jsx'; import UserStore from 'stores/user_store.jsx';
import ChannelStore from 'stores/channel_store.jsx'; import ChannelStore from 'stores/channel_store.jsx';
import * as AsyncClient from 'utils/async_client.jsx'; import * as AsyncClient from 'utils/async_client.jsx';
import * as UserAgent from 'utils/user_agent.jsx';
import Client from 'client/web_client.jsx'; import Client from 'client/web_client.jsx';
export function goToChannel(channel) { export function goToChannel(channel) {
@@ -28,13 +29,17 @@ export function executeCommand(channelId, message, suggest, success, error) {
msg = msg.substring(0, msg.indexOf(' ')).toLowerCase() + msg.substring(msg.indexOf(' '), msg.length); msg = msg.substring(0, msg.indexOf(' ')).toLowerCase() + msg.substring(msg.indexOf(' '), msg.length);
if (message.indexOf('/shortcuts') !== -1 && Utils.isMac()) { if (message.indexOf('/shortcuts') !== -1) {
if (UserAgent.isMobileApp()) {
const err = {message: Utils.localizeMessage('create_post.shortcutsNotSupported', 'Keyboard shortcuts are not supported on your device')};
error(err);
return;
} else if (Utils.isMac()) {
msg += ' mac'; msg += ' mac';
} } else if (message.indexOf('mac') !== -1) {
if (!Utils.isMac() && message.indexOf('/shortcuts') !== -1 && message.indexOf('mac') !== -1) {
msg = '/shortcuts'; msg = '/shortcuts';
} }
}
Client.executeCommand(channelId, msg, suggest, success, error); Client.executeCommand(channelId, msg, suggest, success, error);
} }

Просмотреть файл

@@ -1042,6 +1042,9 @@
"create_comment.files": "Files uploading", "create_comment.files": "Files uploading",
"create_post.comment": "Comment", "create_post.comment": "Comment",
"create_post.post": "Post", "create_post.post": "Post",
"create_post.shortcutsNotSupported": "Keyboard shortcuts are not supported on your device.",
"flag_post.flag": "Flag for follow up",
"flag_post.unflag": "Unflag",
"create_post.tutorialTip": "<h4>Sending Messages</h4><p>Type here to write a message and press <strong>Enter</strong> to post it.</p><p>Click the <strong>Attachment</strong> button to upload an image or a file.</p>", "create_post.tutorialTip": "<h4>Sending Messages</h4><p>Type here to write a message and press <strong>Enter</strong> to post it.</p><p>Click the <strong>Attachment</strong> button to upload an image or a file.</p>",
"create_post.write": "Write a message...", "create_post.write": "Write a message...",
"create_team.agreement": "By proceeding to create your account and use {siteName}, you agree to our <a href='/static/help/terms.html'>Terms of Service</a> and <a href='/static/help/privacy.html'>Privacy Policy</a>. If you do not agree, you cannot use {siteName}.", "create_team.agreement": "By proceeding to create your account and use {siteName}, you agree to our <a href='/static/help/terms.html'>Terms of Service</a> and <a href='/static/help/privacy.html'>Privacy Policy</a>. If you do not agree, you cannot use {siteName}.",

Просмотреть файл

@@ -10,6 +10,7 @@ import ChannelStore from 'stores/channel_store.jsx';
import PostStore from 'stores/post_store.jsx'; import PostStore from 'stores/post_store.jsx';
import UserStore from 'stores/user_store.jsx'; import UserStore from 'stores/user_store.jsx';
import * as utils from './utils.jsx'; import * as utils from './utils.jsx';
import * as UserAgent from './user_agent.jsx';
import ErrorStore from 'stores/error_store.jsx'; import ErrorStore from 'stores/error_store.jsx';
import Constants from './constants.jsx'; import Constants from './constants.jsx';
@@ -871,6 +872,7 @@ export function getSuggestedCommands(command, suggestionId, component) {
(data) => { (data) => {
var matches = []; var matches = [];
data.forEach((cmd) => { data.forEach((cmd) => {
if (cmd.trigger !== 'shortcuts' || !UserAgent.isMobileApp()) {
if (('/' + cmd.trigger).indexOf(command) === 0) { if (('/' + cmd.trigger).indexOf(command) === 0) {
const s = '/' + cmd.trigger; const s = '/' + cmd.trigger;
let hint = ''; let hint = '';
@@ -883,6 +885,7 @@ export function getSuggestedCommands(command, suggestionId, component) {
description: cmd.auto_complete_desc description: cmd.auto_complete_desc
}); });
} }
}
}); });
matches = matches.sort((a, b) => a.suggestion.localeCompare(b.suggestion)); matches = matches.sort((a, b) => a.suggestion.localeCompare(b.suggestion));

Просмотреть файл

@@ -61,6 +61,14 @@ export function isIosWeb() {
return isIosSafari() || isIosChrome(); return isIosSafari() || isIosChrome();
} }
export function isIos() {
return userAgent.indexOf('iPhone') !== -1;
}
export function isAndroid() {
return userAgent.indexOf('Android') !== -1;
}
export function isAndroidChrome() { export function isAndroidChrome() {
return userAgent.indexOf('Android') !== -1 && userAgent.indexOf('Chrome') !== -1 && userAgent.indexOf('Version') === -1; return userAgent.indexOf('Android') !== -1 && userAgent.indexOf('Chrome') !== -1 && userAgent.indexOf('Version') === -1;
} }
@@ -70,7 +78,7 @@ export function isAndroidWeb() {
} }
export function isMobileApp() { export function isMobileApp() {
return userAgent.indexOf('iPhone') !== -1 && userAgent.indexOf('Safari') === -1 && userAgent.indexOf('CriOS') === -1; return isAndroid() || isIos();
} }
export function isFirefox() { export function isFirefox() {