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

[menu-bar] Migrate FilePicker to Expo Modules #132

Merged

Conversation

gabrieldonadel
Copy link
Member

Why

Now that expo modules supports macOS, we can start to slowly migrate our modules to use the Sweet API

How

Migrate FilePicker to use Expo Modules

Test Plan

Screen.Recording.2024-01-09.at.18.50.09.mov

Copy link
Contributor

@alanjhughes alanjhughes left a comment

Choose a reason for hiding this comment

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

Great! I'll start helping out with this. Just a few comments

Comment on lines 47 to 32
AsyncFunction("pickFolder"){ (promise: Promise) in
DispatchQueue.main.async {
let panel = NSOpenPanel()
panel.allowsMultipleSelection = false
panel.canChooseFiles = false
panel.canChooseDirectories = true
panel.canCreateDirectories = true

if panel.runModal() == NSApplication.ModalResponse.OK {
promise.resolve(panel.url?.path)
} else {
promise.reject(Exception(name: "FILE_PICKER_ERROR", description: "NSModalResponseCancel"))
}
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as above.

Name("FilePicker")

AsyncFunction("pickFileWithFilenameExtension"){ (filenameExtensions: [String], prompt: String, promise: Promise) in
DispatchQueue.main.async {
Copy link
Member

Choose a reason for hiding this comment

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

Sooo many spaces 🙉

@gabrieldonadel gabrieldonadel force-pushed the @gabrieldonadel/migrate-file-picker-to-expo-modules branch from 89807c4 to f1089ff Compare January 10, 2024 13:54
@tsapeta tsapeta force-pushed the @tsapeta/install-expo-modules branch 2 times, most recently from 247da92 to 19d0d03 Compare January 18, 2024 10:15
Base automatically changed from @tsapeta/install-expo-modules to main January 18, 2024 13:52
@gabrieldonadel gabrieldonadel force-pushed the @gabrieldonadel/migrate-file-picker-to-expo-modules branch 2 times, most recently from e8d8371 to 33dd18b Compare January 18, 2024 14:54
@gabrieldonadel gabrieldonadel force-pushed the @gabrieldonadel/migrate-file-picker-to-expo-modules branch from c65db43 to 5f7bb65 Compare January 18, 2024 15:23
@gabrieldonadel gabrieldonadel merged commit e605299 into main Jan 18, 2024
1 check passed
@gabrieldonadel gabrieldonadel deleted the @gabrieldonadel/migrate-file-picker-to-expo-modules branch January 18, 2024 15:25
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.

3 participants