Skip to content

Commit

Permalink
Merge branch 'master' into 175883590-satispay-bancomatpay-selector
Browse files Browse the repository at this point in the history
  • Loading branch information
Undermaken authored Nov 26, 2020
2 parents 15fb68e + 9e51f3a commit aa25467
Show file tree
Hide file tree
Showing 23 changed files with 280 additions and 122 deletions.
14 changes: 7 additions & 7 deletions locales/en/index.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ locales:
clipboard:
copyFeedback: Copied to clipboard
copyText: copy
copyFeedbackButton: copied
betaBanner:
title: 'The IO app is in beta version.'
description: Your reports help us to improve day after day.
Expand Down Expand Up @@ -1306,13 +1307,10 @@ contextualHelp:
instabug:
contextualHelp:
title1: Do you need help?
buttonChat: Send us a message
description: "Remember that if you have any doubts about the content of a message, we suggest you to contact the public administration that sent it to you directly: you will find the contact details at the bottom of the message or in the relevant service card."
descriptionChat: "If you have found an error or something that is not working in the app, report a bug to the developers: they will take care of the problem as soon as possible and they will answer you directly via IO."
buttonBug: Report a bug
descriptionBug: If you want to suggest an improvement or a new service that you would like to have on IO, you can send a message to the team directly from here.
title2: Are you new to IO?
descriptionLink: Find out more about the IO project, its history and what news await you by visiting the website
descriptionBug: "If something **doesn't work** as it should or if you want to **suggest an improvement** or a new feature, write us! The IO team will get back to you directly via app."
buttonBug: Write to the IO team
descriptionChat: "Only if you want to **reopen a past report**, to request additional information or add details, click below."
buttonChat: Reopen a report
assistanceWorkHours: IO assistance is available on weekdays from 8.00 to 20.00 and on holidays from 8.00 to 12.00
faq:
1:
Expand Down Expand Up @@ -1805,6 +1803,8 @@ bonus:
canceledOperationWarning: "This transaction is a refund, so the related cashback has been deducted."
canceled: "Refund"
paymentMethods:
add:
alertBody: "The payment method you are adding will be saved in the IO app wallet and, if compatible, can also be used for any payments within the app."
noPaymentMethods: "You must add at least one payment method to start collecting the necessary transactions"
noActiveMethod: "You must have activated at least one payment method to collect transactions"
activateOnOthersChannel:
Expand Down
14 changes: 7 additions & 7 deletions locales/it/index.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ locales:
clipboard:
copyFeedback: Copiato negli appunti
copyText: copia
copyFeedbackButton: copiato
betaBanner:
title: "L’app IO è in versione beta."
description: Le tue segnalazioni ci aiutano a migliorare giorno dopo giorno.
Expand Down Expand Up @@ -1337,13 +1338,10 @@ contextualHelp:
instabug:
contextualHelp:
title1: Hai bisogno di aiuto?
description: "Ricorda che se hai dubbi sul contenuto di un messaggio, ti consigliamo di contattare direttamente l'ente che te lo ha inviato: troverai i recapiti in fondo al messaggio o nella scheda del relativo servizio."
buttonChat: Inviaci un messaggio
descriptionChat: "Se invece hai trovato un errore o qualcosa che non funziona nell’app, segnala un bug agli sviluppatori: si prenderanno carico del problema al più presto e ti risponderanno direttamente tramite IO."
buttonBug: Segnala un bug
descriptionBug: Se vuoi suggerirci un miglioramento o un nuovo servizio che vorresti avere su IO, puoi inviare un messaggio al team direttamente da qui.
title2: Sei nuovo in IO?
descriptionLink: Scopri di più sul progetto IO, sulla sua storia e su quali novità ti attendono, visitando il sito
descriptionBug: "Se qualcosa **non funziona** come dovrebbe o se vuoi **suggerirci un miglioramento** o una nuova funzionalità, scrivici! Il team di IO ti risponderà direttamente tramite l'app."
buttonBug: Scrivi al team di IO
descriptionChat: "Solo se vuoi **riaprire una segnalazione passata**, per chiedere informazioni aggiuntive o aggiungere dettagli, clicca qui sotto."
buttonChat: Riapri una segnalazione
assistanceWorkHours: L'assistenza di IO è disponibile nei giorni feriali dalle ore 8.00 alle 20.00 e nei festivi dalle ore 8.00 alle 12.00
faq:
1:
Expand Down Expand Up @@ -1837,6 +1835,8 @@ bonus:
canceledOperationWarning: "Questa transazione è un rimborso, perciò è stato decurtato il relativo cashback."
canceled: "Storno"
paymentMethods:
add:
alertBody: "Il metodo di pagamento che stai aggiungendo sarà salvato nel wallet dell'app IO e, se compatibile, potrà essere usato anche per eventuali pagamenti all'interno dell'app."
noPaymentMethods: "Devi aggiungere almeno un metodo di pagamento per iniziare a registrare le transazioni necessarie"
noActiveMethod: "Devi aver attivato almeno un metodo di pagamento per registrare le transazioni"
activateOnOthersChannel:
Expand Down
17 changes: 16 additions & 1 deletion ts/api/pagopa.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import {
addWalletsBancomatCardUsingPOSTDecoder,
getAbiListUsingGETDefaultDecoder,
GetAbiListUsingGETT,
GetConsumerUsingGETT,
getPansUsingGETDefaultDecoder,
GetPansUsingGETT,
getWalletsV2UsingGETDecoder
Expand All @@ -41,6 +42,7 @@ import {
favouriteWalletUsingPOSTDecoder,
FavouriteWalletUsingPOSTT,
GetAllPspsUsingGETT,
getConsumerUsingGETDefaultDecoder,
getPspListUsingGETDecoder,
GetPspListUsingGETT,
getPspUsingGETDecoder,
Expand Down Expand Up @@ -438,6 +440,14 @@ const addPans: AddWalletsBancomatCardUsingPOSTTExtra = {
)
};

const searchSatispay: GetConsumerUsingGETT = {
method: "get",
url: () => `/v1/satispay/consumers`,
query: () => ({}),
headers: composeHeaderProducers(tokenHeaderProducer, ApiHeaderJson),
response_decoder: getConsumerUsingGETDefaultDecoder()
};

const withPaymentManagerToken = <P extends { Bearer: string }, R>(
f: (p: P) => Promise<R>
) => (token: PaymentManagerToken) => async (
Expand Down Expand Up @@ -603,7 +613,12 @@ export function PaymentManagerClient(
addPans: (cards: BancomatCardsRequest) =>
flip(
withPaymentManagerToken(createFetchRequestForApi(addPans, altOptions))
)({ bancomatCardsRequest: cards })
)({ bancomatCardsRequest: cards }),
searchSatispay: flip(
withPaymentManagerToken(
createFetchRequestForApi(searchSatispay, altOptions)
)
)
};
}

Expand Down
13 changes: 4 additions & 9 deletions ts/boot/configureInstabug.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { Option } from "fp-ts/lib/Option";
import Instabug, {
BugReporting,
Chats,
NetworkLogger,
Replies
} from "instabug-reactnative";
Expand Down Expand Up @@ -72,19 +71,15 @@ export const initialiseInstabug = () => {
setInstabugUserAttribute("appVersion", getAppVersion());
};

export const openInstabugBugReport = () => {
BugReporting.showWithOptions(BugReporting.reportType.bug, [
export const openInstabugQuestionReport = () => {
BugReporting.showWithOptions(BugReporting.reportType.question, [
BugReporting.option.commentFieldRequired,
BugReporting.option.emailFieldOptional
]);
};

export const openInstabugChat = (hasChats: boolean = false) => {
if (hasChats) {
Replies.show();
} else {
Chats.show();
}
export const openInstabugReplies = () => {
Replies.show();
};

export const setInstabugUserAttribute = (
Expand Down
17 changes: 2 additions & 15 deletions ts/components/ContextualHelpModal.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import { fromNullable, none } from "fp-ts/lib/Option";
import { BugReporting } from "instabug-reactnative";
import * as pot from "italia-ts-commons/lib/pot";
import { Container, Content, H3, Text, View } from "native-base";
import { Container, Content, H3, View } from "native-base";
import * as React from "react";
import {
InteractionManager,
Modal,
ModalBaseProps,
StyleSheet,
TouchableWithoutFeedback
StyleSheet
} from "react-native";
import { connect } from "react-redux";
import I18n from "../i18n";
Expand All @@ -29,7 +28,6 @@ import BetaBannerComponent from "./screens/BetaBannerComponent";
import { EdgeBorderComponent } from "./screens/EdgeBorderComponent";
import ActivityIndicator from "./ui/ActivityIndicator";
import Markdown from "./ui/Markdown";
import { openLink } from "./ui/Markdown/handlers/link";

type OwnProps = Readonly<{
title: string;
Expand Down Expand Up @@ -185,17 +183,6 @@ const ContextualHelpModal: React.FunctionComponent<Props> = (props: Props) => {
<InstabugAssistanceComponent
requestAssistance={props.onRequestAssistance}
/>
<View spacer={true} />
<H3>{I18n.t("instabug.contextualHelp.title2")}</H3>
<View spacer={true} />
<Text>
{`${I18n.t("instabug.contextualHelp.descriptionLink")} `}
<TouchableWithoutFeedback
onPress={() => openLink(I18n.t("global.ioWebSite"))}
>
<Text link={true}>{I18n.t("global.ioWebSite")}</Text>
</TouchableWithoutFeedback>
</Text>
</React.Fragment>
)}
{isContentLoaded && <EdgeBorderComponent />}
Expand Down
50 changes: 42 additions & 8 deletions ts/components/CopyButtonComponent.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import I18n from "i18n-js";
import { Millisecond } from "italia-ts-commons/lib/units";
import { Text } from "native-base";
import * as React from "react";
import { Platform, StyleSheet } from "react-native";
import I18n from "../i18n";
import { makeFontStyleObject } from "../theme/fonts";
import customVariables from "../theme/variables";
import { clipboardSetStringWithFeedback } from "../utils/clipboard";
import ButtonDefaultOpacity from "./ButtonDefaultOpacity";
import { IOColors } from "./core/variables/IOColors";

type Props = Readonly<{
textToCopy: string;
Expand All @@ -22,22 +24,54 @@ const styles = StyleSheet.create({
},
text: {
...makeFontStyleObject(Platform.select, customVariables.textNormalWeight),
color: customVariables.brandPrimary,
paddingLeft: 0,
paddingRight: 0
},
colorBlue: {
color: IOColors.blue
},
colorWhite: {
color: IOColors.white
}
});

export default function CopyButtonComponent(props: Props) {
const FEEDBACK_MS = 4000 as Millisecond;

const CopyButtonComponent: React.FunctionComponent<Props> = (props: Props) => {
const [isTap, setIsTap] = React.useState(false);
const timerRetry = React.useRef<number | undefined>(undefined);

React.useEffect(
() => () => {
clearTimeout(timerRetry.current);
},
[]
);

const handlePress = () => {
setIsTap(true);
clipboardSetStringWithFeedback(props.textToCopy);
// eslint-disable-next-line functional/immutable-data
timerRetry.current = setTimeout(() => setIsTap(false), FEEDBACK_MS);
};

return (
<ButtonDefaultOpacity
onPress={() => clipboardSetStringWithFeedback(props.textToCopy)}
onPress={handlePress}
style={styles.button}
bordered={true}
bordered={!isTap}
primary={isTap}
>
<Text style={styles.text} small={true}>
{I18n.t("clipboard.copyText")}
<Text
style={[styles.text, isTap ? styles.colorWhite : styles.colorBlue]}
small={true}
>
{isTap
? I18n.t("clipboard.copyFeedbackButton")
: I18n.t("clipboard.copyText")}
</Text>
</ButtonDefaultOpacity>
);
}
};

export default CopyButtonComponent;
94 changes: 53 additions & 41 deletions ts/components/InstabugAssistanceComponent.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { BugReporting } from "instabug-reactnative";
import { H3, Text, View } from "native-base";
import { BugReporting, Replies } from "instabug-reactnative";
import { H3, View } from "native-base";
import * as React from "react";
import I18n from "../i18n";
import AdviceComponent from "./AdviceComponent";
import ButtonWithImage from "./ButtonWithImage";
import Markdown from "./ui/Markdown";

type Props = Readonly<{
requestAssistance: (type: BugReporting.reportType) => void;
Expand All @@ -13,44 +14,55 @@ type Props = Readonly<{
* A component to display the buttons to access a new chat with the assistance via Instabug.
* The logic to manage the Instabug APIs is inerithed from the withInstabugHelper HOC.
*/
class InstabugAssistanceComponent extends React.PureComponent<Props> {
public render() {
return (
<React.Fragment>
<H3>{I18n.t("instabug.contextualHelp.title1")}</H3>
<View spacer={true} />
<Text>{I18n.t("instabug.contextualHelp.description")}</Text>
<View spacer={true} />
<Text>{I18n.t("instabug.contextualHelp.descriptionChat")}</Text>
<View spacer={true} large={true} />
<AdviceComponent
text={I18n.t("instabug.contextualHelp.assistanceWorkHours")}
/>
<View spacer={true} />
<ButtonWithImage
icon={"io-bug"}
onPress={() =>
this.props.requestAssistance(BugReporting.reportType.bug)
}
text={I18n.t("instabug.contextualHelp.buttonBug")}
disabled={false}
light={true}
/>
<View spacer={true} />
<Text>{I18n.t("instabug.contextualHelp.descriptionBug")}</Text>
<View spacer={true} />
<ButtonWithImage
icon={"io-send-message"}
onPress={() =>
this.props.requestAssistance(BugReporting.reportType.question)
}
text={I18n.t("instabug.contextualHelp.buttonChat")}
disabled={false}
light={true}
/>
</React.Fragment>
);
}
}

const InstabugAssistanceComponent: React.FunctionComponent<Props> = ({
requestAssistance
}) => {
const [hasPreviousChats, setHasPreviousChats] = React.useState<boolean>(
false
);

React.useEffect(() => {
Replies.hasChats(hasChats => {
setHasPreviousChats(hasChats);
});
});

return (
<>
<H3>{I18n.t("instabug.contextualHelp.title1")}</H3>
<View spacer={true} />
<Markdown>{I18n.t("instabug.contextualHelp.descriptionBug")}</Markdown>
<View spacer={true} large={true} />
<AdviceComponent
text={I18n.t("instabug.contextualHelp.assistanceWorkHours")}
/>
<View spacer={true} />
<ButtonWithImage
icon={"io-bug"}
onPress={() => requestAssistance(BugReporting.reportType.bug)}
text={I18n.t("instabug.contextualHelp.buttonBug")}
disabled={false}
light={true}
/>
{hasPreviousChats && (
<>
<View spacer={true} />
<Markdown>
{I18n.t("instabug.contextualHelp.descriptionChat")}
</Markdown>
<View spacer={true} />
<ButtonWithImage
icon={""}
onPress={() => requestAssistance(BugReporting.reportType.question)}
text={I18n.t("instabug.contextualHelp.buttonChat")}
disabled={false}
light={true}
/>
</>
)}
</>
);
};

export default InstabugAssistanceComponent;
4 changes: 2 additions & 2 deletions ts/components/InstabugChatsComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { BugReporting, dismissType, Replies } from "instabug-reactnative";
import * as React from "react";
import { StyleSheet, View } from "react-native";
import { connect } from "react-redux";
import { openInstabugChat } from "../boot/configureInstabug";
import { openInstabugReplies } from "../boot/configureInstabug";
import I18n from "../i18n";
import {
instabugReportClosed,
Expand Down Expand Up @@ -64,7 +64,7 @@ class InstabugChatsComponent extends React.PureComponent<Props, State> {
instabugReportType: some(BugReporting.reportType.question)
});
this.props.dispatchIBReportOpen(BugReporting.reportType.question);
openInstabugChat(this.state.hasChats);
openInstabugReplies();
};

constructor(props: Props) {
Expand Down
Loading

0 comments on commit aa25467

Please sign in to comment.