[APP-28] add status page link (#987)

* add status page to mobile

* add status page URL to super slow loading screen

* store STATUS_PAGE_URL in constants.ts
This commit is contained in:
Ansh 2023-07-06 18:29:18 -07:00 committed by GitHub
parent 831b367eb9
commit b06304a253
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 51 additions and 9 deletions

View file

@ -132,3 +132,5 @@ export function LINK_META_PROXY(serviceUrl: string) {
return PROD_LINK_META_PROXY return PROD_LINK_META_PROXY
} }
} }
export const STATUS_PAGE_URL = 'https://status.bsky.app/'

View file

@ -1,11 +1,17 @@
import React from 'react' import React from 'react'
import {ActivityIndicator, StyleSheet} from 'react-native' import {
ActivityIndicator,
Linking,
StyleSheet,
TouchableOpacity,
} from 'react-native'
import {observer} from 'mobx-react-lite' import {observer} from 'mobx-react-lite'
import {useStores} from 'state/index' import {useStores} from 'state/index'
import {CenteredView} from '../util/Views' import {CenteredView} from '../util/Views'
import {LoggedOut} from './LoggedOut' import {LoggedOut} from './LoggedOut'
import {Text} from '../util/text/Text' import {Text} from '../util/text/Text'
import {usePalette} from 'lib/hooks/usePalette' import {usePalette} from 'lib/hooks/usePalette'
import {STATUS_PAGE_URL} from 'lib/constants'
export const withAuthRequired = <P extends object>( export const withAuthRequired = <P extends object>(
Component: React.ComponentType<P>, Component: React.ComponentType<P>,
@ -26,7 +32,7 @@ function Loading() {
const [isTakingTooLong, setIsTakingTooLong] = React.useState(false) const [isTakingTooLong, setIsTakingTooLong] = React.useState(false)
React.useEffect(() => { React.useEffect(() => {
const t = setTimeout(() => setIsTakingTooLong(true), 15e3) const t = setTimeout(() => setIsTakingTooLong(true), 15e3) // 15 seconds
return () => clearTimeout(t) return () => clearTimeout(t)
}, [setIsTakingTooLong]) }, [setIsTakingTooLong])
@ -38,6 +44,17 @@ function Loading() {
? "This is taking too long. There may be a problem with your internet or with the service, but we're going to try a couple more times..." ? "This is taking too long. There may be a problem with your internet or with the service, but we're going to try a couple more times..."
: 'Connecting...'} : 'Connecting...'}
</Text> </Text>
{isTakingTooLong ? (
<TouchableOpacity
onPress={() => {
Linking.openURL(STATUS_PAGE_URL)
}}
accessibilityRole="button">
<Text type="2xl" style={[styles.loadingText, pal.link]}>
Check Bluesky status page
</Text>
</TouchableOpacity>
) : null}
</CenteredView> </CenteredView>
) )
} }

View file

@ -1,6 +1,7 @@
import React from 'react' import React from 'react'
import { import {
ActivityIndicator, ActivityIndicator,
Linking,
Platform, Platform,
StyleSheet, StyleSheet,
TextStyle, TextStyle,
@ -47,6 +48,7 @@ import {reset as resetNavigation} from '../../Navigation'
// remove after backend testing finishes // remove after backend testing finishes
// -prf // -prf
import {useDebugHeaderSetting} from 'lib/api/debug-appview-proxy-header' import {useDebugHeaderSetting} from 'lib/api/debug-appview-proxy-header'
import {STATUS_PAGE_URL} from 'lib/constants'
type Props = NativeStackScreenProps<CommonNavigatorParams, 'Settings'> type Props = NativeStackScreenProps<CommonNavigatorParams, 'Settings'>
export const SettingsScreen = withAuthRequired( export const SettingsScreen = withAuthRequired(
@ -187,6 +189,10 @@ export const SettingsScreen = withAuthRequired(
navigation.navigate('SavedFeeds') navigation.navigate('SavedFeeds')
}, [navigation]) }, [navigation])
const onPressStatusPage = React.useCallback(() => {
Linking.openURL(STATUS_PAGE_URL)
}, [])
return ( return (
<View style={[s.hContentRegion]} testID="settingsScreen"> <View style={[s.hContentRegion]} testID="settingsScreen">
<ViewHeader title="Settings" /> <ViewHeader title="Settings" />
@ -529,13 +535,25 @@ export const SettingsScreen = withAuthRequired(
</TouchableOpacity> </TouchableOpacity>
</> </>
) : null} ) : null}
<TouchableOpacity <View style={[styles.footer]}>
accessibilityRole="button" <TouchableOpacity
onPress={onPressBuildInfo}> accessibilityRole="button"
<Text type="sm" style={[styles.buildInfo, pal.textLight]}> onPress={onPressBuildInfo}>
Build version {AppInfo.appVersion} {AppInfo.updateChannel} <Text type="sm" style={[styles.buildInfo, pal.textLight]}>
Build version {AppInfo.appVersion} {AppInfo.updateChannel}
</Text>
</TouchableOpacity>
<Text type="sm" style={[pal.textLight]}>
&middot; &nbsp;
</Text> </Text>
</TouchableOpacity> <TouchableOpacity
accessibilityRole="button"
onPress={onPressStatusPage}>
<Text type="sm" style={[styles.buildInfo, pal.textLight]}>
Status page
</Text>
</TouchableOpacity>
</View>
<View style={s.footerSpacer} /> <View style={s.footerSpacer} />
</ScrollView> </ScrollView>
</View> </View>
@ -621,7 +639,6 @@ const styles = StyleSheet.create({
}, },
buildInfo: { buildInfo: {
paddingVertical: 8, paddingVertical: 8,
paddingHorizontal: 18,
}, },
colorModeText: { colorModeText: {
@ -645,4 +662,10 @@ const styles = StyleSheet.create({
toggleBtn: { toggleBtn: {
paddingHorizontal: 0, paddingHorizontal: 0,
}, },
footer: {
flex: 1,
flexDirection: 'row',
alignItems: 'center',
paddingLeft: 18,
},
}) })