Skip to content

Commit

Permalink
TCAHP: remove toast analytics and browser support
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcWadai committed Jan 22, 2025
1 parent ab6c9b4 commit 26b1ec9
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 19 deletions.
6 changes: 6 additions & 0 deletions patches/tchap-modifications.json
Original file line number Diff line number Diff line change
Expand Up @@ -180,5 +180,11 @@
"src/components/views/auth/AuthPage.tsx",
"src/vector/index.html"
]
},
"remove-toast-analytics-browser-support": {
"issue": "https://github.com/tchapgouv/tchap-web-v4/issues/1222",
"files": [
"src/SupportedBrowser.ts"
]
}
}
32 changes: 17 additions & 15 deletions src/SupportedBrowser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,19 +96,21 @@ export function checkBrowserSupport(): void {
return;
}

const brand = SdkConfig.get().brand;
ToastStore.sharedInstance().addOrReplaceToast({
key: TOAST_KEY,
title: _t("unsupported_browser|title", { brand }),
props: {
description: _t("unsupported_browser|description", { brand }),
secondaryLabel: _t("action|learn_more"),
SecondaryIcon: PopOutIcon,
onSecondaryClick: onLearnMoreClick,
primaryLabel: _t("action|dismiss"),
onPrimaryClick: onDismissClick,
},
component: GenericToast,
priority: 40,
});
//:TCHAP: remove-toast-analytics-browser-support
// const brand = SdkConfig.get().brand;
// ToastStore.sharedInstance().addOrReplaceToast({
// key: TOAST_KEY,
// title: _t("unsupported_browser|title", { brand }),
// props: {
// description: _t("unsupported_browser|description", { brand }),
// secondaryLabel: _t("action|learn_more"),
// SecondaryIcon: PopOutIcon,
// onSecondaryClick: onLearnMoreClick,
// primaryLabel: _t("action|dismiss"),
// onPrimaryClick: onDismissClick,
// },
// component: GenericToast,
// priority: 40,
// });
// end
}
14 changes: 10 additions & 4 deletions src/components/structures/MatrixChat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1443,7 +1443,10 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
private initPosthogAnalyticsToast(): void {
// Show the analytics toast if necessary
if (SettingsStore.getValue("pseudonymousAnalyticsOptIn") === null) {
showAnalyticsToast();
// :TCHAP: remove-toast-analytics-browser-support - showAnalyticsToast();
// default the analytics to true
SettingsStore.setValue("pseudonymousAnalyticsOptIn", null, SettingLevel.ACCOUNT, true);
// end :TCHAP:
}

// Listen to changes in settings and show the toast if appropriate - this is necessary because account
Expand All @@ -1454,15 +1457,18 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
null,
(originalSettingName, changedInRoomId, atLevel, newValueAtLevel, newValue) => {
if (newValue === null) {
showAnalyticsToast();
} else {
// :TCHAP: remove-toast-analytics-browser-support - showAnalyticsToast();
// default the analytics to true
SettingsStore.setValue("pseudonymousAnalyticsOptIn", null, SettingLevel.ACCOUNT, true);
} /*else {
// It's possible for the value to change if a cached sync loads at page load, but then network
// sync contains a new value of the flag with it set to false (e.g. another device set it since last
// loading the page); so hide the toast.
// (this flipping usually happens before first render so the user won't notice it; anyway flicker
// on/off is probably better than showing the toast again when the user already dismissed it)
hideAnalyticsToast();
}
}*/
// end :TCHAP:
},
);
}
Expand Down

0 comments on commit 26b1ec9

Please sign in to comment.