mirror of
https://github.com/TwidereProject/Twidere-Android
synced 2025-02-17 04:00:48 +01:00
fixed rawQuery
This commit is contained in:
parent
251b358918
commit
fda48b3b9e
@ -28,6 +28,6 @@ import org.mariotaku.twidere.provider.TwidereDataStore
|
|||||||
@SuppressLint("Recycle")
|
@SuppressLint("Recycle")
|
||||||
fun ContentResolver.rawQuery(sql: String, selectionArgs: Array<String>?): Cursor {
|
fun ContentResolver.rawQuery(sql: String, selectionArgs: Array<String>?): Cursor {
|
||||||
val rawUri = Uri.withAppendedPath(TwidereDataStore.CONTENT_URI_RAW_QUERY, sql)
|
val rawUri = Uri.withAppendedPath(TwidereDataStore.CONTENT_URI_RAW_QUERY, sql)
|
||||||
return query(rawUri, selectionArgs, null, null, null)
|
return query(rawUri, null, null, selectionArgs, null)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -521,7 +521,7 @@ class TwidereDataProvider : ContentProvider(), LazyLoadCallback {
|
|||||||
DataStoreUtils.getAccountKeys(context))
|
DataStoreUtils.getAccountKeys(context))
|
||||||
prefs.filter(AccountPreferences::isHomeTimelineNotificationEnabled).forEach {
|
prefs.filter(AccountPreferences::isHomeTimelineNotificationEnabled).forEach {
|
||||||
val positionTag = getPositionTag(CustomTabType.HOME_TIMELINE, it.accountKey)
|
val positionTag = getPositionTag(CustomTabType.HOME_TIMELINE, it.accountKey)
|
||||||
contentNotificationManager.showTimelineNotification(it, positionTag)
|
contentNotificationManager.showTimeline(it, positionTag)
|
||||||
}
|
}
|
||||||
notifyUnreadCountChanged(NOTIFICATION_ID_HOME_TIMELINE)
|
notifyUnreadCountChanged(NOTIFICATION_ID_HOME_TIMELINE)
|
||||||
}
|
}
|
||||||
@ -531,7 +531,7 @@ class TwidereDataProvider : ContentProvider(), LazyLoadCallback {
|
|||||||
val prefs = AccountPreferences.getNotificationEnabledPreferences(context,
|
val prefs = AccountPreferences.getNotificationEnabledPreferences(context,
|
||||||
DataStoreUtils.getAccountKeys(context))
|
DataStoreUtils.getAccountKeys(context))
|
||||||
prefs.filter(AccountPreferences::isInteractionsNotificationEnabled).forEach {
|
prefs.filter(AccountPreferences::isInteractionsNotificationEnabled).forEach {
|
||||||
contentNotificationManager.showInteractionsNotification(it, getPositionTag(ReadPositionTag.ACTIVITIES_ABOUT_ME,
|
contentNotificationManager.showInteractions(it, getPositionTag(ReadPositionTag.ACTIVITIES_ABOUT_ME,
|
||||||
it.accountKey))
|
it.accountKey))
|
||||||
}
|
}
|
||||||
notifyUnreadCountChanged(NOTIFICATION_ID_INTERACTIONS_TIMELINE)
|
notifyUnreadCountChanged(NOTIFICATION_ID_INTERACTIONS_TIMELINE)
|
||||||
@ -562,8 +562,15 @@ class TwidereDataProvider : ContentProvider(), LazyLoadCallback {
|
|||||||
|
|
||||||
private fun getConflictAlgorithm(tableId: Int): Int {
|
private fun getConflictAlgorithm(tableId: Int): Int {
|
||||||
when (tableId) {
|
when (tableId) {
|
||||||
TABLE_ID_CACHED_HASHTAGS, TABLE_ID_CACHED_STATUSES, TABLE_ID_CACHED_USERS, TABLE_ID_CACHED_RELATIONSHIPS, TABLE_ID_SEARCH_HISTORY, TABLE_ID_MESSAGES, TABLE_ID_MESSAGES_CONVERSATIONS -> return SQLiteDatabase.CONFLICT_REPLACE
|
TABLE_ID_CACHED_HASHTAGS, TABLE_ID_CACHED_STATUSES, TABLE_ID_CACHED_USERS,
|
||||||
TABLE_ID_FILTERED_USERS, TABLE_ID_FILTERED_KEYWORDS, TABLE_ID_FILTERED_SOURCES, TABLE_ID_FILTERED_LINKS -> return SQLiteDatabase.CONFLICT_IGNORE
|
TABLE_ID_CACHED_RELATIONSHIPS, TABLE_ID_SEARCH_HISTORY, TABLE_ID_MESSAGES,
|
||||||
|
TABLE_ID_MESSAGES_CONVERSATIONS -> {
|
||||||
|
return SQLiteDatabase.CONFLICT_REPLACE
|
||||||
|
}
|
||||||
|
TABLE_ID_FILTERED_USERS, TABLE_ID_FILTERED_KEYWORDS, TABLE_ID_FILTERED_SOURCES,
|
||||||
|
TABLE_ID_FILTERED_LINKS -> {
|
||||||
|
return SQLiteDatabase.CONFLICT_IGNORE
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return SQLiteDatabase.CONFLICT_NONE
|
return SQLiteDatabase.CONFLICT_NONE
|
||||||
}
|
}
|
||||||
|
@ -65,7 +65,7 @@ class ContentNotificationManager(
|
|||||||
private var nameFirst: Boolean = false
|
private var nameFirst: Boolean = false
|
||||||
private var useStarForLikes: Boolean = false
|
private var useStarForLikes: Boolean = false
|
||||||
|
|
||||||
fun showInteractionsNotification(pref: AccountPreferences, position: Long) {
|
fun showInteractions(pref: AccountPreferences, position: Long) {
|
||||||
val cr = context.contentResolver
|
val cr = context.contentResolver
|
||||||
val accountKey = pref.accountKey
|
val accountKey = pref.accountKey
|
||||||
val where = Expression.and(
|
val where = Expression.and(
|
||||||
@ -195,7 +195,7 @@ class ContentNotificationManager(
|
|||||||
return !activityTracker.isHomeActivityStarted
|
return !activityTracker.isHomeActivityStarted
|
||||||
}
|
}
|
||||||
|
|
||||||
fun showTimelineNotification(pref: AccountPreferences, position: Long) {
|
fun showTimeline(pref: AccountPreferences, position: Long) {
|
||||||
val accountKey = pref.accountKey
|
val accountKey = pref.accountKey
|
||||||
val resources = context.resources
|
val resources = context.resources
|
||||||
val nm = notificationManager
|
val nm = notificationManager
|
||||||
|
@ -675,7 +675,7 @@ object DataStoreUtils {
|
|||||||
if (sortExpression != null) {
|
if (sortExpression != null) {
|
||||||
builder.orderBy(sortExpression)
|
builder.orderBy(sortExpression)
|
||||||
}
|
}
|
||||||
resolver.rawQuery(builder.buildSQL(), bindingArgs)?.useCursor { cur ->
|
resolver.rawQuery(builder.buildSQL(), bindingArgs).useCursor { cur ->
|
||||||
cur.moveToFirst()
|
cur.moveToFirst()
|
||||||
val colIdx = creator.newIndex(cur)
|
val colIdx = creator.newIndex(cur)
|
||||||
while (!cur.isAfterLast) {
|
while (!cur.isAfterLast) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user