fixed notifications

This commit is contained in:
Mariotaku Lee 2017-03-03 12:20:52 +08:00
parent 7f380541e8
commit ce02395841
No known key found for this signature in database
GPG Key ID: 15C10F89D7C33535
4 changed files with 6 additions and 4 deletions

View File

@ -147,6 +147,7 @@ public interface TwidereConstants extends SharedPreferenceConstants, IntentConst
String QUERY_PARAM_VALUE_USERS = "users";
String QUERY_PARAM_VALUE_TWEETS = "tweets";
String QUERY_PARAM_SHOW_NOTIFICATION = "show_notification";
String QUERY_PARAM_NOTIFY_CHANGE = "notify_change";
String QUERY_PARAM_LAT = "lat";
String QUERY_PARAM_LNG = "lng";
String QUERY_PARAM_URL = "url";

View File

@ -486,6 +486,7 @@ class TwidereDataProvider : ContentProvider(), LazyLoadCallback {
}
private fun notifyContentObserver(uri: Uri) {
if (!uri.getBooleanQueryParameter(QUERY_PARAM_NOTIFY_CHANGE, true)) return
handler.post {
context?.contentResolver?.notifyChange(uri, null)
}

View File

@ -15,7 +15,7 @@ import org.mariotaku.microblog.library.twitter.model.ResponseList
import org.mariotaku.sqliteqb.library.Expression
import org.mariotaku.twidere.R
import org.mariotaku.twidere.TwidereConstants.LOGTAG
import org.mariotaku.twidere.TwidereConstants.QUERY_PARAM_SHOW_NOTIFICATION
import org.mariotaku.twidere.TwidereConstants.QUERY_PARAM_NOTIFY_CHANGE
import org.mariotaku.twidere.constant.loadItemLimitKey
import org.mariotaku.twidere.extension.model.newMicroBlogInstance
import org.mariotaku.twidere.model.AccountDetails
@ -161,7 +161,7 @@ abstract class GetActivitiesTask(
olderCount = DataStoreUtils.getActivitiesCount(context, contentUri, minPositionKey,
Activities.POSITION_KEY, false, arrayOf(details.key))
}
val writeUri = UriUtils.appendQueryParameters(contentUri, QUERY_PARAM_SHOW_NOTIFICATION, notify)
val writeUri = UriUtils.appendQueryParameters(contentUri, QUERY_PARAM_NOTIFY_CHANGE, notify)
if (deleteBound[0] > 0 && deleteBound[1] > 0) {
val where = Expression.and(
Expression.equalsArgs(Activities.ACCOUNT_KEY),

View File

@ -19,7 +19,7 @@ import org.mariotaku.sqliteqb.library.Columns
import org.mariotaku.sqliteqb.library.Expression
import org.mariotaku.twidere.R
import org.mariotaku.twidere.TwidereConstants.LOGTAG
import org.mariotaku.twidere.TwidereConstants.QUERY_PARAM_SHOW_NOTIFICATION
import org.mariotaku.twidere.TwidereConstants.QUERY_PARAM_NOTIFY_CHANGE
import org.mariotaku.twidere.constant.loadItemLimitKey
import org.mariotaku.twidere.extension.model.newMicroBlogInstance
import org.mariotaku.twidere.model.AccountDetails
@ -151,7 +151,7 @@ abstract class GetStatusesTask(
sinceSortId: Long, maxSortId: Long,
loadItemLimit: Int, notify: Boolean): Int {
val uri = contentUri
val writeUri = UriUtils.appendQueryParameters(uri, QUERY_PARAM_SHOW_NOTIFICATION, notify)
val writeUri = UriUtils.appendQueryParameters(uri, QUERY_PARAM_NOTIFY_CHANGE, notify)
val resolver = context.contentResolver
val noItemsBefore = DataStoreUtils.getStatusCount(context, uri, accountKey) <= 0
val values = arrayOfNulls<ContentValues>(statuses.size)