@@ -14,7 +14,7 @@ import {
14
14
Modal ,
15
15
} from 'react-native' ;
16
16
import { Button , Icon } from 'react-native-elements' ;
17
- import AppIntro from 'rn-app-intro ' ;
17
+ import Swiper from 'react-native-swiper ' ;
18
18
import queryString from 'query-string' ;
19
19
import CookieManager from 'react-native-cookies' ;
20
20
@@ -100,6 +100,14 @@ const styles = StyleSheet.create({
100
100
justifyContent : 'center' ,
101
101
alignItems : 'center' ,
102
102
} ,
103
+ signInContainer : {
104
+ position : 'absolute' ,
105
+ right : 0 ,
106
+ left : 0 ,
107
+ bottom : 80 ,
108
+ justifyContent : 'center' ,
109
+ alignItems : 'center' ,
110
+ } ,
103
111
slide : {
104
112
flex : 1 ,
105
113
justifyContent : 'center' ,
@@ -224,6 +232,12 @@ class Login extends Component {
224
232
}
225
233
} ;
226
234
235
+ shouldDisplayIntro ( ) {
236
+ const { isLoggingIn, isAuthenticated } = this . props ;
237
+
238
+ return ! isAuthenticated && ! isLoggingIn && this . state . asyncStorageChecked ;
239
+ }
240
+
227
241
renderLoading ( ) {
228
242
return (
229
243
< View style = { styles . browserLoader } >
@@ -234,130 +248,120 @@ class Login extends Component {
234
248
}
235
249
236
250
render ( ) {
237
- const { locale, isLoggingIn, isAuthenticated } = this . props ;
251
+ const { locale, isLoggingIn } = this . props ;
238
252
239
253
return (
240
254
< ViewContainer barColor = "light" >
241
- { ! isAuthenticated &&
242
- ! isLoggingIn &&
243
- this . state . asyncStorageChecked && (
244
- < View style = { styles . container } >
245
- < Modal
246
- animationType = "slide"
247
- onRequestClose = { ( ) => null }
248
- visible = { this . state . modalVisible }
249
- style = { styles . container }
250
- >
251
- < View style = { styles . modalContainer } >
252
- < View style = { styles . browserSection } >
253
- < WebView
254
- source = { {
255
- uri : `https://github.com/login/oauth/authorize?response_type=token&client_id=${ CLIENT_ID } &redirect_uri=gitpoint://welcome&scope=user%20repo&state=${ stateRandom } ` ,
256
- } }
257
- onLoadStart = { e => this . toggleCancelButton ( e , true ) }
258
- onLoadEnd = { e => this . toggleCancelButton ( e , false ) }
259
- onNavigationStateChange = { e =>
260
- this . onNavigationStateChange ( e ) }
261
- renderLoading = { ( ) => this . renderLoading ( ) }
262
- startInLoadingState
263
- />
264
- </ View >
265
- < View style = { styles . miniSection } >
266
- < Button
267
- title = { translate ( 'auth.login.cancel' , locale ) }
268
- buttonStyle = { styles . button }
269
- disabled = { this . state . cancelDisabled }
270
- textStyle = { styles . buttonText }
271
- onPress = { ( ) =>
272
- this . setModalVisible ( ! this . state . modalVisible ) }
273
- />
274
- </ View >
275
- </ View >
276
- </ Modal >
277
- < View style = { styles . miniSection } >
278
- < Image
279
- style = { styles . logo }
280
- source = { require ( '../../assets/logo.png' ) }
255
+ { this . shouldDisplayIntro ( ) && (
256
+ < Swiper
257
+ loop = { false }
258
+ dotColor = "#FFFFFF55"
259
+ activeDotColor = { colors . white }
260
+ >
261
+ < View style = { [ styles . slide , styles . slide1 ] } >
262
+ < Image
263
+ style = { styles . logo }
264
+ source = { require ( '../../assets/logo.png' ) }
265
+ />
266
+ < Text style = { styles . title } >
267
+ { translate ( 'auth.login.welcomeTitle' , locale ) }
268
+ </ Text >
269
+ < Text style = { styles . message } >
270
+ { translate ( 'auth.login.welcomeMessage' , locale ) }
271
+ </ Text >
272
+ </ View >
273
+ < View style = { [ styles . slide , styles . slide2 ] } >
274
+ < Icon
275
+ style = { styles . icon }
276
+ color = { colors . white }
277
+ size = { 85 }
278
+ name = "bell"
279
+ type = "octicon"
280
+ />
281
+ < Text style = { styles . title } >
282
+ { translate ( 'auth.login.notificationsTitle' , locale ) }
283
+ </ Text >
284
+ < Text style = { styles . message } >
285
+ { translate ( 'auth.login.notificationsMessage' , locale ) }
286
+ </ Text >
287
+ </ View >
288
+ < View style = { [ styles . slide , styles . slide3 ] } >
289
+ < Icon
290
+ containerStyle = { styles . iconMargin }
291
+ style = { styles . icon }
292
+ color = { colors . white }
293
+ size = { 85 }
294
+ name = "repo"
295
+ type = "octicon"
296
+ />
297
+ < Text style = { styles . title } >
298
+ { translate ( 'auth.login.reposTitle' , locale ) }
299
+ </ Text >
300
+ < Text style = { styles . message } >
301
+ { translate ( 'auth.login.reposMessage' , locale ) }
302
+ </ Text >
303
+ </ View >
304
+ < View style = { [ styles . slide , styles . slide4 ] } >
305
+ < Icon
306
+ containerStyle = { styles . iconMargin }
307
+ style = { styles . icon }
308
+ color = { colors . white }
309
+ size = { 85 }
310
+ name = "git-pull-request"
311
+ type = "octicon"
312
+ />
313
+ < Text style = { styles . title } >
314
+ { translate ( 'auth.login.issuesTitle' , locale ) }
315
+ </ Text >
316
+ < Text style = { styles . message } >
317
+ { translate ( 'auth.login.issuesMessage' , locale ) }
318
+ </ Text >
319
+ </ View >
320
+ </ Swiper >
321
+ ) }
322
+ { this . shouldDisplayIntro ( ) && (
323
+ < View style = { styles . signInContainer } >
324
+ < Button
325
+ raised
326
+ title = { translate ( 'auth.login.signInButton' , locale ) }
327
+ buttonStyle = { styles . button }
328
+ textStyle = { styles . buttonText }
329
+ onPress = { ( ) => this . setModalVisible ( true ) }
330
+ />
331
+ </ View >
332
+ ) }
333
+ { this . shouldDisplayIntro ( ) && (
334
+ < Modal
335
+ animationType = "slide"
336
+ onRequestClose = { ( ) => null }
337
+ visible = { this . state . modalVisible }
338
+ style = { styles . container }
339
+ >
340
+ < View style = { styles . modalContainer } >
341
+ < View style = { styles . browserSection } >
342
+ < WebView
343
+ source = { {
344
+ uri : `https://github.com/login/oauth/authorize?response_type=token&client_id=${ CLIENT_ID } &redirect_uri=gitpoint://welcome&scope=user%20repo&state=${ stateRandom } ` ,
345
+ } }
346
+ onLoadStart = { e => this . toggleCancelButton ( e , true ) }
347
+ onLoadEnd = { e => this . toggleCancelButton ( e , false ) }
348
+ onNavigationStateChange = { e => this . onNavigationStateChange ( e ) }
349
+ renderLoading = { ( ) => this . renderLoading ( ) }
350
+ startInLoadingState
281
351
/>
282
352
</ View >
283
- < View style = { styles . contentSection } >
284
- < AppIntro
285
- activeDotColor = { colors . white }
286
- showSkipButton = { false }
287
- showDoneButton = { false }
288
- >
289
- < View style = { [ styles . slide , styles . slide1 ] } >
290
- < Image
291
- style = { styles . logo }
292
- source = { require ( '../../assets/logo.png' ) }
293
- />
294
- < Text style = { styles . title } >
295
- { translate ( 'auth.login.welcomeTitle' , locale ) }
296
- </ Text >
297
- < Text style = { styles . message } >
298
- { translate ( 'auth.login.welcomeMessage' , locale ) }
299
- </ Text >
300
- </ View >
301
- < View style = { [ styles . slide , styles . slide2 ] } >
302
- < Icon
303
- style = { styles . icon }
304
- color = { colors . white }
305
- size = { 85 }
306
- name = "bell"
307
- type = "octicon"
308
- />
309
- < Text style = { styles . title } >
310
- { translate ( 'auth.login.notificationsTitle' , locale ) }
311
- </ Text >
312
- < Text style = { styles . message } >
313
- { translate ( 'auth.login.notificationsMessage' , locale ) }
314
- </ Text >
315
- </ View >
316
- < View style = { [ styles . slide , styles . slide3 ] } >
317
- < Icon
318
- containerStyle = { styles . iconMargin }
319
- style = { styles . icon }
320
- color = { colors . white }
321
- size = { 85 }
322
- name = "repo"
323
- type = "octicon"
324
- />
325
- < Text style = { styles . title } >
326
- { translate ( 'auth.login.reposTitle' , locale ) }
327
- </ Text >
328
- < Text style = { styles . message } >
329
- { translate ( 'auth.login.reposMessage' , locale ) }
330
- </ Text >
331
- </ View >
332
- < View style = { [ styles . slide , styles . slide4 ] } >
333
- < Icon
334
- containerStyle = { styles . iconMargin }
335
- style = { styles . icon }
336
- color = { colors . white }
337
- size = { 85 }
338
- name = "git-pull-request"
339
- type = "octicon"
340
- />
341
- < Text style = { styles . title } >
342
- { translate ( 'auth.login.issuesTitle' , locale ) }
343
- </ Text >
344
- < Text style = { styles . message } >
345
- { translate ( 'auth.login.issuesMessage' , locale ) }
346
- </ Text >
347
- </ View >
348
- </ AppIntro >
349
- </ View >
350
353
< View style = { styles . miniSection } >
351
354
< Button
352
- raised
353
- title = { translate ( 'auth.login.signInButton' , locale ) }
355
+ title = { translate ( 'auth.login.cancel' , locale ) }
354
356
buttonStyle = { styles . button }
357
+ disabled = { this . state . cancelDisabled }
355
358
textStyle = { styles . buttonText }
356
- onPress = { ( ) => this . setModalVisible ( true ) }
359
+ onPress = { ( ) => this . setModalVisible ( ! this . state . modalVisible ) }
357
360
/>
358
361
</ View >
359
362
</ View >
360
- ) }
363
+ </ Modal >
364
+ ) }
361
365
{ isLoggingIn && (
362
366
< View style = { styles . browserLoader } >
363
367
< Text style = { styles . browserLoadingLabel } >
0 commit comments