Skip to content

Commit

Permalink
Merge pull request #57 from brave/tackley/issue16
Browse files Browse the repository at this point in the history
give `/talk` non-subscribers options to create the call anyway and to login
  • Loading branch information
tackley committed Dec 1, 2021
2 parents 3d28495 + 7106420 commit aa44f91
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,10 @@ const renderHomePage = (options: WelcomeScreenOptions) => {
reportAction("braveRequestAdsEnabled", { result });
if (result) {
// good to start the call now
joinConferenceRoom(generateRoomName(), true);
joinConferenceRoom(
options.roomNameOverride ?? generateRoomName(),
true
);
return;
}

Expand All @@ -329,7 +332,10 @@ const renderHomePage = (options: WelcomeScreenOptions) => {
window.location.reload();
};
} else {
joinConferenceRoom(generateRoomName(), true);
joinConferenceRoom(
options.roomNameOverride ?? generateRoomName(),
true
);
}
};
}
Expand Down Expand Up @@ -585,6 +591,11 @@ const joinConferenceRoom = async (
const isSubscribed = await userIsSubscribed();
if (!isSubscribed) {
notice("Waiting for a subscriber to create the room...");
renderHomePage({
showSubscribeCTA: true,
showStartCall: true,
roomNameOverride: roomName,
});
setTimeout(() => joinConferenceRoom(roomName, false), 5_000);
return;
}
Expand Down
5 changes: 5 additions & 0 deletions src/rules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ export interface WelcomeScreenOptions {
// it asks for the user to opt in - either by manual instruction UI
// or by calling braveRequestAdsEnabled if available
startCallButtonPromptsOptIn?: boolean;

// in some cases, we know the name room we'd want to join/create,
// (e.g. when `create=y` is present), so allow override
// of the auto-generated room name
roomNameOverride?: string;
}

export function checkJoinRoom(
Expand Down

0 comments on commit aa44f91

Please sign in to comment.