-
Notifications
You must be signed in to change notification settings - Fork 292
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ES6: migrated "connect" #1030
ES6: migrated "connect" #1030
Conversation
}).catch((error) => { | ||
return this.logger.error(`Failed to import contacts from Google: ${error.message}`, error); | ||
}); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
get_contacts() {
return this._init_library()
.then(() => this._get_access_token())
.then((access_token) => this._get_contacts(access_token))
.catch((error) => {
return this.logger.error(`Failed to import contacts from Google: ${error.message}`, error);
});
}
|
||
this.logger.info('Lazy loading Google Auth API'); | ||
let script_node = document.createElement('script'); | ||
script_node.src = 'https://apis.google.com/js/auth.js?onload=gapi_loaded'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const
return new Promise((resolve, reject) => { | ||
this.logger.info('Fetching address book from Google'); | ||
let api_endpoint = 'https://www.google.com/m8/feeds/contacts/default/full'; | ||
return $.get(`${api_endpoint}?access_token=${access_token}&alt=json&max-results=15000&v=3.0`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should use fetch
for this at some point
return new Promise((resolve, reject) => { | ||
if (window.gapi.auth) { | ||
let auth_token = window.gapi.auth.getToken(); | ||
if (auth_token) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const
} | ||
return this._load_library(); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return window.gapi ? Promise().resolve() : this._load_library()
maybe
this.logger.info('Google Contacts SDK error', error); | ||
throw new z.connect.ConnectError(z.connect.ConnectError.prototype.TYPE.GOOGLE_DOWNLOAD); | ||
}).then((response) => { | ||
amplify.publish(z.event.WebApp.SEARCH.SHOW); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
then on a new line
this.logger.warn('No contacts found for upload'); | ||
throw new z.connect.ConnectError(z.connect.ConnectError.prototype.TYPE.NO_CONTACTS); | ||
} else { | ||
this.logger.info(`Uploading hashes of '${phone_book.cards.length}' contacts for matching`, phone_book); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
now else
return resolve(undefined); | ||
} | ||
let address_book = window.wAddressBook; | ||
let phone_book = new z.connect.PhoneBook(this.properties_repository.self()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const
f6e4e5f
to
bdfe2fa
Compare
bdfe2fa
to
aff38e2
Compare
No description provided.