@@ -17,6 +17,10 @@ import GrowlNotification from './components/GrowlNotification';
17
17
import * as Growl from './libs/Growl' ;
18
18
import StartupTimer from './libs/StartupTimer' ;
19
19
import Log from './libs/Log' ;
20
+ import ConfirmModal from './components/ConfirmModal' ;
21
+ import compose from './libs/compose' ;
22
+ import withLocalize , { withLocalizePropTypes } from './components/withLocalize' ;
23
+ import * as User from './libs/actions/User' ;
20
24
21
25
Onyx . registerLogger ( ( { level, message} ) => {
22
26
if ( level === 'alert' ) {
@@ -48,6 +52,18 @@ const propTypes = {
48
52
49
53
/** Tells us if the sidebar has rendered */
50
54
isSidebarLoaded : PropTypes . bool ,
55
+
56
+ /** Information about a screen share call requested by a GuidesPlus agent */
57
+ screenShareRequest : PropTypes . shape ( {
58
+
59
+ /** Access token required to join a screen share room, generated by the backend */
60
+ accessToken : PropTypes . string ,
61
+
62
+ /** Name of the screen share room to join */
63
+ roomName : PropTypes . string ,
64
+ } ) ,
65
+
66
+ ...withLocalizePropTypes ,
51
67
} ;
52
68
53
69
const defaultProps = {
@@ -58,6 +74,7 @@ const defaultProps = {
58
74
updateAvailable : false ,
59
75
initialReportDataLoaded : false ,
60
76
isSidebarLoaded : false ,
77
+ screenShareRequest : null ,
61
78
} ;
62
79
63
80
class Expensify extends PureComponent {
@@ -167,6 +184,17 @@ class Expensify extends PureComponent {
167
184
< GrowlNotification ref = { Growl . growlRef } />
168
185
{ /* We include the modal for showing a new update at the top level so the option is always present. */ }
169
186
{ this . props . updateAvailable ? < UpdateAppModal /> : null }
187
+ { this . props . screenShareRequest ? (
188
+ < ConfirmModal
189
+ title = { this . props . translate ( 'guides.screenShare' ) }
190
+ onConfirm = { ( ) => User . joinScreenShare ( this . props . screenShareRequest . accessToken , this . props . screenShareRequest . roomName ) }
191
+ onCancel = { User . clearScreenShareRequest }
192
+ prompt = { this . props . translate ( 'guides.screenShareRequest' ) }
193
+ confirmText = { this . props . translate ( 'common.join' ) }
194
+ cancelText = { this . props . translate ( 'common.decline' ) }
195
+ isVisible
196
+ />
197
+ ) : null }
170
198
</ >
171
199
) }
172
200
@@ -181,18 +209,24 @@ class Expensify extends PureComponent {
181
209
182
210
Expensify . propTypes = propTypes ;
183
211
Expensify . defaultProps = defaultProps ;
184
- export default withOnyx ( {
185
- session : {
186
- key : ONYXKEYS . SESSION ,
187
- } ,
188
- updateAvailable : {
189
- key : ONYXKEYS . UPDATE_AVAILABLE ,
190
- initWithStoredValues : false ,
191
- } ,
192
- initialReportDataLoaded : {
193
- key : ONYXKEYS . INITIAL_REPORT_DATA_LOADED ,
194
- } ,
195
- isSidebarLoaded : {
196
- key : ONYXKEYS . IS_SIDEBAR_LOADED ,
197
- } ,
198
- } ) ( Expensify ) ;
212
+ export default compose (
213
+ withLocalize ,
214
+ withOnyx ( {
215
+ session : {
216
+ key : ONYXKEYS . SESSION ,
217
+ } ,
218
+ updateAvailable : {
219
+ key : ONYXKEYS . UPDATE_AVAILABLE ,
220
+ initWithStoredValues : false ,
221
+ } ,
222
+ initialReportDataLoaded : {
223
+ key : ONYXKEYS . INITIAL_REPORT_DATA_LOADED ,
224
+ } ,
225
+ isSidebarLoaded : {
226
+ key : ONYXKEYS . IS_SIDEBAR_LOADED ,
227
+ } ,
228
+ screenShareRequest : {
229
+ key : ONYXKEYS . SCREEN_SHARE_REQUEST ,
230
+ } ,
231
+ } ) ,
232
+ ) ( Expensify ) ;
0 commit comments