Remove unnecessary break line

This commit is contained in:
Matheus Faustino 2018-09-11 21:10:12 -03:00
parent 59e494c0eb
commit dab67f2d84
No known key found for this signature in database
GPG Key ID: A132F02D41D2F4A6
2 changed files with 0 additions and 18 deletions

View File

@ -5,7 +5,6 @@
*/ */
function getRedirectUrlAuthFlow() { function getRedirectUrlAuthFlow() {
const browserApi = typeof browser === 'undefined' ? chrome : browser; const browserApi = typeof browser === 'undefined' ? chrome : browser;
return browserApi.identity.getRedirectURL(); return browserApi.identity.getRedirectURL();
} }
@ -21,6 +20,5 @@ function launchWebAuthFlow(details) {
chrome.identity.launchWebAuthFlow(details, resolve); chrome.identity.launchWebAuthFlow(details, resolve);
}); });
} }
return browser.identity.launchWebAuthFlow(details); return browser.identity.launchWebAuthFlow(details);
} }

View File

@ -31,7 +31,6 @@ function hasDropboxAccessToken() {
function requestDropboxAccessToken() { function requestDropboxAccessToken() {
const client = new Dropbox.Dropbox({clientId: DROPBOX_API_KEY}); const client = new Dropbox.Dropbox({clientId: DROPBOX_API_KEY});
const authUrl = client.getAuthenticationUrl(getRedirectUrlAuthFlow()); const authUrl = client.getAuthenticationUrl(getRedirectUrlAuthFlow());
return launchWebAuthFlow({url: authUrl, interactive: true}) return launchWebAuthFlow({url: authUrl, interactive: true})
.then(urlReturned => { .then(urlReturned => {
const params = new URLSearchParams(new URL(urlReturned).hash.replace('#', '')); const params = new URLSearchParams(new URL(urlReturned).hash.replace('#', ''));
@ -55,7 +54,6 @@ $('#sync-dropbox-export').onclick = () => {
clientId: DROPBOX_API_KEY, clientId: DROPBOX_API_KEY,
accessToken: token accessToken: token
}); });
return client.filesDownload({path: '/' + DROPBOX_FILE}) return client.filesDownload({path: '/' + DROPBOX_FILE})
.then(() => messageBox.confirm(t('overwriteFileExport'))) .then(() => messageBox.confirm(t('overwriteFileExport')))
.then(ok => { .then(ok => {
@ -63,25 +61,21 @@ $('#sync-dropbox-export').onclick = () => {
if (!ok) { if (!ok) {
return Promise.reject({status: HTTP_STATUS_CANCEL}); return Promise.reject({status: HTTP_STATUS_CANCEL});
} }
return client.filesDelete({path: '/' + DROPBOX_FILE}); return client.filesDelete({path: '/' + DROPBOX_FILE});
}) })
// file deleted with success, get styles and create a file // file deleted with success, get styles and create a file
.then(() => { .then(() => {
messageProgressBar({title: title, text: t('gettingStyles')}); messageProgressBar({title: title, text: t('gettingStyles')});
return API.getStyles().then(styles => JSON.stringify(styles, null, '\t')); return API.getStyles().then(styles => JSON.stringify(styles, null, '\t'));
}) })
// create zip file // create zip file
.then(stylesText => { .then(stylesText => {
messageProgressBar({title: title, text: t('zipStyles')}); messageProgressBar({title: title, text: t('zipStyles')});
return createZipFileFromText(FILENAME_ZIP_FILE, stylesText); return createZipFileFromText(FILENAME_ZIP_FILE, stylesText);
}) })
// create file dropbox // create file dropbox
.then(zipedText => { .then(zipedText => {
messageProgressBar({title: title, text: t('uploadingFile')}); messageProgressBar({title: title, text: t('uploadingFile')});
return uploadFileDropbox(client, zipedText); return uploadFileDropbox(client, zipedText);
}) })
// gives feedback to user // gives feedback to user
@ -91,26 +85,21 @@ $('#sync-dropbox-export').onclick = () => {
console.log(error); console.log(error);
// saving file first time // saving file first time
if (error.status === API_ERROR_STATUS_FILE_NOT_FOUND) { if (error.status === API_ERROR_STATUS_FILE_NOT_FOUND) {
API.getStyles() API.getStyles()
.then(styles => { .then(styles => {
messageProgressBar({title: title, text: t('gettingStyles')}); messageProgressBar({title: title, text: t('gettingStyles')});
return JSON.stringify(styles, null, '\t'); return JSON.stringify(styles, null, '\t');
}) })
.then(stylesText => { .then(stylesText => {
messageProgressBar({title: title, text: t('zipStyles')}); messageProgressBar({title: title, text: t('zipStyles')});
return createZipFileFromText(FILENAME_ZIP_FILE, stylesText); return createZipFileFromText(FILENAME_ZIP_FILE, stylesText);
}) })
.then(zipedText => { .then(zipedText => {
messageProgressBar({title: title, text: t('uploadingFile')}); messageProgressBar({title: title, text: t('uploadingFile')});
return uploadFileDropbox(client, zipedText); return uploadFileDropbox(client, zipedText);
}) })
.then(() => messageProgressBar({title: title, text: t('exportSavedSuccess')})) .then(() => messageProgressBar({title: title, text: t('exportSavedSuccess')}))
.catch(err => messageBox.alert(err)); .catch(err => messageBox.alert(err));
return; return;
} }
@ -135,16 +124,13 @@ $('#sync-dropbox-import').onclick = () => {
clientId: DROPBOX_API_KEY, clientId: DROPBOX_API_KEY,
accessToken: token accessToken: token
}); });
return client.filesDownload({path: '/' + DROPBOX_FILE}) return client.filesDownload({path: '/' + DROPBOX_FILE})
.then(response => { .then(response => {
messageProgressBar({title: title, text: t('unzipStyles')}); messageProgressBar({title: title, text: t('unzipStyles')});
return readZipFileFromBlob(response.fileBlob); return readZipFileFromBlob(response.fileBlob);
}) })
.then(zipedFileBlob => { .then(zipedFileBlob => {
messageProgressBar({title: title, text: t('readingStyles')}); messageProgressBar({title: title, text: t('readingStyles')});
document.body.style.cursor = 'wait'; document.body.style.cursor = 'wait';
const fReader = new FileReader(); const fReader = new FileReader();
fReader.onloadend = event => { fReader.onloadend = event => {
@ -169,10 +155,8 @@ $('#sync-dropbox-import').onclick = () => {
// no file // no file
if (error.status === API_ERROR_STATUS_FILE_NOT_FOUND) { if (error.status === API_ERROR_STATUS_FILE_NOT_FOUND) {
messageBox.alert(t('noFileToImport')); messageBox.alert(t('noFileToImport'));
return; return;
} }
messageBox.alert(error); messageBox.alert(error);
}); });
}); });