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: zulip:// URI Scheme for electron #470 #1407

Closed

Conversation

avijitdas126
Copy link
Collaborator

@avijitdas126 avijitdas126 commented Feb 8, 2025

Added deep linking support with zulip://, registered the protocol handler, and implemented a dialog to choose between opening the link in the app or browser.

  • Added deep linking functionality to open the app via custom protocol (zulip://).
  • Registered the protocol handler using app.setAsDefaultProtocolClient("zulip").
  • Implemented a dialog prompt to ask users whether to open the link in the desktop app or browser.
  • Handled deep link routing in the main process to ensure smooth redirection.
  • Fixed import issues related to electron/main and electron/common.

Fixes: #470

Platforms this PR was tested on:

  • Windows
  • macOS
  • Linux (specify distro)
Self-review checklist
  • Self-reviewed the changes for clarity and maintainability
    (variable names, code reuse, readability, etc.).

Communicate decisions, questions, and potential concerns.

  • Explains differences from previous plans (e.g., issue description).
  • Highlights technical choices and bugs encountered.
  • Calls out remaining decisions and concerns.
  • Automated tests verify logic where appropriate.

Individual commits are ready for review (see commit discipline).

  • Each commit is a coherent idea.
  • Commit message(s) explain reasoning and motivation for changes.

Completed manual review and testing of the following:

  • Visual appearance of the changes.
  • Responsiveness and internationalization.
  • Strings and tooltips.
  • End-to-end functionality of buttons, interactions and flows.
  • Corner cases, error conditions, and easily imagined bugs.

Added deep linking support with zulip://, registered the protocol handler, and implemented a dialog to choose between opening the link in the app or browser.
@zulipbot
Copy link
Member

zulipbot commented Feb 8, 2025

Hello @avijitdas126, it seems like you have referenced #470 in your pull request description, but you have not referenced them in your commit message description(s). Referencing an issue in a commit message automatically closes the corresponding issue when the commit is merged, which makes the issue tracker easier to manage.

Please run git commit --amend in your command line client to amend your commit message description with Fixes #470..

An example of a correctly-formatted commit:

commit fabd5e450374c8dde65ec35f02140383940fe146
Author: zulipbot
Date:   Sat Mar 18 13:42:40 2017 -0700

    pull requests: Check PR commits reference when issue is referenced.

    Fixes #51.

To learn how to write a great commit message, please refer to our guide.

Added deep linking support with zulip://, registered the protocol handler, and implemented a dialog to choose between opening the link in the app or browser.
@zulipbot zulipbot added size: XL and removed size: M labels Feb 8, 2025
@zulipbot zulipbot added size: M and removed size: XL labels Feb 8, 2025
@avijitdas126 avijitdas126 force-pushed the feat/deep-linking-on-zulip-470 branch 2 times, most recently from 3324969 to 3d6ea80 Compare February 8, 2025 14:21
@avijitdas126
Copy link
Collaborator Author

@akashnimare could you please review this PR?

@zulipbot zulipbot added size: L and removed size: M labels Feb 22, 2025
To register a custom protocol for your Electron application across all platforms (Windows, macOS, and Linux), you can define it in the build section of your package.json file using the protocols property provided by electron-builder.
@avijitdas126 avijitdas126 force-pushed the feat/deep-linking-on-zulip-470 branch from 55222f2 to 5b5c380 Compare February 22, 2025 11:39
To register a custom protocol for your Electron application across all platforms (Windows, macOS, and Linux), you can define it in the build section of your package.json file using the protocols property provided by electron-builder.
@zulipbot zulipbot added size: M and removed size: L labels Feb 22, 2025
Comment on lines +219 to +223
if (response.response === 0) {
mainWindow.webContents.send("open-url", url);
} else {
await shell.openExternal(url); // Open in browser
}
Copy link
Member

Choose a reason for hiding this comment

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

What are you expecting this to accomplish, in either case? Neither an Electron webContents nor an external web browser knows anything about zulip: URLs.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

What are you expecting this to accomplish, in either case? Neither an Electron

When a URL is received, the application presents a dialog to the user. If the user confirms (response.response === 0), the app sends an open-url event to the main window's webContents, allowing the app to handle the URL internally. If the user declines, the URL is opened in the default web browser using shell.openExternal(url).

Copy link
Member

Choose a reason for hiding this comment

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

Please don’t waste the time of open source maintainers with AI generated slop. If you don’t understand what’s going on well enough to see that this completely failed to address my question, then this is not the project for you.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

No sir, I cannot solve this issue using AI.I solved this issue using electron deeplinking documentation. When user hit zulip:// endpoint when open a dialog box if user want to open on the desktop click on open with desktop verify response.response===0 go to desktop using mainWindow.webContents.send("open-url", url); otherwise open with browser await shell.openExternal(url);

@avijitdas126 avijitdas126 requested a review from andersk February 28, 2025 06:33
@andersk andersk closed this Feb 28, 2025
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.

Enhancement: zulip:// URI Scheme for electron
3 participants