Skip to content
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

fix(Bonus Pagamenti Digitali): [#176193377] Ask to send cf only on new assistance request #2710

Merged
merged 7 commits into from
Jan 11, 2021
17 changes: 10 additions & 7 deletions ts/components/ContextualHelpModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -140,19 +140,22 @@ const ContextualHelpModal: React.FunctionComponent<Props> = (props: Props) => {
);

/**
* If the user is authenticated we show the screen that allows to choice or not to send the personal token
* If the user is authenticated and is a new request we show the screen that allows to choice or not to send the personal token
* to the assistance.
* Otherwise we allow the user to open directly a new assistance request without sending the personal token.
* Otherwise we allow the user to open directly a the assistance request (new or not) without sending the personal token.
* @param reportType
*/
const handleOnRequestAssistance = (reportType: BugReporting.reportType) => {
if (props.isAuthenticated) {
// refresh / load support token
props.loadSupportToken();

setShowSendPersonalInfo(true);
setSupportType(reportType);
return;

// ask to send the personal information to the assistance only for a new bug.
if (reportType === BugReporting.reportType.bug) {
// refresh / load support token
props.loadSupportToken();
setShowSendPersonalInfo(true);
Undermaken marked this conversation as resolved.
Show resolved Hide resolved
return;
}
}
props.onRequestAssistance(reportType, props.supportToken);
};
Expand Down
22 changes: 13 additions & 9 deletions ts/components/screens/BaseScreenComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -138,16 +138,20 @@ class BaseScreenComponent extends React.PureComponent<Props, State> {
getValueOrElse(rsp, undefined)
)
.getOrElse(undefined);
// log on instabug the support token
if (supportToken) {
instabugLog(
JSON.stringify(supportToken),
TypeLogs.INFO,
"support-token"
);

// Store/remove and log the support token only if is a new assistance request.
if (type === BugReporting.reportType.bug) {
// log on instabug the support token
if (supportToken) {
instabugLog(
JSON.stringify(supportToken),
TypeLogs.INFO,
"support-token"
);
}
// set or remove the support token as instabug user attribute
setInstabugSupportTokenAttribute(supportToken);
}
// set or remove the support token as instabug user attribute
setInstabugSupportTokenAttribute(supportToken);

switch (type) {
case BugReporting.reportType.bug:
Expand Down