|
|
|
@ -17,6 +17,8 @@ |
|
|
|
|
*/ |
|
|
|
|
package org.floens.chan.core.watch; |
|
|
|
|
|
|
|
|
|
import android.util.Log; |
|
|
|
|
|
|
|
|
|
import com.android.volley.VolleyError; |
|
|
|
|
|
|
|
|
|
import org.floens.chan.core.loader.Loader; |
|
|
|
@ -114,36 +116,29 @@ public class PinWatcher implements Loader.LoaderListener { |
|
|
|
|
posts.addAll(result); |
|
|
|
|
|
|
|
|
|
if (pin.watchLastCount < 0) |
|
|
|
|
pin.watchLastCount = pin.watchNewCount; |
|
|
|
|
pin.watchLastCount = result.size(); |
|
|
|
|
|
|
|
|
|
pin.watchNewCount = result.size(); |
|
|
|
|
|
|
|
|
|
// If there are more replies than last time, let the notification make a sound
|
|
|
|
|
int lastCounterForSoundNotification = pin.quoteNewCount; |
|
|
|
|
|
|
|
|
|
// Get list of saved posts
|
|
|
|
|
List<Post> savedPosts = new ArrayList<Post>(); |
|
|
|
|
int total = 0; |
|
|
|
|
for (Post saved : result) { |
|
|
|
|
if (saved.isSavedReply) { |
|
|
|
|
savedPosts.add(saved); |
|
|
|
|
total += saved.repliesFrom.size(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// If there are more replies than last time, let the notification make a sound
|
|
|
|
|
int lastCounterForSoundNotification = pin.quoteNewCount; |
|
|
|
|
|
|
|
|
|
// Find posts quoting these saved posts
|
|
|
|
|
pin.quoteNewCount = 0; |
|
|
|
|
for (Post resultPost : result) { |
|
|
|
|
// This post replies to me
|
|
|
|
|
for (Post savedPost : savedPosts) { |
|
|
|
|
if (resultPost.repliesTo.contains(savedPost.no)) { |
|
|
|
|
pin.quoteNewCount++; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
pin.quoteNewCount = total; |
|
|
|
|
|
|
|
|
|
if (pin.quoteNewCount > lastCounterForSoundNotification) { |
|
|
|
|
wereNewQuotes = true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Log.d(TAG, "QuoteLastCount: " + pin.quoteLastCount + ", quoteNewCount: " + pin.quoteNewCount + ", wereNewQuotes: " + wereNewQuotes); |
|
|
|
|
|
|
|
|
|
WatchService.onPinWatcherResult(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|