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

NotifTroubleshootingScreen: Add Android manufacturer/model info to report #5754

Merged

Conversation

chrisbobbe
Copy link
Contributor

This could provide useful context, e.g., to diagnose issues like issue #4074, "Some device vendors break notifications".

Unfortunately, in my test using an emulated Pixel XL (results recorded in jsdoc), none of these three fields actually had anything like "Pixel XL" in it. Possibly we could get that from something like Android's Build.PRODUCT, documented as "the name of the overall product":
https://developer.android.com/reference/android/os/Build#PRODUCT
but React Native's Platform.constants doesn't expose that value or any other that seems likely, and we have more urgent tasks than plumbing things through React Native (like
https://github.com/zulip/zulip-flutter).

@chrisbobbe chrisbobbe requested a review from gnprice September 1, 2023 23:42
Copy link
Member

@gnprice gnprice left a comment

Choose a reason for hiding this comment

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

Good idea, thanks! Small comments below, then LGTM.

Comment on lines 114 to 115
export function androidManufacturer(): string {
invariant(Platform.OS === 'android', 'androidRelease called on iOS');
Copy link
Member

Choose a reason for hiding this comment

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

nit: invariant message is wrong, looks like a copy-paste issue

Comment on lines 117 to 119
// Flow isn't refining `Platform` to a type that corresponds to values
// we'll see on Android.
//
Copy link
Member

Choose a reason for hiding this comment

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

Maybe leave out this comment; it's not adding much information, and it bulks these functions up (which then tends to conceal things like the "androidRelease called" issue above).

// Flow isn't refining `Platform` to a type that corresponds to values
// we'll see on Android.
//
// (If changing the implementation, adjust comment below jsdoc.)
Copy link
Member

Choose a reason for hiding this comment

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

Then this last comment, and the blank line, can be left out too — because now the implementation just below this is just a couple of lines away from that other comment, so there's no longer a need for a second comment to point to it.

/**
* "The end-user-visible name for the end product."
*
* E.g., "sdk_gphone64_x86_64", "SM-G960U1".
Copy link
Member

Choose a reason for hiding this comment

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

Unfortunately, in my test using an emulated Pixel XL (results recorded in jsdoc), none of these three fields actually had anything like "Pixel XL" in it.

On my physical Pixel 5, I get:

  "manufacturer": "Google",
  "brand": "google",
  "model": "Pixel 5",

So that's encouraging. And for this line we can write:

Suggested change
* E.g., "sdk_gphone64_x86_64", "SM-G960U1".
* E.g., "Pixel 5", "sdk_gphone64_x86_64", "SM-G960U1".

@chrisbobbe chrisbobbe force-pushed the pr-notif-report-android-manufacturer branch from c02b23b to 340dcc3 Compare September 13, 2023 19:42
@chrisbobbe
Copy link
Contributor Author

Thanks for the review! Revision pushed.

Copy link
Member

@gnprice gnprice 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 the revision! All looks good except there's one instance of the invariant mismatch remaining.

Then modulo that please merge at will.

Comment on lines 142 to 143
export function androidModel(): string {
invariant(Platform.OS === 'android', 'androidRelease called on iOS');
Copy link
Member

Choose a reason for hiding this comment

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

nit: mismatch remains here

…port

This could provide useful context, e.g., to diagnose issues like
issue zulip#4074, "Some device vendors break notifications".

Unfortunately, in my test using an emulated Pixel XL (results
recorded in jsdoc), none of these three fields actually had anything
like "Pixel XL" in it. Possibly we could get that from something
like Android's `Build.PRODUCT`, documented as "the name of the
overall product":
  https://developer.android.com/reference/android/os/Build#PRODUCT
but React Native's Platform.constants doesn't expose that value or
any other that seems likely, and we have more urgent tasks than
plumbing things through React Native (like
<https://github.com/zulip/zulip-flutter>).
@chrisbobbe chrisbobbe force-pushed the pr-notif-report-android-manufacturer branch from 340dcc3 to a53b5ed Compare September 15, 2023 22:00
@chrisbobbe
Copy link
Contributor Author

Thanks for the review! Merging, with that fix.

@chrisbobbe chrisbobbe merged commit a53b5ed into zulip:main Sep 15, 2023
@chrisbobbe chrisbobbe deleted the pr-notif-report-android-manufacturer branch September 15, 2023 22:01
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