Code review comment for lp:~mterry/unity8/greeter-refactor

Revision history for this message
Daniel d'Andrada (dandrader) wrote :

In Greeter.qml:

"""
   loader.item.authenticated(false);
"""

Please name it like a function, instead of like a boolean property.

I would suggest:
onAuthenticationSucceeded() and onAuthenticationFailed() (or replace the "on" prefix with "nofify", as it's the pattern you seem to be using already) as dropping the boolean parameter makes Greeter.qml code more readable. After all you're not saving any work with this boolean parameter as the implementation does "if(booleanParam){doSuccessfulPath}else{doFailurePath}" anyway.

eg:

"""
    function authenticated(success) {
        if (success) {
            lockscreen.hide();
        } else {
            lockscreen.clear(true);
        }
    }
"""

Would be:

"""
    function onAuthenticationSucceeded() { lockscreen.hide(); }
    function onAuthenticationFailed() { lockscreen.clear(true); }
"""

« Back to merge proposal