Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package org.wordpress.android.ui.reader.actions;

import android.os.Handler;
import android.os.Looper;
import android.text.TextUtils;
import android.util.Pair;

Expand Down Expand Up @@ -456,12 +458,14 @@ private static void handleUpdateBlogInfoResponse(JSONObject jsonObject, UpdateBl
return;
}

ReaderBlog blogInfo = ReaderBlog.fromJson(jsonObject);
ReaderBlogTable.addOrUpdateBlog(blogInfo);

if (infoListener != null) {
infoListener.onResult(blogInfo);
}
final ReaderBlog blogInfo = ReaderBlog.fromJson(jsonObject);
// Move the INSERT OR REPLACE off the main thread; callers expect onResult on main.
new Thread(() -> {
ReaderBlogTable.addOrUpdateBlog(blogInfo);
if (infoListener != null) {
new Handler(Looper.getMainLooper()).post(() -> infoListener.onResult(blogInfo));
}
}).start();
}

/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ class ReaderPostRepository @Inject constructor(
if (updateAction == ReaderPostServiceStarter.UpdateAction.REQUEST_NEWER ||
updateAction == ReaderPostServiceStarter.UpdateAction.REQUEST_REFRESH
) {
ReaderTagTable.setTagLastUpdated(tag)
Thread { ReaderTagTable.setTagLastUpdated(tag) }.start()
}
handleUpdatePostsResponse(tag, jsonObject, updateAction, resultListener)
}
Expand Down Expand Up @@ -352,7 +352,7 @@ class ReaderPostRepository @Inject constructor(
if (updateAction == ReaderPostServiceStarter.UpdateAction.REQUEST_NEWER ||
updateAction == ReaderPostServiceStarter.UpdateAction.REQUEST_REFRESH
) {
ReaderTagTable.setTagLastUpdated(tag)
Thread { ReaderTagTable.setTagLastUpdated(tag) }.start()
}
handleUpdatePostsResponse(tag, jsonObject, updateAction, resultListener)
}
Expand Down
Loading