|
|
|
|
@ -274,11 +274,11 @@ class FeedFragment : FilterableFragment(), RowRepresentableDelegate, PurchaseLis |
|
|
|
|
retrieveLatestBlogPosts() // attempt to retrieve blog tips on display |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
displayPostButton() |
|
|
|
|
displayBlogPostButton() |
|
|
|
|
binding.postButton.setOnClickListener { |
|
|
|
|
Preferences.setBlogTipsTapped(requireContext()) |
|
|
|
|
parentActivity?.openUrl(URL.BLOG_TIPS.value) |
|
|
|
|
displayPostButton() |
|
|
|
|
displayBlogPostButton() |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
binding.postButton.viewTreeObserver.addOnGlobalLayoutListener { |
|
|
|
|
@ -587,23 +587,26 @@ class FeedFragment : FilterableFragment(), RowRepresentableDelegate, PurchaseLis |
|
|
|
|
if (Preferences.shouldShowBlogTips(requireContext()) && Preferences.getLastBlogTipsRetrievalDate(requireContext()) + 24 * 3600 * 1000 < now) { |
|
|
|
|
|
|
|
|
|
BlogPostApi.getLatestPosts(requireContext()) { posts -> |
|
|
|
|
Preferences.setLastBlogTipsRetrievalDate(now, requireContext()) |
|
|
|
|
|
|
|
|
|
var count = 0 |
|
|
|
|
if (posts.isNotEmpty()) { |
|
|
|
|
Preferences.setLatestRetrievedBlogPostId(posts.first().id, requireContext()) |
|
|
|
|
context?.let { |
|
|
|
|
Preferences.setLastBlogTipsRetrievalDate(now, requireContext()) |
|
|
|
|
var count = 0 |
|
|
|
|
if (posts.isNotEmpty()) { |
|
|
|
|
Preferences.setLatestRetrievedBlogPostId(posts.first().id, requireContext()) |
|
|
|
|
|
|
|
|
|
val id = Preferences.getLatestDisplayedBlogPostId(requireContext()) |
|
|
|
|
val id = Preferences.getLatestDisplayedBlogPostId(requireContext()) |
|
|
|
|
|
|
|
|
|
count = posts.count { it.id > id } |
|
|
|
|
count = posts.count { it.id > id } |
|
|
|
|
} |
|
|
|
|
displayBlogPostButton(count) |
|
|
|
|
} |
|
|
|
|
displayPostButton(count) |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private fun displayPostButton(newCount: Int = 0) { |
|
|
|
|
private fun displayBlogPostButton(newCount: Int = 0) { |
|
|
|
|
var show = false |
|
|
|
|
if (Preferences.shouldShowBlogTips(requireContext()) && newCount > 0) { |
|
|
|
|
show = true |
|
|
|
|
|