Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(rn): contactRequest and contactAcceptRequest arguments
Signed-off-by: Godefroy Ponsinet <godefroy.ponsinet@outlook.com>
- Loading branch information
Showing
14 changed files
with
302 additions
and
268 deletions.
There are no files selected for viewing
45 changes: 26 additions & 19 deletions
45
client/react-native/common/components/Library/ContactIdentityActions/ActionsAdd.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,29 +1,36 @@ | ||
import React from 'react' | ||
import { withNavigation } from 'react-navigation' | ||
import RelayContext from '../../../relay/RelayContext' | ||
import defaultValuesContact from '../../../utils/contact' | ||
import { btoa } from 'b64-lite' | ||
import ActionList from './ActionList' | ||
import { withNamespaces } from 'react-i18next' | ||
|
||
const ActionsAdd = ({ data, self, navigation, inModal, t }) => <RelayContext.Consumer>{({ mutations }) => | ||
<ActionList inModal={inModal}> | ||
<ActionList.Action icon={'plus'} title={t('contacts.add-action')} dismissOnSuccess action={async () => { | ||
await mutations.contactRequest({ | ||
contact: { | ||
...defaultValuesContact, | ||
...data, | ||
id: btoa(`contact:${data.id}`), | ||
}, | ||
introText: '', | ||
}) | ||
const ActionsAdd = ({ data, self, navigation, inModal, t }) => ( | ||
<RelayContext.Consumer> | ||
{({ mutations }) => ( | ||
<ActionList inModal={inModal}> | ||
<ActionList.Action | ||
icon={'plus'} | ||
title={t('contacts.add-action')} | ||
dismissOnSuccess | ||
action={async () => { | ||
await mutations.contactRequest({ | ||
contactId: btoa(`contact:${data.id}`), | ||
contactOverrideDisplayName: | ||
data.overrideDisplayName || data.displayName || '', | ||
introText: '', | ||
}) | ||
|
||
const beforeDismiss = navigation.getParam('beforeDismiss') | ||
if (beforeDismiss) { | ||
beforeDismiss() | ||
} | ||
}} successMessage={t('contacts.add-action-feedback')} /> | ||
</ActionList> | ||
}</RelayContext.Consumer> | ||
const beforeDismiss = navigation.getParam('beforeDismiss') | ||
if (beforeDismiss) { | ||
beforeDismiss() | ||
} | ||
}} | ||
successMessage={t('contacts.add-action-feedback')} | ||
/> | ||
</ActionList> | ||
)} | ||
</RelayContext.Consumer> | ||
) | ||
|
||
export default withNamespaces()(withNavigation(ActionsAdd)) |
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
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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.