gio-plugins icon indicating copy to clipboard operation
gio-plugins copied to clipboard

hyperlink: support more than HTTP/HTTPS

Open inkeliz opened this issue 3 years ago • 10 comments

Currently, hyperlink only supports HTTP and HTTPS. However, I think some known schemes could be supported:

  • tel://
  • mailto://
  • sms://

Also, supporting custom schemes, as long as the device understand such scheme:

  • steam://
  • instagram://
  • titkok://

In both cases, it will only work if the device have some app/program that can open such protocol/scheme. I need to investigate how each OS register the handler of each scheme.

inkeliz avatar Oct 06 '22 18:10 inkeliz

nice idea

gedw99 avatar Oct 08 '22 12:10 gedw99

It's more complex than I initially thought. For iOS 10+, it requires to modify the plist/manifest. That is not the first "plugin" to requires that. The credentials also requires modify the manifest.

I think I should fork gogio and create gio-plugins/gogio, or change the name (gogio2 or giobuilder). Personally, I keep a private fork of gogio in order to modify the manifest: https://stackoverflow.com/questions/38393266/lsapplicationqueriesschemes-and-derived-data/38393379#38393379

The next step is to be able to customize settings based on plugins added. My initial idea is to expose some simple ABI for WASM, and then each plugin can have one pre-compiled WASM, which can modify the manifest and also expose settings to change using some UI. So, if the project includes one folder with some_specific_naming.wasm, it will be executed and run during the builder, basically: script-language to modify the plist/manifest and expose methods to change such settings, without need to change it manually (that will be possible too).

inkeliz avatar Oct 08 '22 20:10 inkeliz

It's more complex than I initially thought. For iOS 10+, it requires to modify the plist/manifest. That is not the first "plugin" to requires that. The credentials also requires modify the manifest.

Got it. The end developers app will need that manifest data too ?

I think I should fork gogio and create gio-plugins/gogio, or change the name (gogio2 or giobuilder). Personally, I keep a private fork of gogio in order to modify the manifest: https://stackoverflow.com/questions/38393266/lsapplicationqueriesschemes-and-derived-data/38393379#38393379

Yes fork it. I was thinking about forking https://github.com/gioui/gio-cmd to add packaging aspects.

The next step is to be able to customize settings based on plugins added. My initial idea is to expose some simple ABI for WASM, and then each plugin can have one pre-compiled WASM, which can modify the manifest and also expose settings to change using some UI. So, if the project includes one folder with some_specific_naming.wasm, it will be executed and run during the builder, basically: script-language to modify the plist/manifest and expose methods to change such settings, without need to change it manually (that will be possible too).

This sounds really nice... Will the UI be GIOUI based ?

gedw99 avatar Oct 10 '22 10:10 gedw99

Got it. The end developers app will need that manifest data too ?

That already happens when using native code (like Obj-C/Swift). Initially I have the idea of evaluate it at compile-time. Expose one function, say: hyperlink.AllowSchema("something://"). So, we can parse the Golang code (AST and such), find for such function, and add this schema into the manifest. However, the content MUST be constant (doing: AllowScheme(x)) will not evaluate the x, since it can change based on the context.

But... That might be so much difficult to implement, it's easier to write some documentation describing the Manifest stuff... 🤣

Will the UI be GIOUI based ?

Yes, it will use Gio. I want to do something "simple", similar to how PhoneGap used to work (https://www.formget.com/wp-content/uploads/2015/11/phonegap-windows-create-project.png). You could setup the folder, ajusts some settings, connect other devices.... Initially, I want to:

  • Be able to change the XML/Manifest.
    • Ideally, it can be "plugin-aware" offering options based on the plugins added (some script-language/vm to extend the builder).
  • Connect to SSH to build stuff on Linux/FreeBSD/MacOS
    • I think Fyne goes to another road, their https://github.com/fyne-io/fyne-cross is cross-compilable (except iOS) without requiring host of such OS. However, that NOT work with custom CGO dependencies, which is likely to happen when using plugins. But, boot some VMs is far easier today, except macOS.
  • Connect to ADB to connect/install Android devices - Run adb install everytime is annoying.
  • View the screen using VNC (maybe external software), to see the result of the compiled stuff.
    • That is how I usually test stuff away from home. For Android, it's possible to use Android x86, to run it on any VM.

.... And, the UI is not mandatory, the CLI should remain and may have most of those features. So, maybe you can use the UI once, to setup, and then use CLI.

inkeliz avatar Oct 10 '22 13:10 inkeliz

Related to packaging, I don't care that much (or I don't get the idea). I think it's quite easy to pack it after the binary is already compiled, maybe some OS that might not work (like some Linux distro).

inkeliz avatar Oct 10 '22 13:10 inkeliz

The similar to Cordoba is clever . Light and simple . Love it

gedw99 avatar Oct 10 '22 13:10 gedw99

Also the AST technique is nice. mother option is to output it at compile time to json and then use that json at packaging time.

Encore.dev heavily uses annotations with AST. It’s on GitHub and pretty interesting / clever how it keeps the runtime and dev time synced in terms of interfaces . Check their tools folder and it will be obvious to you I suspect. If not just ask. Maybe it’s useful ..

gedw99 avatar Oct 10 '22 13:10 gedw99

Hey @inkeliz

https://github.com/hairyhenderson/go-fsimpl looks useful ?

gedw99 avatar Oct 31 '22 11:10 gedw99

I don't think hyperlink is supposed to handle files directly. If you call hyperlink.Open{URL: "s3://...."} it will open some app which handles s3 scheme (in that case). The same (should) happen when use tel:// or mailto://, it will launch some app which handles such scheme.

inkeliz avatar Nov 02 '22 10:11 inkeliz

thanks @inkeliz for the explanation. makes sense now.

gedw99 avatar Nov 03 '22 09:11 gedw99