Skip to content

Commit

Permalink
Merge pull request #2709 from robintown/app-prompt-config
Browse files Browse the repository at this point in the history
Add a config option to disable the app prompt
  • Loading branch information
robintown authored Nov 1, 2024
2 parents 8f8e2b4 + 7ad7006 commit c9cf7aa
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 0 deletions.
2 changes: 2 additions & 0 deletions docs/url-params.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ confineToRoom: boolean; (default: false)
Whether upon entering a room, the user should be prompted to launch the
native mobile app. (Affects only Android and iOS.)

The app prompt must also be enabled in the config for this to take effect.

```ts
appPrompt: boolean; (default: true)
```
Expand Down
2 changes: 2 additions & 0 deletions src/UrlParams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ export interface UrlParams {
/**
* Whether upon entering a room, the user should be prompted to launch the
* native mobile app. (Affects only Android and iOS.)
*
* The app prompt must also be enabled in the config for this to take effect.
*/
appPrompt: boolean;
/**
Expand Down
10 changes: 10 additions & 0 deletions src/config/ConfigOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,14 @@ export interface ConfigOptions {
*/
enable_video?: boolean;
};

/**
* Whether upon entering a room, the user should be prompted to launch the
* native mobile app. (Affects only Android and iOS.)
*
* Note that this can additionally be disabled by the app's URL parameters.
*/
app_prompt?: boolean;
}

// Overrides members from ConfigOptions that are always provided by the
Expand All @@ -103,6 +111,7 @@ export interface ResolvedConfigOptions extends ConfigOptions {
enable_audio: boolean;
enable_video: boolean;
};
app_prompt: boolean;
}

export const DEFAULT_CONFIG: ResolvedConfigOptions = {
Expand All @@ -117,4 +126,5 @@ export const DEFAULT_CONFIG: ResolvedConfigOptions = {
enable_audio: true,
enable_video: true,
},
app_prompt: true,
};
2 changes: 2 additions & 0 deletions src/room/RoomPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import { E2eeType } from "../e2ee/e2eeType";
import { useProfile } from "../profile/useProfile";
import { useMuteStates } from "./MuteStates";
import { useOptInAnalytics } from "../settings/settings";
import { Config } from "../config/Config";

export const RoomPage: FC = () => {
const {
Expand Down Expand Up @@ -185,6 +186,7 @@ export const RoomPage: FC = () => {
{content}
{/* On Android and iOS, show a prompt to launch the mobile app. */}
{appPrompt &&
Config.get().app_prompt &&
(platform === "android" || platform === "ios") &&
roomId && <AppSelectionModal roomId={roomId} />}
</>
Expand Down

0 comments on commit c9cf7aa

Please sign in to comment.