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 identify-user support #3439

Merged
merged 44 commits into from
Nov 26, 2019
Merged

Add identify-user support #3439

merged 44 commits into from
Nov 26, 2019

Conversation

seadowg
Copy link
Member

@seadowg seadowg commented Nov 6, 2019

Closes #3435. This implements the feature described (with designs and specs) in that issue.

A couple of notes on implementation:

  • I've reworked a little about the structure of audit code so it follows producer-consumer design. I've kept the AuditEventLogger (producer) but it now defines an AuditEventWriter interface that's implemented with an AsyncTask. The goal here was to seperate out the logic that creates the list of events from the writing of those events to a file.
  • I've moved code that just deals with auditing into the audit package. This is talked about in the State of the Union.
  • Showing the dialog had to happen in the FormEntryActivity as it controls loading and rendering the form. The code that makes that happen isn't great but I want to follow up with a bit of a refactor of the Activity itself. I didn't feel including that would be the right move as it would be a lot of noise for a reviewer.

What has been done to verify that this works as intended?

Local testing and submitting the form to Aggregate.

How does this change affect users? Describe intentional changes to behavior and behavior that could have accidentally been affected by code changes. In other words, what are the regression risks?

There shouldn't be any changes other than the new feature. Would be good to test form entry in general to make sure we haven't messed up any existing flows.

Before submitting this PR, please make sure you have:

  • run ./gradlew checkAll and confirmed all checks still pass OR confirm CircleCI build passes and run ./gradlew connectedDebugAndroidTest locally.
  • verified that any code or assets from external sources are properly credited in comments and/or in the about file.
  • verified that any new UI elements use theme colors. UI Components Style guidelines

@seadowg seadowg force-pushed the identify-user branch 2 times, most recently from 2de0585 to 8d58db0 Compare November 12, 2019 14:17
@seadowg seadowg marked this pull request as ready for review November 13, 2019 14:25
@grzesiek2010
Copy link
Member

grzesiek2010 commented Nov 14, 2019

  1. There is no ok/navigate forward button?
    Screenshot_2019-11-14-16-57-30

It's strange that I have to open the keyboard and click Done.

  1. The keyboard moves the toolbar up and it's mixed with the status bar:
    Screenshot_2019-11-14-17-01-02

  2. This white-gray area won't be well visible when a user is outside in a sunny day (especially the Identity text and the cursor)
    image

  3. I think it's strange that once you open a form the cursor is blinking but the keyboard is hidden. Either the cursor and keyboard should be visible or both should be hidden.

  4. If you rotate your device when that new view is visible the form is closed then you can open it again bypassing the view 😄

  5. We should handle commas, if I use a comma entering my identity the answer will end up in two separate columns:
    image

  6. I'm able to enter just one space char and go further. We shouldn't allow doing this I guess. The same with emoticons.

  7. If you minimize the app (seeing the new view) and open it again the view is skipped (similar case to 5 but not the same).

  8. Dark theme requires improvements:
    Screenshot_2019-11-14-20-55-14

@seadowg
Copy link
Member Author

seadowg commented Nov 14, 2019

@grzesiek2010 all great finds! Can you stick it into "Request changes"? I'll have a look at fixes.

@seadowg
Copy link
Member Author

seadowg commented Nov 14, 2019

Just questions on a couple of your points @grzesiek2010 (most of them clearly just need fixed):

There is no ok/navigate forward button?

Intention was just to have the keyboard "done" take care of this but that's fairly useless without the field focusing (as you point out) - I'll fix that. Do you think we still need a button if we have that? I was following the pattern used by password prompts on Android.

I'm able to enter just one space char and go further. We shouldn't allow doing this I guess. The same with emoticons.

Great point. The spec states a "non-blank identifier" is required. I don't want to add too much validation in but I'd assume not allowing whitespace only would be ok. Do you have any extra contect on this @lognaturel? If not I can dig through the forum discussion.

@seadowg
Copy link
Member Author

seadowg commented Nov 14, 2019

I've updated the acceptance in #3435 based on @grzesiek2010's findings

@grzesiek2010
Copy link
Member

Intention was just to have the keyboard "done" take care of this but that's fairly useless without the field focusing (as you point out) - I'll fix that. Do you think we still need a button if we have that?

I would prefer to have such a button but it's my personal opinion.

@seadowg
Copy link
Member Author

seadowg commented Nov 19, 2019

Ok I think I've fixed everything @grzesiek2010 found. Some annoying stuff around Theming and getting the soft keyboard to show held this up a little. I'm unclear on one path into the form that I'll leave a comment on.

Generally mocking static methods is considered a smell as it's
sign of implicit dependencies in the object under a test. Here it
was particularly confusing as Powermock was being used to implicitly
set the system to 0 so that tests would pass.
This makes it easier to work on audit features as tests can be run as a set
and it's simple to see all the classes involved in audit logging.

Also moved AuditEventSaveTastTest into Robolectric from Espresso.
- Introduced an AuditEventWriter abstraction that wraps AuditEventSaveTask
- Test AuditEventLogger by inspecting the AuditEvents it writes to the AuditEventWriter
- Remove dependency on Collect static method
@seadowg seadowg changed the title [WIP] Add identify-user support Add identify-user support Nov 21, 2019
@seadowg seadowg requested a review from lognaturel November 21, 2019 10:41
Copy link
Member

@lognaturel lognaturel left a comment

Choose a reason for hiding this comment

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

The code looks good to me and the functionality looks like it's all there thanks to @grzesiek2010's initial review! 🙏

I feel like I'm being a broken record but the fonts really look really small to me. I would expect this to lead to occasional inaccurate identity entry because it's just hard to see what's being typed in. BUT. I understand that they are default and match where the world is going so I think we should go with it and see what user feedback comes in.

Like @grzesiek2010, I instinctively want to swipe forward and had to think a second about tapping "Done". I would tend to have some kind of explicit "Save" button but I'm ok with waiting for user feedback on that part as well.

Copy link
Member

@lognaturel lognaturel left a comment

Choose a reason for hiding this comment

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

The code looks good to me and the functionality looks like it's all there thanks to @grzesiek2010's initial review! 🙏

I feel like I'm being a broken record but the fonts really look really small to me. I would expect this to lead to occasional inaccurate identity entry because it's just hard to see what's being typed in. BUT. I understand that they are default and match where the world is going so I think we should go with it and see what user feedback comes in.

Like @grzesiek2010, I instinctively want to swipe forward and had to think a second about tapping "Done". I would tend to have some kind of explicit "Save" button but I'm ok with waiting for user feedback on that part as well.

Copy link
Member

@lognaturel lognaturel left a comment

Choose a reason for hiding this comment

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

The code looks good to me and the functionality looks like it's all there thanks to @grzesiek2010's initial review! 🙏

I feel like I'm being a broken record but the fonts really look really small to me. I would expect this to lead to occasional inaccurate identity entry because it's just hard to see what's being typed in. BUT. I understand that they are default and match where the world is going so I think we should go with it and see what user feedback comes in.

Like @grzesiek2010, I instinctively want to swipe forward and had to think a second about tapping "Done". I would tend to have some kind of explicit "Save" button but I'm ok with waiting for user feedback on that part as well.

@mmarciniak90
Copy link
Contributor

@seadowg Here is what I found

  1. The one whitespace is still accepted to go further - the problem reported by Grzegorz is visible

  2. The status bar is not visible on Android 4.4 and 4.2

Anroid 6.0 Android 4.4
Screenshot_2019-11-25-14-33-07
  1. Copy-paste functionality covers the field. Some extra space is visible near the cursor pointer and 'frame' for Cup/Copy/Clipboard/Share options. Hope, you can see in on screens:
Screenshot_20191125-144400 Screenshot_20191125-144338
Screenshot_20191125-145017 Screenshot_20191125-145024(1)

I also have questions:

  • Should the font size changes be applied to the identity page?
  • I changed the language to Spanish and I still this page in English. I understand that translations are not updated but I want to make sure that it is not missed.

@mmarciniak90
Copy link
Contributor

@opendatakit-bot unlabel "needs testing"

@seadowg
Copy link
Member Author

seadowg commented Nov 25, 2019

@mmarciniak90 thanks for these - I'll have a look at fixing these issues. I talked to a form designer today about the feature and they weren't conncerned about whitespace but given it says "non blank" in the spec I think we should block whitespace only entries. On the copy/pate menu covering the field: I'm not sure we have control over that but I'll have a look.

On your questions:

Should the font size changes be applied to the identity page?

I'm guessing you mean font size changes in the app rather than at the system level? I'm actually not sure where the distinction lies for what should react to the app's font size change. @lognaturel?

I changed the language to Spanish and I still this page in English. I understand that translations are not updated but I want to make sure that it is not missed.

Good point. What is our normal process for getting translations in place?

@lognaturel
Copy link
Member

lognaturel commented Nov 25, 2019

where the distinction lies for what should react to the app's font size change

It only affects the form entry activity currently. It feels very weird because it doesn't include the hierarchy/jump view or the save/submit screen. Ideally I would think both would be affected because they feel like they're part of the form filling experience. I think that ideally font changes would go to this screen but I don't currently feel strongly about it given the chaotic current state. It's already weird that its fonts don't match the rest of the app (they match Material Design standards which is certainly better than matching nothing).

What is our normal process for getting translations in place?

https://github.com/opendatakit/collect#contributing-translations outlines the process. Transifex pulls the strings.xml file from master once a day so as soon as this is merged, the strings that need translating will be pulled in. The translations will be updated once on ~Dec 4 for a beta and again before release.

Translations are a great thing to check, @mmarciniak90. I believe that it is now impossible to commit untranslatable strings because the build will break. But maybe what you can also do is quickly verify the strings.xml file to make sure all strings that you expect are there. I also do this during code review.

We don't need its behaviour for this screen and it just causes
problems with the Toolbar being hidden on lower API levels.
@seadowg
Copy link
Member Author

seadowg commented Nov 25, 2019

@mmarciniak90 1 and 2 are fixed.

3 is proving amazingly difficult. I'm going to need to some investigation outside our app (in a demo codebase) to work out what's going on. We're going to use the same full screen dialog pattern for the next feature I work (Track Changes Reason) on so I'd vote for us to move on and try and fix after that is done. If you agree I'll make an issue once we merge this is.

EDIT: Scratch that. Had a sudden brainwave and managed to fix 3. Still not 100% sure I understand how exactly but it's looking good!

For some reason this was setting the pop up background that appears
on long press on an EditText.
@mmarciniak90
Copy link
Contributor

@seadowg thanks for taking care of the mentioned problems. I can confirm that they are fixed.

I noticed one more thing.

  1. User adds identity
  2. User rotates device
  3. Filled identity disappears

It would be better not to lose this data during rotation, what do you think?

@seadowg
Copy link
Member Author

seadowg commented Nov 26, 2019

It would be better not to lose this data during rotation, what do you think?

That definitely shoudn't be happening. I'll take a look.

@seadowg
Copy link
Member Author

seadowg commented Nov 26, 2019

@mmarciniak90 fixed! Thanks for keeping me on my toes around screen rotations (this goes for @grzesiek2010 too). It's probably very obvious I've managed to work mostly on apps that lock to portrait in the past 😉

@mmarciniak90
Copy link
Contributor

Tested with success

Tested on Android: 4.2, 4.4, 5.1, 6.0, 6.0, 8.1, 9.0, 10.0

Verified cases:

  • Blank identity
  • Identity with whitespace only
  • Identity with chars and whitespace
  • Status bar
  • Copy-paste functionality
  • Username in audit.csv file
  • Light/dark mode
  • Screen rotation

@opendatakit-bot unlabel "needs testing"
@opendatakit-bot label "behavior verified"

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

Successfully merging this pull request may close these issues.

Form with identify-user=true audit attribute adds identifier to audit log events
5 participants