Merge branch 'main' into missing-audio-logs
This commit is contained in:
commit
fb75c1536b
4 changed files with 14 additions and 6 deletions
|
@ -7,7 +7,6 @@ export VITE_PRODUCT_NAME="Element Call"
|
||||||
|
|
||||||
git clone https://github.com/matrix-org/matrix-js-sdk.git
|
git clone https://github.com/matrix-org/matrix-js-sdk.git
|
||||||
cd matrix-js-sdk
|
cd matrix-js-sdk
|
||||||
git checkout robertlong/group-call
|
|
||||||
yarn install
|
yarn install
|
||||||
yarn run build
|
yarn run build
|
||||||
yarn link
|
yarn link
|
||||||
|
|
|
@ -18,7 +18,7 @@ import posthog, { CaptureOptions, PostHog, Properties } from "posthog-js";
|
||||||
import { logger } from "matrix-js-sdk/src/logger";
|
import { logger } from "matrix-js-sdk/src/logger";
|
||||||
|
|
||||||
import { widget } from "./widget";
|
import { widget } from "./widget";
|
||||||
import { settingsBus } from "./settings/useSetting";
|
import { getSetting, settingsBus } from "./settings/useSetting";
|
||||||
import {
|
import {
|
||||||
CallEndedTracker,
|
CallEndedTracker,
|
||||||
CallStartedTracker,
|
CallStartedTracker,
|
||||||
|
@ -97,7 +97,7 @@ export class PosthogAnalytics {
|
||||||
private static internalInstance = null;
|
private static internalInstance = null;
|
||||||
|
|
||||||
private readonly enabled: boolean = false;
|
private readonly enabled: boolean = false;
|
||||||
private anonymity = Anonymity.Pseudonymous;
|
private anonymity = Anonymity.Disabled;
|
||||||
private platformSuperProperties = {};
|
private platformSuperProperties = {};
|
||||||
private registrationType: RegistrationType = RegistrationType.Guest;
|
private registrationType: RegistrationType = RegistrationType.Guest;
|
||||||
|
|
||||||
|
@ -132,6 +132,8 @@ export class PosthogAnalytics {
|
||||||
} else {
|
} else {
|
||||||
this.enabled = false;
|
this.enabled = false;
|
||||||
}
|
}
|
||||||
|
const optInAnalytics = getSetting("opt-in-analytics", false);
|
||||||
|
this.updateAnonymityFromSettingsAndIdentifyUser(optInAnalytics);
|
||||||
this.startListeningToSettingsChanges();
|
this.startListeningToSettingsChanges();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -270,10 +272,11 @@ export class PosthogAnalytics {
|
||||||
}
|
}
|
||||||
|
|
||||||
private userRegisteredInThisSession(): boolean {
|
private userRegisteredInThisSession(): boolean {
|
||||||
|
// only if the signup end got tracked the end time is set. Otherwise its default value is Date(0).
|
||||||
return this.eventSignup.getSignupEndTime() > new Date(0);
|
return this.eventSignup.getSignupEndTime() > new Date(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async updateAnonymityFromSettings(
|
public async updateAnonymityFromSettingsAndIdentifyUser(
|
||||||
pseudonymousOptIn: boolean
|
pseudonymousOptIn: boolean
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
// Update this.anonymity based on the user's analytics opt-in settings
|
// Update this.anonymity based on the user's analytics opt-in settings
|
||||||
|
@ -315,7 +318,7 @@ export class PosthogAnalytics {
|
||||||
// Note that for new accounts, pseudonymousAnalyticsOptIn won't be set, so updateAnonymityFromSettings
|
// Note that for new accounts, pseudonymousAnalyticsOptIn won't be set, so updateAnonymityFromSettings
|
||||||
// won't be called (i.e. this.anonymity will be left as the default, until the setting changes)
|
// won't be called (i.e. this.anonymity will be left as the default, until the setting changes)
|
||||||
settingsBus.on("opt-in-analytics", (optInAnalytics) => {
|
settingsBus.on("opt-in-analytics", (optInAnalytics) => {
|
||||||
this.updateAnonymityFromSettings(optInAnalytics);
|
this.updateAnonymityFromSettingsAndIdentifyUser(optInAnalytics);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,6 +51,12 @@ const useSetting = <T>(
|
||||||
),
|
),
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
export const getSetting = <T>(name: string, defaultValue: T): T => {
|
||||||
|
const key = `matrix-setting-${name}`;
|
||||||
|
|
||||||
|
const item = localStorage.getItem(key);
|
||||||
|
return item === null ? defaultValue : JSON.parse(item);
|
||||||
|
};
|
||||||
|
|
||||||
export const useSpatialAudio = () => useSetting("spatial-audio", false);
|
export const useSpatialAudio = () => useSetting("spatial-audio", false);
|
||||||
export const useShowInspector = () => useSetting("show-inspector", false);
|
export const useShowInspector = () => useSetting("show-inspector", false);
|
||||||
|
|
|
@ -72,7 +72,7 @@ export function VideoTileContainer({
|
||||||
audioContext,
|
audioContext,
|
||||||
audioDestination,
|
audioDestination,
|
||||||
localVolume,
|
localVolume,
|
||||||
isLocal
|
isLocal || maximised,
|
||||||
);
|
);
|
||||||
const {
|
const {
|
||||||
modalState: videoTileSettingsModalState,
|
modalState: videoTileSettingsModalState,
|
||||||
|
|
Loading…
Add table
Reference in a new issue