Bug 971413 - Send Reader:Removed as response to Reader:Remove. r=lucasr

This commit is contained in:
Brian Nicholson 2014-02-13 15:58:07 -08:00
parent 07c8bdbe5d
commit c84b12ea0a
3 changed files with 16 additions and 16 deletions

View File

@ -244,18 +244,17 @@ abstract class HomeFragment extends Fragment {
if (mInReadingList) {
GeckoEvent e = GeckoEvent.createBroadcastEvent("Reader:Remove", mUrl);
GeckoAppShell.sendEventToGecko(e);
int count = BrowserDB.getReadingListCount(cr);
e = GeckoEvent.createBroadcastEvent("Reader:ListCountUpdated", Integer.toString(count));
GeckoAppShell.sendEventToGecko(e);
}
return null;
}
@Override
public void onPostExecute(Void result) {
int messageId = mInReadingList ? R.string.reading_list_removed : R.string.bookmark_removed;
Toast.makeText(mContext, messageId, Toast.LENGTH_SHORT).show();
// The remove from reading list toast is handled in Reader:Removed,
// so handle only the bookmark removed toast here.
if (!mInReadingList) {
Toast.makeText(mContext, R.string.bookmark_removed, Toast.LENGTH_SHORT).show();
}
}
}

View File

@ -352,16 +352,10 @@ AboutReader.prototype = {
});
}.bind(this));
} else {
gChromeWin.Reader.removeArticleFromCache(this._article.url , function(success) {
dump("Reader:Remove (in reader) success=" + success);
Services.obs.notifyObservers(null, "Reader:Remove", this._article.url);
gChromeWin.sendMessageToJava({
type: "Reader:Removed",
url: this._article.url
});
}.bind(this));
// In addition to removing the article from the cache (handled in
// browser.js), sending this message will cause the toggle button to be
// updated (handled in this file).
Services.obs.notifyObservers(null, "Reader:Remove", this._article.url);
}
},

View File

@ -7571,6 +7571,13 @@ let Reader = {
case "Reader:Remove": {
this.removeArticleFromCache(aData, function(success) {
this.log("Reader:Remove success=" + success + ", url=" + aData);
if (success) {
sendMessageToJava({
type: "Reader:Removed",
url: url
});
}
}.bind(this));
break;
}