Merge pull request #32 from status-im/feat/single-instance-deep-links

Passing custom events over single instance IPC
This commit is contained in:
Iuri Matias 2021-09-15 14:24:50 -04:00 committed by GitHub
commit b67014a56a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 5 deletions

View File

@ -338,7 +338,7 @@ proc dos_qurl_host(host: cstring): cstring {.cdecl, dynlib: dynLibName, importc.
proc dos_qurl_replaceHostAndAddPath(url: cstring, newScheme: cstring, newHost: cstring, pathPrefix: cstring): cstring {.cdecl, dynlib: dynLibName, importc.}
# SingleInstance
proc dos_singleinstance_create(uniqueName: cstring): DosQObject {.cdecl, dynlib: dynLibName, importc.}
proc dos_singleinstance_create(uniqueName: cstring, eventStr: cstring): DosQObject {.cdecl, dynlib: dynLibName, importc.}
proc dos_singleinstance_isfirst(vptr: DosQObject): bool {.cdecl, dynlib: dynLibName, importc.}
proc dos_singleinstance_delete(vptr: DosQObject) {.cdecl, dynlib: dynLibName, importc.}

View File

@ -1,6 +1,6 @@
proc setup*(self: SingleInstance, uniqueName: string) =
proc setup*(self: SingleInstance, uniqueName: string, eventStr: string) =
## Setup a new SingleInstance
self.vptr = dos_singleinstance_create(uniqueName)
self.vptr = dos_singleinstance_create(uniqueName, eventStr)
proc delete*(self: SingleInstance) =
## Delete the given SingleInstance
@ -9,9 +9,9 @@ proc delete*(self: SingleInstance) =
dos_singleinstance_delete(self.vptr)
self.vptr.resetToNil
proc newSingleInstance*(uniqueName: string): SingleInstance =
proc newSingleInstance*(uniqueName: string, eventStr: string): SingleInstance =
new(result, delete)
result.setup(uniqueName)
result.setup(uniqueName, eventStr)
proc secondInstance*(self: SingleInstance): bool =
return not dos_singleinstance_isfirst(self.vptr)