0
Good morning/late/evening!
I am developing a mobile APP! In this APP there is a login screen and a main screen. I want the user not to have to log in every time he enters the APP, the first time the app would open the login screen on the other times would open the main screen. I spent yesterday all day looking for a solution to create a dynamic defaultpage.
Try to explain how this my code!
In the app-root.xml file
<Frame defaultPage="views/login/login-page"></Frame>
In the app.js file
const applicationModule = require("tns-core-modules/application");
applicationModule.run({moduleName: "app-root"});
I’ve tried things like:
In the app-root.xml file
<Frame defaultPage="{{route}}" loaded="init"></Frame>
In a new app-route.js file
const observableModule = require("tns-core-modules/data/observable");
exports.init= (args)=> {
if(appSettings.getString("isLogin", "") == "true"){
page.bindingContext = new observableModule.fromObject({route: "views/feed/feed-page"});
}else {
page.bindingContext = new observableModule.fromObject({route: "views/login/login-page"});
}
};
I didn’t succeed, I tried several other things like changing the app itself.js. Trying something like In the app.js file
const applicationModule = require("tns-core-modules/application");
let module = "app-root"
if(appSettings.getString("isLogin", "") == "true") module = "views/feed/feed-page"
applicationModule.run({moduleName: module });
I would like a good output to encode this feature!
Thank you in advance.