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

app,io: related to deeplink #1

Closed
wants to merge 16 commits into from

Conversation

mearaj
Copy link

@mearaj mearaj commented Jul 24, 2023

discussion at gioui#117 (comment)

egonelbre and others added 14 commits June 27, 2023 10:41
                 │   sec/op    │   sec/op     vs base               │
SplitCubic/4-10    37.36n ± 0%   36.16n ± 0%  -3.21% (p=0.000 n=10)
SplitCubic/8-10    74.53n ± 0%   72.21n ± 0%  -3.12% (p=0.000 n=10)
SplitCubic/16-10   149.3n ± 1%   144.5n ± 0%  -3.22% (p=0.000 n=10)
SplitCubic/33-10   340.1n ± 0%   334.4n ± 0%  -1.65% (p=0.000 n=10)

Signed-off-by: Egon Elbre <[email protected]>
Now, it's possible to launch one Gio app using a custom URI scheme, such as `gio://some/data`.

This feature is supported on Android, iOS, macOS and Windows, issuing a new deeplink.Event,
containing the URL launched. If the program is already opened, one deeplink.Event will be
sent to the current opened app.

Limitations:
On Windows, if the program uses deeplink (compiled with `-deeplink`), then just a single
instance of the app can be open. In other words, just a single `myprogram.exe` can
be active.

Security:
Deeplinking have the same level of security of clipboard. Any other software can send such
information and read the content, without any restriction. That should not be used to transfer
sensible data, and can't be fully trusted.

Setup/Compiling:
In order to set the custom scheme, you need to use the new `-deeplink` flag in `gogio`, using
as `-deeplink gio` will listen to `gio://`.

If you are not using gogio you need to defined some values, which varies for each OS:

macOS/iOS - You need to define the following Properly List:
```
<key>CFBundleURLTypes</key>
<array>
  <dict>
	<key>CFBundleURLSchemes</key>
	<array>
	  <string>yourCustomScheme</string>
	</array>
  </dict>
</array>
```

Windows - You need to compiling using -X argument:
```
-ldflags="-X "gioui.org/app.schemesDeeplink=yourCustomScheme" -H=windowsgui"
```

Android - You need to add IntentFilter in GioActivity:
```
<intent-filter>
	<action android:name="android.intent.action.VIEW"></action>
	<category android:name="android.intent.category.DEFAULT"></category>
	<category android:name="android.intent.category.BROWSABLE"></category>
	<data android:scheme="yourCustomScheme"></data>
</intent-filter>
```

That assumes that you still using GioActivity and GioAppDelegate, otherwise more
changes are required.

Signed-off-by: inkeliz <[email protected]>
Signed-off-by: inkeliz <[email protected]>
Signed-off-by: inkeliz <[email protected]>
discussion at gioui#117 (comment)

Signed-off-by: Mearaj Bhagad <[email protected]>
@inkeliz inkeliz force-pushed the add-deeplink branch 2 times, most recently from 69b0574 to b38ddc0 Compare August 20, 2023 16:10
@mearaj mearaj closed this Mar 10, 2024
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