Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
class Conversation {
//GREETING_EXISTING_USER starts with "Hey%s! ...". So you can put there a name with preceding space,
//or simply an empty String
_greetExistingUser() {
const loggedWaterPromise = this.waterLog.getLoggedWaterForUser(this._getCurrentUserId());
const userNamePromise = this.userManager.loadAssistantUser(this._getCurrentUserId());
return Promise.all([loggedWaterPromise, userNamePromise])
.then(values => {
const loggedWater = values[0];
const userGivenName = values[1].givenName;
let formattedName = '';
if (userGivenName) {
formattedName = ' ' + userGivenName;
util.format(Str.GREETING_EXISTING_USER, formattedName, loggedWater),
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.