Page MenuHomePhabricator

[lib/native] refactor `LogInActionSource` type to use object pattern
ClosedPublic

Authored by kamil on Sep 26 2022, 6:27 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Nov 23, 4:28 PM
Unknown Object (File)
Sat, Nov 23, 3:03 PM
Unknown Object (File)
Sat, Nov 23, 2:54 PM
Unknown Object (File)
Sat, Nov 23, 12:21 PM
Unknown Object (File)
Fri, Nov 22, 9:10 AM
Unknown Object (File)
Fri, Nov 22, 9:10 AM
Unknown Object (File)
Fri, Nov 22, 9:10 AM
Unknown Object (File)
Fri, Nov 22, 9:10 AM

Details

Summary

This diff refactors previous union type LoginActionSource and scattered constants with actions to frequently used pattern with the frozen object to maintain a single source of truth for actions.
Other than that, it'll make validation of this field easier while passing it to the keyserver (introduced in next diffs).

Test Plan

Run type checks to make sure ale usages were properly updated.

Diff Detail

Repository
rCOMM Comm
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

kamil held this revision as a draft.
kamil edited the test plan for this revision. (Show Details)
kamil added reviewers: atul, abosh.
kamil published this revision for review.Sep 26 2022, 7:03 AM
tomek requested changes to this revision.Sep 27 2022, 8:36 AM
tomek added inline comments.
lib/shared/account-utils.js
3–4 ↗(On Diff #17077)

Can we merge these into a single import?

lib/socket/socket.react.js
16–17 ↗(On Diff #17077)

Merge these

lib/types/account-types.js
77 ↗(On Diff #17077)

Not really sure if adding types at the end is beneficial. I guess loginActionSources would suffice but might be wrong.

88 ↗(On Diff #17077)

I think it will be more readable when we use singular form here

This revision now requires changes to proceed.Sep 27 2022, 8:36 AM

clean imports, rename constants

LogInActionSourceType -> LogInActionSource

This revision is now accepted and ready to land.Sep 28 2022, 4:31 AM

Thanks for doing this refactor!! Much cleaner without the copy-paste :)