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

feat(www): add OS and version information to the contact view data form #1725

Closed
wants to merge 45 commits into from

Conversation

sbruens
Copy link
Contributor

@sbruens sbruens commented Sep 26, 2023

No description provided.

@sbruens sbruens requested a review from a team as a code owner September 26, 2023 14:23
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@daniellacosse Where do you think shared / utility libraries should live? I don't think this should live here but there's no clear better place to put these right now. Any preferences?

Copy link
Contributor

Choose a reason for hiding this comment

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

infrastructure!

@sbruens sbruens force-pushed the sbruens/contact-us-autovalues branch from 052a98f to 090b667 Compare September 26, 2023 14:40
@codecov
Copy link

codecov bot commented Sep 26, 2023

Codecov Report

Attention: 6 lines in your changes are missing coverage. Please review.

Files Coverage Δ
src/www/ui_components/app-root.js 4% <ø> (ø)
src/www/views/contact_view/os.ts 100% <100%> (ø)
src/www/views/contact_view/support_form/index.ts 88% <ø> (ø)
src/www/views/contact_view/index.ts 88% <50%> (-6%) ⬇️

📢 Thoughts on this report? Let us know!.

@sbruens sbruens force-pushed the sbruens/contact-us-autovalues branch from 090b667 to 6aaeea5 Compare September 26, 2023 14:46
@sbruens sbruens force-pushed the sbruens/contact-us-autovalues branch from 6aaeea5 to 9cdf436 Compare September 26, 2023 14:49
src/www/views/contact_view/os.ts Show resolved Hide resolved
@@ -289,3 +295,12 @@ export class ContactView extends LitElement {
}
}
}

function getOperatingSystemValue(): string | undefined {
Copy link
Contributor

Choose a reason for hiding this comment

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

We should add this to infrastructure as well!

What's your rationale behind separating the boolean constants and the strings? Why not just a getOperatingSystemValue that returns an enum/string union?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is specific to the form values that Salesforce expects. They shouldn't be re-used elsewhere. In fact, I'm going to update them once I get the correct API values.

I went with a boolean as its a fairly common pattern for this type of check; it's slightly more efficient, but mostly it allows for more readable re-use if we want to use it elsewhere. Compare:

if (IS_ANDROID) {
  doSomething():
}

if (getOperatingSystemValue() === OperatingSystem.ANDROID) {
  doSomething();
}

I could created a shared infrastructure function that returns an enum, and then map the enum values to the form strings as a second step. Seems a bit more convoluted though, so I'm hesitant to add it just for the sake of it? But I can be convinced.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes I do find the whole approach a bit anemic - ideally we'd have a UserAgent singleton class that has these methods on it e.g.

const agent = new UserAgent();

agent.isAndroid();

which could then be extended later

Copy link
Contributor

Choose a reason for hiding this comment

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

infrastructure!

@sbruens sbruens force-pushed the sbruens/contact-us-autovalues branch from 9cdf436 to f28a638 Compare September 26, 2023 15:32
@sbruens
Copy link
Contributor Author

sbruens commented Sep 29, 2023

Going to abandon this PR after doing some more exploring. Version, OS, and build are already available elsewhere.

@sbruens sbruens closed this Sep 29, 2023
@sbruens sbruens deleted the sbruens/contact-us-autovalues branch September 29, 2023 15:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants