-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'release/1.5.25' into main
- Loading branch information
Showing
39 changed files
with
1,648 additions
and
140 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
...k-android/src/main/java/org/matrix/android/sdk/api/session/room/poll/LoadedPollsStatus.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* Copyright (c) 2023 The Matrix.org Foundation C.I.C. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.matrix.android.sdk.api.session.room.poll | ||
|
||
/** | ||
* Represent the status of the loaded polls for a room. | ||
*/ | ||
data class LoadedPollsStatus( | ||
/** | ||
* Indicate whether more polls can be loaded from timeline. | ||
* A false value would mean the start of the timeline has been reached. | ||
*/ | ||
val canLoadMore: Boolean, | ||
|
||
/** | ||
* Number of days of timeline events currently synced (fetched and stored in local). | ||
*/ | ||
val daysSynced: Int, | ||
|
||
/** | ||
* Indicate whether a sync of timeline events has been completely done in backward. It would | ||
* mean timeline events have been synced for at least a number of days defined by [PollHistoryService.loadingPeriodInDays]. | ||
*/ | ||
val hasCompletedASyncBackward: Boolean, | ||
) |
58 changes: 58 additions & 0 deletions
58
...-android/src/main/java/org/matrix/android/sdk/api/session/room/poll/PollHistoryService.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/* | ||
* Copyright (c) 2023 The Matrix.org Foundation C.I.C. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.matrix.android.sdk.api.session.room.poll | ||
|
||
import androidx.lifecycle.LiveData | ||
import org.matrix.android.sdk.api.session.room.timeline.TimelineEvent | ||
|
||
/** | ||
* Expose methods to get history of polls in rooms. | ||
*/ | ||
interface PollHistoryService { | ||
|
||
/** | ||
* The number of days covered when requesting to load more polls. | ||
*/ | ||
val loadingPeriodInDays: Int | ||
|
||
/** | ||
* This must be called when you don't need the service anymore. | ||
* It ensures the underlying database get closed. | ||
*/ | ||
fun dispose() | ||
|
||
/** | ||
* Ask to load more polls starting from last loaded polls for a period defined by | ||
* [loadingPeriodInDays]. | ||
*/ | ||
suspend fun loadMore(): LoadedPollsStatus | ||
|
||
/** | ||
* Get the current status of the loaded polls. | ||
*/ | ||
suspend fun getLoadedPollsStatus(): LoadedPollsStatus | ||
|
||
/** | ||
* Sync polls from last loaded polls until now. | ||
*/ | ||
suspend fun syncPolls() | ||
|
||
/** | ||
* Get currently loaded list of poll events. See [loadMore]. | ||
*/ | ||
fun getPollEvents(): LiveData<List<TimelineEvent>> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
...d/src/main/java/org/matrix/android/sdk/internal/database/migration/MigrateSessionTo050.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* | ||
* Copyright (c) 2023 The Matrix.org Foundation C.I.C. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.matrix.android.sdk.internal.database.migration | ||
|
||
import io.realm.DynamicRealm | ||
import org.matrix.android.sdk.internal.database.model.PollHistoryStatusEntityFields | ||
import org.matrix.android.sdk.internal.util.database.RealmMigrator | ||
|
||
/** | ||
* Adding new entity PollHistoryStatusEntity. | ||
*/ | ||
internal class MigrateSessionTo050(realm: DynamicRealm) : RealmMigrator(realm, 50) { | ||
|
||
override fun doMigrate(realm: DynamicRealm) { | ||
realm.schema.create("PollHistoryStatusEntity") | ||
.addField(PollHistoryStatusEntityFields.ROOM_ID, String::class.java) | ||
.addPrimaryKey(PollHistoryStatusEntityFields.ROOM_ID) | ||
.setRequired(PollHistoryStatusEntityFields.ROOM_ID, true) | ||
.addField(PollHistoryStatusEntityFields.CURRENT_TIMESTAMP_TARGET_BACKWARD_MS, Long::class.java) | ||
.setNullable(PollHistoryStatusEntityFields.CURRENT_TIMESTAMP_TARGET_BACKWARD_MS, true) | ||
.addField(PollHistoryStatusEntityFields.OLDEST_TIMESTAMP_TARGET_REACHED_MS, Long::class.java) | ||
.setNullable(PollHistoryStatusEntityFields.OLDEST_TIMESTAMP_TARGET_REACHED_MS, true) | ||
.addField(PollHistoryStatusEntityFields.OLDEST_EVENT_ID_REACHED, String::class.java) | ||
.addField(PollHistoryStatusEntityFields.MOST_RECENT_EVENT_ID_REACHED, String::class.java) | ||
.addField(PollHistoryStatusEntityFields.IS_END_OF_POLLS_BACKWARD, Boolean::class.java) | ||
} | ||
} |
Oops, something went wrong.