Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
const mobileMessageMenu = {
show(message, template, e, scope) {
if (!window.plugins.actionsheet) {
return false;
}
const options = {
'androidTheme': window.plugins.actionsheet.ANDROID_THEMES.THEME_HOLO_LIGHT,
'buttonLabels': [
TAPi18n.__('Report Abuse')
],
androidEnableCancelButton: true,
addCancelButtonWithLabel: TAPi18n.__('Cancel')
};
const buttonActions = [
mobileMessageMenu.reportAbuse
];
const buttons = RocketChat.MessageAction.getButtons(message, message.customClass || 'message-mobile');
for (let i = 0, len = buttons.length; i < len; i++) {
if (buttons[i].id === 'delete-message') {
options.addDestructiveButtonWithLabel = TAPi18n.__(buttons[i].i18nLabel);
buttonActions.unshift(buttons[i].action);
} else {
buttonActions.push(buttons[i].action);
options.buttonLabels.push(TAPi18n.__(buttons[i].i18nLabel));
}
}
window.plugins.actionsheet.show(options, (buttonIndex) => {
if (buttonActions[buttonIndex - 1] != null) {
return buttonActions[buttonIndex - 1].call(scope, e, template, message);
}
});
},
reportAbuse: (e, t, message) => {
swal({
title: TAPi18n.__('Report_this_message_question_mark'),
text: message.msg,
inputPlaceholder: TAPi18n.__('Why_do_you_want_to_report_question_mark'),
type: 'input',
showCancelButton: true,
confirmButtonColor: '#DD6B55',
confirmButtonText: TAPi18n.__('Report_exclamation_mark'),
cancelButtonText: TAPi18n.__('Cancel'),
closeOnConfirm: false,
html: false
}, (inputValue) => {
if (inputValue === false) {
return false;
}
if (inputValue === '') {
swal.showInputError(TAPi18n.__('You_need_to_write_something'));
return false;
}
Meteor.call('reportMessage', message, inputValue);
swal({
title: TAPi18n.__('Report_sent'),
text: TAPi18n.__('Thank_you_exclamation_mark '),
type: 'success',
timer: 1000,
showConfirmButton: false
});
});
}
};
this.mobileMessageMenu = mobileMessageMenu;
console.log('mobileMessageMenu');