Skip to content
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

[Improvement] Add expensify.cash to iOS and Android native share menus #1294

Closed
sakluger opened this issue Jan 21, 2021 · 6 comments · Fixed by #1361
Closed

[Improvement] Add expensify.cash to iOS and Android native share menus #1294

sakluger opened this issue Jan 21, 2021 · 6 comments · Fixed by #1361
Labels
Monthly KSv2 Not a priority Planning Changes still in the thought process

Comments

@sakluger
Copy link
Contributor

sakluger commented Jan 21, 2021

If you haven’t already, check out our contributing guidelines for onboarding!


Platform - version:
iOS, Android - All versions

Problem

A common action when using a mobile device is to share something (a web page, an image, a tweet, etc) with another person. Both iOS and Android have a native "share" button that allows you to share things via apps that you have installed on your phone.

Here's an example of what the native iOS share menu looks like:
image

Why is this important?

The native share function is a common flow and one of the easier ways to share something with someone. For example, I find it to be easier than copying the url of a web page from my mobile browser, switching apps, and pasting it in to the messenger app. It's much easier to just hit the share button, choose the messenger app, and select who I want to send the url to.

Solution

Add support for sharing directly to our app. Here is an example react native library that helps with this, though I haven't done any research into it. I think the way we would implement it is:

  1. Expensify.cash shows up as an option in the native share menu
  2. When Expensify.cash is selected, we bring up your Expensify.cash home screen (Screenshot is below)
  3. You can select a chat
  4. Whatever you are sharing (url, image, etc) is sent to that chat

This is very similar to the flow when using the native share functionality with WhatsApp.

Screenshot of Expensify.cash home screen:

image

Upwork Job Link: https://www.upwork.com/jobs/~01fb534e5bfc655563

@tugbadogan
Copy link
Contributor

Is this task still available? I would like to work on this issue.

@sakluger
Copy link
Contributor Author

Hi @tugbadogan thanks for the interest! It is not available, but any available issues should be posted on Upwork.

@r8
Copy link
Collaborator

r8 commented Jan 27, 2021

I evaluated several React Native libraries, but it looks like the real choice is only between two of them:

The former looks more popular, but requires manual install and haven't been updated in a while, which causes a lot of troubles and compatibility issues with latest React versions. So probably it's better to go with react-native-share-menu, like it was proposed in issue description.

I've tested the integration, it works more or less fine, but has one issue on iOS: Expensify/react-native-share-menu#82

My proposal is to create libs/ShareManager module, similar to ActiveClientManager or Notification.
Something like that:

libs/ShareManager/index.native.js

import ShareMenu from 'react-native-share-menu';

let listener;

function handleShare(item) {
    // Check the shared item, save it to Onyx 
    // and redirect to chat chooser interface
}

function register() {
    ShareMenu.getInitialShare(handleShare);
    listener = ShareMenu.addNewShareListener(handleShare);
}

function unregister() {
    listener.remove();
}

export {
    register,
    unregister,
};

The code should go index.native.js, and nooped in index.js, because it will not work in web and desktop anyway.
Then we should register in componentDidMount of Expensify.js and unregister in componentWillUnmount.

Instead of showing the Home screen with a list of chats I suggest to create a separate screen for that.
If we will reuse Home screen, we would have to:

  • Hide user avatar, because when user taps on it, it will open the Settings screen and break the sharing flow
  • Change the onTap callback for chats in the list, because instead of just opening the chat, first we would need to post a message.

With all these new conditions, checks (and the fact that sharing should work only on mobile) Home screen and Sidebar can become too heavy. So maybe it's better to create a separate SharingScreen and reuse sidebar components or even whole SidebarView there.

@marcaaron
Copy link
Contributor

@r8 Thanks for the proposal, plan sounds good 👍

I agree with you that we should create a separate SharePage that reuses sidebar components.

@MelvinBot
Copy link

it looks like no one is assigned to work on this job.
Please double the price or add a comment stating why the job isn't being doubled.

@MelvinBot
Copy link

@sakluger, this Monthly task hasn't been acted upon in 6 weeks; closing.

If you disagree, feel encouraged to reopen it -- but pick your least important issue to close instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Monthly KSv2 Not a priority Planning Changes still in the thought process
Projects
None yet
7 participants