mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-21 04:29:45 +01:00
Fix user migration step
Signed-off-by: Mario Danic <mario@lovelyhq.com>
This commit is contained in:
parent
5945700ffb
commit
d5cf261776
@ -3,6 +3,8 @@
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/Projects-talk-android.iml" filepath="$PROJECT_DIR$/Projects-talk-android.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/talk-android.iml" filepath="$PROJECT_DIR$/talk-android.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/app/talk-android-app.iml" filepath="$PROJECT_DIR$/app/talk-android-app.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
|
@ -63,6 +63,7 @@ import com.nextcloud.talk.newarch.local.dao.UsersDao
|
||||
import com.nextcloud.talk.newarch.local.models.UserNgEntity
|
||||
import com.nextcloud.talk.newarch.local.models.other.UserStatus.ACTIVE
|
||||
import com.nextcloud.talk.newarch.local.models.other.UserStatus.DORMANT
|
||||
import com.nextcloud.talk.newarch.local.models.other.UserStatus.PENDING_DELETE
|
||||
import com.nextcloud.talk.utils.ClosedInterfaceImpl
|
||||
import com.nextcloud.talk.utils.DisplayUtils
|
||||
import com.nextcloud.talk.utils.OkHttpNetworkFetcherWithCache
|
||||
@ -241,6 +242,7 @@ class NextcloudTalkApplication : Application(), LifecycleObserver {
|
||||
}
|
||||
|
||||
fun migrateUsers() {
|
||||
if (!appPreferences.migrationToRoomFinished) {
|
||||
GlobalScope.launch {
|
||||
val users: List<UserEntity> = userUtils.users as List<UserEntity>
|
||||
var userNg: UserNgEntity
|
||||
@ -267,12 +269,20 @@ class NextcloudTalkApplication : Application(), LifecycleObserver {
|
||||
}
|
||||
if (user.current) {
|
||||
userNg.status = ACTIVE
|
||||
} else {
|
||||
if (user.scheduledForDeletion) {
|
||||
userNg.status = PENDING_DELETE
|
||||
} else {
|
||||
userNg.status = DORMANT
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
newUsers.add(userNg)
|
||||
}
|
||||
usersDao.saveUsers(*newUsers.toTypedArray())
|
||||
appPreferences.migrationToRoomFinished = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -31,7 +31,6 @@ import com.nextcloud.talk.newarch.local.models.other.UserStatus
|
||||
import com.nextcloud.talk.utils.ApiUtils
|
||||
import kotlinx.android.parcel.Parcelize
|
||||
import kotlinx.android.parcel.RawValue
|
||||
import kotlinx.android.parcel.WriteWith
|
||||
|
||||
@Parcelize
|
||||
@Entity(tableName = "users")
|
||||
|
@ -287,6 +287,17 @@ public interface AppPreferences {
|
||||
@UnregisterChangeListenerMethod
|
||||
void unregisterThemeChangeListener(OnPreferenceValueChangedListener<String> listener);
|
||||
|
||||
@KeyByString("migration_to_room")
|
||||
@DefaultValue(R.bool.value_false)
|
||||
boolean getMigrationToRoomFinished();
|
||||
|
||||
@KeyByString("migration_to_room")
|
||||
void setMigrationToRoomFinished(boolean value);
|
||||
|
||||
@KeyByString("migration_to_room")
|
||||
@RemoveMethod
|
||||
void removeMigrationToRoomFinished();
|
||||
|
||||
@ClearMethod
|
||||
void clear();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user