Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend account deletion dialogue #12015

Merged
merged 18 commits into from
Nov 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,161 changes: 1,161 additions & 0 deletions app/schemas/com.nextcloud.client.database.NextcloudDatabase/74.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class OCCapabilityIT : AbstractIT() {
capability.etag = "123"
capability.userStatus = CapabilityBooleanType.TRUE
capability.userStatusSupportsEmoji = CapabilityBooleanType.TRUE
capability.dropAccount = CapabilityBooleanType.TRUE

fileDataStorageManager.saveCapabilities(capability)

Expand All @@ -45,5 +46,6 @@ class OCCapabilityIT : AbstractIT() {
assertEquals(capability.etag, newCapability.etag)
assertEquals(capability.userStatus, newCapability.userStatus)
assertEquals(capability.userStatusSupportsEmoji, newCapability.userStatusSupportsEmoji)
assertEquals(capability.dropAccount, newCapability.dropAccount)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ import com.nextcloud.client.database.entity.ShareEntity
import com.nextcloud.client.database.entity.SyncedFolderEntity
import com.nextcloud.client.database.entity.UploadEntity
import com.nextcloud.client.database.entity.VirtualEntity
import com.nextcloud.client.database.migrations.DatabaseMigrationUtil
import com.nextcloud.client.database.migrations.Migration67to68
import com.nextcloud.client.database.migrations.Migration70to71
import com.nextcloud.client.database.migrations.RoomMigration
import com.nextcloud.client.database.migrations.addLegacyMigrations
import com.owncloud.android.db.ProviderMeta
Expand All @@ -64,8 +64,10 @@ import com.owncloud.android.db.ProviderMeta
AutoMigration(from = 66, to = 67),
AutoMigration(from = 68, to = 69),
AutoMigration(from = 69, to = 70),
AutoMigration(from = 70, to = 71, spec = DatabaseMigrationUtil.ResetCapabilitiesPostMigration::class),
AutoMigration(from = 71, to = 72),
AutoMigration(from = 72, to = 73)
AutoMigration(from = 72, to = 73),
AutoMigration(from = 73, to = 74, spec = DatabaseMigrationUtil.ResetCapabilitiesPostMigration::class)
],
exportSchema = true
)
Expand Down Expand Up @@ -95,7 +97,6 @@ abstract class NextcloudDatabase : RoomDatabase() {
.addLegacyMigrations(clock, context)
.addMigrations(RoomMigration())
.addMigrations(Migration67to68())
.addMigrations(Migration70to71())
.fallbackToDestructiveMigration()
.build()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,5 +129,7 @@ data class CapabilityEntity(
@ColumnInfo(name = ProviderTableMeta.CAPABILITIES_FILES_LOCKING_VERSION)
val filesLockingVersion: String?,
@ColumnInfo(name = ProviderTableMeta.CAPABILITIES_GROUPFOLDERS)
val groupfolders: Int?
val groupfolders: Int?,
@ColumnInfo(name = ProviderTableMeta.CAPABILITIES_DROP_ACCOUNT)
val dropAccount: Int?
)
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

package com.nextcloud.client.database.migrations

import androidx.room.migration.AutoMigrationSpec
import androidx.sqlite.db.SupportSQLiteDatabase

object DatabaseMigrationUtil {
Expand Down Expand Up @@ -102,4 +103,14 @@ object DatabaseMigrationUtil {
database.execSQL("DROP TABLE $tableName")
database.execSQL("ALTER TABLE $newTableTempName RENAME TO $tableName")
}

/**
* Room AutoMigrationSpec to reset capabilities post migration.
*/
class ResetCapabilitiesPostMigration : AutoMigrationSpec {
override fun onPostMigrate(db: SupportSQLiteDatabase) {
resetCapabilities(db)
super.onPostMigrate(db)
}
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
import com.owncloud.android.ui.activity.UploadFilesActivity;
import com.owncloud.android.ui.activity.UploadListActivity;
import com.owncloud.android.ui.activity.UserInfoActivity;
import com.owncloud.android.ui.dialog.AccountRemovalConfirmationDialog;
import com.owncloud.android.ui.dialog.AccountRemovalDialog;
import com.owncloud.android.ui.dialog.ChooseRichDocumentsTemplateDialogFragment;
import com.owncloud.android.ui.dialog.ChooseTemplateDialogFragment;
import com.owncloud.android.ui.dialog.ConfirmationDialogFragment;
Expand Down Expand Up @@ -270,7 +270,7 @@ abstract class ComponentsModule {
abstract ChooseTemplateDialogFragment chooseTemplateDialogFragment();

@ContributesAndroidInjector
abstract AccountRemovalConfirmationDialog accountRemovalConfirmationDialog();
abstract AccountRemovalDialog accountRemovalDialog();

@ContributesAndroidInjector
abstract ChooseRichDocumentsTemplateDialogFragment chooseRichDocumentsTemplateDialogFragment();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1947,6 +1947,7 @@ private ContentValues createContentValues(String accountName, OCCapability capab
contentValues.put(ProviderTableMeta.CAPABILITIES_FILES_LOCKING_VERSION,
capability.getFilesLockingVersion());
contentValues.put(ProviderTableMeta.CAPABILITIES_GROUPFOLDERS, capability.getGroupfolders().getValue());
contentValues.put(ProviderTableMeta.CAPABILITIES_DROP_ACCOUNT, capability.getDropAccount().getValue());

return contentValues;
}
Expand Down Expand Up @@ -2103,6 +2104,7 @@ private OCCapability createCapabilityInstance(Cursor cursor) {
capability.setFilesLockingVersion(
getString(cursor, ProviderTableMeta.CAPABILITIES_FILES_LOCKING_VERSION));
capability.setGroupfolders(getBoolean(cursor, ProviderTableMeta.CAPABILITIES_GROUPFOLDERS));
capability.setDropAccount(getBoolean(cursor, ProviderTableMeta.CAPABILITIES_DROP_ACCOUNT));
}
return capability;
}
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/java/com/owncloud/android/db/ProviderMeta.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
*/
public class ProviderMeta {
public static final String DB_NAME = "filelist";
public static final int DB_VERSION = 73;
public static final int DB_VERSION = 74;

private ProviderMeta() {
// No instance
Expand Down Expand Up @@ -259,6 +259,7 @@ static public class ProviderTableMeta implements BaseColumns {
public static final String CAPABILITIES_USER_STATUS = "user_status";
public static final String CAPABILITIES_USER_STATUS_SUPPORTS_EMOJI = "user_status_supports_emoji";
public static final String CAPABILITIES_GROUPFOLDERS = "groupfolders";
public static final String CAPABILITIES_DROP_ACCOUNT = "drop_account";

//Columns of Uploads table
public static final String UPLOADS_LOCAL_PATH = "local_path";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@ private void onNavigationItemClicked(final MenuItem menuItem) {
menuItem.setChecked(false);
final Optional<User> optionalUser = getUser();
if (optionalUser.isPresent()) {
UserInfoActivity.openAccountRemovalConfirmationDialog(optionalUser.get(), getSupportFragmentManager());
UserInfoActivity.openAccountRemovalDialog(optionalUser.get(), getSupportFragmentManager());
}
} else if (itemId == R.id.nav_shared) {
startSharedSearch(menuItem);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
import com.owncloud.android.services.OperationsService;
import com.owncloud.android.ui.adapter.UserListAdapter;
import com.owncloud.android.ui.adapter.UserListItem;
import com.owncloud.android.ui.dialog.AccountRemovalConfirmationDialog;
import com.owncloud.android.ui.dialog.AccountRemovalDialog;
import com.owncloud.android.ui.events.AccountRemovedEvent;
import com.owncloud.android.ui.helpers.FileOperationsHelper;

Expand Down Expand Up @@ -470,9 +470,8 @@ private void performAccountRemoval(User user) {
}
}

public static void openAccountRemovalConfirmationDialog(User user, FragmentManager fragmentManager) {
AccountRemovalConfirmationDialog dialog =
AccountRemovalConfirmationDialog.newInstance(user);
public static void openAccountRemovalDialog(User user, FragmentManager fragmentManager) {
AccountRemovalDialog dialog = AccountRemovalDialog.newInstance(user);
dialog.show(fragmentManager, "dialog");
}

Expand Down Expand Up @@ -509,7 +508,7 @@ public void onOptionItemClicked(User user, View view) {
if (itemId == R.id.action_open_account) {
accountClicked(user.hashCode());
} else if (itemId == R.id.action_delete_account) {
openAccountRemovalConfirmationDialog(user, getSupportFragmentManager());
openAccountRemovalDialog(user, getSupportFragmentManager());
} else {
openAccount(user);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
import com.owncloud.android.lib.common.utils.Log_OC;
import com.owncloud.android.lib.resources.users.GetUserInfoRemoteOperation;
import com.owncloud.android.ui.dialog.AccountRemovalConfirmationDialog;
import com.owncloud.android.ui.dialog.AccountRemovalDialog;
import com.owncloud.android.ui.events.TokenPushEvent;
import com.owncloud.android.utils.DisplayUtils;
import com.owncloud.android.utils.PushUtils;
Expand Down Expand Up @@ -173,7 +173,7 @@ public boolean onOptionsItemSelected(MenuItem item) {
} else if (itemId == R.id.action_open_account) {
accountClicked(user.hashCode());
} else if (itemId == R.id.action_delete_account) {
openAccountRemovalConfirmationDialog(user, getSupportFragmentManager());
openAccountRemovalDialog(user, getSupportFragmentManager());
} else {
retval = super.onOptionsItemSelected(item);
}
Expand Down Expand Up @@ -302,8 +302,8 @@ private void addToListIfNeeded(List<UserInfoDetailsItem> info, @DrawableRes int
}
}

public static void openAccountRemovalConfirmationDialog(User user, FragmentManager fragmentManager) {
AccountRemovalConfirmationDialog dialog = AccountRemovalConfirmationDialog.newInstance(user);
public static void openAccountRemovalDialog(User user, FragmentManager fragmentManager) {
AccountRemovalDialog dialog = AccountRemovalDialog.newInstance(user);
dialog.show(fragmentManager, "dialog");
}

Expand Down

This file was deleted.

Loading
Loading