qml PIN: do not lock inactive app, and remove timeout
- the activity callback does not work properly on android (does not work on my phone). Also, it duplicates the lock screen function of most phones. - if we do not lock inactive app, then the PIN feature does not need a timeout, and is easier to understand without it. - in Preferences, explain what it does
This commit is contained in:
@@ -191,7 +191,7 @@ Pane {
|
||||
}
|
||||
Label {
|
||||
Layout.fillWidth: true
|
||||
text: qsTr('PIN')
|
||||
text: qsTr('PIN protect payments')
|
||||
wrapMode: Text.Wrap
|
||||
}
|
||||
}
|
||||
|
||||
@@ -485,9 +485,6 @@ ApplicationWindow
|
||||
}
|
||||
}
|
||||
|
||||
property var _lastCorrectPinTime: 0
|
||||
property int _pinValidSeconds: 5*60
|
||||
|
||||
function handleAuthRequired(qtobject, method) {
|
||||
console.log('auth using method ' + method)
|
||||
if (method == 'wallet') {
|
||||
@@ -513,14 +510,8 @@ ApplicationWindow
|
||||
// no PIN configured
|
||||
qtobject.authProceed()
|
||||
} else {
|
||||
if (Date.now() - _lastCorrectPinTime <= _pinValidSeconds * 1000) {
|
||||
// correct pin entered recently, accept.
|
||||
qtobject.authProceed()
|
||||
return
|
||||
}
|
||||
var dialog = app.pinDialog.createObject(app, {mode: 'check', pincode: Config.pinCode})
|
||||
dialog.accepted.connect(function() {
|
||||
_lastCorrectPinTime = Date.now()
|
||||
qtobject.authProceed()
|
||||
dialog.close()
|
||||
})
|
||||
@@ -538,27 +529,4 @@ ApplicationWindow
|
||||
property var _lastActive: 0 // record time of last activity
|
||||
property bool _lockDialogShown: false
|
||||
|
||||
onActiveChanged: {
|
||||
console.log('app active = ' + active)
|
||||
if (active) {
|
||||
if (!_lastActive) {
|
||||
_lastActive = Date.now()
|
||||
return
|
||||
}
|
||||
// activated
|
||||
if (Date.now() - _lastCorrectPinTime > _pinValidSeconds * 1000) {
|
||||
if (_lockDialogShown || Config.pinCode == '')
|
||||
return
|
||||
var dialog = app.pinDialog.createObject(app, {mode: 'check', canCancel: false, pincode: Config.pinCode})
|
||||
dialog.accepted.connect(function() {
|
||||
_lastCorrectPinTime = Date.now()
|
||||
dialog.close()
|
||||
_lockDialogShown = false
|
||||
})
|
||||
dialog.open()
|
||||
_lockDialogShown = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user