Skip to content

Commit

Permalink
Merge branch 'master' into 176417281-return-to-wallet-after-add-bpay
Browse files Browse the repository at this point in the history
  • Loading branch information
Undermaken authored Jan 11, 2021
2 parents ae8544a + f27079c commit 0c343de
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 10 deletions.
Binary file modified img/wallet/payment-methods/bancomatpay-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 14 additions & 2 deletions ts/boot/configureInstabug.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Option } from "fp-ts/lib/Option";
import { fromNullable, Option } from "fp-ts/lib/Option";
import Instabug, {
BugReporting,
NetworkLogger,
Expand All @@ -12,6 +12,7 @@ import { IdentityProvider } from "../models/IdentityProvider";
import variables from "../theme/variables";
import { getAppVersion } from "../utils/appVersion";
import { isDevEnv } from "../utils/environment";
import { SupportToken } from "../../definitions/backend/SupportToken";

type InstabugLocales = { [k in Locales]: Instabug.locale };

Expand All @@ -22,7 +23,8 @@ type InstabugUserAttributeKeys =
| "identityProvider"
| "lastSeenMessageID"
| "appVersion"
| "blockedPaymentRptId";
| "blockedPaymentRptId"
| "supportToken";

const instabugLocales: InstabugLocales = {
en: Instabug.locale.english,
Expand Down Expand Up @@ -120,6 +122,16 @@ export const setInstabugProfileAttributes = (
);
};

// if support token is defined set it as user property
// otherwise remove that attribute
export const setInstabugSupportTokenAttribute = (
supportToken: SupportToken | undefined
) =>
fromNullable(supportToken).foldL(
() => Instabug.removeUserAttribute("supportToken"),
st => setInstabugUserAttribute("supportToken", st.access_token)
);

// The maximum log length accepted by Instabug
const maxInstabugLogLength = 4096;
// margin used for numerate the chunks
Expand Down
28 changes: 20 additions & 8 deletions ts/components/screens/BaseScreenComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@ import * as React from "react";
import { ColorValue, ModalBaseProps, Platform } from "react-native";
import { TranslationKeys } from "../../../locales/locales";
import {
instabugLog,
TypeLogs,
openInstabugQuestionReport,
openInstabugReplies,
DefaultReportAttachmentTypeConfiguration
DefaultReportAttachmentTypeConfiguration,
setInstabugSupportTokenAttribute,
TypeLogs,
instabugLog
} from "../../boot/configureInstabug";
import I18n from "../../i18n";
import customVariables from "../../theme/variables";
Expand All @@ -33,6 +34,7 @@ import {
} from "../ui/Markdown/handlers/link";
import { SupportTokenState } from "../../store/reducers/authentication";
import { getValueOrElse } from "../../features/bonus/bpd/model/RemoteValue";
import { SupportToken } from "../../../definitions/backend/SupportToken";
import { AccessibilityEvents, BaseHeader } from "./BaseHeader";

export interface ContextualHelpProps {
Expand Down Expand Up @@ -131,11 +133,21 @@ class BaseScreenComponent extends React.PureComponent<Props, State> {
const maybeReport = this.state.requestReport;
this.setState({ requestReport: none }, () => {
maybeReport.map(type => {
fromNullable(this.state.supportToken)
.mapNullable(rsp => getValueOrElse(rsp, undefined))
.map(st => {
instabugLog(JSON.stringify(st), TypeLogs.INFO, "support-token");
});
const supportToken = fromNullable(this.state.supportToken)
.mapNullable<SupportToken | undefined>(rsp =>
getValueOrElse(rsp, undefined)
)
.getOrElse(undefined);
// 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);

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

0 comments on commit 0c343de

Please sign in to comment.