-
Notifications
You must be signed in to change notification settings - Fork 106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[#172526356] Adds Screen to explain why CIE login is not available #1769
Changes from 6 commits
d6ae4e0
4e278b1
786a2f9
a635a86
8dd4db0
bec700c
3f4942f
c5de974
05798b8
f7deed5
d5b26f8
66da00d
4451d59
a59ef20
6533ccb
2aa5125
b9360fb
b2ea415
8ad80c1
e9d8632
7e69c33
18a18de
3c88387
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
To login you need to have a device with NFC technology or a device compatible with the current implementation (iOS devices are not yet compatible but will soon become compatible with the new update). |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Specifically, the cases in which you **cannot** access with an Electronic Identity Card (CIE) on your Android device are: |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Per effettuare il login è necessario avere un dispositivo con tecnologia NFC o un dispositivo compatibile con l’attuale implementazione (i dispositivi iOS non sono ancora compatibili ma a breve lo diventeranno con il nuovo aggiornamento). | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Nello specifico, i casi in cui **non** è possibile accedere con Carta di Identità Elettronica (CIE) su dispositivo Android sono: |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,19 +3,23 @@ | |
* It includes a carousel with highlights on the app functionalities | ||
*/ | ||
import * as pot from "italia-ts-commons/lib/pot"; | ||
import { Content, Text, View } from "native-base"; | ||
import { Body, Content, List, ListItem, Text, View } from "native-base"; | ||
import * as React from "react"; | ||
import { StyleSheet } from "react-native"; | ||
import { Platform, StyleSheet } from "react-native"; | ||
import { NavigationInjectedProps } from "react-navigation"; | ||
import { connect } from "react-redux"; | ||
import ButtonDefaultOpacity from "../../components/ButtonDefaultOpacity"; | ||
import { ContextualHelp } from "../../components/ContextualHelp"; | ||
import { DevScreenButton } from "../../components/DevScreenButton"; | ||
import { withLightModalContext } from "../../components/helpers/withLightModalContext"; | ||
import { HorizontalScroll } from "../../components/HorizontalScroll"; | ||
import { LandingCardComponent } from "../../components/LandingCardComponent"; | ||
import BaseScreenComponent, { | ||
ContextualHelpPropsMarkdown | ||
} from "../../components/screens/BaseScreenComponent"; | ||
import IconFont from "../../components/ui/IconFont"; | ||
import { LightModalContextInterface } from "../../components/ui/LightModal"; | ||
import Markdown from "../../components/ui/Markdown"; | ||
import I18n from "../../i18n"; | ||
import { IdentityProvider } from "../../models/IdentityProvider"; | ||
import ROUTES from "../../navigation/routes"; | ||
|
@@ -25,14 +29,20 @@ import { | |
} from "../../store/actions/authentication"; | ||
import { Dispatch } from "../../store/actions/types"; | ||
import { isSessionExpiredSelector } from "../../store/reducers/authentication"; | ||
import { isCieSupportedSelector } from "../../store/reducers/cie"; | ||
import { | ||
hasApiLevelSupportSelector, | ||
hasNFCFeatureSelector, | ||
isCieSupportedSelector | ||
} from "../../store/reducers/cie"; | ||
import { GlobalState } from "../../store/reducers/types"; | ||
import variables from "../../theme/variables"; | ||
import customVariables from "../../theme/variables"; | ||
import { ComponentProps } from "../../types/react"; | ||
import { isDevEnv } from "../../utils/environment"; | ||
import { showToast } from "../../utils/showToast"; | ||
|
||
type Props = NavigationInjectedProps & | ||
LightModalContextInterface & | ||
ReturnType<typeof mapStateToProps> & | ||
ReturnType<typeof mapDispatchToProps>; | ||
|
||
|
@@ -89,6 +99,12 @@ const styles = StyleSheet.create({ | |
}, | ||
flex: { | ||
flex: 1 | ||
}, | ||
noCie: { | ||
opacity: 0.35 | ||
}, | ||
checkboxBackground: { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It seems to be not used There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed in 6533ccb |
||
backgroundColor: "#0073E6" | ||
} | ||
}); | ||
|
||
|
@@ -120,15 +136,86 @@ class LandingScreen extends React.PureComponent<Props> { | |
} | ||
} | ||
|
||
private renderAndroidConditions = () => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could it be a component included in its own file? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We may create a component for the complete child of the Modal including this block maybe? <React.Fragment>
<Markdown>
{I18n.t("authentication.landing.cie_unsupported.body")}
</Markdown>
{Platform.OS === "android" && this.renderAndroidConditions()}
</React.Fragment> we should pass There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Undermaken |
||
return ( | ||
<React.Fragment> | ||
<View spacer={true} /> | ||
<Markdown> | ||
{I18n.t("authentication.landing.cie_unsupported.android_desc")} | ||
</Markdown> | ||
<View spacer={true} extralarge={true} /> | ||
<List> | ||
<ListItem> | ||
<IconFont | ||
name="io-tick-big" | ||
size={16} | ||
color={ | ||
this.props.hasCieApiLevelSupport | ||
? customVariables.brandLightGray | ||
: customVariables.contentPrimaryBackground | ||
} | ||
/> | ||
<Body> | ||
<Text> | ||
{I18n.t( | ||
"authentication.landing.cie_unsupported.os_version_unsupported" | ||
)} | ||
</Text> | ||
</Body> | ||
</ListItem> | ||
<ListItem> | ||
<IconFont | ||
name="io-tick-big" | ||
size={16} | ||
color={ | ||
this.props.hasCieNFCFeature | ||
? customVariables.brandLightGray | ||
: customVariables.contentPrimaryBackground | ||
} | ||
/> | ||
<Body> | ||
<Text> | ||
{I18n.t( | ||
"authentication.landing.cie_unsupported.nfc_incompatible" | ||
)} | ||
</Text> | ||
</Body> | ||
</ListItem> | ||
</List> | ||
</React.Fragment> | ||
); | ||
}; | ||
|
||
private openUnsupportedCIEModal = () => { | ||
this.props.showAnimatedModal( | ||
<ContextualHelp | ||
onClose={this.props.hideModal} | ||
title={I18n.t("authentication.landing.cie_unsupported.title")} | ||
body={() => ( | ||
<React.Fragment> | ||
<Markdown> | ||
{I18n.t("authentication.landing.cie_unsupported.body")} | ||
</Markdown> | ||
{Platform.OS === "android" && this.renderAndroidConditions()} | ||
</React.Fragment> | ||
)} | ||
/> | ||
); | ||
}; | ||
|
||
private navigateToMarkdown = () => | ||
this.props.navigation.navigate(ROUTES.MARKDOWN); | ||
|
||
private navigateToIdpSelection = () => | ||
this.props.navigation.navigate(ROUTES.AUTHENTICATION_IDP_SELECTION); | ||
|
||
private navigateToCiePinScreen = () => { | ||
this.props.dispatchIdpCieSelected(); | ||
this.props.navigation.navigate(ROUTES.CIE_PIN_SCREEN); | ||
if (this.props.isCieSupported) { | ||
this.props.dispatchIdpCieSelected(); | ||
this.props.navigation.navigate(ROUTES.CIE_PIN_SCREEN); | ||
} else { | ||
this.openUnsupportedCIEModal(); | ||
} | ||
}; | ||
|
||
private navigateToSpidCieInformationRequest = () => | ||
|
@@ -162,18 +249,17 @@ class LandingScreen extends React.PureComponent<Props> { | |
</Content> | ||
|
||
<View footer={true}> | ||
{this.props.isCieSupported && ( | ||
<ButtonDefaultOpacity | ||
block={true} | ||
primary={true} | ||
iconLeft={true} | ||
onPress={this.navigateToCiePinScreen} | ||
testID={"landing-button-login-cie"} | ||
> | ||
<IconFont name={"io-cie"} color={variables.colorWhite} /> | ||
<Text>{I18n.t("authentication.landing.loginCie")}</Text> | ||
</ButtonDefaultOpacity> | ||
)} | ||
<ButtonDefaultOpacity | ||
style={!this.props.isCieSupported ? styles.noCie : undefined} | ||
block={true} | ||
primary={true} | ||
iconLeft={true} | ||
onPress={this.navigateToCiePinScreen} | ||
testID={"landing-button-login-cie"} | ||
> | ||
<IconFont name={"io-cie"} color={variables.colorWhite} /> | ||
<Text>{I18n.t("authentication.landing.loginCie")}</Text> | ||
</ButtonDefaultOpacity> | ||
<View spacer={true} /> | ||
<ButtonDefaultOpacity | ||
block={true} | ||
|
@@ -206,9 +292,13 @@ class LandingScreen extends React.PureComponent<Props> { | |
|
||
const mapStateToProps = (state: GlobalState) => { | ||
const isCIEAuthenticationSupported = isCieSupportedSelector(state); | ||
const hasApiLevelSupport = hasApiLevelSupportSelector(state); | ||
const hasNFCFeature = hasNFCFeatureSelector(state); | ||
return { | ||
isSessionExpired: isSessionExpiredSelector(state), | ||
isCieSupported: pot.getOrElse(isCIEAuthenticationSupported, false) | ||
isCieSupported: pot.getOrElse(isCIEAuthenticationSupported, false), | ||
hasCieApiLevelSupport: pot.getOrElse(hasApiLevelSupport, false), | ||
hasCieNFCFeature: pot.getOrElse(hasNFCFeature, false) | ||
}; | ||
}; | ||
|
||
|
@@ -220,4 +310,4 @@ const mapDispatchToProps = (dispatch: Dispatch) => ({ | |
export default connect( | ||
mapStateToProps, | ||
mapDispatchToProps | ||
)(LandingScreen); | ||
)(withLightModalContext(LandingScreen)); |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -5,19 +5,25 @@ import * as pot from "italia-ts-commons/lib/pot"; | |||||
import { getType } from "typesafe-actions"; | ||||||
import { | ||||||
cieIsSupported, | ||||||
hasApiLevelSupport, | ||||||
hasNFCFeature, | ||||||
nfcIsEnabled, | ||||||
updateReadingState | ||||||
} from "../actions/cie"; | ||||||
import { Action } from "../actions/types"; | ||||||
import { GlobalState } from "./types"; | ||||||
|
||||||
export type CieState = { | ||||||
hasApiLevelSupport: pot.Pot<boolean, Error>; | ||||||
hasNFCFeature: pot.Pot<boolean, Error>; | ||||||
isCieSupported: pot.Pot<boolean, Error>; | ||||||
isNfcEnabled: pot.Pot<boolean, Error>; | ||||||
readingEvent: pot.Pot<string, Error>; | ||||||
}; | ||||||
|
||||||
const INITIAL_STATE: CieState = { | ||||||
hasApiLevelSupport: pot.none, | ||||||
hasNFCFeature: pot.none, | ||||||
isCieSupported: pot.none, | ||||||
isNfcEnabled: pot.none, | ||||||
readingEvent: pot.none | ||||||
|
@@ -38,6 +44,26 @@ export default function cieReducer( | |||||
...state, | ||||||
isCieSupported: pot.toError(state.isCieSupported, action.payload) | ||||||
}; | ||||||
case getType(hasApiLevelSupport.success): | ||||||
return { | ||||||
...state, | ||||||
hasApiLevelSupport: pot.some(action.payload) | ||||||
}; | ||||||
case getType(hasApiLevelSupport.failure): | ||||||
return { | ||||||
...state, | ||||||
hasApiLevelSupport: pot.toError(state.isCieSupported, action.payload) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed in 6533ccb |
||||||
}; | ||||||
case getType(hasNFCFeature.success): | ||||||
return { | ||||||
...state, | ||||||
hasNFCFeature: pot.some(action.payload) | ||||||
}; | ||||||
case getType(hasNFCFeature.failure): | ||||||
return { | ||||||
...state, | ||||||
hasNFCFeature: pot.toError(state.isCieSupported, action.payload) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed in 6533ccb |
||||||
}; | ||||||
case getType(nfcIsEnabled.success): | ||||||
return { | ||||||
...state, | ||||||
|
@@ -66,6 +92,12 @@ export default function cieReducer( | |||||
} | ||||||
|
||||||
// Selectors | ||||||
export const hasNFCFeatureSelector = (state: GlobalState) => | ||||||
state.cie.hasNFCFeature; | ||||||
|
||||||
export const hasApiLevelSupportSelector = (state: GlobalState) => | ||||||
state.cie.hasApiLevelSupport; | ||||||
|
||||||
export const isCieSupportedSelector = (state: GlobalState) => | ||||||
state.cie.isCieSupported; | ||||||
|
||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess it's more appropriate. In that way the user could expect CIE in iOS on the next release