Hey!
I need to count the number of app starts, as only on the first launch do I need my users to agree to the privacy policy/terms of service! I found on;
https://felgo.com/doc/apps-howtos/#save-things-in-a-local-database
the section of:
import Felgo 3.0
import QtQuick 2.5
App {
// define Storage item for loading/storing key-value data
Storage {
id: localStorage
property int appStarts: 0
// update app starts counter
Component.onCompleted: {
var nr = localStorage.getValue("appstarts")
if(nr === undefined)
nr = 0
nr++
localStorage.setValue("appstarts", nr)
appStarts = nr
}
}
// define page that shows nr of app starts
NavigationStack {
Page {
id: page
title: "Local Storage"
AppText {
anchors.centerIn: parent
text: "App Starts: "+localStorage.appStarts
}
}
}
}
and have added to my main.qml, but I still get the popup each time my users launch the app?
the visibility of the item I want show/hide is on a separate page, loginPage.qml, and the visibility is:
Item {
id: termsAccept
visible: localStorage.appStarts > 1 ? false : true
enabled: localStorage.appStarts > 1 ? false : true
}
WHat could I change to sort this?
Thanks 🙂