summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcyBerta <cyberta@riseup.net>2024-12-07 16:01:10 +0100
committercyberta <cyberta@riseup.net>2024-12-11 00:09:34 +0000
commit4fd0c5e51ad3fa0d5696f726e5966503325c046d (patch)
tree2441e7fefc14f2425a0614e1889fbffb63b93fba
parentdaa7b6fd567a5037a85a11f6c601997c37b42c53 (diff)
set introducer URL in bitmask-core during provider setup, in case there's an invite code present
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/base/models/Introducer.java4
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/base/models/Provider.java2
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/providersetup/ProviderApiManagerV5.java4
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/providersetup/fragments/ProviderSelectionFragment.java6
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/providersetup/fragments/viewmodel/ProviderSelectionViewModel.java1
5 files changed, 9 insertions, 8 deletions
diff --git a/app/src/main/java/se/leap/bitmaskclient/base/models/Introducer.java b/app/src/main/java/se/leap/bitmaskclient/base/models/Introducer.java
index c31912d9..671992ca 100644
--- a/app/src/main/java/se/leap/bitmaskclient/base/models/Introducer.java
+++ b/app/src/main/java/se/leap/bitmaskclient/base/models/Introducer.java
@@ -29,6 +29,10 @@ public class Introducer implements Parcelable {
kcpEnabled = in.readByte() != 0;
}
+ public String getFullyQualifiedDomainName() {
+ return fullyQualifiedDomainName;
+ }
+
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeString(type);
diff --git a/app/src/main/java/se/leap/bitmaskclient/base/models/Provider.java b/app/src/main/java/se/leap/bitmaskclient/base/models/Provider.java
index ac3aba7a..5b5fac48 100644
--- a/app/src/main/java/se/leap/bitmaskclient/base/models/Provider.java
+++ b/app/src/main/java/se/leap/bitmaskclient/base/models/Provider.java
@@ -135,7 +135,7 @@ public final class Provider implements Parcelable {
public Provider() { }
public Provider(Introducer introducer) {
- this(introducer.toUrl(), null);
+ this("https://" + introducer.getFullyQualifiedDomainName());
this.introducer = introducer;
}
diff --git a/app/src/main/java/se/leap/bitmaskclient/providersetup/ProviderApiManagerV5.java b/app/src/main/java/se/leap/bitmaskclient/providersetup/ProviderApiManagerV5.java
index 926b1545..9af14eda 100644
--- a/app/src/main/java/se/leap/bitmaskclient/providersetup/ProviderApiManagerV5.java
+++ b/app/src/main/java/se/leap/bitmaskclient/providersetup/ProviderApiManagerV5.java
@@ -164,7 +164,9 @@ public class ProviderApiManagerV5 extends ProviderApiManagerBase implements IPro
if (TorStatusObservable.isRunning() && TorStatusObservable.getSocksProxyPort() != -1) {
bm.setSocksProxy(SOCKS_PROXY_SCHEME + PROXY_HOST + ":" + TorStatusObservable.getSocksProxyPort());
}
- // TODO bm.setIntroducer();
+ if (provider.hasIntroducer()) {
+ bm.setIntroducer(provider.getIntroducer().toUrl());
+ }
} catch (Exception e) {
// TODO: improve error message
return eventSender.setErrorResult(currentDownload, R.string.config_error_found, null);
diff --git a/app/src/main/java/se/leap/bitmaskclient/providersetup/fragments/ProviderSelectionFragment.java b/app/src/main/java/se/leap/bitmaskclient/providersetup/fragments/ProviderSelectionFragment.java
index 3ac122f8..e4302be5 100644
--- a/app/src/main/java/se/leap/bitmaskclient/providersetup/fragments/ProviderSelectionFragment.java
+++ b/app/src/main/java/se/leap/bitmaskclient/providersetup/fragments/ProviderSelectionFragment.java
@@ -3,10 +3,8 @@ package se.leap.bitmaskclient.providersetup.fragments;
import static se.leap.bitmaskclient.providersetup.fragments.viewmodel.ProviderSelectionViewModel.ADD_PROVIDER;
import static se.leap.bitmaskclient.providersetup.fragments.viewmodel.ProviderSelectionViewModel.INVITE_CODE_PROVIDER;
-import android.Manifest;
import android.app.Activity;
import android.content.Intent;
-import android.content.pm.PackageManager;
import android.graphics.Typeface;
import android.os.Bundle;
import android.text.Editable;
@@ -20,19 +18,17 @@ import androidx.activity.result.ActivityResultLauncher;
import androidx.activity.result.contract.ActivityResultContracts;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
-import androidx.core.app.ActivityCompat;
-import androidx.core.content.ContextCompat;
import androidx.lifecycle.ViewModelProvider;
import java.util.ArrayList;
import se.leap.bitmaskclient.R;
-import se.leap.bitmaskclient.providersetup.activities.scanner.ScannerActivity;
import se.leap.bitmaskclient.base.models.Introducer;
import se.leap.bitmaskclient.base.models.Provider;
import se.leap.bitmaskclient.base.utils.ViewHelper;
import se.leap.bitmaskclient.databinding.FProviderSelectionBinding;
import se.leap.bitmaskclient.providersetup.activities.CancelCallback;
+import se.leap.bitmaskclient.providersetup.activities.scanner.ScannerActivity;
import se.leap.bitmaskclient.providersetup.fragments.viewmodel.ProviderSelectionViewModel;
import se.leap.bitmaskclient.providersetup.fragments.viewmodel.ProviderSelectionViewModelFactory;
diff --git a/app/src/main/java/se/leap/bitmaskclient/providersetup/fragments/viewmodel/ProviderSelectionViewModel.java b/app/src/main/java/se/leap/bitmaskclient/providersetup/fragments/viewmodel/ProviderSelectionViewModel.java
index 5f9a0f3d..fe21c6b3 100644
--- a/app/src/main/java/se/leap/bitmaskclient/providersetup/fragments/viewmodel/ProviderSelectionViewModel.java
+++ b/app/src/main/java/se/leap/bitmaskclient/providersetup/fragments/viewmodel/ProviderSelectionViewModel.java
@@ -6,7 +6,6 @@ import static se.leap.bitmaskclient.base.utils.ConfigHelper.isNetworkUrl;
import android.content.Context;
import android.content.res.AssetManager;
import android.text.InputType;
-import android.util.Patterns;
import android.view.View;
import androidx.lifecycle.ViewModel;