-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Add Expensify.cash to iOS and Android native share menus #1361
Conversation
CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅ |
Great job on this! I gave this a passthrough and it looks good but it seems like there might be some unintended differences as a result of a merge conflict? Could you give it a look and resolve the merge conflicts before I give it a full review? |
@TomatoToaster Oh, sorry. It seems that something has been merged after I've submitted the PR, and I haven't noticed it until now. |
No problem at all, Thanks! |
@TomatoToaster Conflicts are resolved |
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.
Hey sorry, this took a bit for me to review, but this mostly looks good! I had a few adjustments requested. LMK what you think.
|
||
COCOAPODS: 1.10.0 | ||
COCOAPODS: 1.10.1 |
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.
Would you mind reverting to 1.10.0 to build this project? We haven't switched to 1.10.1 quite yet and it would help keep our mobile repos in sync.
I managed to do it by reinstalling the cocoapods gem to that version and deleting this file before a pod install.
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.
I had to use 1.10.1, because you have this version in your Gemfile.lock
I had 1.10.0 too, but pod install
wasn't working and was showing following error: Could not find proper version of cocoapods (1.10.1) in any of the sources
.
So I'm not sure how to proceed. I can revert to 1.10.0, but are you sure that it will work?
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.
Ah I see, I didn't realize it was locked to that version in the gemfile. Let me double check on that.
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.
This looks pretty good to me, let me double check about the gemfile situation.
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.
Have not tested this but just leaving some thoughts...
Probably we should be have used the new OptionsList
instead of ChatSwitcherView
for this as the latter will be deleted soon. The adaptation of the SidebarLinks
for use in SharePage
could benefit from some clean up. Seems like there is a lot of duplication which will make this code hard to maintain.
* @param {Object} sharedItem | ||
*/ | ||
function handleShare(sharedItem) { | ||
if (sharedItem) { |
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.
This should be an early return
* Removes share events listener. | ||
*/ | ||
function deregister() { | ||
listener.remove(); |
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.
Should we set the listener back to undefined
? Probably we should not call remove()
if it doesn't exist. Have seen this happen with some other listeners.
onClose={this.toggleCreateMenu} | ||
isVisible={this.state.isCreateMenuActive} | ||
onItemSelected={this.onCreateMenuItemSelected} | ||
/> |
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.
We probably don't need the CreateMenu
here?
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.
Same with the FAB
?
@@ -241,7 +245,8 @@ class ChatSwitcherView extends React.Component { | |||
*/ | |||
startGroupChat() { | |||
const userLogins = _.map(this.state.usersToStartGroupReportWith, option => option.login); | |||
fetchOrCreateChatReport([this.props.session.email, ...userLogins]); | |||
fetchOrCreateChatReport([this.props.session.email, ...userLogins]) | |||
.then(this.props.onReportSelected); |
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.
I'm confused about why we added this. And if this is what we want why did we not add a .then()
to fetchOrCreateChatReport()
instead adding it to several usages?
@@ -504,6 +504,7 @@ function fetchAll(shouldRedirectToReport = true, shouldFetchActions = false, sho | |||
* set of participants | |||
* | |||
* @param {String[]} participants | |||
* @returns {Promise} reportID |
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.
Why should this return a Promise
?
redirect(this.props.currentlyViewedReportID !== '' | ||
? ROUTES.getReportRoute(this.props.currentlyViewedReportID) | ||
: ROUTES.HOME); | ||
} |
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.
Seems like duplicated redirect logic here. Maybe could have abstracted this somehow.
paddingLeft: 20, | ||
paddingRight: 0, | ||
paddingVertical: 12, | ||
}, |
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.
Rather than create a new style we should use padding spacing helpers.
onPress={this.props.onCloseButtonClick} | ||
> | ||
<Icon src={Close} /> | ||
</TouchableOpacity> |
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.
This could probably be refactored into a CloseButton
component.
isActive={this.props.network && !this.props.network.isOffline} | ||
/> | ||
</TouchableOpacity> | ||
{this.props.showCloseButton && ( |
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.
If we need to add things like showCloseButton
and showAvatar
then it might make more sense to reduce the responsibility of these components and use a version that allows adding in the header parts where they are needed instead of a new prop to make optional.
} else { | ||
fetchOrCreateChatReport([this.props.session.email, selectedOption.login]); | ||
fetchOrCreateChatReport([this.props.session.email, selectedOption.login]) | ||
.then(this.props.onReportSelected); |
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.
Just FYI this entire file will be removed very soon and this change makes it difficult to do.
MARKETING_VERSION = 1.0.1; | ||
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; | ||
MTL_FAST_MATH = YES; | ||
PRODUCT_BUNDLE_IDENTIFIER = com.chat.expensify.chat.ShareExtension; |
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.
Hey also as a note, there might need to be more done with adding this bundle. The logs for our iOS deploy shows there was an error with this identifier.
In the new PR we can figure out fixes for this and what needs to be done.
Details
Uses react-native-share-menu to add Expensify.cash to the native share menu on mobile platforms and enables sharing to the app.
Chat selection is made on separate page, which reuses components from Home page. To achieve this I had to modify some sidebar related components and functions, mainly to add callbacks for getting selected chat id.
Fixed Issues
Fixes #1294
Tests
Send to...
page.Tested On
Screenshots
iOS
ShareMenu-iOS.mp4
Android
ShareMenu-Android.mp4