Skip to content

Commit 4b90de9

Browse files
Update Error screens in mobile app
1 parent 4d86aa3 commit 4b90de9

File tree

1 file changed

+92
-12
lines changed
  • app/src/features/reader/ui/screens/reader

1 file changed

+92
-12
lines changed

app/src/features/reader/ui/screens/reader/index.tsx

Lines changed: 92 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import Navigation, {
1717
} from 'src/features/overview/ui/components/navigation'
1818
import * as icons from 'src/ui/components/icons/icons-list'
1919
import styled from 'styled-components/native'
20+
import { Icon } from 'src/ui/components/icons/icon-mobile'
2021

2122
export default class Reader extends StatefulUIElement<Props, State, Event> {
2223
constructor(props: Props) {
@@ -125,23 +126,51 @@ export default class Reader extends StatefulUIElement<Props, State, Event> {
125126
errorDesc: string,
126127
) => {
127128
// Lack of SSL error case
128-
if (errorCode === -1023) {
129+
if (errorCode === -1023 || errorCode === -1200) {
129130
return (
130-
<ErrorMessage>
131-
The page could not be loaded because Memex couldn't create a
132-
secure connection
133-
</ErrorMessage>
131+
<ErrorScreen>
132+
<SectionCircle size="60px">
133+
<Icon
134+
icon={icons.Lock}
135+
heightAndWidth="20px"
136+
color="purple"
137+
/>
138+
</SectionCircle>
139+
<Header>HTTP pages not supported</Header>
140+
<ErrorMessage>
141+
Please save and open a HTTPS version of this page
142+
</ErrorMessage>
143+
</ErrorScreen>
134144
)
135145
}
136146

137147
// Default error case
138148
return (
139-
<ErrorMessage>
140-
The page could not be loaded because of an unknown error:{'\n'}
141-
{errorCode}
142-
{'\n'}
143-
{errorDesc}
144-
</ErrorMessage>
149+
<ErrorScreen>
150+
<SectionCircle size="60px">
151+
<Icon
152+
icon={icons.Alert}
153+
heightAndWidth="20px"
154+
color="purple"
155+
/>
156+
</SectionCircle>
157+
<Header>Error Loading Page</Header>
158+
<ErrorMessage>
159+
The page could not be loaded because of an error:{'\n'}
160+
{errorDesc}
161+
{'\n'}({errorCode})
162+
</ErrorMessage>
163+
<Spacer10 />
164+
<Button
165+
onPress={() =>
166+
Linking.openURL(
167+
`mailto:[email protected]?subject=Memex%20Go%3A%20Error%20Opening%20Link&body=Hey%20folks%2C%0D%0A%0D%0AI%20have%20an%20error%20opening%20a%20link%20in%20the%20mobile%20app.%0D%0AThe%20error%20message%20is%20${errorCode}.%0D%0A%0D%0AThanks%20for%20the%20help%0D%0A`,
168+
)
169+
}
170+
>
171+
<ButtonText>Report</ButtonText>
172+
</Button>
173+
</ErrorScreen>
145174
)
146175
}
147176

@@ -277,4 +306,55 @@ const WebViewContainer = styled.SafeAreaView<{
277306
: ''}
278307
`
279308

280-
const ErrorMessage = styled.Text``
309+
const ErrorScreen = styled.View`
310+
height: 100%;
311+
width: 100%;
312+
display: flex;
313+
justify-content: center;
314+
align-items: center;
315+
padding: 20px;
316+
`
317+
318+
const ErrorMessage = styled.Text`
319+
font-size: 18px;
320+
color: ${(props) => props.theme.colors.lighterText};
321+
text-align: center;
322+
padding: 0px 20px;
323+
`
324+
325+
const Header = styled.Text`
326+
font-size: 22px;
327+
font-weight: 800;
328+
color: ${(props) => props.theme.colors.darkerText};
329+
margin-bottom: 10px;
330+
`
331+
const SectionCircle = styled.View<{ size: string }>`
332+
background: ${(props) => props.theme.colors.backgroundHighlight};
333+
border-radius: 100px;
334+
height: ${(props) => (props.size ? props.size : '60px')};
335+
width: ${(props) => (props.size ? props.size : '60px')};
336+
display: flex;
337+
justify-content: center;
338+
align-items: center;
339+
margin-bottom: 20px;
340+
`
341+
342+
const Spacer10 = styled.View`
343+
height: 20px;
344+
`
345+
346+
const Button = styled.TouchableOpacity`
347+
width: 100px;
348+
height: 40px;
349+
background: ${(props) => props.theme.colors.purple};
350+
border-radius: 5px;
351+
display: flex;
352+
justify-content: center;
353+
align-items: center;
354+
`
355+
356+
const ButtonText = styled.Text`
357+
font-weight: 500;
358+
font-size: 16px;
359+
color: white;
360+
`

0 commit comments

Comments
 (0)