Fix foreign key constraint issues with backup restore.

This commit is contained in:
Greyson Parrelli
2023-04-25 15:52:09 -04:00
committed by GitHub
parent 0e631508b2
commit a01fb7ff1c
7 changed files with 104 additions and 27 deletions

View File

@@ -58,6 +58,9 @@ final class NewDeviceServerTask implements ServerTask {
} catch (FullBackupImporter.DatabaseDowngradeException e) {
Log.w(TAG, "Failed due to the backup being from a newer version of Signal.", e);
EventBus.getDefault().post(new Status(0, Status.State.FAILURE_VERSION_DOWNGRADE));
} catch (FullBackupImporter.ForeignKeyViolationException e) {
Log.w(TAG, "Failed due to foreign key constraint violations.", e);
EventBus.getDefault().post(new Status(0, Status.State.FAILURE_FOREIGN_KEY));
} catch (IOException e) {
Log.w(TAG, e);
EventBus.getDefault().post(new Status(0, Status.State.FAILURE_UNKNOWN));
@@ -99,6 +102,7 @@ final class NewDeviceServerTask implements ServerTask {
IN_PROGRESS,
SUCCESS,
FAILURE_VERSION_DOWNGRADE,
FAILURE_FOREIGN_KEY,
FAILURE_UNKNOWN
}
}

View File

@@ -66,6 +66,9 @@ public final class NewDeviceTransferFragment extends DeviceTransferFragment {
case FAILURE_VERSION_DOWNGRADE:
abort(R.string.NewDeviceTransfer__cannot_transfer_from_a_newer_version_of_signal);
break;
case FAILURE_FOREIGN_KEY:
abort(R.string.NewDeviceTransfer__failure_foreign_key);
break;
case FAILURE_UNKNOWN:
abort();
break;