@@ -8,27 +8,75 @@ import React from 'react'
88import {
99 StyleSheet ,
1010 View ,
11- WebView ,
11+ Text ,
12+ Linking ,
13+ Platform ,
14+ Dimensions ,
15+ Image ,
1216} from 'react-native'
17+ import Button from 'react-native-button'
18+ import * as c from '../components/colors'
1319
14- // let kstoDownload = 'itms://itunes.apple.com/us/app/ksto/id953916647'
15-
16- const url = 'http://pages.stolaf.edu/ksto/listen/'
20+ let kstoApp = 'KSTORadio://'
21+ let kstoDownload = 'itms://itunes.apple.com/us/app/ksto/id953916647'
22+ let kstoWeb = 'https://www.stolaf.edu/multimedia/play/embed/ksto.html'
23+ let image = require ( '../../data/images/streaming/ksto/ksto-logo.png' )
1724
1825export default function KSTOView ( ) {
1926 return (
2027 < View style = { styles . container } >
21- < WebView
22- source = { { uri : url } }
23- startInLoadingState = { true }
24- style = { styles . container }
25- />
28+ < Image source = { image } style = { styles . logo } />
29+ < Text style = { styles . kstoText } > St. Olaf College Radio</ Text >
30+ < Text style = { styles . kstoText } > KSTO 93.1 FM</ Text >
31+ < Button
32+ onPress = { ( ) => {
33+ if ( Platform . OS === 'android' ) {
34+ Linking . openURL ( kstoWeb ) . catch ( err => console . error ( 'An error occurred opening the Android KSTO url' , err ) )
35+ } else {
36+ Linking . canOpenURL ( kstoApp ) . then ( supported => {
37+ if ( ! supported ) {
38+ Linking . openURL ( kstoDownload ) . catch ( err => console . error ( 'An error occurred opening the KSTO download url' , err ) )
39+ } else {
40+ return Linking . openURL ( kstoApp )
41+ }
42+ } ) . catch ( err => console . error ( 'An error occurred opening the iOS KSTO url' , err ) )
43+ }
44+ } }
45+ style = { styles . button }
46+ > Listen to KSTO</ Button >
47+ < Text style = { styles . kstoSubtext } > Look out for changes here soon!</ Text >
2648 </ View >
2749 )
2850}
2951
3052let styles = StyleSheet . create ( {
3153 container : {
3254 flex : 1 ,
55+ alignItems : 'center' ,
56+ marginTop : 15 ,
57+ } ,
58+ kstoText : {
59+ marginTop : 5 ,
60+ color : c . kstoPrimaryDark ,
61+ fontSize : 25 ,
62+ } ,
63+ kstoSubtext : {
64+ marginTop : 5 ,
65+ } ,
66+ logo : {
67+ maxWidth : Dimensions . get ( 'window' ) . width / 1.2 ,
68+ maxHeight : Dimensions . get ( 'window' ) . height / 2 ,
69+ } ,
70+ button : {
71+ backgroundColor : c . denim ,
72+ width : 200 ,
73+ color : c . white ,
74+ alignSelf : 'center' ,
75+ height : 30 ,
76+ paddingTop : 3 ,
77+ marginBottom : 10 ,
78+ marginTop : 10 ,
79+ borderRadius : 6 ,
80+ overflow : 'hidden' ,
3381 } ,
3482} )
0 commit comments