The Welcome Home Screen: Return Button (#9089)

* Implement button to return to user onboarding screen
* Add analytics events
* Increase stability of lazy loading test
This commit is contained in:
Janne Mareike Koschinski 2022-08-12 12:55:31 +02:00 committed by GitHub
parent 8db7766a40
commit 9eaf48b176
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 241 additions and 28 deletions

View file

@ -14,8 +14,9 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
import { useCallback, useEffect, useState } from "react";
import { logger } from "matrix-js-sdk/src/logger";
import { ClientEvent, IMyDevice, Room } from "matrix-js-sdk/src/matrix";
import { useCallback, useEffect, useState } from "react";
import { MatrixClientPeg } from "../MatrixClientPeg";
import DMRoomMap from "../utils/DMRoomMap";
@ -33,18 +34,23 @@ export function useUserOnboardingContext(): UserOnboardingContext | null {
const cli = MatrixClientPeg.get();
const handler = useCallback(async () => {
const profile = await cli.getProfileInfo(cli.getUserId());
try {
const profile = await cli.getProfileInfo(cli.getUserId());
const myDevice = cli.getDeviceId();
const devices = await cli.getDevices();
const myDevice = cli.getDeviceId();
const devices = await cli.getDevices();
const dmRooms = DMRoomMap.shared().getUniqueRoomsWithIndividuals() ?? {};
setContext({
avatar: profile?.avatar_url ?? null,
myDevice,
devices: devices.devices,
dmRooms: dmRooms,
});
const dmRooms = DMRoomMap.shared().getUniqueRoomsWithIndividuals() ?? {};
setContext({
avatar: profile?.avatar_url ?? null,
myDevice,
devices: devices.devices,
dmRooms: dmRooms,
});
} catch (e) {
logger.warn("Could not load context for user onboarding task list: ", e);
setContext(null);
}
}, [cli]);
useEventEmitter(cli, ClientEvent.AccountData, handler);