-
Notifications
You must be signed in to change notification settings - Fork 6
feat(linux): add deep link handling and new dependency for unique4j #669
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
Conversation
// Register shutdown hook to free the lock when application exits | ||
Runtime.getRuntime().addShutdownHook( | ||
Thread { | ||
unique?.freeLock() |
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.
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.
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 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") |
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.
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?
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.
The deeplink works if there is an instance already.
The lock is for unique4j to know the status
composeApp/src/desktopMain/kotlin/org/ooni/probe/data/DeepLinkHandler.kt
Outdated
Show resolved
Hide resolved
import java.nio.file.Paths | ||
import java.util.Date | ||
|
||
class DeepLinkHandler { |
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 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 there are still some unaddressed comments from my last review. |
Split InstanceManager and DeepLinkParser
Closes #640
Reference hydraulic-software/conveyor#5