Merge pull request #1219 from hydralauncher/feat/intercom-user-id
Some checks failed
Release / build (ubuntu-latest) (push) Failing after 9s
Release / build (windows-latest) (push) Has been cancelled

feat: add intercom user id
This commit is contained in:
Zamitto 2024-11-28 11:27:57 -03:00 committed by GitHub
commit 5bc424796a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 17 additions and 10 deletions

View File

@ -1,4 +1,4 @@
import { appVersion, defaultDownloadsPath } from "@main/constants"; import { appVersion, defaultDownloadsPath, isStaging } from "@main/constants";
import { ipcMain } from "electron"; import { ipcMain } from "electron";
import "./catalogue/get-catalogue"; import "./catalogue/get-catalogue";
@ -72,5 +72,6 @@ import "./misc/show-item-in-folder";
ipcMain.handle("ping", () => "pong"); ipcMain.handle("ping", () => "pong");
ipcMain.handle("getVersion", () => appVersion); ipcMain.handle("getVersion", () => appVersion);
ipcMain.handle("isStaging", () => isStaging);
ipcMain.handle("isPortableVersion", () => isPortableVersion()); ipcMain.handle("isPortableVersion", () => isPortableVersion());
ipcMain.handle("getDefaultDownloadsPath", () => defaultDownloadsPath); ipcMain.handle("getDefaultDownloadsPath", () => defaultDownloadsPath);

View File

@ -198,6 +198,7 @@ contextBridge.exposeInMainWorld("electron", {
ping: () => ipcRenderer.invoke("ping"), ping: () => ipcRenderer.invoke("ping"),
getVersion: () => ipcRenderer.invoke("getVersion"), getVersion: () => ipcRenderer.invoke("getVersion"),
getDefaultDownloadsPath: () => ipcRenderer.invoke("getDefaultDownloadsPath"), getDefaultDownloadsPath: () => ipcRenderer.invoke("getDefaultDownloadsPath"),
isStaging: () => ipcRenderer.invoke("isStaging"),
isPortableVersion: () => ipcRenderer.invoke("isPortableVersion"), isPortableVersion: () => ipcRenderer.invoke("isPortableVersion"),
openExternal: (src: string) => ipcRenderer.invoke("openExternal", src), openExternal: (src: string) => ipcRenderer.invoke("openExternal", src),
openCheckout: () => ipcRenderer.invoke("openCheckout"), openCheckout: () => ipcRenderer.invoke("openCheckout"),

View File

@ -54,7 +54,9 @@ export function Sidebar() {
useEffect(() => { useEffect(() => {
if (userDetails) { if (userDetails) {
window.electron.isStaging().then((isStaging) => {
update({ update({
user_id: userDetails.id + (isStaging ? "-staging" : ""),
name: userDetails.displayName, name: userDetails.displayName,
Username: userDetails.username, Username: userDetails.username,
email: userDetails.email ?? undefined, email: userDetails.email ?? undefined,
@ -62,6 +64,7 @@ export function Sidebar() {
"Subscription expiration date": userDetails?.subscription?.expiresAt, "Subscription expiration date": userDetails?.subscription?.expiresAt,
"Payment status": userDetails?.subscription?.status, "Payment status": userDetails?.subscription?.status,
}); });
});
} }
}, [userDetails, hasActiveSubscription]); }, [userDetails, hasActiveSubscription]);

View File

@ -162,6 +162,7 @@ declare global {
openExternal: (src: string) => Promise<void>; openExternal: (src: string) => Promise<void>;
openCheckout: () => Promise<void>; openCheckout: () => Promise<void>;
getVersion: () => Promise<string>; getVersion: () => Promise<string>;
isStaging: () => Promise<boolean>;
ping: () => string; ping: () => string;
getDefaultDownloadsPath: () => Promise<string>; getDefaultDownloadsPath: () => Promise<string>;
isPortableVersion: () => Promise<boolean>; isPortableVersion: () => Promise<boolean>;

View File

@ -46,7 +46,7 @@ export const removeSymbolsFromName = (name: string) =>
export const removeSpecialEditionFromName = (name: string) => export const removeSpecialEditionFromName = (name: string) =>
name.replace( name.replace(
/(The |Digital )?(GOTY|Deluxe|Standard|Ultimate|Definitive|Enhanced|Collector's|Premium|Digital|Limited|Game of the Year|Reloaded|[0-9]{4}) Edition/g, /(The |Digital )?(GOTY|Deluxe|Standard|Ultimate|Definitive|Enhanced|Collector's|Premium|Digital|Limited|Game of the Year|Reloaded|[0-9]{4}) Edition/gi,
"" ""
); );
@ -73,7 +73,8 @@ export const formatName = pipe<string>(
replaceUnderscoreWithSpace, replaceUnderscoreWithSpace,
replaceDotsWithSpace, replaceDotsWithSpace,
replaceNbspWithSpace, replaceNbspWithSpace,
(str) => str.replace(/DIRECTOR'S CUT/g, ""), (str) => str.replace(/DIRECTOR'S CUT/gi, ""),
(str) => str.replace(/Friend's Pass/gi, ""),
removeSymbolsFromName, removeSymbolsFromName,
removeDuplicateSpaces, removeDuplicateSpaces,
(str) => str.trim() (str) => str.trim()