|
@@ -1,11 +1,8 @@
|
1
|
1
|
import React, { Component } from 'react';
|
2
|
2
|
import { connect } from 'react-redux';
|
3
|
3
|
|
4
|
|
-import { appNavigate } from '../../app';
|
5
|
4
|
import { Platform } from '../../base/react';
|
6
|
5
|
|
7
|
|
-import { mobileBrowserPageIsShown } from '../actions';
|
8
|
|
-
|
9
|
6
|
/**
|
10
|
7
|
* The map of platforms to URLs at which the mobile app for the associated
|
11
|
8
|
* platform is available for download.
|
|
@@ -27,8 +24,14 @@ class UnsupportedMobileBrowser extends Component {
|
27
|
24
|
* @static
|
28
|
25
|
*/
|
29
|
26
|
static propTypes = {
|
30
|
|
- dispatch: React.PropTypes.func,
|
31
|
|
- room: React.PropTypes.string
|
|
27
|
+ /**
|
|
28
|
+ * The name of the conference room to be joined upon clicking the
|
|
29
|
+ * respective button.
|
|
30
|
+ *
|
|
31
|
+ * @private
|
|
32
|
+ * @type {string}
|
|
33
|
+ */
|
|
34
|
+ _room: React.PropTypes.string
|
32
|
35
|
}
|
33
|
36
|
|
34
|
37
|
/**
|
|
@@ -41,16 +44,7 @@ class UnsupportedMobileBrowser extends Component {
|
41
|
44
|
super(props);
|
42
|
45
|
|
43
|
46
|
// Bind methods
|
44
|
|
- this._onClickJoin = this._onClickJoin.bind(this);
|
45
|
|
- }
|
46
|
|
-
|
47
|
|
- /**
|
48
|
|
- * React lifecycle method triggered after component is mounted.
|
49
|
|
- *
|
50
|
|
- * @returns {void}
|
51
|
|
- */
|
52
|
|
- componentDidMount() {
|
53
|
|
- this.props.dispatch(mobileBrowserPageIsShown());
|
|
47
|
+ this._onJoinClick = this._onJoinClick.bind(this);
|
54
|
48
|
}
|
55
|
49
|
|
56
|
50
|
/**
|
|
@@ -59,21 +53,11 @@ class UnsupportedMobileBrowser extends Component {
|
59
|
53
|
* @returns {void}
|
60
|
54
|
*/
|
61
|
55
|
componentWillMount() {
|
62
|
|
- const { room } = this.props;
|
63
|
|
- let btnText;
|
64
|
|
- let link;
|
65
|
|
-
|
66
|
|
- if (room) {
|
67
|
|
- btnText = 'Join the conversation';
|
68
|
|
- link = room;
|
69
|
|
- } else {
|
70
|
|
- btnText = 'Start a conference';
|
71
|
|
- link = '';
|
72
|
|
- }
|
|
56
|
+ const joinButtonText
|
|
57
|
+ = this.props._room ? 'Join the conversation' : 'Start a conference';
|
73
|
58
|
|
74
|
59
|
this.setState({
|
75
|
|
- btnText,
|
76
|
|
- link
|
|
60
|
+ joinButtonText
|
77
|
61
|
});
|
78
|
62
|
}
|
79
|
63
|
|
|
@@ -84,8 +68,7 @@ class UnsupportedMobileBrowser extends Component {
|
84
|
68
|
*/
|
85
|
69
|
render() {
|
86
|
70
|
const ns = 'unsupported-mobile-browser';
|
87
|
|
- const primaryButtonClasses
|
88
|
|
- = `${ns}__button ${ns}__button_primary`;
|
|
71
|
+ const downloadButtonClassName = `${ns}__button ${ns}__button_primary`;
|
89
|
72
|
|
90
|
73
|
return (
|
91
|
74
|
<div className = { ns }>
|
|
@@ -98,7 +81,7 @@ class UnsupportedMobileBrowser extends Component {
|
98
|
81
|
conversation on your mobile
|
99
|
82
|
</p>
|
100
|
83
|
<a href = { URLS[Platform.OS] }>
|
101
|
|
- <button className = { primaryButtonClasses }>
|
|
84
|
+ <button className = { downloadButtonClassName }>
|
102
|
85
|
Download the App
|
103
|
86
|
</button>
|
104
|
87
|
</a>
|
|
@@ -109,9 +92,9 @@ class UnsupportedMobileBrowser extends Component {
|
109
|
92
|
</p>
|
110
|
93
|
<button
|
111
|
94
|
className = { `${ns}__button` }
|
112
|
|
- onClick = { this._onClickJoin }>
|
|
95
|
+ onClick = { this._onJoinClick }>
|
113
|
96
|
{
|
114
|
|
- this.state.btnText
|
|
97
|
+ this.state.joinButtonText
|
115
|
98
|
}
|
116
|
99
|
</button>
|
117
|
100
|
</div>
|
|
@@ -120,13 +103,19 @@ class UnsupportedMobileBrowser extends Component {
|
120
|
103
|
}
|
121
|
104
|
|
122
|
105
|
/**
|
123
|
|
- * Navigates to the next state of the app.
|
|
106
|
+ * Handles clicks on the button that joins the local participant in a
|
|
107
|
+ * conference.
|
124
|
108
|
*
|
125
|
109
|
* @private
|
126
|
110
|
* @returns {void}
|
127
|
111
|
*/
|
128
|
|
- _onClickJoin() {
|
129
|
|
- this.props.dispatch(appNavigate(this.state.link));
|
|
112
|
+ _onJoinClick() {
|
|
113
|
+ // If the user installed the app while this Component was displayed
|
|
114
|
+ // (e.g. the user clicked the Download the App button), then we would
|
|
115
|
+ // like to open the current URL in the mobile app.
|
|
116
|
+
|
|
117
|
+ // TODO The only way to do it appears to be a link with an app-specific
|
|
118
|
+ // scheme, not a Universal Link.
|
130
|
119
|
}
|
131
|
120
|
}
|
132
|
121
|
|
|
@@ -136,12 +125,19 @@ class UnsupportedMobileBrowser extends Component {
|
136
|
125
|
*
|
137
|
126
|
* @param {Object} state - Redux state.
|
138
|
127
|
* @returns {{
|
139
|
|
- * room: string
|
|
128
|
+ * _room: string
|
140
|
129
|
* }}
|
141
|
130
|
*/
|
142
|
131
|
function mapStateToProps(state) {
|
143
|
132
|
return {
|
144
|
|
- room: state['features/base/conference'].room
|
|
133
|
+ /**
|
|
134
|
+ * The name of the conference room to be joined upon clicking the
|
|
135
|
+ * respective button.
|
|
136
|
+ *
|
|
137
|
+ * @private
|
|
138
|
+ * @type {string}
|
|
139
|
+ */
|
|
140
|
+ _room: state['features/base/conference'].room
|
145
|
141
|
};
|
146
|
142
|
}
|
147
|
143
|
|