浏览代码

[RN] Add unlock room function to mobile

master
Zoltan Bettenbuk 7 年前
父节点
当前提交
192f1d44f5

+ 1
- 0
lang/main.json 查看文件

230
         "rejoinNow": "Rejoin now",
230
         "rejoinNow": "Rejoin now",
231
         "maxUsersLimitReachedTitle": "Maximum members limit reached",
231
         "maxUsersLimitReachedTitle": "Maximum members limit reached",
232
         "maxUsersLimitReached": "The limit for maximum number of members has been reached. The conference is full. Please contact the meeting owner or try again later!",
232
         "maxUsersLimitReached": "The limit for maximum number of members has been reached. The conference is full. Please contact the meeting owner or try again later!",
233
+        "lockRoom": "Lock room",
233
         "lockTitle": "Lock failed",
234
         "lockTitle": "Lock failed",
234
         "lockMessage": "Failed to lock the conference.",
235
         "lockMessage": "Failed to lock the conference.",
235
         "warning": "Warning",
236
         "warning": "Warning",

+ 17
- 0
react/features/room-lock/actions.js 查看文件

98
 export function _openPasswordRequiredPrompt(conference: Object) {
98
 export function _openPasswordRequiredPrompt(conference: Object) {
99
     return openDialog(PasswordRequiredPrompt, { conference });
99
     return openDialog(PasswordRequiredPrompt, { conference });
100
 }
100
 }
101
+
102
+/**
103
+ * Unlocks the current jitsi conference.
104
+ *
105
+ * @returns {Function}
106
+ */
107
+export function unlockRoom() {
108
+    return (dispatch: Dispatch<Function>, getState: Function) => {
109
+        const { conference } = getState()['features/base/conference'];
110
+
111
+        return dispatch(setPassword(
112
+            conference,
113
+            conference.lock,
114
+            ''
115
+        ));
116
+    };
117
+}

+ 17
- 7
react/features/room-lock/components/RoomLockButton.js 查看文件

3
 import { connect } from 'react-redux';
3
 import { connect } from 'react-redux';
4
 
4
 
5
 import { translate } from '../../base/i18n';
5
 import { translate } from '../../base/i18n';
6
+import { isLocalParticipantModerator } from '../../base/participants';
6
 import { AbstractButton } from '../../base/toolbox';
7
 import { AbstractButton } from '../../base/toolbox';
7
 import type { AbstractButtonProps } from '../../base/toolbox';
8
 import type { AbstractButtonProps } from '../../base/toolbox';
8
 
9
 
9
-import { beginRoomLockRequest } from '../actions';
10
+import { beginRoomLockRequest, unlockRoom } from '../actions';
10
 
11
 
11
 type Props = AbstractButtonProps & {
12
 type Props = AbstractButtonProps & {
12
 
13
 
13
     /**
14
     /**
14
-     * The current conference.
15
+     * Whether the current local participant is a moderator, therefore is
16
+     * allowed to lock or unlock the conference.
15
      */
17
      */
16
-    _conference: Object,
18
+    _localParticipantModerator: boolean,
17
 
19
 
18
     /**
20
     /**
19
      * Whether the current conference is locked or not.
21
      * Whether the current conference is locked or not.
43
      * @returns {void}
45
      * @returns {void}
44
      */
46
      */
45
     _handleClick() {
47
     _handleClick() {
46
-        this.props.dispatch(beginRoomLockRequest());
48
+        const { dispatch, _locked } = this.props;
49
+
50
+        if (_locked) {
51
+            dispatch(unlockRoom());
52
+        } else {
53
+            dispatch(beginRoomLockRequest());
54
+        }
47
     }
55
     }
48
 
56
 
49
     /**
57
     /**
54
      * @returns {boolean}
62
      * @returns {boolean}
55
      */
63
      */
56
     _isDisabled() {
64
     _isDisabled() {
57
-        return !this.props._conference;
65
+        return !this.props._localParticipantModerator;
58
     }
66
     }
59
 
67
 
60
     /**
68
     /**
76
  * @param {Object} state - The Redux state.
84
  * @param {Object} state - The Redux state.
77
  * @private
85
  * @private
78
  * @returns {{
86
  * @returns {{
79
- *     _audioOnly: boolean
87
+ *     _localParticipantModerator: boolean,
88
+ *     _locked: boolean
80
  * }}
89
  * }}
81
  */
90
  */
82
 function _mapStateToProps(state): Object {
91
 function _mapStateToProps(state): Object {
83
     const { conference, locked } = state['features/base/conference'];
92
     const { conference, locked } = state['features/base/conference'];
84
 
93
 
85
     return {
94
     return {
86
-        _conference: conference,
95
+        _localParticipantModerator:
96
+            Boolean(conference && isLocalParticipantModerator(state)),
87
         _locked: Boolean(conference && locked)
97
         _locked: Boolean(conference && locked)
88
     };
98
     };
89
 }
99
 }

+ 1
- 1
react/features/room-lock/components/RoomLockPrompt.native.js 查看文件

65
                 onCancel = { this._onCancel }
65
                 onCancel = { this._onCancel }
66
                 onSubmit = { this._onSubmit }
66
                 onSubmit = { this._onSubmit }
67
                 textInputProps = { _TEXT_INPUT_PROPS }
67
                 textInputProps = { _TEXT_INPUT_PROPS }
68
-                titleKey = 'toolbar.lock' />
68
+                titleKey = 'dialog.lockRoom' />
69
         );
69
         );
70
     }
70
     }
71
 
71
 

正在加载...
取消
保存