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

Add tap to view full screen image functionality #630

Merged
merged 49 commits into from
Nov 19, 2020

Conversation

thienlnam
Copy link
Contributor

@thienlnam thienlnam commented Oct 10, 2020

Fixed Issues

Fixes https://github.com/Expensify/Expensify/issues/142710 and https://github.com/Expensify/Expensify/issues/143523

Tests

  1. Upload an image and a PDF
  2. Click on them and verify they open correctly

Screenshots

Screen Shot 2020-10-30 at 1 51 19 PM

Screen Shot 2020-10-30 at 1 51 07 PM

Screen Shot 2020-10-30 at 1 50 32 PM

Screen Shot 2020-10-30 at 1 50 40 PM

@thienlnam thienlnam self-assigned this Oct 10, 2020
@shawnborton
Copy link
Contributor

Tagging @Expensify/design to follow along for screenshots. Can we get a preview of how this will look/function?

@thienlnam thienlnam changed the title Add tap to view full screen image functionality [HOLD] Add tap to view full screen image functionality Oct 12, 2020
@thienlnam thienlnam changed the title [HOLD] Add tap to view full screen image functionality [WIP] Add tap to view full screen image functionality Oct 12, 2020
@thienlnam
Copy link
Contributor Author

Yup! I'll get those added after flushing this out today

Copy link
Contributor

@tgolen tgolen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know this is a WIP, so just adding a few comments. Looks like it's all on the right track 👍

src/components/ImageModal/index.js Outdated Show resolved Hide resolved
src/components/ImageModal/index.js Outdated Show resolved Hide resolved
src/style/StyleSheet.js Outdated Show resolved Hide resolved
@thienlnam
Copy link
Contributor Author

Thanks Tim!

As for how this looks/functions, here is a demo on iOS:

The idea is there will be a header on the modal that you can drag down to close / or press the exit button to close

  • Still need to update the button icon
  • Still need to get gesture handling working

demo

On web I am trying to make it look similar to the way it currently is expensify.com without the profile info so it would hopefully eventually look something like this -
Screen Shot 2020-10-12 at 1 35 13 PM

@thienlnam
Copy link
Contributor Author

FYI: Expanding this PR to also accomodate issue to view PDFs when clicked

@shawnborton
Copy link
Contributor

Hey @thienlnam this looks great, but curious if there are any mockups you are basing your work off of?

@thienlnam
Copy link
Contributor Author

@shawnborton I've been working from the web modal and looking to have the final look something similar to that. I don't have any mockups for what it would look like on mobile or web with react native. I'd be happy to make adjustments based on any mockups!

@shawnborton
Copy link
Contributor

Yeah, let's try to get you some good mockups. I don't think that should stop your progress from making this functional, but we never mocked up what viewing attachments would look like in the ReactNative world so I think it would be a good idea for us to feel super aligned on how this would look/work across all platforms.

@shawnborton
Copy link
Contributor

Also - why not show the owner of the photo in the modal preview? As in, show the profile picture + name?

@thienlnam
Copy link
Contributor Author

@shawnborton Sounds good, and my only worry with that right now is that it already takes a little bit for the image to load full screen so it would only be adding more overhead costs until we added some kind of caching but I will work off designs.

@tgolen
Copy link
Contributor

tgolen commented Oct 26, 2020

What's the status of this PR? Has it been deprioritized for something else? Looks like it's just collecting conflicts now :D Anything I can do to help push it along?

@thienlnam
Copy link
Contributor Author

So there has been a discussion around the design of the modal in the main issue, and then @roryabraham is also working on this proposal here so this PR is kind of in a weird spot right now.

This PR is mostly complete, needs the modal to be styled and then figure out PDF viewing on web but if everyone is okay with it then I can continue and push this out and we can refactor it later to be inline with standards that come from the whatsnext discussion

@tgolen
Copy link
Contributor

tgolen commented Oct 26, 2020 via email

@thienlnam
Copy link
Contributor Author

Sounds good, I will put this train back on the track then!

tgolen
tgolen previously approved these changes Nov 17, 2020
Copy link
Contributor

@tgolen tgolen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for those changes. Looks good!

src/CONFIG.js Outdated Show resolved Hide resolved
@thienlnam
Copy link
Contributor Author

Alright, this should be ready to go! @marcaaron is out this week but he tested/approved before he left.

cc @tgolen @roryabraham

Copy link
Contributor

@roryabraham roryabraham left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks pretty good, just a few suggestions. Sorry for the delayed review - this was my first time fully looking through this PR

.env.example Outdated Show resolved Hide resolved
src/components/BaseImageModal.js Show resolved Hide resolved
src/components/BaseImageModal.js Show resolved Hide resolved
src/components/BaseImageModal.js Outdated Show resolved Hide resolved
*
* @param {Boolean} visibility
*/
setModalVisiblity(visibility) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NAB bind this in the constructor and then get rid of the arrow functions when it's called. I think that's the convention in our react code because it's marginally more performant

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I binded the function but when I tried removing the arrow functions it just stopped working - I think it might be because I'm passing a parameter in the function as well?

src/components/ImageView/index.js Outdated Show resolved Hide resolved
src/components/ImageView/index.native.js Outdated Show resolved Hide resolved
src/components/ImageView/index.native.js Outdated Show resolved Hide resolved
src/components/ImageView/index.native.js Outdated Show resolved Hide resolved
src/components/ImageView/index.js Outdated Show resolved Hide resolved
roryabraham
roryabraham previously approved these changes Nov 18, 2020
Copy link
Contributor

@roryabraham roryabraham left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@thienlnam thienlnam requested a review from tgolen November 18, 2020 22:46
tgolen
tgolen previously approved these changes Nov 19, 2020
Copy link
Contributor

@tgolen tgolen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The different constants are getting confusing. The more explicit the constant name, the less confusing this will be. I really hate blocking the PR on this though, so I would be OK with merging this PR as-is and then doing an immediate follow-up to clean up these constants.

Here are the things that I find confusing:

  • I don't know when to use ngrok or why
  • If USE_NGROK=true, then SITE_ROOT and API_ROOT are modified with the ngrok URL. However, if you have to modify the .env file to set USE_NGROK then why not just change SITE_ROOT and API_ROOT instead?
  • If NGROCK_URL exists, then it's not clear what happens with EXPENSIFY_SITE_ROOT
  • DEFAULT_SITE_ROOT is a very ambiguous name with no meaning
  • SITE_ROOT is also ambiguous and easily confused with the other constants
  • USE_NGROK is not really necessary because the logic can just check if NGROK_URL exists

Some suggestions:

  1. The readme probably needs updated instructions for using ngrok properly (why, when, how, etc.)
  2. Get rid of API_ROOT completely. It is only used twice, and those can be switched to be ${SITE_ROOT}api? instead
  3. Rename DEFAULT_SITE_ROOT to URL_EXPENSIFY_COM
  4. Rename CASH_SITE_ROOT to URL_EXPENSIFY_CASH
  5. Rename SITE_ROOT to something else (but I am still unclear what it is used for so I can't suggest a better name right now)
  6. Maybe we can add a platform specific .env.native file which would be where the ngrok values are set (so you don't have to constantly be modifying .env when switching between platforms).

src/CONFIG.js Outdated Show resolved Hide resolved
@tgolen
Copy link
Contributor

tgolen commented Nov 19, 2020 via email

@thienlnam
Copy link
Contributor Author

@tgolen 🐎 🟢

Should be ready to go now!

@thienlnam thienlnam requested a review from tgolen November 19, 2020 19:54
@roryabraham
Copy link
Contributor

Okay, I agree the constants ended up being a bit messy. It's partially my fault, because I thought having USE_NGROK would be a convenient way to just "flip a switch" to start using NGROK, but I can see how it complicates things.

Anyways, LGTM so merging 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants