-
Notifications
You must be signed in to change notification settings - Fork 3k
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
[No QA][TS migration] Migrate 'Visibility' lib to TypeScript #27437
[No QA][TS migration] Migrate 'Visibility' lib to TypeScript #27437
Conversation
src/libs/Visibility/index.desktop.ts
Outdated
*/ | ||
function isVisible() { | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-return |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think electron is typed as 'any', we have to change this @Skalakid
src/libs/Visibility/index.desktop.ts
Outdated
return window.electron.sendSync(ELECTRON_EVENTS.REQUEST_VISIBILITY); | ||
} | ||
|
||
/** | ||
* @returns {Boolean} | ||
*/ | ||
function hasFocus() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please create types.ts
file with shared types, similar to this PR
src/types/modules/electron.d.ts
Outdated
declare global { | ||
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions | ||
interface Window { | ||
electron: Electron; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In my IDE Electron is of type any
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Either way LGTM.
src/types/modules/electron.d.ts
Outdated
declare global { | ||
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions | ||
interface Window { | ||
electron: Electron.IpcRenderer; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
function isVisible() { | ||
return window.electron.sendSync(ELECTRON_EVENTS.REQUEST_VISIBILITY); | ||
} | ||
const isVisible: IsVisible = () => !!window.electron.sendSync(ELECTRON_EVENTS.REQUEST_VISIBILITY); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we had to remove the named function here.
function isVisible(): boolean
would be fine I guess.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From TS guidelines:
In modules with platform-specific implementations, create
types.ts
to define shared types. For platform-specific implementations, always define shared types that complies with all variants.
That's why IsVisible
type was created in the first place and used here. I think the change was necessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving for engineer review
We did not find an internal engineer to review this PR, trying to assign a random engineer to #24844 as well as to this PR... Please reach out for help on Slack if no one gets assigned! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, CK still need to do the checklist.
Reviewer Checklist
Screenshots/VideosWebScreen.Recording.2023-09-19.at.18.59.43.movScreen.Recording.2023-09-19.at.19.00.44.movDesktopScreen.Recording.2023-09-19.at.19.02.28.movMobile Web - ChromeScreen.Recording.2023-09-19.at.19.04.17.movAndroidScreen.Recording.2023-09-19.at.19.05.36.movMobile Web - SafariScreen.Recording.2023-09-19.at.19.08.00.moviOSScreen.Recording.2023-09-19.at.19.08.37.mov |
@@ -0,0 +1,18 @@ | |||
// TODO: Move this type to desktop/contextBridge.js once it is converted to TS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we link to the tracking issue for this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, here is a link to desktop files migration issue: #25333
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool thanks, we could also link it here for clarity
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
🚀 Deployed to staging by https://github.com/flodnv in version: 1.3.73-0 🚀
|
🚀 Deployed to production by https://github.com/mountiny in version: 1.3.73-1 🚀
|
🚀 Deployed to staging by https://github.com/flodnv in version: 1.3.74-0 🚀
|
🚀 Deployed to production by https://github.com/chiragsalian in version: 1.3.74-3 🚀
|
Details
Fixed Issues
$ #24844
PROPOSAL: #24844
Tests
verbose
logsOffline tests
Same as Tests
QA Steps
Same as tests
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodWaiting for Copy
label for a copy review on the original GH to get the correct copy.STYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)/** comment above it */
this
properly so there are no scoping issues (i.e. foronClick={this.submit}
the methodthis.submit
should be bound tothis
in the constructor)this
are necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);
ifthis.submit
is never passed to a component event handler likeonClick
)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
Web
web.mov
Mobile Web - Chrome
chrome.mov
Mobile Web - Safari
safari.mov
Desktop
desktop.mov
iOS
ios.mov
Android
android.mov