Repository navigation
feat: Pre flight #7038
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
feat: Pre flight #7038
Changes from 17 commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
393937f
base action sheet
diegolmello 70663fc
base autocomplete
diegolmello 62b723a
refactor components
diegolmello 9ef3a0e
Small refactor and auto fill peer
diegolmello 117cb0d
refactor: update NewMediaCall components for improved type handling a…
diegolmello 38c182f
Update tests
diegolmello 50c1149
Add unit tests
diegolmello 6c316d4
Fixed chip and improve stories
diegolmello 9341fa8
Reset store when action sheet is closed
diegolmello 42bffbe
create separate BaseButton component on RoomInfo
diegolmello 35142f4
refactor: replace useMediaCallPermission with useNewMediaCall for imp…
diegolmello 0f9b6a5
Refactor
diegolmello 5de5f50
Update unit tests
diegolmello 6b545c5
chore: format code and fix lint issues
diegolmello 6974083
refactor: simplify NewMediaCall components by removing unused state m…
diegolmello b8cfd58
Update tests
diegolmello 59fb65f
Fix tests
diegolmello b9fd3e7
Fix tests
diegolmello 1d48d38
Atomic update
diegolmello cd623c1
Improve use sub and write tests
diegolmello 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
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,54 @@ | ||
| import React from 'react'; | ||
| import { StyleSheet, Text, View } from 'react-native'; | ||
| import BottomSheet from '@discord/bottom-sheet'; | ||
|
|
||
| import { Container } from './Container'; | ||
|
|
||
| const styles = StyleSheet.create({ | ||
| root: { | ||
| flex: 1 | ||
| }, | ||
| placeholder: { | ||
| marginTop: 8, | ||
| padding: 12, | ||
| borderRadius: 6, | ||
| backgroundColor: '#efefef' | ||
| } | ||
| }); | ||
|
|
||
| const PlaceholderChildren = () => ( | ||
| <View style={styles.placeholder}> | ||
| <Text>Mock children placeholder</Text> | ||
| </View> | ||
| ); | ||
|
|
||
| const BottomSheetWrapper = ({ children }: { children: React.ReactNode }) => ( | ||
| <View style={styles.root}> | ||
| <BottomSheet | ||
| index={0} | ||
| snapPoints={['95%']} | ||
| handleComponent={null} | ||
| enablePanDownToClose={false} | ||
| backgroundStyle={{ backgroundColor: 'transparent' }}> | ||
| <View style={styles.root}>{children}</View> | ||
| </BottomSheet> | ||
| </View> | ||
| ); | ||
|
|
||
| export default { | ||
| title: 'NewMediaCall/Container', | ||
| component: Container, | ||
| decorators: [ | ||
| (Story: React.ComponentType) => ( | ||
| <BottomSheetWrapper> | ||
| <Story /> | ||
| </BottomSheetWrapper> | ||
| ) | ||
| ] | ||
| }; | ||
|
|
||
| export const Default = () => ( | ||
| <Container> | ||
| <PlaceholderChildren /> | ||
| </Container> | ||
| ); |
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,18 @@ | ||
| import React from 'react'; | ||
| import { StyleSheet, View } from 'react-native'; | ||
|
|
||
| import { useTheme } from '../../theme'; | ||
|
|
||
| export const Container = ({ children }: { children: React.ReactElement[] | React.ReactElement }) => { | ||
| const { colors } = useTheme(); | ||
|
|
||
| return <View style={[styles.container, { backgroundColor: colors.surfaceLight }]}>{children}</View>; | ||
| }; | ||
|
|
||
| const styles = StyleSheet.create({ | ||
| container: { | ||
| flex: 1, | ||
| paddingHorizontal: 16, | ||
| paddingTop: 16 | ||
| } | ||
| }); |
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,46 @@ | ||
| import React from 'react'; | ||
|
|
||
| import * as ActionSheetModule from '../ActionSheet'; | ||
| import { mediaSessionInstance } from '../../lib/services/voip/MediaSessionInstance'; | ||
| import { usePeerAutocompleteStore } from '../../lib/services/voip/usePeerAutocompleteStore'; | ||
| import { CreateCall } from './CreateCall'; | ||
| import type { TPeerItem } from '../../lib/services/voip/getPeerAutocompleteOptions'; | ||
|
|
||
| const mediaSession = mediaSessionInstance as unknown as { startCall: (...args: unknown[]) => void }; | ||
| mediaSession.startCall = () => {}; | ||
|
|
||
| try { | ||
| Object.defineProperty(ActionSheetModule, 'hideActionSheetRef', { | ||
| value: () => {}, | ||
| writable: true | ||
| }); | ||
| } catch { | ||
| // noop: in environments where export is not re-definable, | ||
| // the original hideActionSheetRef is already safe with optional chaining. | ||
| } | ||
|
|
||
| const setStoreState = (selectedPeer: ReturnType<typeof usePeerAutocompleteStore.getState>['selectedPeer']) => { | ||
| usePeerAutocompleteStore.setState({ selectedPeer }); | ||
| }; | ||
|
|
||
| const userPeer: TPeerItem = { | ||
| type: 'user', | ||
| value: 'user-1', | ||
| label: 'Alice Johnson', | ||
| username: 'alice.johnson' | ||
| }; | ||
|
|
||
| export default { | ||
| title: 'NewMediaCall/CreateCall', | ||
| component: CreateCall | ||
| }; | ||
|
|
||
| export const Disabled = () => { | ||
| setStoreState(null); | ||
| return <CreateCall />; | ||
| }; | ||
|
|
||
| export const Enabled = () => { | ||
| setStoreState(userPeer); | ||
| return <CreateCall />; | ||
| }; |
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.