Skip to content

Conversation

@aitorvs
Copy link
Collaborator

@aitorvs aitorvs commented Jan 15, 2021

Task/Issue URL: https://app.asana.com/0/414730916066338/1199568299173487/f
Tech Design URL: https://app.asana.com/0/481882893211075/1199538898514883/f
CC:

Description:

This PR fixes the rq_x pixels that got broke when removing the double search header. The main issue was that pixels have a suffix android_{formFactor}, but also under the iOS implementation a few more fine tuning was done to improve them. This PR will:

  • Remove the android_tablet/phone suffix from the rq_x pixels
  • Override the user agent so that rq_x pixels are sent with the same UA as the webview
  • Align the search bar behavior with iOS
  • rq.0 will fire when
    • the user resubmits the search through the search box in our app.
    • the SERP is reloaded
    • hitting refresh button
    • resubmitting query without editing
    • selecting autocomplete item that matches what was just searched
  • rq.1 will fire when
    • the user has the SERP loaded in the current tab and submits a different search (by typing or selecting different autocomplete entry).

Steps to test this PR:
Note: to check rq_x are being sent, just filter for Pixel interceptor in logcat

The following should test all scenarios.

  • open app and search reddit
  • Verify rq.x pixels are not sent
  • pull to refresh
  • verify rq.0 pixel is sent
  • overflow menu -> refresh
  • verify rq.0 is sent
  • tap on search bar
  • verify "reddit" word is not selected, cursor is at the end of the word and autocomplete appears
  • select "🔎 reddit" from autocomplete
  • verify rq.0 is sent
  • tap on search bar and select "🔎 reddit politics" (or any other reddit xxx autocomplete result)
  • Verify rq.1 pixel is sent
  • click on a link in SERP, open it in a new tab and wait for it to load
  • tap on the search bar
  • verify autocomplete results don't appear
  • verify URL in search bar is selected - ❌ this check will fail, I didn't manage to make it work
  • close the app and re-open
  • Verify rq.x pixels are not sent
  • switch to the tab with the query search, ie "reddit..."
  • verify rq.1 pixel is sent
  • (here use Charles to inspect UA)
  • change the query in the search bar and ENTER
  • verify the UA is the one used for webview when rq.1 is sent
  • pull to refresh
  • verify the UA is the one used for webview when rq.1 is sent

Internal references:

Software Engineering Expectations
Technical Design Template

@aitorvs
Copy link
Collaborator Author

aitorvs commented Jan 15, 2021

@malmstein help wanted for the test step that I marked as ❌. I think it'd be no biggie to not have it, but if we did, better

@malmstein
Copy link
Contributor

@aitorvs:

verify URL in search bar is selected - ❌ this check will fail, I didn't manage to make it work
close the app and re-open
verify rq.1 pixel is sent

This step does not work for me either. In fact, the pixel is not sent after closing / opening the app. I'd argue that it should not be fired since the query hasn't changed.

Copy link
Contributor

@malmstein malmstein left a comment

Choose a reason for hiding this comment

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

Question about the steps to test, other than that looks good. Great job @aitorvs !


override fun onFocusChanged(focused: Boolean, direction: Int, previouslyFocusedRect: Rect?) {
super.onFocusChanged(focused, direction, previouslyFocusedRect)
// stop the auto-selection of text after the first focus
Copy link
Contributor

Choose a reason for hiding this comment

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

we don't usually leave comments unless they are really necessary. seems like the code is pretty self-explanatory, so I'd say it's safe to remove them

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Makes sense, will do

@aitorvs
Copy link
Collaborator Author

aitorvs commented Jan 20, 2021

@aitorvs:

verify URL in search bar is selected - ❌ this check will fail, I didn't manage to make it work
close the app and re-open
verify rq.1 pixel is sent

This step does not work for me either. In fact, the pixel is not sent after closing / opening the app. I'd argue that it should not be fired since the query hasn't changed.

Did you close the app and re-open or just put it in background and re-open. The former would send the rq.1 pixel just because the app starts with with an empty oldQuery and the newQuery is whatever in the search bar of the tab fragment.
If you place the app in the background and then re-open, nothing will be sent.

@aitorvs aitorvs force-pushed the feature/aitor/rq_pixel branch from a0073db to efd7e2d Compare January 26, 2021 08:42
@malmstein
Copy link
Contributor

@aitorvs it should not matter if the app was put in background or closed, for pixel purposes it makes no difference and the rq.1 should not be sent. I don't want to delay this much longer so there are two solutions:

  1. Fix the behavior on app start
  2. Explain this behavior in the task and get feedback from interesting parties. Based on that we can close this or fix it.

@aitorvs
Copy link
Collaborator Author

aitorvs commented Jan 26, 2021

@aitorvs it should not matter if the app was put in background or closed, for pixel purposes it makes no difference and the rq.1 should not be sent. I don't want to delay this much longer so there are two solutions:

  1. Fix the behavior on app start
  2. Explain this behavior in the task and get feedback from interesting parties. Based on that we can close this or fix it.

Done in c935b09

@aitorvs aitorvs requested a review from malmstein January 26, 2021 16:26
Copy link
Contributor

@malmstein malmstein left a comment

Choose a reason for hiding this comment

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

Great stuff @aitorvs. Thanks for making the changes!

@aitorvs aitorvs merged commit 3ad788b into develop Jan 27, 2021
@aitorvs aitorvs deleted the feature/aitor/rq_pixel branch January 27, 2021 10:28
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.

2 participants