Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: contact modal card via relay id and deep link fixes
Signed-off-by: Godefroy Ponsinet <godefroy.ponsinet@outlook.com>
- Loading branch information
Showing
10 changed files
with
190 additions
and
146 deletions.
There are no files selected for viewing
This file contains 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 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
70 changes: 33 additions & 37 deletions
70
client/react-native/common/components/Library/ContactIdentityActions/index.js
This file contains 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,47 +1,43 @@ | ||
import React from 'react' | ||
import { WithContact } from '../../../utils/contact' | ||
import { enums } from '../../../graphql' | ||
import { Text, View, ActivityIndicator } from 'react-native' | ||
import { Text, View } from 'react-native' | ||
import { withNavigation } from 'react-navigation' | ||
import ActionsAdd from './ActionsAdd' | ||
import ActionsShare from './ActionsShare' | ||
import ReceivedActions from './ActionsReceived' | ||
import ActionsSent from './ActionsSent' | ||
|
||
const ContactIdentityActions = ({ data, navigation, modalWidth }) => <View | ||
style={{ width: modalWidth, flexDirection: 'row', marginTop: 12 }}> | ||
<WithContact id={data.id}>{(user, state) => { | ||
if (state.type === state.error) { | ||
return <View style={{ flex: 1 }}><Text>Error</Text></View> | ||
} else if (state.type !== state.success) { | ||
return <View style={{ flex: 1 }}><ActivityIndicator /></View> | ||
} else if (user === null) { | ||
return <ActionsAdd data={data} navigation={navigation} inModal /> | ||
} else { | ||
switch (user.status) { | ||
case enums.BertyEntityContactInputStatus.Myself: | ||
return <ActionsShare data={user} self navigation={navigation} inModal /> | ||
|
||
case enums.BertyEntityContactInputStatus.IsFriend: | ||
case enums.BertyEntityContactInputStatus.IsTrustedFriend: | ||
return <ActionsShare data={user} navigation={navigation} inModal /> | ||
|
||
case enums.BertyEntityContactInputStatus.IsRequested: | ||
console.log(user) | ||
return <ActionsSent data={user} inModal /> | ||
|
||
case enums.BertyEntityContactInputStatus.RequestedMe: | ||
return <ReceivedActions data={user} inModal /> | ||
|
||
case enums.BertyEntityContactInputStatus.IsBlocked: | ||
return <Text>Is blocked</Text> | ||
|
||
case enums.BertyEntityContactInputStatus.Unknown: | ||
default: | ||
return <Text>Unknown state</Text> | ||
} | ||
} | ||
}}</WithContact> | ||
</View> | ||
const Actions = ({ data, navigation }) => { | ||
if (data == null) { | ||
return <ActionsAdd data={data} navigation={navigation} inModal /> | ||
} | ||
switch (data.status) { | ||
case enums.BertyEntityContactInputStatus.Myself: | ||
return <ActionsShare data={data} self navigation={navigation} inModal /> | ||
|
||
case enums.BertyEntityContactInputStatus.IsFriend: | ||
case enums.BertyEntityContactInputStatus.IsTrustedFriend: | ||
return <ActionsShare data={data} navigation={navigation} inModal /> | ||
|
||
case enums.BertyEntityContactInputStatus.IsRequested: | ||
return <ActionsSent data={data} inModal /> | ||
|
||
case enums.BertyEntityContactInputStatus.RequestedMe: | ||
return <ReceivedActions data={data} inModal /> | ||
|
||
case enums.BertyEntityContactInputStatus.IsBlocked: | ||
return <Text>Is blocked</Text> | ||
|
||
case enums.BertyEntityContactInputStatus.Unknown: | ||
default: | ||
return <Text>Unknown state</Text> | ||
} | ||
} | ||
|
||
const ContactIdentityActions = ({ modalWidth, ...props }) => ( | ||
<View style={{ width: modalWidth, flexDirection: 'row', marginTop: 12 }}> | ||
<Actions {...props} /> | ||
</View> | ||
) | ||
|
||
export default withNavigation(ContactIdentityActions) |
22 changes: 11 additions & 11 deletions
22
client/react-native/common/components/Library/SelfAvatarIcon.js
This file contains 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 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.