How do I call this router in JS? router is null in my JS. Do I need to do something more in my .uno class then just add (Fuse.Navigation.Router router) to my constructor?
You can not combine ux:Dependency with ux:AutoCtor="false" in the same class, unfortunately. To do this, you have to split your class in two layers. In the base class, introduce the dependency. In the derived class, do ux:AutoCtor="false" and then pass a non-null router to the base constructor.
You can not combine ux:Dependency with ux:AutoCtor="false" in the same class, unfortunately. To do this, you have to split your class in two layers. In the base class, introduce the dependency. In the derived class, do ux:AutoCtor="false" and then pass a non-null router to the base constructor.
> Hi Anders, Can you post an example please or help me with the code below (not working with error = “‘SplashPage’ does not have a property called ‘router’.”): Base class: Derived class .ux: Derived class .uno: using Uno; using Uno.Collections; using Uno.Permissions; using Fuse; public partial class SplashPage { public SplashPage(Fuse.Navigation.Router router) { debug\_log("App init!"); var permissionPromise = Permissions.Request(Permissions.Android.CAMERA); permissionPromise.Then(OnPermitted, OnRejected); } void OnPermitted(PlatformPermission permission) { debug\_log "Woo, we can take the picture now"; InitializeUX(); } void OnRejected(Exception e) { debug_log "Damn: " + e.Message; } } MainView.ux: Thanks for your help !
Hi Anders, and thanks for your answer!
I made the changes but still getting “SplashPage.uno(10.12): E3003: ‘__baseClass12’ does not have a constructor that matches this argument list”.
Also getting "MainView.ux(9): E8001: ‘SplashPage’ does not have a property called ‘router’. " if I remove the ux:Dependency=“router” in SplashPage.ux.
The updated files look as follows:
SplashPage.uno
using Uno;
using Uno.UX;
using Uno.Collections;
using Uno.Permissions;
using Fuse;
public partial class SplashPage => should I add :SplashPageRouter ?
{
[UXConstructor]
public SplashPage([UXParameter("router")] Fuse.Navigation.Router router): base(router) {
var permissionPromise = Permissions.Request(Permissions.Android.CAMERA);
permissionPromise.Then(OnPermitted, OnRejected);
}
void OnPermitted(PlatformPermission permission){ InitializeUX(); }
...
SplashPage.ux:
<SplashPageRouter ux:Class="SplashPage" ux:AutoCtor="false" router="router":(tried with and without router="router")>
...
MainView.ux contains a Navigator with two pages. The status bar is set to hidden.
MainView.uno requests access to the Camera.
the app launches, the default page is set, but the camera permission dialog is not visible.
Only when the user navigates to the second page, then the camera permission dialog appears.
the user grants permission and the second page is displayed.
Ok so far (still I would expect the permission to appear from the beginning). But the issue is that when the second page is displayed, the status bar becomes visible + a white rectangle at the bottom of the page appears.
MainView.ux contains a Navigator with two pages. The status bar is set to hidden.
MainView.uno requests access to the Camera.
the app launches, the default page is set, but the camera permission dialog is not visible.
Only when the user navigates to the second page, then the camera permission dialog appears.
the user grants permission and the second page is displayed.
Ok so far (still I would expect the permission to appear from the beginning). But the issue is that when the second page is displayed, the status bar becomes visible + a white rectangle at the bottom of the page appears.
Which I just solved replacing ClientPanel by Panel in the second Page…