|
@@ -38,7 +38,6 @@ import android.support.annotation.StringRes;
|
|
|
import android.support.multidex.MultiDexApplication;
|
|
|
import android.support.v4.util.Pair;
|
|
|
import android.support.v7.app.AlertDialog;
|
|
|
-import android.util.Log;
|
|
|
import android.view.WindowManager;
|
|
|
|
|
|
import com.evernote.android.job.JobManager;
|
|
@@ -66,13 +65,6 @@ import com.owncloud.android.utils.FilesSyncHelper;
|
|
|
import com.owncloud.android.utils.PermissionUtil;
|
|
|
import com.owncloud.android.utils.ReceiversHelper;
|
|
|
|
|
|
-import org.lukhnos.nnio.file.Files;
|
|
|
-import org.lukhnos.nnio.file.Path;
|
|
|
-import org.lukhnos.nnio.file.Paths;
|
|
|
-import org.lukhnos.nnio.file.StandardCopyOption;
|
|
|
-
|
|
|
-import java.io.File;
|
|
|
-import java.io.IOException;
|
|
|
import java.lang.reflect.Method;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.HashMap;
|
|
@@ -245,53 +237,6 @@ public class MainApp extends MultiDexApplication {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public static void migratePushKeys() {
|
|
|
- Context context = getAppContext();
|
|
|
-
|
|
|
- if (!PreferenceManager.getKeysMigration(context)) {
|
|
|
- String oldKeyPath = getStoragePath() + File.separator + MainApp.getDataFolder() + File.separator + "nc-keypair";
|
|
|
- File oldPrivateKeyFile = new File(oldKeyPath, "push_key.priv");
|
|
|
- File oldPublicKeyFile = new File(oldKeyPath, "push_key.pub");
|
|
|
-
|
|
|
- Path oldPrivateKeyPath = Paths.get(oldPrivateKeyFile.toURI());
|
|
|
- Path oldPublicKeyPath = Paths.get(oldPublicKeyFile.toURI());
|
|
|
-
|
|
|
- String keyPath = getAppContext().getFilesDir().getAbsolutePath() +
|
|
|
- File.separator + MainApp.getDataFolder() + File.separator + "nc-keypair";
|
|
|
- File privateKeyFile = new File(keyPath, "push_key.priv");
|
|
|
- File publicKeyFile = new File(keyPath, "push_key.pub");
|
|
|
-
|
|
|
- Path privateKeyPath = Paths.get(privateKeyFile.toURI());
|
|
|
- Path publicKeyPath = Paths.get(publicKeyFile.toURI());
|
|
|
-
|
|
|
-
|
|
|
- if ((privateKeyFile.exists() && publicKeyFile.exists()) ||
|
|
|
- (!oldPrivateKeyFile.exists() && !oldPublicKeyFile.exists())) {
|
|
|
- PreferenceManager.setKeysMigration(context, true);
|
|
|
- } else {
|
|
|
- if (oldPrivateKeyFile.exists()) {
|
|
|
- try {
|
|
|
- Files.move(oldPrivateKeyPath, privateKeyPath, StandardCopyOption.ATOMIC_MOVE);
|
|
|
- } catch (IOException e) {
|
|
|
- Log.e(TAG, "Failed to move old private key to new location");
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- if (oldPublicKeyFile.exists()) {
|
|
|
- try {
|
|
|
- Files.move(oldPublicKeyPath, publicKeyPath, StandardCopyOption.ATOMIC_MOVE);
|
|
|
- } catch (IOException e) {
|
|
|
- Log.e(TAG, "Failed to move old public key to new location");
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- if (privateKeyFile.exists() && publicKeyFile.exists()) {
|
|
|
- PreferenceManager.setKeysMigration(context, true);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
public static void notificationChannels() {
|
|
|
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O && getAppContext() != null) {
|
|
|
Context context = getAppContext();
|