Save persistently that default identity is created

In 943a4213fb default identity creation
  burst has been solved but some times the duplication happens in
  sequent instances of the app, now te app store permanently if default
  identity has been created so this other kind of duplication is avoided
  too (hopefully)
This commit is contained in:
Gioacchino Mazzurco 2017-04-19 14:23:29 +02:00
parent e83fec8d84
commit 30bb84c4a9

View File

@ -20,6 +20,7 @@ import QtQuick 2.7
import QtQuick.Controls 2.0 import QtQuick.Controls 2.0
import org.retroshare.qml_components.LibresapiLocalClient 1.0 import org.retroshare.qml_components.LibresapiLocalClient 1.0
import "." //Needed for TokensManager singleton import "." //Needed for TokensManager singleton
import Qt.labs.settings 1.0
Item Item
{ {
@ -63,7 +64,6 @@ Item
rsApi.request("/identity/*/", "", refreshContactsCallback) rsApi.request("/identity/*/", "", refreshContactsCallback)
} }
property bool _refreshOwnCallback_creating: false
function refreshOwnCallback(par) function refreshOwnCallback(par)
{ {
console.log("contactsView.refreshOwnCallback(par)", visible) console.log("contactsView.refreshOwnCallback(par)", visible)
@ -76,10 +76,10 @@ Item
contactsView.own_gxs_id = json.data[0].gxs_id contactsView.own_gxs_id = json.data[0].gxs_id
contactsView.own_nick = json.data[0].name contactsView.own_nick = json.data[0].name
} }
else if (!_refreshOwnCallback_creating) else if (!settings.defaultIdentityCreated)
{ {
console.log("refreshOwnCallback(par)", "creating new identity" ) console.log("refreshOwnCallback(par)", "creating new identity" )
_refreshOwnCallback_creating = true settings.defaultIdentityCreated = true
var jsonData = { "name": mainWindow.pgp_name, "pgp_linked": false } var jsonData = { "name": mainWindow.pgp_name, "pgp_linked": false }
rsApi.request( rsApi.request(
@ -203,4 +203,12 @@ Item
"</pre>" "</pre>"
} }
} }
Settings
{
id: settings
category: "contactsView"
property bool defaultIdentityCreated: false
}
} }