-
Notifications
You must be signed in to change notification settings - Fork 180
Migrate web view screen and components to sdk #1293
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
Closed
Closed
Changes from 9 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
7122b7e
feat: add shared webview screen
transphorm e0427e0
get react web view working
transphorm d26e9ca
fix default
transphorm 8da77f6
fix footer
transphorm de3af81
fix nav header
transphorm 99adaa3
android layout looks good
transphorm 4da40b5
Merge branch 'dev' into codex/add-webview-screen-with-header-and-footer
transphorm b84b13d
fix initial screen
transphorm d7c7b30
add webview types
transphorm 7c1a603
fix types
transphorm c420f05
Merge branch 'dev' into justin/migrate-webview-screen-to-sdk
transphorm 977391c
fix these tests
transphorm 1a44efb
update packages
transphorm 4f7148d
fix pipelines?
transphorm 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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,91 @@ | ||
| // SPDX-FileCopyrightText: 2025 Social Connect Labs, Inc. | ||
| // SPDX-License-Identifier: BUSL-1.1 | ||
| // NOTE: Converts to Apache-2.0 on 2029-06-11 per LICENSE. | ||
|
|
||
| import React from 'react'; | ||
| import { StyleSheet, Text } from 'react-native'; | ||
| import { useSafeAreaInsets } from 'react-native-safe-area-context'; | ||
| import { ExternalLink, X } from '@tamagui/lucide-icons'; | ||
|
|
||
| import { Button, XStack } from '@selfxyz/mobile-sdk-alpha/components'; | ||
|
|
||
| import { black } from '@/utils/colors'; | ||
| import { dinot } from '@/utils/fonts'; | ||
| import { buttonTap } from '@/utils/haptic'; | ||
|
|
||
| export interface WebViewNavBarProps { | ||
| title?: string; | ||
| canGoBack?: boolean; | ||
| onBackPress: () => void; | ||
| onSharePress?: () => void; | ||
| onOpenExternalPress?: () => void; | ||
| isShareDisabled?: boolean; | ||
| isOpenExternalDisabled?: boolean; | ||
| } | ||
|
|
||
| export const WebViewNavBar: React.FC<WebViewNavBarProps> = ({ | ||
| title, | ||
| onBackPress, | ||
| onOpenExternalPress, | ||
| isOpenExternalDisabled, | ||
| }) => { | ||
| const insets = useSafeAreaInsets(); | ||
|
|
||
| return ( | ||
| <XStack | ||
| paddingHorizontal={20} | ||
| paddingVertical={10} | ||
| paddingTop={insets.top + 10} | ||
| gap={14} | ||
| alignItems="center" | ||
| backgroundColor="white" | ||
| > | ||
| {/* Left: Close Button */} | ||
| <Button | ||
| unstyled | ||
| hitSlop={{ top: 20, bottom: 20, left: 20, right: 10 }} | ||
| icon={<X size={24} color={black} />} | ||
| onPress={() => { | ||
| buttonTap(); | ||
| onBackPress(); | ||
| }} | ||
| /> | ||
|
|
||
| {/* Center: Title */} | ||
| <XStack flex={1} alignItems="center" justifyContent="center"> | ||
| <Text style={styles.title} numberOfLines={1}> | ||
| {title?.toUpperCase() || 'PAGE TITLE'} | ||
| </Text> | ||
| </XStack> | ||
|
|
||
| {/* Right: Open External Button */} | ||
| <Button | ||
| unstyled | ||
| disabled={isOpenExternalDisabled} | ||
| hitSlop={{ top: 20, bottom: 20, left: 10, right: 20 }} | ||
| icon={ | ||
| <ExternalLink | ||
| size={24} | ||
| color={isOpenExternalDisabled ? black : black} | ||
| opacity={isOpenExternalDisabled ? 0.3 : 1} | ||
| /> | ||
| } | ||
| onPress={() => { | ||
| buttonTap(); | ||
| onOpenExternalPress?.(); | ||
| }} | ||
| /> | ||
| </XStack> | ||
| ); | ||
| }; | ||
|
|
||
| const styles = StyleSheet.create({ | ||
| title: { | ||
| fontFamily: dinot, | ||
| fontSize: 15, | ||
| color: black, | ||
| letterSpacing: 0.6, | ||
| textAlign: 'center', | ||
| textTransform: 'uppercase', | ||
| }, | ||
| }); | ||
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,86 @@ | ||
| // SPDX-FileCopyrightText: 2025 Social Connect Labs, Inc. | ||
| // SPDX-License-Identifier: BUSL-1.1 | ||
| // NOTE: Converts to Apache-2.0 on 2029-06-11 per LICENSE. | ||
|
|
||
| import React from 'react'; | ||
| import { ArrowLeft, ArrowRight, RotateCcw } from '@tamagui/lucide-icons'; | ||
|
|
||
| import { Button, XStack, YStack } from '@selfxyz/mobile-sdk-alpha/components'; | ||
|
|
||
| import { black, slate50, slate400 } from '@/utils/colors'; | ||
| import { buttonTap } from '@/utils/haptic'; | ||
|
|
||
| export interface WebViewFooterProps { | ||
| canGoBack: boolean; | ||
| canGoForward: boolean; | ||
| onGoBack: () => void; | ||
| onGoForward: () => void; | ||
| onReload: () => void; | ||
| onOpenInBrowser: () => void; | ||
| } | ||
|
|
||
| const iconSize = 22; | ||
| const buttonSize = 36; | ||
|
|
||
| export const WebViewFooter: React.FC<WebViewFooterProps> = ({ | ||
| canGoBack, | ||
| canGoForward, | ||
| onGoBack, | ||
| onGoForward, | ||
| onReload, | ||
| onOpenInBrowser: _onOpenInBrowser, | ||
| }) => { | ||
| const renderIconButton = ( | ||
| key: string, | ||
| icon: React.ReactNode, | ||
| onPress: () => void, | ||
| disabled?: boolean, | ||
| ) => ( | ||
| <Button | ||
| key={key} | ||
| size="$4" | ||
| unstyled | ||
| disabled={disabled} | ||
| onPress={() => { | ||
| buttonTap(); | ||
| onPress(); | ||
| }} | ||
| backgroundColor={slate50} | ||
| borderRadius={buttonSize / 2} | ||
| width={buttonSize} | ||
| height={buttonSize} | ||
| alignItems="center" | ||
| justifyContent="center" | ||
| opacity={disabled ? 0.5 : 1} | ||
| > | ||
| {icon} | ||
| </Button> | ||
| ); | ||
transphorm marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| return ( | ||
| <YStack gap={12} paddingVertical={12} width="100%"> | ||
| <XStack justifyContent="space-between" alignItems="center" width="100%"> | ||
| {renderIconButton( | ||
| 'back', | ||
| <ArrowLeft size={iconSize} color={canGoBack ? black : slate400} />, | ||
| onGoBack, | ||
| !canGoBack, | ||
| )} | ||
| {renderIconButton( | ||
| 'reload', | ||
| <RotateCcw size={iconSize} color={black} />, | ||
| onReload, | ||
| )} | ||
| {renderIconButton( | ||
| 'forward', | ||
| <ArrowRight | ||
| size={iconSize} | ||
| color={canGoForward ? black : slate400} | ||
| />, | ||
| onGoForward, | ||
| !canGoForward, | ||
| )} | ||
| </XStack> | ||
| </YStack> | ||
| ); | ||
| }; | ||
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
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,19 @@ | ||
| // SPDX-FileCopyrightText: 2025 Social Connect Labs, Inc. | ||
| // SPDX-License-Identifier: BUSL-1.1 | ||
| // NOTE: Converts to Apache-2.0 on 2029-06-11 per LICENSE. | ||
|
|
||
| import type { DocumentCategory } from '@selfxyz/common/types'; | ||
|
|
||
| export type SharedRoutesParamList = { | ||
| ComingSoon: { | ||
| countryCode?: string; | ||
| documentCategory?: DocumentCategory; | ||
| }; | ||
| WebView: { | ||
| url: string; | ||
| title?: string; | ||
| shareTitle?: string; | ||
| shareMessage?: string; | ||
| shareUrl?: string; | ||
| }; | ||
| }; |
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 |
|---|---|---|
|
|
@@ -33,14 +33,15 @@ import Star from '@/images/icons/star.svg'; | |
| import Telegram from '@/images/icons/telegram.svg'; | ||
| import Web from '@/images/icons/webpage.svg'; | ||
| import X from '@/images/icons/x.svg'; | ||
| import type { RootStackParamList } from '@/navigation'; | ||
| import { useSettingStore } from '@/stores/settingStore'; | ||
| import { amber500, black, neutral700, slate800, white } from '@/utils/colors'; | ||
| import { extraYPadding } from '@/utils/constants'; | ||
| import { impactLight } from '@/utils/haptic'; | ||
| import { getCountry, getLocales, getTimeZone } from '@/utils/locale'; | ||
|
|
||
| import { version } from '../../../../package.json'; | ||
| // Avoid importing RootStackParamList to prevent type cycles; use minimal typing | ||
| type MinimalRootStackParamList = Record<string, object | undefined>; | ||
|
|
||
transphorm marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| interface MenuButtonProps extends PropsWithChildren { | ||
| Icon: React.FC<SvgProps>; | ||
|
|
@@ -52,11 +53,8 @@ interface SocialButtonProps { | |
| } | ||
|
|
||
| const emailFeedback = '[email protected]'; | ||
| type RouteOption = | ||
| | keyof RootStackParamList | ||
| | 'share' | ||
| | 'email_feedback' | ||
| | 'ManageDocuments'; | ||
| // Avoid importing RootStackParamList; we only need string route names plus a few literals | ||
| type RouteOption = string | 'share' | 'email_feedback' | 'ManageDocuments'; | ||
|
|
||
| const storeURL = Platform.OS === 'ios' ? appStoreUrl : playStoreUrl; | ||
|
|
||
|
|
@@ -144,7 +142,7 @@ const SocialButton: React.FC<SocialButtonProps> = ({ Icon, href }) => { | |
| const SettingsScreen: React.FC = () => { | ||
| const { isDevMode, setDevModeOn } = useSettingStore(); | ||
| const navigation = | ||
| useNavigation<NativeStackNavigationProp<RootStackParamList>>(); | ||
| useNavigation<NativeStackNavigationProp<MinimalRootStackParamList>>(); | ||
|
|
||
| const screenRoutes = useMemo(() => { | ||
| return isDevMode ? [...routes, ...DEBUG_MENU] : routes; | ||
|
|
@@ -230,9 +228,11 @@ ${deviceInfo.map(([k, v]) => `${k}=${v}`).join('; ')} | |
| justifyContent="flex-start" | ||
| width="100%" | ||
| > | ||
| {screenRoutes.map(([Icon, menuText, menuRoute]) => ( | ||
| {screenRoutes.map(([Icon, menuText, menuRoute], idx) => ( | ||
| <MenuButton | ||
| key={menuRoute} | ||
| key={ | ||
| typeof menuRoute === 'string' ? menuRoute : String(idx) | ||
| } | ||
| Icon={Icon} | ||
| onPress={onMenuPress(menuRoute)} | ||
| > | ||
|
|
||
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.
Uh oh!
There was an error while loading. Please reload this page.