|
|
|
|
@ -582,25 +582,21 @@ class FeedFragment : FilterableFragment(), RowRepresentableDelegate, PurchaseLis |
|
|
|
|
|
|
|
|
|
private fun retrieveLatestBlogPosts() { |
|
|
|
|
|
|
|
|
|
val now = Date().time |
|
|
|
|
// if (true) { |
|
|
|
|
if (Preferences.shouldShowBlogTips(requireContext()) && Preferences.getLastBlogTipsRetrievalDate(requireContext()) + 24 * 3600 * 1000 < now) { |
|
|
|
|
this.context?.let { context -> |
|
|
|
|
val now = Date().time |
|
|
|
|
if (Preferences.shouldShowBlogTips(context) && Preferences.getLastBlogTipsRetrievalDate(context) + 24 * 3600 * 1000 < now) { |
|
|
|
|
|
|
|
|
|
BlogPostApi.getLatestPosts(requireContext()) { posts -> |
|
|
|
|
BlogPostApi.getLatestPosts(context) { posts -> |
|
|
|
|
|
|
|
|
|
context?.let { |
|
|
|
|
Preferences.setLastBlogTipsRetrievalDate(now, requireContext()) |
|
|
|
|
Preferences.setLastBlogTipsRetrievalDate(now, context) |
|
|
|
|
var count = 0 |
|
|
|
|
if (posts.isNotEmpty()) { |
|
|
|
|
Preferences.setLatestRetrievedBlogPostId(posts.first().id, requireContext()) |
|
|
|
|
|
|
|
|
|
val id = Preferences.getLatestDisplayedBlogPostId(requireContext()) |
|
|
|
|
|
|
|
|
|
Preferences.setLatestRetrievedBlogPostId(posts.first().id, context) |
|
|
|
|
val id = Preferences.getLatestDisplayedBlogPostId(context) |
|
|
|
|
count = posts.count { it.id > id } |
|
|
|
|
} |
|
|
|
|
displayBlogPostButton(count) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|