function authStateObserver(user) {
  if (user) {
    // User is signed in!
    // Get the signed-in user's profile pic and name.
    var profilePicUrl = getProfilePicUrl();
    var userName = getUserName();

    // Set the user's profile pic and name.
    userPicElement.style.backgroundImage =
      'url(' + profilePicUrl + ')';
    userNameElement.textContent = userName;

    // Show user's profile and sign-out button.
    userNameElement.removeAttribute('hidden');
    userPicElement.removeAttribute('hidden');
    signOutButtonElement.removeAttribute('hidden');
    profileButtonElement.removeAttribute('hidden');

    // Hide sign-in button.
    signInEmailButtonElement.setAttribute('hidden', 'true');

    getProfile();

    // We save the Firebase Messaging Device token and enable notifications.
    //saveMessagingDeviceToken();
  } else {
    // User is signed out!
    // Hide user's profile and sign-out button.
    userNameElement.setAttribute('hidden', 'true');
    userPicElement.setAttribute('hidden', 'true');
    signOutButtonElement.setAttribute('hidden', 'true');
    profileButtonElement.setAttribute('hidden', 'true');

    // Show sign-in button.
    signInEmailButtonElement.removeAttribute('hidden');
    resetMaterialTextfield(ageInputElement);
    resetMaterialTextfield(sexInputElement);
    resetMaterialTextfield(yearlyGoalInputElement);
    resetMaterialTextfield(countyInputElement);
  }
}
// Triggers when the auth state change for instance when the user signs-in or signs-out.
Triggers when the auth state change for instance when the user signs-in or signs-out.
Triggers when the auth state change for instance when the user signs - in or signs - out .
function authStateObserver(user) {
  if (user) {
    var profilePicUrl = getProfilePicUrl();
    var userName = getUserName();
    userPicElement.style.backgroundImage =
      'url(' + profilePicUrl + ')';
    userNameElement.textContent = userName;
    userNameElement.removeAttribute('hidden');
    userPicElement.removeAttribute('hidden');
    signOutButtonElement.removeAttribute('hidden');
    profileButtonElement.removeAttribute('hidden');
    signInEmailButtonElement.setAttribute('hidden', 'true');
    getProfile();
  } else {
    userNameElement.setAttribute('hidden', 'true');
    userPicElement.setAttribute('hidden', 'true');
    signOutButtonElement.setAttribute('hidden', 'true');
    profileButtonElement.setAttribute('hidden', 'true');
    signInEmailButtonElement.removeAttribute('hidden');
    resetMaterialTextfield(ageInputElement);
    resetMaterialTextfield(sexInputElement);
    resetMaterialTextfield(yearlyGoalInputElement);
    resetMaterialTextfield(countyInputElement);
  }
}
function authStateObserver ( user ) { if ( user ) { var profilePicUrl = getProfilePicUrl ( ) ; var userName = getUserName ( ) ; userPicElement . style . backgroundImage = 'url(' + profilePicUrl + ')' ; userNameElement . textContent = userName ; userNameElement . removeAttribute ( 'hidden' ) ; userPicElement . removeAttribute ( 'hidden' ) ; signOutButtonElement . removeAttribute ( 'hidden' ) ; profileButtonElement . removeAttribute ( 'hidden' ) ; signInEmailButtonElement . setAttribute ( 'hidden' , 'true' ) ; getProfile ( ) ; } else { userNameElement . setAttribute ( 'hidden' , 'true' ) ; userPicElement . setAttribute ( 'hidden' , 'true' ) ; signOutButtonElement . setAttribute ( 'hidden' , 'true' ) ; profileButtonElement . setAttribute ( 'hidden' , 'true' ) ; signInEmailButtonElement . removeAttribute ( 'hidden' ) ; resetMaterialTextfield ( ageInputElement ) ; resetMaterialTextfield ( sexInputElement ) ; resetMaterialTextfield ( yearlyGoalInputElement ) ; resetMaterialTextfield ( countyInputElement ) ; } }
Triggers when the auth state change for instance when the user signs-in or signs-out.
Triggers when the auth state change for instance when the user signs - in or signs - out .
// User is signed in! // Get the signed-in user's profile pic and name. // Set the user's profile pic and name. // Show user's profile and sign-out button. // Hide sign-in button. // We save the Firebase Messaging Device token and enable notifications. //saveMessagingDeviceToken(); // User is signed out! // Hide user's profile and sign-out button. // Show sign-in button.