Repository navigation
feat(mobile): gate the app behind a paid plan and flatten settings #6414
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,11 @@ | ||
| import { useSession } from "@/lib/auth/client"; | ||
| import { HomeScreen } from "@/screens/(authenticated)/(home)/home"; | ||
| import { HomePaywallScreen } from "@/screens/(authenticated)/(home)/home-paywall"; | ||
|
|
||
| export default HomeScreen; | ||
| export default function HomeIndex() { | ||
| const { data: session } = useSession(); | ||
| if (session && !session.session.plan) { | ||
| return <HomePaywallScreen />; | ||
| } | ||
| return <HomeScreen />; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
apps/mobile/screens/(auth)/sign-in/components/EmailSignInLink/EmailSignInLink.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| import { prompt } from "@superset/alert-prompt"; | ||
| import { useState } from "react"; | ||
| import { Text } from "@/components/ui/text"; | ||
| import { signIn } from "@/lib/auth/client"; | ||
|
|
||
| /** Quiet credential sign-in for accounts with a password set (App Store | ||
| * review demo account; sign-up stays disabled in production). */ | ||
| export function EmailSignInLink({ | ||
| onError, | ||
| }: { | ||
| onError: (message: string) => void; | ||
| }) { | ||
| const [isLoading, setIsLoading] = useState(false); | ||
|
|
||
| const handlePress = async () => { | ||
| const email = ( | ||
| await prompt({ | ||
| title: "Sign in with email", | ||
| message: "Email", | ||
| confirmText: "Next", | ||
| }) | ||
| )?.trim(); | ||
| if (!email) return; | ||
|
|
||
| const password = await prompt({ | ||
| title: "Sign in with email", | ||
| message: `Password for ${email}`, | ||
| confirmText: "Sign in", | ||
| }); | ||
| if (!password) return; | ||
|
|
||
| setIsLoading(true); | ||
| try { | ||
| const res = await signIn.email({ email, password }); | ||
| if (res.error) throw new Error(res.error.message); | ||
| } catch (err) { | ||
| console.error("[sign-in] Email error:", err); | ||
| onError(err instanceof Error ? err.message : "Something went wrong"); | ||
| } finally { | ||
| setIsLoading(false); | ||
| } | ||
| }; | ||
|
|
||
| return ( | ||
| <Text | ||
| className="text-sm text-muted-foreground underline" | ||
| onPress={isLoading ? undefined : () => void handlePress()} | ||
| > | ||
| Sign in with email | ||
| </Text> | ||
| ); | ||
| } |
1 change: 1 addition & 0 deletions
1
apps/mobile/screens/(auth)/sign-in/components/EmailSignInLink/index.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| export { EmailSignInLink } from "./EmailSignInLink"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
77 changes: 77 additions & 0 deletions
77
apps/mobile/screens/(authenticated)/(home)/home-paywall/HomePaywallScreen.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,77 @@ | ||
| import Ionicons from "@expo/vector-icons/Ionicons"; | ||
| import * as Haptics from "expo-haptics"; | ||
| import { useState } from "react"; | ||
| import { useWindowDimensions, View } from "react-native"; | ||
| import { Button } from "@/components/ui/button"; | ||
| import { Text } from "@/components/ui/text"; | ||
| import { useTheme } from "@/hooks/useTheme"; | ||
| import { useSession } from "@/lib/auth/client"; | ||
| import { useOrganizations } from "@/screens/(authenticated)/hooks/useOrganizations"; | ||
| import { OrganizationHeaderButton } from "../home/components/OrganizationHeaderButton"; | ||
| import { OrganizationSwitcherSheet } from "../home/components/OrganizationSwitcherSheet"; | ||
|
|
||
| /** Home content for accounts whose active org has no paid plan. The shell | ||
| * stays fully navigable — the org switcher sheet also carries the Settings | ||
| * entry, so plan changes, org switches, and account deletion all use the | ||
| * normal surfaces. The trpc middleware is the actual wall. */ | ||
| export function HomePaywallScreen() { | ||
| const theme = useTheme(); | ||
| const { width } = useWindowDimensions(); | ||
| const { refetch } = useSession(); | ||
| const { | ||
| organizations, | ||
| activeOrganization, | ||
| activeOrganizationId, | ||
| switchOrganization, | ||
| } = useOrganizations(); | ||
| const [sheetOpen, setSheetOpen] = useState(false); | ||
|
|
||
| const handleSwitchOrganization = (organizationId: string) => { | ||
| setSheetOpen(false); | ||
| void switchOrganization(organizationId).then(() => refetch()); | ||
| }; | ||
|
|
||
| return ( | ||
| <> | ||
| <OrganizationHeaderButton | ||
| name={activeOrganization?.name} | ||
| logo={activeOrganization?.logo} | ||
| onPress={() => { | ||
| void Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Light); | ||
| setSheetOpen(true); | ||
| }} | ||
| /> | ||
| <View className="flex-1 items-center justify-center gap-6 bg-background p-6"> | ||
| <View | ||
| className="size-16 items-center justify-center rounded-full" | ||
| style={{ backgroundColor: theme.muted }} | ||
| > | ||
| <Ionicons name="lock-closed" size={32} color={theme.foreground} /> | ||
| </View> | ||
|
|
||
| <View className="items-center gap-2"> | ||
| <Text className="text-2xl font-semibold text-foreground"> | ||
| Superset Mobile is part of Pro | ||
| </Text> | ||
| <Text className="text-center text-base text-muted-foreground"> | ||
| {activeOrganization | ||
| ? `${activeOrganization.name} is on the Free plan. Superset Mobile is available for organizations on Pro.` | ||
| : "This organization is on the Free plan. Superset Mobile is available for organizations on Pro."} | ||
| </Text> | ||
| </View> | ||
|
|
||
| <Button size="lg" className="w-4/5" onPress={() => void refetch()}> | ||
| <Text>Refresh</Text> | ||
| </Button> | ||
| </View> | ||
| <OrganizationSwitcherSheet | ||
| isPresented={sheetOpen} | ||
| onIsPresentedChange={setSheetOpen} | ||
| organizations={organizations} | ||
| activeOrganizationId={activeOrganizationId} | ||
| onSwitchOrganization={handleSwitchOrganization} | ||
| width={width} | ||
| /> | ||
| </> | ||
| ); | ||
| } |
1 change: 1 addition & 0 deletions
1
apps/mobile/screens/(authenticated)/(home)/home-paywall/index.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| export { HomePaywallScreen } from "./HomePaywallScreen"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Make the placeholder match the searchable fields.
Line 347 says
Search workspaces, butvisibleWorkspacesstill searches terminal session titles throughsessionsMatchat Lines 125-147. RestoreSearch workspaces and sessions, or remove session-title matching if the narrower scope is intentional.Proposed fix
📝 Committable suggestion
🤖 Prompt for AI Agents