refactor
This commit is contained in:
parent
7600b4c58c
commit
f030963c9e
|
@ -29,7 +29,7 @@ import org.torproject.android.ui.PromoAppsActivity;
|
||||||
import org.torproject.android.ui.Rotate3dAnimation;
|
import org.torproject.android.ui.Rotate3dAnimation;
|
||||||
import org.torproject.android.ui.hs.providers.HSContentProvider;
|
import org.torproject.android.ui.hs.providers.HSContentProvider;
|
||||||
import org.torproject.android.vpn.VPNEnableActivity;
|
import org.torproject.android.vpn.VPNEnableActivity;
|
||||||
import org.torproject.android.hsutils.HiddenServiceUtils;
|
import org.torproject.android.backup.BackupUtils;
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.app.ActivityManager;
|
import android.app.ActivityManager;
|
||||||
|
@ -646,7 +646,7 @@ public class OrbotMainActivity extends AppCompatActivity
|
||||||
Cursor onion = getContentResolver().query(HSContentProvider.CONTENT_URI, mProjection, "port=" + hsPort, null, null);
|
Cursor onion = getContentResolver().query(HSContentProvider.CONTENT_URI, mProjection, "port=" + hsPort, null, null);
|
||||||
if(onion != null) {
|
if(onion != null) {
|
||||||
hostname = onion.getString(onion.getColumnIndex(HSContentProvider.HiddenService.NAME));
|
hostname = onion.getString(onion.getColumnIndex(HSContentProvider.HiddenService.NAME));
|
||||||
HiddenServiceUtils hsutils = new HiddenServiceUtils(getApplicationContext());
|
BackupUtils hsutils = new BackupUtils(getApplicationContext());
|
||||||
if(keyZipPath != null && keyZipPath.length() > 0)
|
if(keyZipPath != null && keyZipPath.length() > 0)
|
||||||
{
|
{
|
||||||
hsutils.restoreOnionBackup(hsPort, keyZipPath);
|
hsutils.restoreOnionBackup(hsPort, keyZipPath);
|
||||||
|
|
|
@ -1,18 +1,17 @@
|
||||||
package org.torproject.android.hsutils;
|
package org.torproject.android.backup;
|
||||||
|
|
||||||
import android.app.Application;
|
import android.app.Application;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
|
||||||
import org.torproject.android.service.TorServiceConstants;
|
import org.torproject.android.service.TorServiceConstants;
|
||||||
import org.torproject.android.storage.ExternalStorage;
|
import org.torproject.android.storage.ExternalStorage;
|
||||||
import org.torproject.android.zip.ZipIt;
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
public class HiddenServiceUtils {
|
public class BackupUtils {
|
||||||
private static File appCacheHome;
|
private static File appCacheHome;
|
||||||
|
|
||||||
public HiddenServiceUtils(Context context) {
|
public BackupUtils(Context context) {
|
||||||
appCacheHome = context.getDir(TorServiceConstants.DIRECTORY_TOR_DATA, Application.MODE_PRIVATE);
|
appCacheHome = context.getDir(TorServiceConstants.DIRECTORY_TOR_DATA, Application.MODE_PRIVATE);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package org.torproject.android.zip;
|
package org.torproject.android.backup;
|
||||||
|
|
||||||
|
|
||||||
import java.io.BufferedInputStream;
|
import java.io.BufferedInputStream;
|
|
@ -58,9 +58,7 @@ public class HiddenServicesActivity extends AppCompatActivity {
|
||||||
|
|
||||||
mAdapter = new OnionListAdapter(
|
mAdapter = new OnionListAdapter(
|
||||||
this,
|
this,
|
||||||
mCR.query(
|
mCR.query(HSContentProvider.CONTENT_URI, mProjection, mWhere, null, null),
|
||||||
HSContentProvider.CONTENT_URI, mProjection, mWhere, null, null
|
|
||||||
),
|
|
||||||
0
|
0
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ import android.widget.Button;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import org.torproject.android.R;
|
import org.torproject.android.R;
|
||||||
import org.torproject.android.hsutils.HiddenServiceUtils;
|
import org.torproject.android.backup.BackupUtils;
|
||||||
import org.torproject.android.ui.hs.providers.HSContentProvider;
|
import org.torproject.android.ui.hs.providers.HSContentProvider;
|
||||||
|
|
||||||
public class HSActionsDialog extends DialogFragment {
|
public class HSActionsDialog extends DialogFragment {
|
||||||
|
@ -49,7 +49,7 @@ public class HSActionsDialog extends DialogFragment {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
HiddenServiceUtils hsutils = new HiddenServiceUtils(mContext);
|
BackupUtils hsutils = new BackupUtils(mContext);
|
||||||
String backupPath = hsutils.createOnionBackup(Integer.parseInt(arguments.getString("port")));
|
String backupPath = hsutils.createOnionBackup(Integer.parseInt(arguments.getString("port")));
|
||||||
|
|
||||||
if (backupPath == null || backupPath.length() < 1) {
|
if (backupPath == null || backupPath.length() < 1) {
|
||||||
|
|
Loading…
Reference in New Issue