Skip to content

Commit

Permalink
fixed bug that caused waiter to keep displaying on error in google-ph…
Browse files Browse the repository at this point in the history
…otos-page
  • Loading branch information
opus1269 committed Mar 11, 2017
1 parent ea0204a commit bc77963
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 39 deletions.
53 changes: 26 additions & 27 deletions app/elements/pages/google-photos-page.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@

<link rel="import" href="../../bower_components/paper-material/paper-material.html">
<link rel="import" href="../../bower_components/paper-ripple/paper-ripple.html">
<link rel="import" href="../../bower_components/paper-dialog/paper-dialog.html">
<link rel="import" href="../../bower_components/paper-dialog-scrollable/paper-dialog-scrollable.html">
<link rel="import" href="../../bower_components/paper-button/paper-button.html">
<link rel="import" href="../../bower_components/paper-item/paper-item.html">
<link rel="import" href="../../bower_components/paper-item/paper-item-body.html">
<link rel="import" href="../../bower_components/paper-toolbar/paper-toolbar.html">
Expand Down Expand Up @@ -139,6 +142,18 @@

<div class="page-content">

<!-- Error dialog -->
<paper-dialog id="errorDialog" modal entry-animation="scale-up-animation"
exit-animation="fade-out-animation">
<h2 id="dialogTitle"></h2>
<paper-dialog-scrollable>
<p id="dialogText"></p>
</paper-dialog-scrollable>
<div class="buttons">
<paper-button dialog-dismiss>OK</paper-button>
</div>
</paper-dialog>

<div class="waiter" hidden$="[[!waitForLoad]]">
<div class="horizontal center-justified layout">
<paper-spinner alt="Loading Albums" active="[[waitForLoad]]"></paper-spinner>
Expand Down Expand Up @@ -174,15 +189,11 @@
is: 'google-photos-page',

// so we can lazily create the page
factoryImpl: function(id, dialogEl, dialogTitleEl, dialogTextEl) {
factoryImpl: function(id) {
this.setAttribute('id', id);
this.dialogEl = dialogEl;
this.dialogTitleEl = dialogTitleEl;
this.dialogTextEl = dialogTextEl;
},

properties: {

albums: {
type: Array,
notify: true,
Expand All @@ -197,23 +208,7 @@
waitForLoad: {
type: Boolean,
value: false
},

dialogEl: {
type: Object,
value: {}
},

dialogTitleEl: {
type: Object,
value: {}
},

dialogTextEl: {
type: Object,
value: {}
}

},

ready: function() {
Expand All @@ -231,17 +226,21 @@
}
photoSources.process('useGoogle', function(error) {
if (error) {
this.dialogTitleEl.innerHTML = 'Request failed. Select refresh to try again.';
this.dialogTextEl.innerHTML = error;
this.dialogEl.open();
this.set('waitForLoad', false);
this.$.dialogTitle.innerHTML =
'Request failed. Select refresh to try again.';
this.$.dialogText.innerHTML = error;
this.$.errorDialog.open();
} else {
this._selectAlbums();
}
}.bind(this));
} else {
this.dialogTitleEl.innerHTML = 'Request failed. Select refresh to try again.';
this.dialogTextEl.innerHTML = error;
this.dialogEl.open();
this.set('waitForLoad', false);
this.$.dialogTitle.innerHTML =
'Request failed. Select refresh to try again.';
this.$.dialogText.innerHTML = error;
this.$.errorDialog.open();
}
this.set('waitForLoad', false);
}.bind(this));
Expand Down
12 changes: 0 additions & 12 deletions app/scripts/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,18 +151,6 @@
}
};

/**
* Event Listener for display of Error Dialog
*
* @param {Event} event
*
*/
t.onShowErrorDialog = function(event) {
t.dialogTitle = event.detail.title;
t.dialogText = event.detail.text;
t.$.errorDialog.open();
};

/**
* Listen for app messages
*
Expand Down

0 comments on commit bc77963

Please sign in to comment.