Skip to content

Conversation

aanorbel
Copy link
Member

@aanorbel aanorbel commented Apr 10, 2025

// Register shutdown hook to free the lock when application exits
Runtime.getRuntime().addShutdownHook(
Thread {
unique?.freeLock()
Copy link
Contributor

Choose a reason for hiding this comment

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

Did you check how this handles hard crashes? If we can still open the app? If it uses a lock file, it could still be there.

Copy link
Member Author

Choose a reason for hiding this comment

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

I have to check this. I havent had a broken instance if the app crashed at runtime before.

// Register as a protocol handler if not already registered
registerProtocolHandler()
} else {
Logger.d("Could not acquire lock - this should not happen")
Copy link
Contributor

Choose a reason for hiding this comment

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

Isn't this what happens with the second instance? And should we ignore the args from the second instance? Would a deeplink work for an already existing app?

Copy link
Member Author

Choose a reason for hiding this comment

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

The deeplink works if there is an instance already.

The lock is for unique4j to know the status

import java.nio.file.Paths
import java.util.Date

class DeepLinkHandler {
Copy link
Contributor

Choose a reason for hiding this comment

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

I feel we could simplify this class by splitting it into the 3 things it's trying to do:

  • Make sure only one app instance is running, and passing the args of every open to the first instance
  • Parsing deeplinks
  • Registering protocol handlers

@aanorbel aanorbel marked this pull request as ready for review April 15, 2025 15:04
@sdsantos
Copy link
Contributor

@aanorbel there are still some unaddressed comments from my last review.

@sdsantos sdsantos merged commit 404933f into main May 5, 2025
5 checks passed
@sdsantos sdsantos deleted the issues/640 branch May 5, 2025 10:32
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.

desktop(linux): deeplink support for website testing and installing run V2 links
2 participants