-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(native-app): add upgrade wall to app (#16164)
* feat: add user agent to api requests * feat: add first version of upgrade wall * feat: update illustration to have dots * feat: modal should not be closable and adding correct links to update button * feat: use feature flag for minimum version supported instead of backend * feat: fallback version set to 1.0.0 * chore: update Podfile.lock and project.pbxproj * Fix: send correct user agent header * fix: remove console.log * feat: use styled components more instead of inline styling * feat: make modal closable as well * feat: add skippedSoftUpdate flag to preferences store * fix: revert * fix: update import * feat: address minor comments from PR --------- Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
- Loading branch information
1 parent
81e07f5
commit 06f5a62
Showing
20 changed files
with
309 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+21.8 KB
apps/native/app/src/assets/illustrations/digital-services-m1-dots.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,143 @@ | ||
import { Button, Typography, NavigationBarSheet } from '@ui' | ||
import React, { useEffect } from 'react' | ||
import { useIntl, FormattedMessage } from 'react-intl' | ||
import { View, Image, SafeAreaView, Linking } from 'react-native' | ||
import styled from 'styled-components/native' | ||
import { | ||
Navigation, | ||
NavigationFunctionComponent, | ||
} from 'react-native-navigation' | ||
import { createNavigationOptionHooks } from '../../hooks/create-navigation-option-hooks' | ||
import logo from '../../assets/logo/logo-64w.png' | ||
import illustrationSrc from '../../assets/illustrations/digital-services-m1-dots.png' | ||
import { isIos } from '../../utils/devices' | ||
import { preferencesStore } from '../../stores/preferences-store' | ||
|
||
const Text = styled.View` | ||
margin-horizontal: ${({ theme }) => theme.spacing[7]}px; | ||
text-align: center; | ||
margin-vertical: ${({ theme }) => theme.spacing[5]}px; | ||
` | ||
|
||
const Host = styled.View` | ||
justify-content: center; | ||
align-items: center; | ||
flex: 1; | ||
` | ||
|
||
const ButtonWrapper = styled.View` | ||
padding-horizontal: ${({ theme }) => theme.spacing[2]}px; | ||
padding-vertical: ${({ theme }) => theme.spacing[4]}px; | ||
gap: ${({ theme }) => theme.spacing[1]}px; | ||
` | ||
|
||
const Title = styled(Typography)` | ||
padding-horizontal: ${({ theme }) => theme.spacing[2]}px; | ||
margin-bottom: ${({ theme }) => theme.spacing[2]}px; | ||
` | ||
|
||
const { getNavigationOptions, useNavigationOptions } = | ||
createNavigationOptionHooks(() => ({ | ||
topBar: { | ||
visible: false, | ||
}, | ||
hardwareBackButton: { | ||
dismissModalOnPress: false, | ||
}, | ||
})) | ||
|
||
export const UpdateAppScreen: NavigationFunctionComponent<{ | ||
closable?: boolean | ||
}> = ({ closable = true, componentId }) => { | ||
useNavigationOptions(componentId) | ||
const intl = useIntl() | ||
|
||
useEffect(() => { | ||
// Make sure to allow closing of the modal if this is a closable screen | ||
Navigation.mergeOptions(componentId, { | ||
hardwareBackButton: { | ||
dismissModalOnPress: closable, | ||
}, | ||
modal: { | ||
swipeToDismiss: closable, | ||
}, | ||
}) | ||
}, []) | ||
|
||
return ( | ||
<View style={{ flex: 1 }}> | ||
<NavigationBarSheet | ||
componentId={componentId} | ||
title={''} | ||
onClosePress={() => { | ||
if (closable) { | ||
preferencesStore.setState({ skippedSoftUpdate: true }) | ||
Navigation.dismissModal(componentId) | ||
} | ||
}} | ||
style={{ marginHorizontal: 16 }} | ||
closable={closable} | ||
/> | ||
<SafeAreaView style={{ flex: 1 }}> | ||
<Host> | ||
<Image | ||
source={logo} | ||
resizeMode="contain" | ||
style={{ width: 45, height: 45 }} | ||
/> | ||
<Text> | ||
<Title variant={'heading2'} textAlign="center"> | ||
<FormattedMessage | ||
id="updateApp.title" | ||
defaultMessage="Uppfæra app" | ||
/> | ||
</Title> | ||
<Typography textAlign="center"> | ||
<FormattedMessage | ||
id="updateApp.description" | ||
defaultMessage={ | ||
'Þú ert að fara að nota gamla útgáfu af Ísland.is appinu. Vinsamlegast uppfærðu appið til að halda áfram.' | ||
} | ||
/> | ||
</Typography> | ||
</Text> | ||
<Image | ||
source={illustrationSrc} | ||
style={{ width: 210, height: 240 }} | ||
resizeMode="contain" | ||
/> | ||
</Host> | ||
<ButtonWrapper> | ||
<Button | ||
title={intl.formatMessage({ | ||
id: 'updateApp.button', | ||
defaultMessage: 'Uppfæra', | ||
})} | ||
onPress={() => { | ||
Linking.openURL( | ||
isIos | ||
? 'https://apps.apple.com/app/%C3%ADsland-is-stafr%C3%A6nt-%C3%ADsland/id1569828682' | ||
: 'https://play.google.com/store/apps/details?id=is.island.app', | ||
) | ||
}} | ||
/> | ||
{closable && ( | ||
<Button | ||
isOutlined | ||
title={intl.formatMessage({ | ||
id: 'updateApp.buttonSkip', | ||
defaultMessage: 'Sleppa', | ||
})} | ||
onPress={() => { | ||
preferencesStore.setState({ skippedSoftUpdate: true }) | ||
Navigation.dismissModal(componentId) | ||
}} | ||
/> | ||
)} | ||
</ButtonWrapper> | ||
</SafeAreaView> | ||
</View> | ||
) | ||
} | ||
|
||
UpdateAppScreen.options = getNavigationOptions |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.