Closed edgarfgp closed 1 year ago
@twop After some investigation this how the feature could be implemented. and detailed some of the limitation . Not sure if there is a way to fix the limitation I found. @TimLariviere and yourself know the internals better that I do . So any feedback is appreciated
Maybe you can add a AppLinks collection to CustomApplication to be able to use widget collection?
Hmm, actually you can do it without adding a new property to CustomApplication. You can create a fake "AppLinks" collection attribute that would direct update Application.AppLinks.Register/Deregister (see NavigationPage.Pages for example)
Implementation of fabulous-dev/Fabulous.XamarinForms#21
In order to support Deep linking a Indexing we need to:
[]
static member inline onLinkReceived(this: WidgetBuilder<'msg, #IApplication>, fn: LinkRequestReceivedEventArgs -> 'msg) =
this.AddScalar(Application.LinkRequestReceived.WithValue(fn >> box))
BUT AppLinks is not a List of AppLink is just and Intercase AppLinks . So can not use a widget collection.
Workaround
Use ViewRef to to get access to the Register and DeRegister methods
match applicationRef.TryValue with | Some target -> target.AppLinks.RegisterLink(createLink) | None -> failwith "No application ref")