diff options
author | cyBerta <cyberta@riseup.net> | 2020-12-29 00:54:08 +0100 |
---|---|---|
committer | cyBerta <cyberta@riseup.net> | 2020-12-29 00:54:08 +0100 |
commit | 6b032b751324a30120cfaabe88940f95171df11f (patch) | |
tree | b6b26b84358726a02e27558562e7e9ea70a7aaa0 /app/src/main | |
parent | 16da1eeb5180cbb4a0d916785a08ccbcd3c1d74e (diff) |
new year cleanup: restructure messy project
Diffstat (limited to 'app/src/main')
116 files changed, 591 insertions, 498 deletions
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index ec053185..7e964211 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -29,7 +29,7 @@ android:maxSdkVersion="18"/> <application - android:name=".BitmaskApp" + android:name=".base.BitmaskApp" android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" @@ -50,13 +50,13 @@ </intent-filter> </service> <service - android:name=".ProviderAPI" + android:name=".providersetup.ProviderAPI" android:exported="false" android:permission="android.permission.BIND_JOB_SERVICE"> </service> <receiver - android:name=".OnBootReceiver" + android:name=".base.OnBootReceiver" android:enabled="true" android:permission="android.permission.RECEIVE_BOOT_COMPLETED" > <intent-filter android:priority="999"> @@ -71,7 +71,7 @@ android:name="de.blinkt.openvpn.LaunchVPN" android:theme="@style/invisibleTheme" /> <activity - android:name=".StartActivity" + android:name=".base.StartActivity" android:label="@string/app_name" android:launchMode="singleTop" android:theme="@style/SplashTheme" @@ -87,29 +87,29 @@ </activity> <activity - android:name=".MainActivity" + android:name=".base.MainActivity" android:label="@string/app_name" android:launchMode="singleTop" /> <activity - android:name=".ProviderListActivity" + android:name=".providersetup.ProviderListActivity" android:label="@string/configuration_wizard_title" /> <activity - android:name=".CustomProviderSetupActivity" + android:name=".providersetup.activities.CustomProviderSetupActivity" android:label="@string/setup_provider" /> <activity - android:name=".AddProviderActivity" + android:name=".providersetup.AddProviderActivity" android:label="@string/add_provider" /> <activity - android:name=".ProviderDetailActivity" + android:name=".providersetup.ProviderDetailActivity" android:label="@string/provider_details_title" android:launchMode="singleTop" /> - <activity android:name=".LoginActivity" /> - <activity android:name=".SignupActivity" /> + <activity android:name=".providersetup.activities.LoginActivity" /> + <activity android:name=".providersetup.activities.SignupActivity" /> <service android:name=".eip.EIP" @@ -118,7 +118,7 @@ </service> <service - android:name=".BitmaskTileService" + android:name=".base.BitmaskTileService" android:icon="@drawable/vpn_disconnected" android:label="@string/qs_title" android:permission="android.permission.BIND_QUICK_SETTINGS_TILE" diff --git a/app/src/main/java/de/blinkt/openvpn/LaunchVPN.java b/app/src/main/java/de/blinkt/openvpn/LaunchVPN.java index 70f8e445..b148d04d 100644 --- a/app/src/main/java/de/blinkt/openvpn/LaunchVPN.java +++ b/app/src/main/java/de/blinkt/openvpn/LaunchVPN.java @@ -23,11 +23,11 @@ import de.blinkt.openvpn.core.ConnectionStatus; import de.blinkt.openvpn.core.Preferences; import de.blinkt.openvpn.core.VPNLaunchHelper; import de.blinkt.openvpn.core.VpnStatus; -import se.leap.bitmaskclient.MainActivity; +import se.leap.bitmaskclient.base.MainActivity; import se.leap.bitmaskclient.R; -import static se.leap.bitmaskclient.Constants.EIP_ACTION_PREPARE_VPN; -import static se.leap.bitmaskclient.Constants.PROVIDER_PROFILE; +import static se.leap.bitmaskclient.base.models.Constants.EIP_ACTION_PREPARE_VPN; +import static se.leap.bitmaskclient.base.models.Constants.PROVIDER_PROFILE; import static se.leap.bitmaskclient.eip.EipResultBroadcast.tellToReceiverOrBroadcast; /** diff --git a/app/src/main/java/de/blinkt/openvpn/VpnProfile.java b/app/src/main/java/de/blinkt/openvpn/VpnProfile.java index 519c2106..5df1d56b 100644 --- a/app/src/main/java/de/blinkt/openvpn/VpnProfile.java +++ b/app/src/main/java/de/blinkt/openvpn/VpnProfile.java @@ -69,8 +69,8 @@ import se.leap.bitmaskclient.BuildConfig; import se.leap.bitmaskclient.R; import static de.blinkt.openvpn.core.connection.Connection.TransportType.OBFS4; -import static se.leap.bitmaskclient.Constants.PROVIDER_PROFILE; -import static se.leap.bitmaskclient.utils.ConfigHelper.stringEqual; +import static se.leap.bitmaskclient.base.models.Constants.PROVIDER_PROFILE; +import static se.leap.bitmaskclient.base.utils.ConfigHelper.stringEqual; public class VpnProfile implements Serializable, Cloneable { // Note that this class cannot be moved to core where it belongs since diff --git a/app/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java b/app/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java index 61969769..7dfacd91 100644 --- a/app/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java +++ b/app/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java @@ -45,14 +45,14 @@ import de.blinkt.openvpn.core.VpnStatus.StateListener; import de.blinkt.openvpn.core.connection.Connection; import de.blinkt.openvpn.core.connection.Obfs4Connection; import se.leap.bitmaskclient.R; -import se.leap.bitmaskclient.VpnNotificationManager; +import se.leap.bitmaskclient.eip.VpnNotificationManager; import se.leap.bitmaskclient.pluggableTransports.Shapeshifter; import se.leap.bitmaskclient.firewall.FirewallManager; import static de.blinkt.openvpn.core.ConnectionStatus.LEVEL_CONNECTED; import static de.blinkt.openvpn.core.ConnectionStatus.LEVEL_WAITING_FOR_USER_INPUT; import static de.blinkt.openvpn.core.NetworkSpace.IpAddress; -import static se.leap.bitmaskclient.Constants.PROVIDER_PROFILE; +import static se.leap.bitmaskclient.base.models.Constants.PROVIDER_PROFILE; public class OpenVPNService extends VpnService implements StateListener, Callback, ByteCountListener, IOpenVPNServiceInternal, VpnNotificationManager.VpnServiceCallback { diff --git a/app/src/main/java/de/blinkt/openvpn/core/VpnStatus.java b/app/src/main/java/de/blinkt/openvpn/core/VpnStatus.java index 737b8b42..8007f7c5 100644 --- a/app/src/main/java/de/blinkt/openvpn/core/VpnStatus.java +++ b/app/src/main/java/de/blinkt/openvpn/core/VpnStatus.java @@ -21,9 +21,9 @@ import java.util.concurrent.atomic.AtomicBoolean; import de.blinkt.openvpn.VpnProfile; import se.leap.bitmaskclient.R; -import se.leap.bitmaskclient.utils.PreferenceHelper; +import se.leap.bitmaskclient.base.utils.PreferenceHelper; -import static se.leap.bitmaskclient.utils.ConfigHelper.getProviderFormattedString; +import static se.leap.bitmaskclient.base.utils.ConfigHelper.getProviderFormattedString; public class VpnStatus { diff --git a/app/src/main/java/se/leap/bitmaskclient/DrawerSettingsAdapter.java b/app/src/main/java/se/leap/bitmaskclient/DrawerSettingsAdapter.java deleted file mode 100644 index e69de29b..00000000 --- a/app/src/main/java/se/leap/bitmaskclient/DrawerSettingsAdapter.java +++ /dev/null diff --git a/app/src/main/java/se/leap/bitmaskclient/BitmaskApp.java b/app/src/main/java/se/leap/bitmaskclient/base/BitmaskApp.java index 437998e0..4b6fea72 100644 --- a/app/src/main/java/se/leap/bitmaskclient/BitmaskApp.java +++ b/app/src/main/java/se/leap/bitmaskclient/base/BitmaskApp.java @@ -15,7 +15,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -package se.leap.bitmaskclient; +package se.leap.bitmaskclient.base; import android.content.Context; import android.content.IntentFilter; @@ -28,16 +28,20 @@ import androidx.multidex.MultiDexApplication; import com.squareup.leakcanary.LeakCanary; import com.squareup.leakcanary.RefWatcher; +import se.leap.bitmaskclient.BuildConfig; import se.leap.bitmaskclient.appUpdate.DownloadBroadcastReceiver; +import se.leap.bitmaskclient.eip.EipSetupObserver; +import se.leap.bitmaskclient.base.models.ProviderObservable; import se.leap.bitmaskclient.tethering.TetheringStateManager; +import se.leap.bitmaskclient.base.utils.PRNGFixes; import static android.content.Intent.CATEGORY_DEFAULT; -import static se.leap.bitmaskclient.Constants.BROADCAST_DOWNLOAD_SERVICE_EVENT; -import static se.leap.bitmaskclient.Constants.SHARED_PREFERENCES; +import static se.leap.bitmaskclient.base.models.Constants.BROADCAST_DOWNLOAD_SERVICE_EVENT; +import static se.leap.bitmaskclient.base.models.Constants.SHARED_PREFERENCES; import static se.leap.bitmaskclient.appUpdate.DownloadBroadcastReceiver.ACTION_DOWNLOAD; import static se.leap.bitmaskclient.appUpdate.DownloadServiceCommand.CHECK_VERSION_FILE; import static se.leap.bitmaskclient.appUpdate.DownloadServiceCommand.DOWNLOAD_UPDATE; -import static se.leap.bitmaskclient.utils.PreferenceHelper.getSavedProviderFromSharedPreferences; +import static se.leap.bitmaskclient.base.utils.PreferenceHelper.getSavedProviderFromSharedPreferences; /** * Created by cyberta on 24.10.17. diff --git a/app/src/main/java/se/leap/bitmaskclient/BitmaskTileService.java b/app/src/main/java/se/leap/bitmaskclient/base/BitmaskTileService.java index 4b423624..4a8b1236 100644 --- a/app/src/main/java/se/leap/bitmaskclient/BitmaskTileService.java +++ b/app/src/main/java/se/leap/bitmaskclient/base/BitmaskTileService.java @@ -1,4 +1,4 @@ -package se.leap.bitmaskclient; +package se.leap.bitmaskclient.base; import android.annotation.SuppressLint; import android.annotation.TargetApi; @@ -11,8 +11,11 @@ import android.service.quicksettings.TileService; import java.util.Observable; import java.util.Observer; +import se.leap.bitmaskclient.R; import se.leap.bitmaskclient.eip.EipCommand; import se.leap.bitmaskclient.eip.EipStatus; +import se.leap.bitmaskclient.base.models.Provider; +import se.leap.bitmaskclient.base.models.ProviderObservable; @TargetApi(Build.VERSION_CODES.N) diff --git a/app/src/main/java/se/leap/bitmaskclient/FragmentManagerEnhanced.java b/app/src/main/java/se/leap/bitmaskclient/base/FragmentManagerEnhanced.java index f4215e89..bc01dcec 100644 --- a/app/src/main/java/se/leap/bitmaskclient/FragmentManagerEnhanced.java +++ b/app/src/main/java/se/leap/bitmaskclient/base/FragmentManagerEnhanced.java @@ -14,7 +14,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -package se.leap.bitmaskclient; +package se.leap.bitmaskclient.base; import androidx.fragment.app.Fragment; import androidx.fragment.app.FragmentManager; diff --git a/app/src/main/java/se/leap/bitmaskclient/MainActivity.java b/app/src/main/java/se/leap/bitmaskclient/base/MainActivity.java index 867f66e5..1b7de10e 100644 --- a/app/src/main/java/se/leap/bitmaskclient/MainActivity.java +++ b/app/src/main/java/se/leap/bitmaskclient/base/MainActivity.java @@ -14,7 +14,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -package se.leap.bitmaskclient; +package se.leap.bitmaskclient.base; import android.content.Intent; @@ -34,34 +34,43 @@ import org.json.JSONObject; import java.util.Observable; import java.util.Observer; -import se.leap.bitmaskclient.drawer.NavigationDrawerFragment; +import se.leap.bitmaskclient.R; +import se.leap.bitmaskclient.base.drawer.NavigationDrawerFragment; import se.leap.bitmaskclient.eip.EIP; import se.leap.bitmaskclient.eip.EipCommand; -import se.leap.bitmaskclient.fragments.ExcludeAppsFragment; -import se.leap.bitmaskclient.fragments.LogFragment; -import se.leap.bitmaskclient.utils.PreferenceHelper; - -import static se.leap.bitmaskclient.Constants.ASK_TO_CANCEL_VPN; -import static se.leap.bitmaskclient.Constants.BROADCAST_RESULT_CODE; -import static se.leap.bitmaskclient.Constants.BROADCAST_RESULT_KEY; -import static se.leap.bitmaskclient.Constants.EIP_ACTION_PREPARE_VPN; -import static se.leap.bitmaskclient.Constants.EIP_ACTION_START; -import static se.leap.bitmaskclient.Constants.EIP_REQUEST; -import static se.leap.bitmaskclient.Constants.PROVIDER_KEY; -import static se.leap.bitmaskclient.Constants.REQUEST_CODE_CONFIGURE_LEAP; -import static se.leap.bitmaskclient.Constants.REQUEST_CODE_LOG_IN; -import static se.leap.bitmaskclient.Constants.REQUEST_CODE_SWITCH_PROVIDER; -import static se.leap.bitmaskclient.Constants.SHARED_PREFERENCES; -import static se.leap.bitmaskclient.ProviderAPI.ERRORID; -import static se.leap.bitmaskclient.ProviderAPI.ERRORS; -import static se.leap.bitmaskclient.ProviderAPI.INCORRECTLY_DOWNLOADED_EIP_SERVICE; -import static se.leap.bitmaskclient.ProviderAPI.INCORRECTLY_UPDATED_INVALID_VPN_CERTIFICATE; -import static se.leap.bitmaskclient.ProviderAPI.USER_MESSAGE; +import se.leap.bitmaskclient.eip.EipSetupListener; +import se.leap.bitmaskclient.eip.EipSetupObserver; +import se.leap.bitmaskclient.base.fragments.EipFragment; +import se.leap.bitmaskclient.base.fragments.ExcludeAppsFragment; +import se.leap.bitmaskclient.base.fragments.LogFragment; +import se.leap.bitmaskclient.base.models.Provider; +import se.leap.bitmaskclient.base.models.ProviderObservable; +import se.leap.bitmaskclient.providersetup.models.LeapSRPSession; +import se.leap.bitmaskclient.providersetup.activities.LoginActivity; +import se.leap.bitmaskclient.base.utils.PreferenceHelper; +import se.leap.bitmaskclient.base.fragments.MainActivityErrorDialog; + +import static se.leap.bitmaskclient.base.models.Constants.ASK_TO_CANCEL_VPN; +import static se.leap.bitmaskclient.base.models.Constants.BROADCAST_RESULT_CODE; +import static se.leap.bitmaskclient.base.models.Constants.BROADCAST_RESULT_KEY; +import static se.leap.bitmaskclient.base.models.Constants.EIP_ACTION_PREPARE_VPN; +import static se.leap.bitmaskclient.base.models.Constants.EIP_ACTION_START; +import static se.leap.bitmaskclient.base.models.Constants.EIP_REQUEST; +import static se.leap.bitmaskclient.base.models.Constants.PROVIDER_KEY; +import static se.leap.bitmaskclient.base.models.Constants.REQUEST_CODE_CONFIGURE_LEAP; +import static se.leap.bitmaskclient.base.models.Constants.REQUEST_CODE_LOG_IN; +import static se.leap.bitmaskclient.base.models.Constants.REQUEST_CODE_SWITCH_PROVIDER; +import static se.leap.bitmaskclient.base.models.Constants.SHARED_PREFERENCES; +import static se.leap.bitmaskclient.providersetup.ProviderAPI.ERRORID; +import static se.leap.bitmaskclient.providersetup.ProviderAPI.ERRORS; +import static se.leap.bitmaskclient.providersetup.ProviderAPI.INCORRECTLY_DOWNLOADED_EIP_SERVICE; +import static se.leap.bitmaskclient.providersetup.ProviderAPI.INCORRECTLY_UPDATED_INVALID_VPN_CERTIFICATE; +import static se.leap.bitmaskclient.providersetup.ProviderAPI.USER_MESSAGE; import static se.leap.bitmaskclient.R.string.downloading_vpn_certificate_failed; import static se.leap.bitmaskclient.R.string.vpn_certificate_user_message; import static se.leap.bitmaskclient.eip.EIP.EIPErrors.ERROR_INVALID_VPN_CERTIFICATE; import static se.leap.bitmaskclient.eip.EIP.EIPErrors.ERROR_VPN_PREPARE; -import static se.leap.bitmaskclient.utils.PreferenceHelper.storeProviderInPreferences; +import static se.leap.bitmaskclient.base.utils.PreferenceHelper.storeProviderInPreferences; public class MainActivity extends AppCompatActivity implements EipSetupListener, Observer, ExcludeAppsFragment.ExcludedAppsCallback { diff --git a/app/src/main/java/se/leap/bitmaskclient/OnBootReceiver.java b/app/src/main/java/se/leap/bitmaskclient/base/OnBootReceiver.java index 2efce9e4..df1d3e5a 100644 --- a/app/src/main/java/se/leap/bitmaskclient/OnBootReceiver.java +++ b/app/src/main/java/se/leap/bitmaskclient/base/OnBootReceiver.java @@ -1,4 +1,4 @@ -package se.leap.bitmaskclient; +package se.leap.bitmaskclient.base; import android.content.BroadcastReceiver; import android.content.Context; @@ -7,14 +7,12 @@ import android.content.SharedPreferences; import android.util.Log; import de.blinkt.openvpn.core.VpnStatus; -import se.leap.bitmaskclient.utils.PreferenceHelper; import static android.content.Intent.ACTION_BOOT_COMPLETED; -import static se.leap.bitmaskclient.Constants.APP_ACTION_CONFIGURE_ALWAYS_ON_PROFILE; -import static se.leap.bitmaskclient.Constants.EIP_IS_ALWAYS_ON; -import static se.leap.bitmaskclient.Constants.EIP_RESTART_ON_BOOT; -import static se.leap.bitmaskclient.Constants.PROVIDER_VPN_CERTIFICATE; -import static se.leap.bitmaskclient.Constants.SHARED_PREFERENCES; +import static se.leap.bitmaskclient.base.models.Constants.APP_ACTION_CONFIGURE_ALWAYS_ON_PROFILE; +import static se.leap.bitmaskclient.base.models.Constants.EIP_RESTART_ON_BOOT; +import static se.leap.bitmaskclient.base.models.Constants.PROVIDER_VPN_CERTIFICATE; +import static se.leap.bitmaskclient.base.models.Constants.SHARED_PREFERENCES; public class OnBootReceiver extends BroadcastReceiver { diff --git a/app/src/main/java/se/leap/bitmaskclient/StartActivity.java b/app/src/main/java/se/leap/bitmaskclient/base/StartActivity.java index 1a679b1c..cf64905a 100644 --- a/app/src/main/java/se/leap/bitmaskclient/StartActivity.java +++ b/app/src/main/java/se/leap/bitmaskclient/base/StartActivity.java @@ -14,7 +14,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -package se.leap.bitmaskclient; +package se.leap.bitmaskclient.base; import android.app.Activity; import android.content.Intent; @@ -30,19 +30,24 @@ import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import de.blinkt.openvpn.core.VpnStatus; +import se.leap.bitmaskclient.providersetup.ProviderListActivity; import se.leap.bitmaskclient.eip.EipCommand; -import se.leap.bitmaskclient.utils.PreferenceHelper; - -import static se.leap.bitmaskclient.Constants.APP_ACTION_CONFIGURE_ALWAYS_ON_PROFILE; -import static se.leap.bitmaskclient.Constants.EIP_RESTART_ON_BOOT; -import static se.leap.bitmaskclient.Constants.PREFERENCES_APP_VERSION; -import static se.leap.bitmaskclient.Constants.PROVIDER_EIP_DEFINITION; -import static se.leap.bitmaskclient.Constants.PROVIDER_KEY; -import static se.leap.bitmaskclient.Constants.REQUEST_CODE_CONFIGURE_LEAP; -import static se.leap.bitmaskclient.Constants.SHARED_PREFERENCES; -import static se.leap.bitmaskclient.MainActivity.ACTION_SHOW_VPN_FRAGMENT; -import static se.leap.bitmaskclient.utils.ConfigHelper.isDefaultBitmask; -import static se.leap.bitmaskclient.utils.PreferenceHelper.storeProviderInPreferences; +import se.leap.bitmaskclient.base.models.FeatureVersionCode; +import se.leap.bitmaskclient.base.models.Provider; +import se.leap.bitmaskclient.base.models.ProviderObservable; +import se.leap.bitmaskclient.providersetup.activities.CustomProviderSetupActivity; +import se.leap.bitmaskclient.base.utils.PreferenceHelper; + +import static se.leap.bitmaskclient.base.models.Constants.APP_ACTION_CONFIGURE_ALWAYS_ON_PROFILE; +import static se.leap.bitmaskclient.base.models.Constants.EIP_RESTART_ON_BOOT; +import static se.leap.bitmaskclient.base.models.Constants.PREFERENCES_APP_VERSION; +import static se.leap.bitmaskclient.base.models.Constants.PROVIDER_EIP_DEFINITION; +import static se.leap.bitmaskclient.base.models.Constants.PROVIDER_KEY; +import static se.leap.bitmaskclient.base.models.Constants.REQUEST_CODE_CONFIGURE_LEAP; +import static se.leap.bitmaskclient.base.models.Constants.SHARED_PREFERENCES; +import static se.leap.bitmaskclient.base.MainActivity.ACTION_SHOW_VPN_FRAGMENT; +import static se.leap.bitmaskclient.base.utils.ConfigHelper.isDefaultBitmask; +import static se.leap.bitmaskclient.base.utils.PreferenceHelper.storeProviderInPreferences; /** * Activity shown at startup. Evaluates if App is started for the first time or has been upgraded diff --git a/app/src/main/java/se/leap/bitmaskclient/drawer/NavigationDrawerFragment.java b/app/src/main/java/se/leap/bitmaskclient/base/drawer/NavigationDrawerFragment.java index fabaa7c3..e70c87f9 100644 --- a/app/src/main/java/se/leap/bitmaskclient/drawer/NavigationDrawerFragment.java +++ b/app/src/main/java/se/leap/bitmaskclient/base/drawer/NavigationDrawerFragment.java @@ -14,7 +14,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -package se.leap.bitmaskclient.drawer; +package se.leap.bitmaskclient.base.drawer; import android.app.Activity; @@ -50,47 +50,47 @@ import java.util.Observer; import java.util.Set; import de.blinkt.openvpn.core.VpnStatus; -import se.leap.bitmaskclient.EipFragment; -import se.leap.bitmaskclient.FragmentManagerEnhanced; -import se.leap.bitmaskclient.MainActivity; -import se.leap.bitmaskclient.Provider; -import se.leap.bitmaskclient.ProviderListActivity; -import se.leap.bitmaskclient.ProviderObservable; +import se.leap.bitmaskclient.base.fragments.EipFragment; +import se.leap.bitmaskclient.base.FragmentManagerEnhanced; +import se.leap.bitmaskclient.base.MainActivity; +import se.leap.bitmaskclient.base.models.Provider; +import se.leap.bitmaskclient.providersetup.ProviderListActivity; +import se.leap.bitmaskclient.base.models.ProviderObservable; import se.leap.bitmaskclient.R; import se.leap.bitmaskclient.eip.EipCommand; import se.leap.bitmaskclient.eip.EipStatus; import se.leap.bitmaskclient.firewall.FirewallManager; -import se.leap.bitmaskclient.fragments.AboutFragment; -import se.leap.bitmaskclient.fragments.AlwaysOnDialog; -import se.leap.bitmaskclient.fragments.ExcludeAppsFragment; -import se.leap.bitmaskclient.fragments.LogFragment; -import se.leap.bitmaskclient.fragments.TetheringDialog; +import se.leap.bitmaskclient.base.fragments.AboutFragment; +import se.leap.bitmaskclient.base.fragments.AlwaysOnDialog; +import se.leap.bitmaskclient.base.fragments.ExcludeAppsFragment; +import se.leap.bitmaskclient.base.fragments.LogFragment; +import se.leap.bitmaskclient.base.fragments.TetheringDialog; import se.leap.bitmaskclient.tethering.TetheringObservable; -import se.leap.bitmaskclient.utils.PreferenceHelper; -import se.leap.bitmaskclient.views.IconSwitchEntry; -import se.leap.bitmaskclient.views.IconTextEntry; +import se.leap.bitmaskclient.base.utils.PreferenceHelper; +import se.leap.bitmaskclient.base.views.IconSwitchEntry; +import se.leap.bitmaskclient.base.views.IconTextEntry; import static android.content.Context.MODE_PRIVATE; import static android.view.View.GONE; import static android.view.View.VISIBLE; -import static se.leap.bitmaskclient.BitmaskApp.getRefWatcher; -import static se.leap.bitmaskclient.Constants.DONATION_URL; -import static se.leap.bitmaskclient.Constants.ENABLE_DONATION; -import static se.leap.bitmaskclient.Constants.PROVIDER_KEY; -import static se.leap.bitmaskclient.Constants.REQUEST_CODE_SWITCH_PROVIDER; -import static se.leap.bitmaskclient.Constants.SHARED_PREFERENCES; -import static se.leap.bitmaskclient.Constants.USE_IPv6_FIREWALL; -import static se.leap.bitmaskclient.Constants.USE_PLUGGABLE_TRANSPORTS; +import static se.leap.bitmaskclient.base.BitmaskApp.getRefWatcher; +import static se.leap.bitmaskclient.base.models.Constants.DONATION_URL; +import static se.leap.bitmaskclient.base.models.Constants.ENABLE_DONATION; +import static se.leap.bitmaskclient.base.models.Constants.PROVIDER_KEY; +import static se.leap.bitmaskclient.base.models.Constants.REQUEST_CODE_SWITCH_PROVIDER; +import static se.leap.bitmaskclient.base.models.Constants.SHARED_PREFERENCES; +import static se.leap.bitmaskclient.base.models.Constants.USE_IPv6_FIREWALL; +import static se.leap.bitmaskclient.base.models.Constants.USE_PLUGGABLE_TRANSPORTS; import static se.leap.bitmaskclient.R.string.about_fragment_title; import static se.leap.bitmaskclient.R.string.exclude_apps_fragment_title; import static se.leap.bitmaskclient.R.string.log_fragment_title; -import static se.leap.bitmaskclient.utils.ConfigHelper.isDefaultBitmask; -import static se.leap.bitmaskclient.utils.PreferenceHelper.getSaveBattery; -import static se.leap.bitmaskclient.utils.PreferenceHelper.getShowAlwaysOnDialog; -import static se.leap.bitmaskclient.utils.PreferenceHelper.getUsePluggableTransports; -import static se.leap.bitmaskclient.utils.PreferenceHelper.saveBattery; -import static se.leap.bitmaskclient.utils.PreferenceHelper.showExperimentalFeatures; -import static se.leap.bitmaskclient.utils.PreferenceHelper.usePluggableTransports; +import static se.leap.bitmaskclient.base.utils.ConfigHelper.isDefaultBitmask; +import static se.leap.bitmaskclient.base.utils.PreferenceHelper.getSaveBattery; +import static se.leap.bitmaskclient.base.utils.PreferenceHelper.getShowAlwaysOnDialog; +import static se.leap.bitmaskclient.base.utils.PreferenceHelper.getUsePluggableTransports; +import static se.leap.bitmaskclient.base.utils.PreferenceHelper.saveBattery; +import static se.leap.bitmaskclient.base.utils.PreferenceHelper.showExperimentalFeatures; +import static se.leap.bitmaskclient.base.utils.PreferenceHelper.usePluggableTransports; /** * Fragment used for managing interactions for and presentation of a navigation drawer. diff --git a/app/src/main/java/se/leap/bitmaskclient/fragments/AboutFragment.java b/app/src/main/java/se/leap/bitmaskclient/base/fragments/AboutFragment.java index b7743a75..d901ba68 100644 --- a/app/src/main/java/se/leap/bitmaskclient/fragments/AboutFragment.java +++ b/app/src/main/java/se/leap/bitmaskclient/base/fragments/AboutFragment.java @@ -1,4 +1,4 @@ -package se.leap.bitmaskclient.fragments; +package se.leap.bitmaskclient.base.fragments; import android.content.pm.PackageInfo; import android.content.pm.PackageManager.NameNotFoundException; diff --git a/app/src/main/java/se/leap/bitmaskclient/fragments/AlwaysOnDialog.java b/app/src/main/java/se/leap/bitmaskclient/base/fragments/AlwaysOnDialog.java index cb26e685..a8034e1a 100644 --- a/app/src/main/java/se/leap/bitmaskclient/fragments/AlwaysOnDialog.java +++ b/app/src/main/java/se/leap/bitmaskclient/base/fragments/AlwaysOnDialog.java @@ -1,4 +1,4 @@ -package se.leap.bitmaskclient.fragments; +package se.leap.bitmaskclient.base.fragments; import android.app.Dialog; import android.content.Intent; @@ -16,9 +16,9 @@ import android.widget.CheckBox; import butterknife.ButterKnife; import butterknife.InjectView; import se.leap.bitmaskclient.R; -import se.leap.bitmaskclient.views.IconTextView; +import se.leap.bitmaskclient.base.views.IconTextView; -import static se.leap.bitmaskclient.utils.PreferenceHelper.saveShowAlwaysOnDialog; +import static se.leap.bitmaskclient.base.utils.PreferenceHelper.saveShowAlwaysOnDialog; /** diff --git a/app/src/main/java/se/leap/bitmaskclient/fragments/DonationReminderDialog.java b/app/src/main/java/se/leap/bitmaskclient/base/fragments/DonationReminderDialog.java index 046acad4..0277933c 100644 --- a/app/src/main/java/se/leap/bitmaskclient/fragments/DonationReminderDialog.java +++ b/app/src/main/java/se/leap/bitmaskclient/base/fragments/DonationReminderDialog.java @@ -1,4 +1,4 @@ -package se.leap.bitmaskclient.fragments; +package se.leap.bitmaskclient.base.fragments; import android.app.Dialog; import android.content.ActivityNotFoundException; @@ -20,15 +20,15 @@ import java.text.ParseException; import butterknife.ButterKnife; import butterknife.InjectView; import se.leap.bitmaskclient.R; -import se.leap.bitmaskclient.utils.DateHelper; -import se.leap.bitmaskclient.utils.PreferenceHelper; - -import static se.leap.bitmaskclient.Constants.DONATION_REMINDER_DURATION; -import static se.leap.bitmaskclient.Constants.DONATION_URL; -import static se.leap.bitmaskclient.Constants.ENABLE_DONATION; -import static se.leap.bitmaskclient.Constants.ENABLE_DONATION_REMINDER; -import static se.leap.bitmaskclient.Constants.FIRST_TIME_USER_DATE; -import static se.leap.bitmaskclient.Constants.LAST_DONATION_REMINDER_DATE; +import se.leap.bitmaskclient.base.utils.DateHelper; +import se.leap.bitmaskclient.base.utils.PreferenceHelper; + +import static se.leap.bitmaskclient.base.models.Constants.DONATION_REMINDER_DURATION; +import static se.leap.bitmaskclient.base.models.Constants.DONATION_URL; +import static se.leap.bitmaskclient.base.models.Constants.ENABLE_DONATION; +import static se.leap.bitmaskclient.base.models.Constants.ENABLE_DONATION_REMINDER; +import static se.leap.bitmaskclient.base.models.Constants.FIRST_TIME_USER_DATE; +import static se.leap.bitmaskclient.base.models.Constants.LAST_DONATION_REMINDER_DATE; public class DonationReminderDialog extends AppCompatDialogFragment { diff --git a/app/src/main/java/se/leap/bitmaskclient/EipFragment.java b/app/src/main/java/se/leap/bitmaskclient/base/fragments/EipFragment.java index fceadd88..9544fb1e 100644 --- a/app/src/main/java/se/leap/bitmaskclient/EipFragment.java +++ b/app/src/main/java/se/leap/bitmaskclient/base/fragments/EipFragment.java @@ -14,7 +14,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -package se.leap.bitmaskclient; +package se.leap.bitmaskclient.base.fragments; import android.app.Activity; import android.content.ComponentName; @@ -54,32 +54,40 @@ import butterknife.OnClick; import de.blinkt.openvpn.core.IOpenVPNServiceInternal; import de.blinkt.openvpn.core.OpenVPNService; import de.blinkt.openvpn.core.VpnStatus; +import se.leap.bitmaskclient.providersetup.ProviderListActivity; +import se.leap.bitmaskclient.R; +import se.leap.bitmaskclient.base.FragmentManagerEnhanced; +import se.leap.bitmaskclient.base.models.Provider; +import se.leap.bitmaskclient.base.models.ProviderObservable; +import se.leap.bitmaskclient.base.views.VpnStateImage; import se.leap.bitmaskclient.eip.EipCommand; import se.leap.bitmaskclient.eip.EipStatus; -import se.leap.bitmaskclient.fragments.DonationReminderDialog; -import se.leap.bitmaskclient.views.VpnStateImage; +import se.leap.bitmaskclient.providersetup.ProviderAPICommand; +import se.leap.bitmaskclient.providersetup.activities.CustomProviderSetupActivity; +import se.leap.bitmaskclient.providersetup.activities.LoginActivity; +import se.leap.bitmaskclient.providersetup.models.LeapSRPSession; import static android.view.View.GONE; import static android.view.View.VISIBLE; import static de.blinkt.openvpn.core.ConnectionStatus.LEVEL_NONETWORK; -import static se.leap.bitmaskclient.Constants.ASK_TO_CANCEL_VPN; -import static se.leap.bitmaskclient.Constants.EIP_ACTION_START; -import static se.leap.bitmaskclient.Constants.EIP_EARLY_ROUTES; -import static se.leap.bitmaskclient.Constants.EIP_RESTART_ON_BOOT; -import static se.leap.bitmaskclient.Constants.PROVIDER_KEY; -import static se.leap.bitmaskclient.Constants.REQUEST_CODE_CONFIGURE_LEAP; -import static se.leap.bitmaskclient.Constants.REQUEST_CODE_LOG_IN; -import static se.leap.bitmaskclient.Constants.REQUEST_CODE_SWITCH_PROVIDER; -import static se.leap.bitmaskclient.Constants.SHARED_PREFERENCES; -import static se.leap.bitmaskclient.EipSetupObserver.connectionRetry; -import static se.leap.bitmaskclient.EipSetupObserver.gatewayOrder; -import static se.leap.bitmaskclient.EipSetupObserver.reconnectingWithDifferentGateway; -import static se.leap.bitmaskclient.ProviderAPI.DOWNLOAD_GEOIP_JSON; -import static se.leap.bitmaskclient.ProviderAPI.UPDATE_INVALID_VPN_CERTIFICATE; -import static se.leap.bitmaskclient.ProviderAPI.USER_MESSAGE; import static se.leap.bitmaskclient.R.string.vpn_certificate_user_message; -import static se.leap.bitmaskclient.utils.ConfigHelper.isDefaultBitmask; -import static se.leap.bitmaskclient.utils.ViewHelper.convertDimensionToPx; +import static se.leap.bitmaskclient.base.models.Constants.ASK_TO_CANCEL_VPN; +import static se.leap.bitmaskclient.base.models.Constants.EIP_ACTION_START; +import static se.leap.bitmaskclient.base.models.Constants.EIP_EARLY_ROUTES; +import static se.leap.bitmaskclient.base.models.Constants.EIP_RESTART_ON_BOOT; +import static se.leap.bitmaskclient.base.models.Constants.PROVIDER_KEY; +import static se.leap.bitmaskclient.base.models.Constants.REQUEST_CODE_CONFIGURE_LEAP; +import static se.leap.bitmaskclient.base.models.Constants.REQUEST_CODE_LOG_IN; +import static se.leap.bitmaskclient.base.models.Constants.REQUEST_CODE_SWITCH_PROVIDER; +import static se.leap.bitmaskclient.base.models.Constants.SHARED_PREFERENCES; +import static se.leap.bitmaskclient.base.utils.ConfigHelper.isDefaultBitmask; +import static se.leap.bitmaskclient.base.utils.ViewHelper.convertDimensionToPx; +import static se.leap.bitmaskclient.eip.EipSetupObserver.connectionRetry; +import static se.leap.bitmaskclient.eip.EipSetupObserver.gatewayOrder; +import static se.leap.bitmaskclient.eip.EipSetupObserver.reconnectingWithDifferentGateway; +import static se.leap.bitmaskclient.providersetup.ProviderAPI.DOWNLOAD_GEOIP_JSON; +import static se.leap.bitmaskclient.providersetup.ProviderAPI.UPDATE_INVALID_VPN_CERTIFICATE; +import static se.leap.bitmaskclient.providersetup.ProviderAPI.USER_MESSAGE; public class EipFragment extends Fragment implements Observer { diff --git a/app/src/main/java/se/leap/bitmaskclient/fragments/ExcludeAppsFragment.java b/app/src/main/java/se/leap/bitmaskclient/base/fragments/ExcludeAppsFragment.java index 9559978b..18000171 100644 --- a/app/src/main/java/se/leap/bitmaskclient/fragments/ExcludeAppsFragment.java +++ b/app/src/main/java/se/leap/bitmaskclient/base/fragments/ExcludeAppsFragment.java @@ -3,7 +3,7 @@ * Distributed under the GNU GPL v2 with additional terms. For full terms see the file doc/LICENSE.txt */ -package se.leap.bitmaskclient.fragments; +package se.leap.bitmaskclient.base.fragments; import android.Manifest; import android.app.Activity; @@ -37,7 +37,7 @@ import java.util.Vector; import de.blinkt.openvpn.VpnProfile; import se.leap.bitmaskclient.R; -import se.leap.bitmaskclient.utils.PreferenceHelper; +import se.leap.bitmaskclient.base.utils.PreferenceHelper; /** * Created by arne on 16.11.14. diff --git a/app/src/main/java/se/leap/bitmaskclient/fragments/LogFragment.java b/app/src/main/java/se/leap/bitmaskclient/base/fragments/LogFragment.java index 19787dc3..d788b9e6 100644 --- a/app/src/main/java/se/leap/bitmaskclient/fragments/LogFragment.java +++ b/app/src/main/java/se/leap/bitmaskclient/base/fragments/LogFragment.java @@ -3,7 +3,7 @@ * Distributed under the GNU GPL v2 with additional terms. For full terms see the file doc/LICENSE.txt */ -package se.leap.bitmaskclient.fragments; +package se.leap.bitmaskclient.base.fragments; import android.animation.Animator; import android.animation.AnimatorListenerAdapter; @@ -55,7 +55,7 @@ import de.blinkt.openvpn.core.Preferences; import de.blinkt.openvpn.core.VpnStatus; import de.blinkt.openvpn.core.VpnStatus.LogListener; import de.blinkt.openvpn.core.VpnStatus.StateListener; -import se.leap.bitmaskclient.Constants; +import se.leap.bitmaskclient.base.models.Constants; import se.leap.bitmaskclient.R; import static de.blinkt.openvpn.core.OpenVPNService.humanReadableByteCount; diff --git a/app/src/main/java/se/leap/bitmaskclient/MainActivityErrorDialog.java b/app/src/main/java/se/leap/bitmaskclient/base/fragments/MainActivityErrorDialog.java index 7e9bad22..4b307f23 100644 --- a/app/src/main/java/se/leap/bitmaskclient/MainActivityErrorDialog.java +++ b/app/src/main/java/se/leap/bitmaskclient/base/fragments/MainActivityErrorDialog.java @@ -14,7 +14,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -package se.leap.bitmaskclient; +package se.leap.bitmaskclient.base.fragments; import android.app.Dialog; import android.content.Context; @@ -26,18 +26,21 @@ import androidx.appcompat.app.AlertDialog; import org.json.JSONObject; +import se.leap.bitmaskclient.R; import se.leap.bitmaskclient.eip.EIP; import se.leap.bitmaskclient.eip.EipCommand; +import se.leap.bitmaskclient.base.models.Provider; +import se.leap.bitmaskclient.providersetup.ProviderAPICommand; -import static se.leap.bitmaskclient.ProviderAPI.UPDATE_INVALID_VPN_CERTIFICATE; +import static se.leap.bitmaskclient.providersetup.ProviderAPI.UPDATE_INVALID_VPN_CERTIFICATE; import static se.leap.bitmaskclient.R.string.warning_option_try_ovpn; import static se.leap.bitmaskclient.R.string.warning_option_try_pt; import static se.leap.bitmaskclient.eip.EIP.EIPErrors.UNKNOWN; import static se.leap.bitmaskclient.eip.EIP.EIPErrors.valueOf; import static se.leap.bitmaskclient.eip.EIP.ERRORS; import static se.leap.bitmaskclient.eip.EIP.ERRORID; -import static se.leap.bitmaskclient.utils.PreferenceHelper.getUsePluggableTransports; -import static se.leap.bitmaskclient.utils.PreferenceHelper.usePluggableTransports; +import static se.leap.bitmaskclient.base.utils.PreferenceHelper.getUsePluggableTransports; +import static se.leap.bitmaskclient.base.utils.PreferenceHelper.usePluggableTransports; /** * Implements an error dialog for the main activity. diff --git a/app/src/main/java/se/leap/bitmaskclient/fragments/TetheringDialog.java b/app/src/main/java/se/leap/bitmaskclient/base/fragments/TetheringDialog.java index 24e3c814..8593e25c 100644 --- a/app/src/main/java/se/leap/bitmaskclient/fragments/TetheringDialog.java +++ b/app/src/main/java/se/leap/bitmaskclient/base/fragments/TetheringDialog.java @@ -1,4 +1,4 @@ -package se.leap.bitmaskclient.fragments; +package se.leap.bitmaskclient.base.fragments; import android.app.Dialog; import android.content.ActivityNotFoundException; @@ -33,8 +33,8 @@ import de.blinkt.openvpn.core.VpnStatus; import se.leap.bitmaskclient.R; import se.leap.bitmaskclient.firewall.FirewallManager; import se.leap.bitmaskclient.tethering.TetheringObservable; -import se.leap.bitmaskclient.utils.PreferenceHelper; -import se.leap.bitmaskclient.views.IconCheckboxEntry; +import se.leap.bitmaskclient.base.utils.PreferenceHelper; +import se.leap.bitmaskclient.base.views.IconCheckboxEntry; /** * Copyright (c) 2020 LEAP Encryption Access Project and contributers diff --git a/app/src/main/java/se/leap/bitmaskclient/Constants.java b/app/src/main/java/se/leap/bitmaskclient/base/models/Constants.java index 1d364074..d649aaf5 100644 --- a/app/src/main/java/se/leap/bitmaskclient/Constants.java +++ b/app/src/main/java/se/leap/bitmaskclient/base/models/Constants.java @@ -14,10 +14,12 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -package se.leap.bitmaskclient; +package se.leap.bitmaskclient.base.models; import android.text.TextUtils; +import se.leap.bitmaskclient.BuildConfig; + public interface Constants { ////////////////////////////////////////////// diff --git a/app/src/main/java/se/leap/bitmaskclient/DefaultedURL.java b/app/src/main/java/se/leap/bitmaskclient/base/models/DefaultedURL.java index 0cbb0d72..4bb7e4ee 100644 --- a/app/src/main/java/se/leap/bitmaskclient/DefaultedURL.java +++ b/app/src/main/java/se/leap/bitmaskclient/base/models/DefaultedURL.java @@ -1,4 +1,4 @@ -package se.leap.bitmaskclient; +package se.leap.bitmaskclient.base.models; import java.net.MalformedURLException; import java.net.URL; diff --git a/app/src/main/java/se/leap/bitmaskclient/FeatureVersionCode.java b/app/src/main/java/se/leap/bitmaskclient/base/models/FeatureVersionCode.java index 519e4fc2..7b3f1888 100644 --- a/app/src/main/java/se/leap/bitmaskclient/FeatureVersionCode.java +++ b/app/src/main/java/se/leap/bitmaskclient/base/models/FeatureVersionCode.java @@ -1,4 +1,4 @@ -package se.leap.bitmaskclient; +package se.leap.bitmaskclient.base.models; public interface FeatureVersionCode { int RENAMED_EIP_IN_PREFERENCES = 132; diff --git a/app/src/main/java/se/leap/bitmaskclient/Provider.java b/app/src/main/java/se/leap/bitmaskclient/base/models/Provider.java index ce428a54..97f1019b 100644 --- a/app/src/main/java/se/leap/bitmaskclient/Provider.java +++ b/app/src/main/java/se/leap/bitmaskclient/base/models/Provider.java @@ -14,7 +14,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -package se.leap.bitmaskclient; +package se.leap.bitmaskclient.base.models; import android.os.Parcel; import android.os.Parcelable; @@ -30,13 +30,13 @@ import java.net.URL; import java.util.Locale; import static de.blinkt.openvpn.core.connection.Connection.TransportType.OBFS4; -import static se.leap.bitmaskclient.Constants.CAPABILITIES; -import static se.leap.bitmaskclient.Constants.GATEWAYS; -import static se.leap.bitmaskclient.Constants.PROVIDER_ALLOWED_REGISTERED; -import static se.leap.bitmaskclient.Constants.PROVIDER_ALLOW_ANONYMOUS; -import static se.leap.bitmaskclient.Constants.TRANSPORT; -import static se.leap.bitmaskclient.Constants.TYPE; -import static se.leap.bitmaskclient.ProviderAPI.ERRORS; +import static se.leap.bitmaskclient.base.models.Constants.CAPABILITIES; +import static se.leap.bitmaskclient.base.models.Constants.GATEWAYS; +import static se.leap.bitmaskclient.base.models.Constants.PROVIDER_ALLOWED_REGISTERED; +import static se.leap.bitmaskclient.base.models.Constants.PROVIDER_ALLOW_ANONYMOUS; +import static se.leap.bitmaskclient.base.models.Constants.TRANSPORT; +import static se.leap.bitmaskclient.base.models.Constants.TYPE; +import static se.leap.bitmaskclient.providersetup.ProviderAPI.ERRORS; /** * @author Sean Leonard <meanderingcode@aetherislands.net> @@ -259,7 +259,7 @@ public final class Provider implements Parcelable { } } - protected String getApiUrlWithVersion() { + public String getApiUrlWithVersion() { return getApiUrlString() + "/" + getApiVersion(); } @@ -272,7 +272,7 @@ public final class Provider implements Parcelable { return apiVersion; } - boolean hasCaCert() { + public boolean hasCaCert() { return caCert != null && !caCert.isEmpty(); } @@ -311,7 +311,7 @@ public final class Provider implements Parcelable { return name; } - protected String getDescription() { + public String getDescription() { String lang = Locale.getDefault().getLanguage(); String desc = null; try { @@ -328,7 +328,7 @@ public final class Provider implements Parcelable { return desc; } - protected boolean hasEIP() { + public boolean hasEIP() { return getEipServiceJson() != null && getEipServiceJson().length() > 0 && !getEipServiceJson().has(ERRORS); } diff --git a/app/src/main/java/se/leap/bitmaskclient/ProviderObservable.java b/app/src/main/java/se/leap/bitmaskclient/base/models/ProviderObservable.java index 50cc37d4..19555504 100644 --- a/app/src/main/java/se/leap/bitmaskclient/ProviderObservable.java +++ b/app/src/main/java/se/leap/bitmaskclient/base/models/ProviderObservable.java @@ -1,4 +1,4 @@ -package se.leap.bitmaskclient; +package se.leap.bitmaskclient.base.models; import java.util.Observable; diff --git a/app/src/main/java/se/leap/bitmaskclient/utils/Cmd.java b/app/src/main/java/se/leap/bitmaskclient/base/utils/Cmd.java index 7b97add2..affceacf 100644 --- a/app/src/main/java/se/leap/bitmaskclient/utils/Cmd.java +++ b/app/src/main/java/se/leap/bitmaskclient/base/utils/Cmd.java @@ -15,7 +15,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -package se.leap.bitmaskclient.utils; +package se.leap.bitmaskclient.base.utils; import androidx.annotation.WorkerThread; diff --git a/app/src/main/java/se/leap/bitmaskclient/utils/ConfigHelper.java b/app/src/main/java/se/leap/bitmaskclient/base/utils/ConfigHelper.java index 5a142d90..4248072a 100644 --- a/app/src/main/java/se/leap/bitmaskclient/utils/ConfigHelper.java +++ b/app/src/main/java/se/leap/bitmaskclient/base/utils/ConfigHelper.java @@ -14,7 +14,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -package se.leap.bitmaskclient.utils; +package se.leap.bitmaskclient.base.utils; import android.content.Context; import android.content.res.Resources; @@ -46,10 +46,10 @@ import java.security.spec.PKCS8EncodedKeySpec; import java.util.Calendar; import se.leap.bitmaskclient.BuildConfig; -import se.leap.bitmaskclient.ProviderAPI; +import se.leap.bitmaskclient.providersetup.ProviderAPI; import se.leap.bitmaskclient.R; -import static se.leap.bitmaskclient.Constants.DEFAULT_BITMASK; +import static se.leap.bitmaskclient.base.models.Constants.DEFAULT_BITMASK; /** * Stores constants, and implements auxiliary methods used across all Bitmask Android classes. diff --git a/app/src/main/java/se/leap/bitmaskclient/utils/DateHelper.java b/app/src/main/java/se/leap/bitmaskclient/base/utils/DateHelper.java index 523c8c4c..0476bf12 100644 --- a/app/src/main/java/se/leap/bitmaskclient/utils/DateHelper.java +++ b/app/src/main/java/se/leap/bitmaskclient/base/utils/DateHelper.java @@ -1,4 +1,4 @@ -package se.leap.bitmaskclient.utils; +package se.leap.bitmaskclient.base.utils; import java.text.ParseException; import java.text.SimpleDateFormat; diff --git a/app/src/main/java/se/leap/bitmaskclient/utils/FileHelper.java b/app/src/main/java/se/leap/bitmaskclient/base/utils/FileHelper.java index ebcc32ba..eb1c255c 100644 --- a/app/src/main/java/se/leap/bitmaskclient/utils/FileHelper.java +++ b/app/src/main/java/se/leap/bitmaskclient/base/utils/FileHelper.java @@ -1,4 +1,4 @@ -package se.leap.bitmaskclient.utils; +package se.leap.bitmaskclient.base.utils; import android.content.Context; diff --git a/app/src/main/java/se/leap/bitmaskclient/utils/IPAddress.java b/app/src/main/java/se/leap/bitmaskclient/base/utils/IPAddress.java index 2e3ef596..377617a4 100644 --- a/app/src/main/java/se/leap/bitmaskclient/utils/IPAddress.java +++ b/app/src/main/java/se/leap/bitmaskclient/base/utils/IPAddress.java @@ -1,4 +1,4 @@ -package se.leap.bitmaskclient.utils; +package se.leap.bitmaskclient.base.utils; /* * Copyright (C) 2006-2008 Alfresco Software Limited. diff --git a/app/src/main/java/se/leap/bitmaskclient/utils/InputStreamHelper.java b/app/src/main/java/se/leap/bitmaskclient/base/utils/InputStreamHelper.java index 87996615..77189dff 100644 --- a/app/src/main/java/se/leap/bitmaskclient/utils/InputStreamHelper.java +++ b/app/src/main/java/se/leap/bitmaskclient/base/utils/InputStreamHelper.java @@ -1,4 +1,4 @@ -package se.leap.bitmaskclient.utils; +package se.leap.bitmaskclient.base.utils; import java.io.FileInputStream; import java.io.FileNotFoundException; diff --git a/app/src/main/java/se/leap/bitmaskclient/utils/KeyStoreHelper.java b/app/src/main/java/se/leap/bitmaskclient/base/utils/KeyStoreHelper.java index 48d4cbad..b0b28993 100644 --- a/app/src/main/java/se/leap/bitmaskclient/utils/KeyStoreHelper.java +++ b/app/src/main/java/se/leap/bitmaskclient/base/utils/KeyStoreHelper.java @@ -1,4 +1,4 @@ -package se.leap.bitmaskclient.utils; +package se.leap.bitmaskclient.base.utils; import java.io.IOException; import java.io.InputStream; diff --git a/app/src/main/java/se/leap/bitmaskclient/PRNGFixes.java b/app/src/main/java/se/leap/bitmaskclient/base/utils/PRNGFixes.java index 9e523751..41b8cf35 100644 --- a/app/src/main/java/se/leap/bitmaskclient/PRNGFixes.java +++ b/app/src/main/java/se/leap/bitmaskclient/base/utils/PRNGFixes.java @@ -1,4 +1,4 @@ -package se.leap.bitmaskclient; +package se.leap.bitmaskclient.base.utils; /* * This software is provided 'as-is', without any express or implied diff --git a/app/src/main/java/se/leap/bitmaskclient/utils/PreferenceHelper.java b/app/src/main/java/se/leap/bitmaskclient/base/utils/PreferenceHelper.java index 5b62d0ff..d31c7a20 100644 --- a/app/src/main/java/se/leap/bitmaskclient/utils/PreferenceHelper.java +++ b/app/src/main/java/se/leap/bitmaskclient/base/utils/PreferenceHelper.java @@ -1,4 +1,4 @@ -package se.leap.bitmaskclient.utils; +package se.leap.bitmaskclient.base.utils; import android.content.Context; import android.content.SharedPreferences; @@ -13,26 +13,26 @@ import java.util.HashSet; import java.util.Set; import de.blinkt.openvpn.VpnProfile; -import se.leap.bitmaskclient.Provider; +import se.leap.bitmaskclient.base.models.Provider; import static android.content.Context.MODE_PRIVATE; -import static se.leap.bitmaskclient.Constants.ALLOW_TETHERING_BLUETOOTH; -import static se.leap.bitmaskclient.Constants.ALLOW_TETHERING_USB; -import static se.leap.bitmaskclient.Constants.ALLOW_TETHERING_WIFI; -import static se.leap.bitmaskclient.Constants.ALWAYS_ON_SHOW_DIALOG; -import static se.leap.bitmaskclient.Constants.DEFAULT_SHARED_PREFS_BATTERY_SAVER; -import static se.leap.bitmaskclient.Constants.EXCLUDED_APPS; -import static se.leap.bitmaskclient.Constants.LAST_UPDATE_CHECK; -import static se.leap.bitmaskclient.Constants.LAST_USED_PROFILE; -import static se.leap.bitmaskclient.Constants.PROVIDER_CONFIGURED; -import static se.leap.bitmaskclient.Constants.PROVIDER_EIP_DEFINITION; -import static se.leap.bitmaskclient.Constants.PROVIDER_PRIVATE_KEY; -import static se.leap.bitmaskclient.Constants.PROVIDER_VPN_CERTIFICATE; -import static se.leap.bitmaskclient.Constants.RESTART_ON_UPDATE; -import static se.leap.bitmaskclient.Constants.SHARED_PREFERENCES; -import static se.leap.bitmaskclient.Constants.SHOW_EXPERIMENTAL; -import static se.leap.bitmaskclient.Constants.USE_IPv6_FIREWALL; -import static se.leap.bitmaskclient.Constants.USE_PLUGGABLE_TRANSPORTS; +import static se.leap.bitmaskclient.base.models.Constants.ALLOW_TETHERING_BLUETOOTH; +import static se.leap.bitmaskclient.base.models.Constants.ALLOW_TETHERING_USB; +import static se.leap.bitmaskclient.base.models.Constants.ALLOW_TETHERING_WIFI; +import static se.leap.bitmaskclient.base.models.Constants.ALWAYS_ON_SHOW_DIALOG; +import static se.leap.bitmaskclient.base.models.Constants.DEFAULT_SHARED_PREFS_BATTERY_SAVER; +import static se.leap.bitmaskclient.base.models.Constants.EXCLUDED_APPS; +import static se.leap.bitmaskclient.base.models.Constants.LAST_UPDATE_CHECK; +import static se.leap.bitmaskclient.base.models.Constants.LAST_USED_PROFILE; +import static se.leap.bitmaskclient.base.models.Constants.PROVIDER_CONFIGURED; +import static se.leap.bitmaskclient.base.models.Constants.PROVIDER_EIP_DEFINITION; +import static se.leap.bitmaskclient.base.models.Constants.PROVIDER_PRIVATE_KEY; +import static se.leap.bitmaskclient.base.models.Constants.PROVIDER_VPN_CERTIFICATE; +import static se.leap.bitmaskclient.base.models.Constants.RESTART_ON_UPDATE; +import static se.leap.bitmaskclient.base.models.Constants.SHARED_PREFERENCES; +import static se.leap.bitmaskclient.base.models.Constants.SHOW_EXPERIMENTAL; +import static se.leap.bitmaskclient.base.models.Constants.USE_IPv6_FIREWALL; +import static se.leap.bitmaskclient.base.models.Constants.USE_PLUGGABLE_TRANSPORTS; /** * Created by cyberta on 18.03.18. diff --git a/app/src/main/java/se/leap/bitmaskclient/utils/ViewHelper.java b/app/src/main/java/se/leap/bitmaskclient/base/utils/ViewHelper.java index 5f4fc2a6..23ca40e5 100644 --- a/app/src/main/java/se/leap/bitmaskclient/utils/ViewHelper.java +++ b/app/src/main/java/se/leap/bitmaskclient/base/utils/ViewHelper.java @@ -1,4 +1,4 @@ -package se.leap.bitmaskclient.utils; +package se.leap.bitmaskclient.base.utils; import android.content.Context; diff --git a/app/src/main/java/se/leap/bitmaskclient/views/IconCheckboxEntry.java b/app/src/main/java/se/leap/bitmaskclient/base/views/IconCheckboxEntry.java index efe20b4c..fdbd7dbd 100644 --- a/app/src/main/java/se/leap/bitmaskclient/views/IconCheckboxEntry.java +++ b/app/src/main/java/se/leap/bitmaskclient/base/views/IconCheckboxEntry.java @@ -1,4 +1,4 @@ -package se.leap.bitmaskclient.views; +package se.leap.bitmaskclient.base.views; import android.annotation.TargetApi; import android.content.Context; @@ -16,7 +16,7 @@ import android.widget.TextView; import butterknife.ButterKnife; import butterknife.InjectView; import se.leap.bitmaskclient.R; -import se.leap.bitmaskclient.fragments.TetheringDialog; +import se.leap.bitmaskclient.base.fragments.TetheringDialog; public class IconCheckboxEntry extends LinearLayout { diff --git a/app/src/main/java/se/leap/bitmaskclient/views/IconSwitchEntry.java b/app/src/main/java/se/leap/bitmaskclient/base/views/IconSwitchEntry.java index c9b6024d..1160986e 100644 --- a/app/src/main/java/se/leap/bitmaskclient/views/IconSwitchEntry.java +++ b/app/src/main/java/se/leap/bitmaskclient/base/views/IconSwitchEntry.java @@ -1,4 +1,4 @@ -package se.leap.bitmaskclient.views; +package se.leap.bitmaskclient.base.views; import android.annotation.TargetApi; import android.content.Context; diff --git a/app/src/main/java/se/leap/bitmaskclient/views/IconTextEntry.java b/app/src/main/java/se/leap/bitmaskclient/base/views/IconTextEntry.java index 7a1717e9..6b9bd760 100644 --- a/app/src/main/java/se/leap/bitmaskclient/views/IconTextEntry.java +++ b/app/src/main/java/se/leap/bitmaskclient/base/views/IconTextEntry.java @@ -1,4 +1,4 @@ -package se.leap.bitmaskclient.views; +package se.leap.bitmaskclient.base.views; import android.annotation.TargetApi; import android.content.Context; diff --git a/app/src/main/java/se/leap/bitmaskclient/views/IconTextView.java b/app/src/main/java/se/leap/bitmaskclient/base/views/IconTextView.java index 29c70859..1f64e483 100644 --- a/app/src/main/java/se/leap/bitmaskclient/views/IconTextView.java +++ b/app/src/main/java/se/leap/bitmaskclient/base/views/IconTextView.java @@ -1,4 +1,4 @@ -package se.leap.bitmaskclient.views; +package se.leap.bitmaskclient.base.views; import android.content.Context; diff --git a/app/src/main/java/se/leap/bitmaskclient/views/ProviderHeaderView.java b/app/src/main/java/se/leap/bitmaskclient/base/views/ProviderHeaderView.java index 4fa3771b..811a54a2 100644 --- a/app/src/main/java/se/leap/bitmaskclient/views/ProviderHeaderView.java +++ b/app/src/main/java/se/leap/bitmaskclient/base/views/ProviderHeaderView.java @@ -1,4 +1,4 @@ -package se.leap.bitmaskclient.views; +package se.leap.bitmaskclient.base.views; import android.content.Context; import androidx.annotation.DrawableRes; @@ -13,7 +13,7 @@ import android.widget.RelativeLayout; import se.leap.bitmaskclient.R; -import static se.leap.bitmaskclient.utils.ViewHelper.convertDimensionToPx; +import static se.leap.bitmaskclient.base.utils.ViewHelper.convertDimensionToPx; /** * Created by cyberta on 29.06.18. diff --git a/app/src/main/java/se/leap/bitmaskclient/views/VpnStateImage.java b/app/src/main/java/se/leap/bitmaskclient/base/views/VpnStateImage.java index c0432edc..2f8a4448 100644 --- a/app/src/main/java/se/leap/bitmaskclient/views/VpnStateImage.java +++ b/app/src/main/java/se/leap/bitmaskclient/base/views/VpnStateImage.java @@ -14,7 +14,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -package se.leap.bitmaskclient.views; +package se.leap.bitmaskclient.base.views; import android.content.Context; import androidx.constraintlayout.widget.ConstraintLayout; diff --git a/app/src/main/java/se/leap/bitmaskclient/eip/EIP.java b/app/src/main/java/se/leap/bitmaskclient/eip/EIP.java index e0c96ebb..e5cf70be 100644 --- a/app/src/main/java/se/leap/bitmaskclient/eip/EIP.java +++ b/app/src/main/java/se/leap/bitmaskclient/eip/EIP.java @@ -49,39 +49,39 @@ import de.blinkt.openvpn.core.IOpenVPNServiceInternal; import de.blinkt.openvpn.core.OpenVPNService; import de.blinkt.openvpn.core.VpnStatus; import de.blinkt.openvpn.core.connection.Connection; -import se.leap.bitmaskclient.OnBootReceiver; -import se.leap.bitmaskclient.ProviderObservable; +import se.leap.bitmaskclient.base.OnBootReceiver; +import se.leap.bitmaskclient.base.models.ProviderObservable; import se.leap.bitmaskclient.R; -import se.leap.bitmaskclient.utils.PreferenceHelper; +import se.leap.bitmaskclient.base.utils.PreferenceHelper; import static android.app.Activity.RESULT_CANCELED; import static android.app.Activity.RESULT_OK; import static de.blinkt.openvpn.core.connection.Connection.TransportType.OBFS4; import static de.blinkt.openvpn.core.connection.Connection.TransportType.OPENVPN; -import static se.leap.bitmaskclient.Constants.BROADCAST_GATEWAY_SETUP_OBSERVER_EVENT; -import static se.leap.bitmaskclient.Constants.BROADCAST_RESULT_KEY; -import static se.leap.bitmaskclient.Constants.EIP_ACTION_CHECK_CERT_VALIDITY; -import static se.leap.bitmaskclient.Constants.EIP_ACTION_CONFIGURE_TETHERING; -import static se.leap.bitmaskclient.Constants.EIP_ACTION_IS_RUNNING; -import static se.leap.bitmaskclient.Constants.EIP_ACTION_START; -import static se.leap.bitmaskclient.Constants.EIP_ACTION_START_ALWAYS_ON_VPN; -import static se.leap.bitmaskclient.Constants.EIP_ACTION_START_BLOCKING_VPN; -import static se.leap.bitmaskclient.Constants.EIP_ACTION_STOP; -import static se.leap.bitmaskclient.Constants.EIP_ACTION_STOP_BLOCKING_VPN; -import static se.leap.bitmaskclient.Constants.EIP_EARLY_ROUTES; -import static se.leap.bitmaskclient.Constants.EIP_N_CLOSEST_GATEWAY; -import static se.leap.bitmaskclient.Constants.EIP_RECEIVER; -import static se.leap.bitmaskclient.Constants.EIP_RESTART_ON_BOOT; -import static se.leap.bitmaskclient.Constants.PROVIDER_PROFILE; -import static se.leap.bitmaskclient.Constants.PROVIDER_VPN_CERTIFICATE; -import static se.leap.bitmaskclient.Constants.SHARED_PREFERENCES; +import static se.leap.bitmaskclient.base.models.Constants.BROADCAST_GATEWAY_SETUP_OBSERVER_EVENT; +import static se.leap.bitmaskclient.base.models.Constants.BROADCAST_RESULT_KEY; +import static se.leap.bitmaskclient.base.models.Constants.EIP_ACTION_CHECK_CERT_VALIDITY; +import static se.leap.bitmaskclient.base.models.Constants.EIP_ACTION_CONFIGURE_TETHERING; +import static se.leap.bitmaskclient.base.models.Constants.EIP_ACTION_IS_RUNNING; +import static se.leap.bitmaskclient.base.models.Constants.EIP_ACTION_START; +import static se.leap.bitmaskclient.base.models.Constants.EIP_ACTION_START_ALWAYS_ON_VPN; +import static se.leap.bitmaskclient.base.models.Constants.EIP_ACTION_START_BLOCKING_VPN; +import static se.leap.bitmaskclient.base.models.Constants.EIP_ACTION_STOP; +import static se.leap.bitmaskclient.base.models.Constants.EIP_ACTION_STOP_BLOCKING_VPN; +import static se.leap.bitmaskclient.base.models.Constants.EIP_EARLY_ROUTES; +import static se.leap.bitmaskclient.base.models.Constants.EIP_N_CLOSEST_GATEWAY; +import static se.leap.bitmaskclient.base.models.Constants.EIP_RECEIVER; +import static se.leap.bitmaskclient.base.models.Constants.EIP_RESTART_ON_BOOT; +import static se.leap.bitmaskclient.base.models.Constants.PROVIDER_PROFILE; +import static se.leap.bitmaskclient.base.models.Constants.PROVIDER_VPN_CERTIFICATE; +import static se.leap.bitmaskclient.base.models.Constants.SHARED_PREFERENCES; import static se.leap.bitmaskclient.R.string.vpn_certificate_is_invalid; import static se.leap.bitmaskclient.R.string.warning_client_parsing_error_gateways; import static se.leap.bitmaskclient.eip.EIP.EIPErrors.ERROR_INVALID_VPN_CERTIFICATE; import static se.leap.bitmaskclient.eip.EIP.EIPErrors.NO_MORE_GATEWAYS; import static se.leap.bitmaskclient.eip.EipResultBroadcast.tellToReceiverOrBroadcast; -import static se.leap.bitmaskclient.utils.ConfigHelper.ensureNotOnMainThread; -import static se.leap.bitmaskclient.utils.PreferenceHelper.getUsePluggableTransports; +import static se.leap.bitmaskclient.base.utils.ConfigHelper.ensureNotOnMainThread; +import static se.leap.bitmaskclient.base.utils.PreferenceHelper.getUsePluggableTransports; /** * EIP is the abstract base class for interacting with and managing the Encrypted diff --git a/app/src/main/java/se/leap/bitmaskclient/eip/EipCommand.java b/app/src/main/java/se/leap/bitmaskclient/eip/EipCommand.java index 25450f56..39d4e33e 100644 --- a/app/src/main/java/se/leap/bitmaskclient/eip/EipCommand.java +++ b/app/src/main/java/se/leap/bitmaskclient/eip/EipCommand.java @@ -11,14 +11,14 @@ import androidx.annotation.VisibleForTesting; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import static se.leap.bitmaskclient.Constants.EIP_ACTION_CHECK_CERT_VALIDITY; -import static se.leap.bitmaskclient.Constants.EIP_ACTION_CONFIGURE_TETHERING; -import static se.leap.bitmaskclient.Constants.EIP_ACTION_START; -import static se.leap.bitmaskclient.Constants.EIP_ACTION_START_BLOCKING_VPN; -import static se.leap.bitmaskclient.Constants.EIP_ACTION_STOP; -import static se.leap.bitmaskclient.Constants.EIP_EARLY_ROUTES; -import static se.leap.bitmaskclient.Constants.EIP_N_CLOSEST_GATEWAY; -import static se.leap.bitmaskclient.Constants.EIP_RECEIVER; +import static se.leap.bitmaskclient.base.models.Constants.EIP_ACTION_CHECK_CERT_VALIDITY; +import static se.leap.bitmaskclient.base.models.Constants.EIP_ACTION_CONFIGURE_TETHERING; +import static se.leap.bitmaskclient.base.models.Constants.EIP_ACTION_START; +import static se.leap.bitmaskclient.base.models.Constants.EIP_ACTION_START_BLOCKING_VPN; +import static se.leap.bitmaskclient.base.models.Constants.EIP_ACTION_STOP; +import static se.leap.bitmaskclient.base.models.Constants.EIP_EARLY_ROUTES; +import static se.leap.bitmaskclient.base.models.Constants.EIP_N_CLOSEST_GATEWAY; +import static se.leap.bitmaskclient.base.models.Constants.EIP_RECEIVER; /** * Use this class to send commands to EIP diff --git a/app/src/main/java/se/leap/bitmaskclient/eip/EipResultBroadcast.java b/app/src/main/java/se/leap/bitmaskclient/eip/EipResultBroadcast.java index 92d1338c..68d9c8ad 100644 --- a/app/src/main/java/se/leap/bitmaskclient/eip/EipResultBroadcast.java +++ b/app/src/main/java/se/leap/bitmaskclient/eip/EipResultBroadcast.java @@ -8,10 +8,10 @@ import androidx.localbroadcastmanager.content.LocalBroadcastManager; import android.util.Log; import static android.content.Intent.CATEGORY_DEFAULT; -import static se.leap.bitmaskclient.Constants.BROADCAST_EIP_EVENT; -import static se.leap.bitmaskclient.Constants.BROADCAST_RESULT_CODE; -import static se.leap.bitmaskclient.Constants.BROADCAST_RESULT_KEY; -import static se.leap.bitmaskclient.Constants.EIP_REQUEST; +import static se.leap.bitmaskclient.base.models.Constants.BROADCAST_EIP_EVENT; +import static se.leap.bitmaskclient.base.models.Constants.BROADCAST_RESULT_CODE; +import static se.leap.bitmaskclient.base.models.Constants.BROADCAST_RESULT_KEY; +import static se.leap.bitmaskclient.base.models.Constants.EIP_REQUEST; public class EipResultBroadcast { private static final String TAG = EipResultBroadcast.class.getSimpleName(); diff --git a/app/src/main/java/se/leap/bitmaskclient/EipSetupListener.java b/app/src/main/java/se/leap/bitmaskclient/eip/EipSetupListener.java index 71e2fd52..13d9bdec 100644 --- a/app/src/main/java/se/leap/bitmaskclient/EipSetupListener.java +++ b/app/src/main/java/se/leap/bitmaskclient/eip/EipSetupListener.java @@ -1,4 +1,4 @@ -package se.leap.bitmaskclient; +package se.leap.bitmaskclient.eip; import android.content.Intent; diff --git a/app/src/main/java/se/leap/bitmaskclient/EipSetupObserver.java b/app/src/main/java/se/leap/bitmaskclient/eip/EipSetupObserver.java index e365c857..1c101e2d 100644 --- a/app/src/main/java/se/leap/bitmaskclient/EipSetupObserver.java +++ b/app/src/main/java/se/leap/bitmaskclient/eip/EipSetupObserver.java @@ -15,7 +15,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -package se.leap.bitmaskclient; +package se.leap.bitmaskclient.eip; import android.content.BroadcastReceiver; import android.content.Context; @@ -38,40 +38,39 @@ import de.blinkt.openvpn.VpnProfile; import de.blinkt.openvpn.core.ConnectionStatus; import de.blinkt.openvpn.core.LogItem; import de.blinkt.openvpn.core.VpnStatus; +import se.leap.bitmaskclient.base.models.Provider; +import se.leap.bitmaskclient.providersetup.ProviderAPI; +import se.leap.bitmaskclient.providersetup.ProviderAPICommand; +import se.leap.bitmaskclient.base.models.ProviderObservable; import se.leap.bitmaskclient.appUpdate.DownloadServiceCommand; -import se.leap.bitmaskclient.eip.EIP; -import se.leap.bitmaskclient.eip.EipCommand; -import se.leap.bitmaskclient.eip.EipStatus; -import se.leap.bitmaskclient.eip.Gateway; -import se.leap.bitmaskclient.eip.GatewaysManager; -import se.leap.bitmaskclient.utils.PreferenceHelper; +import se.leap.bitmaskclient.base.utils.PreferenceHelper; import static android.app.Activity.RESULT_CANCELED; import static android.content.Intent.CATEGORY_DEFAULT; import static de.blinkt.openvpn.core.ConnectionStatus.LEVEL_CONNECTING_NO_SERVER_REPLY_YET; import static de.blinkt.openvpn.core.ConnectionStatus.LEVEL_NOTCONNECTED; -import static se.leap.bitmaskclient.Constants.BROADCAST_EIP_EVENT; -import static se.leap.bitmaskclient.Constants.BROADCAST_GATEWAY_SETUP_OBSERVER_EVENT; -import static se.leap.bitmaskclient.Constants.BROADCAST_PROVIDER_API_EVENT; -import static se.leap.bitmaskclient.Constants.BROADCAST_RESULT_CODE; -import static se.leap.bitmaskclient.Constants.BROADCAST_RESULT_KEY; -import static se.leap.bitmaskclient.Constants.EIP_ACTION_PREPARE_VPN; -import static se.leap.bitmaskclient.Constants.EIP_ACTION_START; -import static se.leap.bitmaskclient.Constants.EIP_ACTION_START_ALWAYS_ON_VPN; -import static se.leap.bitmaskclient.Constants.EIP_EARLY_ROUTES; -import static se.leap.bitmaskclient.Constants.EIP_REQUEST; -import static se.leap.bitmaskclient.Constants.PROVIDER_KEY; -import static se.leap.bitmaskclient.Constants.PROVIDER_PROFILE; -import static se.leap.bitmaskclient.ProviderAPI.CORRECTLY_DOWNLOADED_EIP_SERVICE; -import static se.leap.bitmaskclient.ProviderAPI.CORRECTLY_DOWNLOADED_GEOIP_JSON; -import static se.leap.bitmaskclient.ProviderAPI.CORRECTLY_UPDATED_INVALID_VPN_CERTIFICATE; -import static se.leap.bitmaskclient.ProviderAPI.INCORRECTLY_DOWNLOADED_GEOIP_JSON; +import static se.leap.bitmaskclient.base.models.Constants.BROADCAST_EIP_EVENT; +import static se.leap.bitmaskclient.base.models.Constants.BROADCAST_GATEWAY_SETUP_OBSERVER_EVENT; +import static se.leap.bitmaskclient.base.models.Constants.BROADCAST_PROVIDER_API_EVENT; +import static se.leap.bitmaskclient.base.models.Constants.BROADCAST_RESULT_CODE; +import static se.leap.bitmaskclient.base.models.Constants.BROADCAST_RESULT_KEY; +import static se.leap.bitmaskclient.base.models.Constants.EIP_ACTION_PREPARE_VPN; +import static se.leap.bitmaskclient.base.models.Constants.EIP_ACTION_START; +import static se.leap.bitmaskclient.base.models.Constants.EIP_ACTION_START_ALWAYS_ON_VPN; +import static se.leap.bitmaskclient.base.models.Constants.EIP_EARLY_ROUTES; +import static se.leap.bitmaskclient.base.models.Constants.EIP_REQUEST; +import static se.leap.bitmaskclient.base.models.Constants.PROVIDER_KEY; +import static se.leap.bitmaskclient.base.models.Constants.PROVIDER_PROFILE; +import static se.leap.bitmaskclient.providersetup.ProviderAPI.CORRECTLY_DOWNLOADED_EIP_SERVICE; +import static se.leap.bitmaskclient.providersetup.ProviderAPI.CORRECTLY_DOWNLOADED_GEOIP_JSON; +import static se.leap.bitmaskclient.providersetup.ProviderAPI.CORRECTLY_UPDATED_INVALID_VPN_CERTIFICATE; +import static se.leap.bitmaskclient.providersetup.ProviderAPI.INCORRECTLY_DOWNLOADED_GEOIP_JSON; import static se.leap.bitmaskclient.appUpdate.DownloadServiceCommand.CHECK_VERSION_FILE; /** * Created by cyberta on 05.12.18. */ -class EipSetupObserver extends BroadcastReceiver implements VpnStatus.StateListener, VpnStatus.LogListener { +public class EipSetupObserver extends BroadcastReceiver implements VpnStatus.StateListener, VpnStatus.LogListener { private static final String TAG = EipSetupObserver.class.getName(); diff --git a/app/src/main/java/se/leap/bitmaskclient/eip/Gateway.java b/app/src/main/java/se/leap/bitmaskclient/eip/Gateway.java index f3eea415..1df54e6e 100644 --- a/app/src/main/java/se/leap/bitmaskclient/eip/Gateway.java +++ b/app/src/main/java/se/leap/bitmaskclient/eip/Gateway.java @@ -32,16 +32,16 @@ import java.util.Set; import de.blinkt.openvpn.VpnProfile; import de.blinkt.openvpn.core.ConfigParser; import de.blinkt.openvpn.core.connection.Connection; -import se.leap.bitmaskclient.utils.PreferenceHelper; - -import static se.leap.bitmaskclient.Constants.HOST; -import static se.leap.bitmaskclient.Constants.IP_ADDRESS; -import static se.leap.bitmaskclient.Constants.LOCATION; -import static se.leap.bitmaskclient.Constants.LOCATIONS; -import static se.leap.bitmaskclient.Constants.NAME; -import static se.leap.bitmaskclient.Constants.OPENVPN_CONFIGURATION; -import static se.leap.bitmaskclient.Constants.TIMEZONE; -import static se.leap.bitmaskclient.Constants.VERSION; +import se.leap.bitmaskclient.base.utils.PreferenceHelper; + +import static se.leap.bitmaskclient.base.models.Constants.HOST; +import static se.leap.bitmaskclient.base.models.Constants.IP_ADDRESS; +import static se.leap.bitmaskclient.base.models.Constants.LOCATION; +import static se.leap.bitmaskclient.base.models.Constants.LOCATIONS; +import static se.leap.bitmaskclient.base.models.Constants.NAME; +import static se.leap.bitmaskclient.base.models.Constants.OPENVPN_CONFIGURATION; +import static se.leap.bitmaskclient.base.models.Constants.TIMEZONE; +import static se.leap.bitmaskclient.base.models.Constants.VERSION; /** * Gateway provides objects defining gateways and their metadata. diff --git a/app/src/main/java/se/leap/bitmaskclient/eip/GatewaySelector.java b/app/src/main/java/se/leap/bitmaskclient/eip/GatewaySelector.java index 0ba0f207..33fd3c21 100644 --- a/app/src/main/java/se/leap/bitmaskclient/eip/GatewaySelector.java +++ b/app/src/main/java/se/leap/bitmaskclient/eip/GatewaySelector.java @@ -8,7 +8,7 @@ import java.util.Map; import java.util.Set; import java.util.TreeMap; -import static se.leap.bitmaskclient.utils.ConfigHelper.getCurrentTimezone; +import static se.leap.bitmaskclient.base.utils.ConfigHelper.getCurrentTimezone; public class GatewaySelector { private final static String TAG = GatewaySelector.class.getSimpleName(); diff --git a/app/src/main/java/se/leap/bitmaskclient/eip/GatewaysManager.java b/app/src/main/java/se/leap/bitmaskclient/eip/GatewaysManager.java index 354fd9a3..a5d4c416 100644 --- a/app/src/main/java/se/leap/bitmaskclient/eip/GatewaysManager.java +++ b/app/src/main/java/se/leap/bitmaskclient/eip/GatewaysManager.java @@ -35,15 +35,15 @@ import de.blinkt.openvpn.VpnProfile; import de.blinkt.openvpn.core.ConfigParser; import de.blinkt.openvpn.core.VpnStatus; import de.blinkt.openvpn.core.connection.Connection; -import se.leap.bitmaskclient.Provider; -import se.leap.bitmaskclient.ProviderObservable; +import se.leap.bitmaskclient.base.models.Provider; +import se.leap.bitmaskclient.base.models.ProviderObservable; import static de.blinkt.openvpn.core.connection.Connection.TransportType.OBFS4; import static de.blinkt.openvpn.core.connection.Connection.TransportType.OPENVPN; -import static se.leap.bitmaskclient.Constants.GATEWAYS; -import static se.leap.bitmaskclient.Constants.PROVIDER_PRIVATE_KEY; -import static se.leap.bitmaskclient.Constants.PROVIDER_VPN_CERTIFICATE; -import static se.leap.bitmaskclient.utils.PreferenceHelper.getUsePluggableTransports; +import static se.leap.bitmaskclient.base.models.Constants.GATEWAYS; +import static se.leap.bitmaskclient.base.models.Constants.PROVIDER_PRIVATE_KEY; +import static se.leap.bitmaskclient.base.models.Constants.PROVIDER_VPN_CERTIFICATE; +import static se.leap.bitmaskclient.base.utils.PreferenceHelper.getUsePluggableTransports; /** * @author parmegv diff --git a/app/src/main/java/se/leap/bitmaskclient/eip/VoidVpnLauncher.java b/app/src/main/java/se/leap/bitmaskclient/eip/VoidVpnLauncher.java index 9a3c8f85..e6905448 100644 --- a/app/src/main/java/se/leap/bitmaskclient/eip/VoidVpnLauncher.java +++ b/app/src/main/java/se/leap/bitmaskclient/eip/VoidVpnLauncher.java @@ -6,7 +6,7 @@ import android.net.VpnService; import android.os.Build; import android.os.Bundle; -import static se.leap.bitmaskclient.Constants.EIP_ACTION_START_BLOCKING_VPN; +import static se.leap.bitmaskclient.base.models.Constants.EIP_ACTION_START_BLOCKING_VPN; public class VoidVpnLauncher extends Activity { diff --git a/app/src/main/java/se/leap/bitmaskclient/eip/VoidVpnService.java b/app/src/main/java/se/leap/bitmaskclient/eip/VoidVpnService.java index 78deea0b..77038492 100644 --- a/app/src/main/java/se/leap/bitmaskclient/eip/VoidVpnService.java +++ b/app/src/main/java/se/leap/bitmaskclient/eip/VoidVpnService.java @@ -33,14 +33,13 @@ import java.util.Observer; import de.blinkt.openvpn.core.ConnectionStatus; import de.blinkt.openvpn.core.VpnStatus; import se.leap.bitmaskclient.R; -import se.leap.bitmaskclient.VpnNotificationManager; - -import static se.leap.bitmaskclient.Constants.EIP_ACTION_START_ALWAYS_ON_VPN; -import static se.leap.bitmaskclient.Constants.EIP_ACTION_START_BLOCKING_VPN; -import static se.leap.bitmaskclient.Constants.EIP_ACTION_STOP_BLOCKING_VPN; -import static se.leap.bitmaskclient.Constants.EIP_IS_ALWAYS_ON; -import static se.leap.bitmaskclient.Constants.SHARED_PREFERENCES; -import static se.leap.bitmaskclient.utils.ConfigHelper.getProviderFormattedString; + +import static se.leap.bitmaskclient.base.models.Constants.EIP_ACTION_START_ALWAYS_ON_VPN; +import static se.leap.bitmaskclient.base.models.Constants.EIP_ACTION_START_BLOCKING_VPN; +import static se.leap.bitmaskclient.base.models.Constants.EIP_ACTION_STOP_BLOCKING_VPN; +import static se.leap.bitmaskclient.base.models.Constants.EIP_IS_ALWAYS_ON; +import static se.leap.bitmaskclient.base.models.Constants.SHARED_PREFERENCES; +import static se.leap.bitmaskclient.base.utils.ConfigHelper.getProviderFormattedString; public class VoidVpnService extends VpnService implements Observer, VpnNotificationManager.VpnServiceCallback { diff --git a/app/src/main/java/se/leap/bitmaskclient/eip/VpnCertificateValidator.java b/app/src/main/java/se/leap/bitmaskclient/eip/VpnCertificateValidator.java index 83904729..c747b731 100644 --- a/app/src/main/java/se/leap/bitmaskclient/eip/VpnCertificateValidator.java +++ b/app/src/main/java/se/leap/bitmaskclient/eip/VpnCertificateValidator.java @@ -22,7 +22,7 @@ import java.security.cert.X509Certificate; import java.util.Calendar; import java.util.Date; -import se.leap.bitmaskclient.utils.ConfigHelper; +import se.leap.bitmaskclient.base.utils.ConfigHelper; public class VpnCertificateValidator { public final static String TAG = VpnCertificateValidator.class.getSimpleName(); diff --git a/app/src/main/java/se/leap/bitmaskclient/eip/VpnConfigGenerator.java b/app/src/main/java/se/leap/bitmaskclient/eip/VpnConfigGenerator.java index 08e219c7..51069d6d 100644 --- a/app/src/main/java/se/leap/bitmaskclient/eip/VpnConfigGenerator.java +++ b/app/src/main/java/se/leap/bitmaskclient/eip/VpnConfigGenerator.java @@ -30,21 +30,21 @@ import java.util.Iterator; import de.blinkt.openvpn.VpnProfile; import de.blinkt.openvpn.core.ConfigParser; import de.blinkt.openvpn.core.connection.Connection; -import se.leap.bitmaskclient.Provider; +import se.leap.bitmaskclient.base.models.Provider; import se.leap.bitmaskclient.pluggableTransports.Obfs4Options; import static de.blinkt.openvpn.core.connection.Connection.TransportType.OBFS4; import static de.blinkt.openvpn.core.connection.Connection.TransportType.OPENVPN; -import static se.leap.bitmaskclient.Constants.CAPABILITIES; -import static se.leap.bitmaskclient.Constants.IP_ADDRESS; -import static se.leap.bitmaskclient.Constants.OPTIONS; -import static se.leap.bitmaskclient.Constants.PORTS; -import static se.leap.bitmaskclient.Constants.PROTOCOLS; -import static se.leap.bitmaskclient.Constants.PROVIDER_PRIVATE_KEY; -import static se.leap.bitmaskclient.Constants.PROVIDER_VPN_CERTIFICATE; -import static se.leap.bitmaskclient.Constants.REMOTE; -import static se.leap.bitmaskclient.Constants.TRANSPORT; -import static se.leap.bitmaskclient.Constants.TYPE; +import static se.leap.bitmaskclient.base.models.Constants.CAPABILITIES; +import static se.leap.bitmaskclient.base.models.Constants.IP_ADDRESS; +import static se.leap.bitmaskclient.base.models.Constants.OPTIONS; +import static se.leap.bitmaskclient.base.models.Constants.PORTS; +import static se.leap.bitmaskclient.base.models.Constants.PROTOCOLS; +import static se.leap.bitmaskclient.base.models.Constants.PROVIDER_PRIVATE_KEY; +import static se.leap.bitmaskclient.base.models.Constants.PROVIDER_VPN_CERTIFICATE; +import static se.leap.bitmaskclient.base.models.Constants.REMOTE; +import static se.leap.bitmaskclient.base.models.Constants.TRANSPORT; +import static se.leap.bitmaskclient.base.models.Constants.TYPE; import static se.leap.bitmaskclient.pluggableTransports.Dispatcher.DISPATCHER_IP; import static se.leap.bitmaskclient.pluggableTransports.Dispatcher.DISPATCHER_PORT; diff --git a/app/src/main/java/se/leap/bitmaskclient/VpnNotificationManager.java b/app/src/main/java/se/leap/bitmaskclient/eip/VpnNotificationManager.java index 290a9aa9..b3ed5394 100644 --- a/app/src/main/java/se/leap/bitmaskclient/VpnNotificationManager.java +++ b/app/src/main/java/se/leap/bitmaskclient/eip/VpnNotificationManager.java @@ -14,7 +14,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -package se.leap.bitmaskclient; +package se.leap.bitmaskclient.eip; import android.annotation.TargetApi; import android.app.Notification; @@ -39,7 +39,9 @@ import android.widget.RemoteViews; import de.blinkt.openvpn.LaunchVPN; import de.blinkt.openvpn.core.ConnectionStatus; import de.blinkt.openvpn.core.OpenVPNService; -import se.leap.bitmaskclient.eip.VoidVpnService; +import se.leap.bitmaskclient.base.MainActivity; +import se.leap.bitmaskclient.R; +import se.leap.bitmaskclient.base.StartActivity; import static android.os.Build.VERSION_CODES.O; import static androidx.core.app.NotificationCompat.PRIORITY_HIGH; @@ -48,9 +50,9 @@ import static androidx.core.app.NotificationCompat.PRIORITY_MIN; import static android.text.TextUtils.isEmpty; import static de.blinkt.openvpn.core.ConnectionStatus.LEVEL_NONETWORK; import static de.blinkt.openvpn.core.ConnectionStatus.LEVEL_WAITING_FOR_USER_INPUT; -import static se.leap.bitmaskclient.Constants.ASK_TO_CANCEL_VPN; -import static se.leap.bitmaskclient.Constants.EIP_ACTION_STOP_BLOCKING_VPN; -import static se.leap.bitmaskclient.MainActivity.ACTION_SHOW_VPN_FRAGMENT; +import static se.leap.bitmaskclient.base.models.Constants.ASK_TO_CANCEL_VPN; +import static se.leap.bitmaskclient.base.models.Constants.EIP_ACTION_STOP_BLOCKING_VPN; +import static se.leap.bitmaskclient.base.MainActivity.ACTION_SHOW_VPN_FRAGMENT; /** * Created by cyberta on 14.01.18. diff --git a/app/src/main/java/se/leap/bitmaskclient/firewall/FirewallManager.java b/app/src/main/java/se/leap/bitmaskclient/firewall/FirewallManager.java index ace8a298..dcb4a743 100644 --- a/app/src/main/java/se/leap/bitmaskclient/firewall/FirewallManager.java +++ b/app/src/main/java/se/leap/bitmaskclient/firewall/FirewallManager.java @@ -28,7 +28,7 @@ import de.blinkt.openvpn.core.VpnStatus; import se.leap.bitmaskclient.R; import se.leap.bitmaskclient.tethering.TetheringObservable; import se.leap.bitmaskclient.tethering.TetheringState; -import se.leap.bitmaskclient.utils.PreferenceHelper; +import se.leap.bitmaskclient.base.utils.PreferenceHelper; public class FirewallManager implements FirewallCallback, Observer { public static String BITMASK_CHAIN = "bitmask_fw"; diff --git a/app/src/main/java/se/leap/bitmaskclient/firewall/SetupTetheringTask.java b/app/src/main/java/se/leap/bitmaskclient/firewall/SetupTetheringTask.java index edf79add..53118cae 100644 --- a/app/src/main/java/se/leap/bitmaskclient/firewall/SetupTetheringTask.java +++ b/app/src/main/java/se/leap/bitmaskclient/firewall/SetupTetheringTask.java @@ -29,7 +29,7 @@ import se.leap.bitmaskclient.tethering.TetheringState; import static se.leap.bitmaskclient.firewall.FirewallManager.BITMASK_FORWARD; import static se.leap.bitmaskclient.firewall.FirewallManager.BITMASK_POSTROUTING; -import static se.leap.bitmaskclient.utils.Cmd.runBlockingCmd; +import static se.leap.bitmaskclient.base.utils.Cmd.runBlockingCmd; public class SetupTetheringTask extends AsyncTask<Void, Boolean, Boolean> { diff --git a/app/src/main/java/se/leap/bitmaskclient/firewall/ShutdownIPv6FirewallTask.java b/app/src/main/java/se/leap/bitmaskclient/firewall/ShutdownIPv6FirewallTask.java index 63d6074d..c14c579e 100644 --- a/app/src/main/java/se/leap/bitmaskclient/firewall/ShutdownIPv6FirewallTask.java +++ b/app/src/main/java/se/leap/bitmaskclient/firewall/ShutdownIPv6FirewallTask.java @@ -22,7 +22,7 @@ import android.util.Log; import java.lang.ref.WeakReference; import static se.leap.bitmaskclient.firewall.FirewallManager.BITMASK_CHAIN; -import static se.leap.bitmaskclient.utils.Cmd.runBlockingCmd; +import static se.leap.bitmaskclient.base.utils.Cmd.runBlockingCmd; class ShutdownIPv6FirewallTask extends AsyncTask<Void, Boolean, Boolean> { diff --git a/app/src/main/java/se/leap/bitmaskclient/firewall/ShutdownTetheringTask.java b/app/src/main/java/se/leap/bitmaskclient/firewall/ShutdownTetheringTask.java index dcb3ccba..d867009a 100644 --- a/app/src/main/java/se/leap/bitmaskclient/firewall/ShutdownTetheringTask.java +++ b/app/src/main/java/se/leap/bitmaskclient/firewall/ShutdownTetheringTask.java @@ -27,7 +27,7 @@ import se.leap.bitmaskclient.tethering.TetheringState; import static se.leap.bitmaskclient.firewall.FirewallManager.BITMASK_FORWARD; import static se.leap.bitmaskclient.firewall.FirewallManager.BITMASK_POSTROUTING; -import static se.leap.bitmaskclient.utils.Cmd.runBlockingCmd; +import static se.leap.bitmaskclient.base.utils.Cmd.runBlockingCmd; public class ShutdownTetheringTask extends AsyncTask<Void, Boolean, Boolean> { diff --git a/app/src/main/java/se/leap/bitmaskclient/firewall/StartIPv6FirewallTask.java b/app/src/main/java/se/leap/bitmaskclient/firewall/StartIPv6FirewallTask.java index b01270e0..f2c8b739 100644 --- a/app/src/main/java/se/leap/bitmaskclient/firewall/StartIPv6FirewallTask.java +++ b/app/src/main/java/se/leap/bitmaskclient/firewall/StartIPv6FirewallTask.java @@ -22,7 +22,7 @@ import android.util.Log; import java.lang.ref.WeakReference; import static se.leap.bitmaskclient.firewall.FirewallManager.BITMASK_CHAIN; -import static se.leap.bitmaskclient.utils.Cmd.runBlockingCmd; +import static se.leap.bitmaskclient.base.utils.Cmd.runBlockingCmd; class StartIPv6FirewallTask extends AsyncTask<Void, Boolean, Boolean> { diff --git a/app/src/main/java/se/leap/bitmaskclient/ProviderAPI.java b/app/src/main/java/se/leap/bitmaskclient/providersetup/ProviderAPI.java index bec16139..23c750a3 100644 --- a/app/src/main/java/se/leap/bitmaskclient/ProviderAPI.java +++ b/app/src/main/java/se/leap/bitmaskclient/providersetup/ProviderAPI.java @@ -14,7 +14,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -package se.leap.bitmaskclient; +package se.leap.bitmaskclient.providersetup; import android.annotation.SuppressLint; import android.content.Context; @@ -25,7 +25,9 @@ import androidx.annotation.NonNull; import androidx.core.app.JobIntentService; import androidx.localbroadcastmanager.content.LocalBroadcastManager; -import static se.leap.bitmaskclient.Constants.SHARED_PREFERENCES; +import se.leap.bitmaskclient.providersetup.connectivity.OkHttpClientGenerator; + +import static se.leap.bitmaskclient.base.models.Constants.SHARED_PREFERENCES; /** * Implements HTTP api methods (encapsulated in {{@link ProviderApiManager}}) diff --git a/app/src/main/java/se/leap/bitmaskclient/ProviderAPICommand.java b/app/src/main/java/se/leap/bitmaskclient/providersetup/ProviderAPICommand.java index 8de90af2..79a107d1 100644 --- a/app/src/main/java/se/leap/bitmaskclient/ProviderAPICommand.java +++ b/app/src/main/java/se/leap/bitmaskclient/providersetup/ProviderAPICommand.java @@ -1,14 +1,16 @@ -package se.leap.bitmaskclient; +package se.leap.bitmaskclient.providersetup; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.os.ResultReceiver; -import android.util.Log; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import se.leap.bitmaskclient.base.models.Constants; +import se.leap.bitmaskclient.base.models.Provider; + public class ProviderAPICommand { private static final String TAG = ProviderAPICommand.class.getSimpleName(); private Context context; diff --git a/app/src/main/java/se/leap/bitmaskclient/ProviderApiConnector.java b/app/src/main/java/se/leap/bitmaskclient/providersetup/ProviderApiConnector.java index 84f21343..ba902566 100644 --- a/app/src/main/java/se/leap/bitmaskclient/ProviderApiConnector.java +++ b/app/src/main/java/se/leap/bitmaskclient/providersetup/ProviderApiConnector.java @@ -15,7 +15,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -package se.leap.bitmaskclient; +package se.leap.bitmaskclient.providersetup; import androidx.annotation.NonNull; import android.util.Pair; diff --git a/app/src/main/java/se/leap/bitmaskclient/ProviderApiManagerBase.java b/app/src/main/java/se/leap/bitmaskclient/providersetup/ProviderApiManagerBase.java index 025e7aab..8a0c8f02 100644 --- a/app/src/main/java/se/leap/bitmaskclient/ProviderApiManagerBase.java +++ b/app/src/main/java/se/leap/bitmaskclient/providersetup/ProviderApiManagerBase.java @@ -15,7 +15,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -package se.leap.bitmaskclient; +package se.leap.bitmaskclient.providersetup; import android.content.Intent; import android.content.SharedPreferences; @@ -53,57 +53,64 @@ import javax.net.ssl.SSLHandshakeException; import javax.net.ssl.SSLPeerUnverifiedException; import okhttp3.OkHttpClient; -import se.leap.bitmaskclient.Constants.CREDENTIAL_ERRORS; -import se.leap.bitmaskclient.utils.ConfigHelper; - -import static se.leap.bitmaskclient.Constants.BROADCAST_PROVIDER_API_EVENT; -import static se.leap.bitmaskclient.Constants.BROADCAST_RESULT_CODE; -import static se.leap.bitmaskclient.Constants.BROADCAST_RESULT_KEY; -import static se.leap.bitmaskclient.Constants.CREDENTIALS_PASSWORD; -import static se.leap.bitmaskclient.Constants.CREDENTIALS_USERNAME; -import static se.leap.bitmaskclient.Constants.EIP_ACTION_START; -import static se.leap.bitmaskclient.Constants.PROVIDER_KEY; -import static se.leap.bitmaskclient.Constants.PROVIDER_PRIVATE_KEY; -import static se.leap.bitmaskclient.Constants.PROVIDER_VPN_CERTIFICATE; -import static se.leap.bitmaskclient.Provider.CA_CERT; -import static se.leap.bitmaskclient.Provider.GEOIP_URL; -import static se.leap.bitmaskclient.Provider.PROVIDER_API_IP; -import static se.leap.bitmaskclient.Provider.PROVIDER_IP; -import static se.leap.bitmaskclient.ProviderAPI.BACKEND_ERROR_KEY; -import static se.leap.bitmaskclient.ProviderAPI.BACKEND_ERROR_MESSAGE; -import static se.leap.bitmaskclient.ProviderAPI.CORRECTLY_DOWNLOADED_EIP_SERVICE; -import static se.leap.bitmaskclient.ProviderAPI.CORRECTLY_DOWNLOADED_GEOIP_JSON; -import static se.leap.bitmaskclient.ProviderAPI.CORRECTLY_DOWNLOADED_VPN_CERTIFICATE; -import static se.leap.bitmaskclient.ProviderAPI.CORRECTLY_UPDATED_INVALID_VPN_CERTIFICATE; -import static se.leap.bitmaskclient.ProviderAPI.DOWNLOAD_GEOIP_JSON; -import static se.leap.bitmaskclient.ProviderAPI.DOWNLOAD_SERVICE_JSON; -import static se.leap.bitmaskclient.ProviderAPI.DOWNLOAD_VPN_CERTIFICATE; -import static se.leap.bitmaskclient.ProviderAPI.ERRORID; -import static se.leap.bitmaskclient.ProviderAPI.ERRORS; -import static se.leap.bitmaskclient.ProviderAPI.FAILED_LOGIN; -import static se.leap.bitmaskclient.ProviderAPI.FAILED_SIGNUP; -import static se.leap.bitmaskclient.ProviderAPI.INCORRECTLY_DOWNLOADED_EIP_SERVICE; -import static se.leap.bitmaskclient.ProviderAPI.INCORRECTLY_DOWNLOADED_GEOIP_JSON; -import static se.leap.bitmaskclient.ProviderAPI.INCORRECTLY_DOWNLOADED_VPN_CERTIFICATE; -import static se.leap.bitmaskclient.ProviderAPI.INCORRECTLY_UPDATED_INVALID_VPN_CERTIFICATE; -import static se.leap.bitmaskclient.ProviderAPI.LOGOUT_FAILED; -import static se.leap.bitmaskclient.ProviderAPI.LOG_IN; -import static se.leap.bitmaskclient.ProviderAPI.LOG_OUT; -import static se.leap.bitmaskclient.ProviderAPI.PARAMETERS; -import static se.leap.bitmaskclient.ProviderAPI.PROVIDER_NOK; -import static se.leap.bitmaskclient.ProviderAPI.PROVIDER_OK; -import static se.leap.bitmaskclient.ProviderAPI.RECEIVER_KEY; -import static se.leap.bitmaskclient.ProviderAPI.SET_UP_PROVIDER; -import static se.leap.bitmaskclient.ProviderAPI.SIGN_UP; -import static se.leap.bitmaskclient.ProviderAPI.SUCCESSFUL_LOGIN; -import static se.leap.bitmaskclient.ProviderAPI.SUCCESSFUL_LOGOUT; -import static se.leap.bitmaskclient.ProviderAPI.SUCCESSFUL_SIGNUP; -import static se.leap.bitmaskclient.ProviderAPI.UPDATE_INVALID_VPN_CERTIFICATE; -import static se.leap.bitmaskclient.ProviderAPI.UPDATE_PROVIDER_DETAILS; -import static se.leap.bitmaskclient.ProviderAPI.USER_MESSAGE; -import static se.leap.bitmaskclient.ProviderSetupFailedDialog.DOWNLOAD_ERRORS.ERROR_CERTIFICATE_PINNING; -import static se.leap.bitmaskclient.ProviderSetupFailedDialog.DOWNLOAD_ERRORS.ERROR_CORRUPTED_PROVIDER_JSON; -import static se.leap.bitmaskclient.ProviderSetupFailedDialog.DOWNLOAD_ERRORS.ERROR_INVALID_CERTIFICATE; +import se.leap.bitmaskclient.base.models.Constants.CREDENTIAL_ERRORS; +import se.leap.bitmaskclient.base.models.Provider; +import se.leap.bitmaskclient.base.models.ProviderObservable; +import se.leap.bitmaskclient.R; +import se.leap.bitmaskclient.providersetup.connectivity.OkHttpClientGenerator; +import se.leap.bitmaskclient.providersetup.models.LeapSRPSession; +import se.leap.bitmaskclient.providersetup.models.SrpCredentials; +import se.leap.bitmaskclient.providersetup.models.SrpRegistrationData; +import se.leap.bitmaskclient.base.utils.ConfigHelper; + +import static se.leap.bitmaskclient.base.models.Constants.BROADCAST_PROVIDER_API_EVENT; +import static se.leap.bitmaskclient.base.models.Constants.BROADCAST_RESULT_CODE; +import static se.leap.bitmaskclient.base.models.Constants.BROADCAST_RESULT_KEY; +import static se.leap.bitmaskclient.base.models.Constants.CREDENTIALS_PASSWORD; +import static se.leap.bitmaskclient.base.models.Constants.CREDENTIALS_USERNAME; +import static se.leap.bitmaskclient.base.models.Constants.EIP_ACTION_START; +import static se.leap.bitmaskclient.base.models.Constants.PROVIDER_KEY; +import static se.leap.bitmaskclient.base.models.Constants.PROVIDER_PRIVATE_KEY; +import static se.leap.bitmaskclient.base.models.Constants.PROVIDER_VPN_CERTIFICATE; +import static se.leap.bitmaskclient.base.models.Provider.CA_CERT; +import static se.leap.bitmaskclient.base.models.Provider.GEOIP_URL; +import static se.leap.bitmaskclient.base.models.Provider.PROVIDER_API_IP; +import static se.leap.bitmaskclient.base.models.Provider.PROVIDER_IP; +import static se.leap.bitmaskclient.providersetup.ProviderAPI.BACKEND_ERROR_KEY; +import static se.leap.bitmaskclient.providersetup.ProviderAPI.BACKEND_ERROR_MESSAGE; +import static se.leap.bitmaskclient.providersetup.ProviderAPI.CORRECTLY_DOWNLOADED_EIP_SERVICE; +import static se.leap.bitmaskclient.providersetup.ProviderAPI.CORRECTLY_DOWNLOADED_GEOIP_JSON; +import static se.leap.bitmaskclient.providersetup.ProviderAPI.CORRECTLY_DOWNLOADED_VPN_CERTIFICATE; +import static se.leap.bitmaskclient.providersetup.ProviderAPI.CORRECTLY_UPDATED_INVALID_VPN_CERTIFICATE; +import static se.leap.bitmaskclient.providersetup.ProviderAPI.DOWNLOAD_GEOIP_JSON; +import static se.leap.bitmaskclient.providersetup.ProviderAPI.DOWNLOAD_SERVICE_JSON; +import static se.leap.bitmaskclient.providersetup.ProviderAPI.DOWNLOAD_VPN_CERTIFICATE; +import static se.leap.bitmaskclient.providersetup.ProviderAPI.ERRORID; +import static se.leap.bitmaskclient.providersetup.ProviderAPI.ERRORS; +import static se.leap.bitmaskclient.providersetup.ProviderAPI.FAILED_LOGIN; +import static se.leap.bitmaskclient.providersetup.ProviderAPI.FAILED_SIGNUP; +import static se.leap.bitmaskclient.providersetup.ProviderAPI.INCORRECTLY_DOWNLOADED_EIP_SERVICE; +import static se.leap.bitmaskclient.providersetup.ProviderAPI.INCORRECTLY_DOWNLOADED_GEOIP_JSON; +import static se.leap.bitmaskclient.providersetup.ProviderAPI.INCORRECTLY_DOWNLOADED_VPN_CERTIFICATE; +import static se.leap.bitmaskclient.providersetup.ProviderAPI.INCORRECTLY_UPDATED_INVALID_VPN_CERTIFICATE; +import static se.leap.bitmaskclient.providersetup.ProviderAPI.LOGOUT_FAILED; +import static se.leap.bitmaskclient.providersetup.ProviderAPI.LOG_IN; +import static se.leap.bitmaskclient.providersetup.ProviderAPI.LOG_OUT; +import static se.leap.bitmaskclient.providersetup.ProviderAPI.PARAMETERS; +import static se.leap.bitmaskclient.providersetup.ProviderAPI.PROVIDER_NOK; +import static se.leap.bitmaskclient.providersetup.ProviderAPI.PROVIDER_OK; +import static se.leap.bitmaskclient.providersetup.ProviderAPI.RECEIVER_KEY; +import static se.leap.bitmaskclient.providersetup.ProviderAPI.SET_UP_PROVIDER; +import static se.leap.bitmaskclient.providersetup.ProviderAPI.SIGN_UP; +import static se.leap.bitmaskclient.providersetup.ProviderAPI.SUCCESSFUL_LOGIN; +import static se.leap.bitmaskclient.providersetup.ProviderAPI.SUCCESSFUL_LOGOUT; +import static se.leap.bitmaskclient.providersetup.ProviderAPI.SUCCESSFUL_SIGNUP; +import static se.leap.bitmaskclient.providersetup.ProviderAPI.UPDATE_INVALID_VPN_CERTIFICATE; +import static se.leap.bitmaskclient.providersetup.ProviderAPI.UPDATE_PROVIDER_DETAILS; +import static se.leap.bitmaskclient.providersetup.ProviderAPI.USER_MESSAGE; +import static se.leap.bitmaskclient.providersetup.ProviderSetupFailedDialog.DOWNLOAD_ERRORS.ERROR_CERTIFICATE_PINNING; +import static se.leap.bitmaskclient.providersetup.ProviderSetupFailedDialog.DOWNLOAD_ERRORS.ERROR_CORRUPTED_PROVIDER_JSON; +import static se.leap.bitmaskclient.providersetup.ProviderSetupFailedDialog.DOWNLOAD_ERRORS.ERROR_INVALID_CERTIFICATE; import static se.leap.bitmaskclient.R.string.certificate_error; import static se.leap.bitmaskclient.R.string.error_io_exception_user_message; import static se.leap.bitmaskclient.R.string.error_json_exception_user_message; @@ -115,11 +122,11 @@ import static se.leap.bitmaskclient.R.string.vpn_certificate_is_invalid; import static se.leap.bitmaskclient.R.string.warning_corrupted_provider_cert; import static se.leap.bitmaskclient.R.string.warning_corrupted_provider_details; import static se.leap.bitmaskclient.R.string.warning_expired_provider_cert; -import static se.leap.bitmaskclient.utils.ConfigHelper.getFingerprintFromCertificate; -import static se.leap.bitmaskclient.utils.ConfigHelper.getProviderFormattedString; -import static se.leap.bitmaskclient.utils.ConfigHelper.parseRsaKeyFromString; -import static se.leap.bitmaskclient.utils.PreferenceHelper.deleteProviderDetailsFromPreferences; -import static se.leap.bitmaskclient.utils.PreferenceHelper.getFromPersistedProvider; +import static se.leap.bitmaskclient.base.utils.ConfigHelper.getFingerprintFromCertificate; +import static se.leap.bitmaskclient.base.utils.ConfigHelper.getProviderFormattedString; +import static se.leap.bitmaskclient.base.utils.ConfigHelper.parseRsaKeyFromString; +import static se.leap.bitmaskclient.base.utils.PreferenceHelper.deleteProviderDetailsFromPreferences; +import static se.leap.bitmaskclient.base.utils.PreferenceHelper.getFromPersistedProvider; /** * Implements the logic of the http api calls. The methods of this class needs to be called from diff --git a/app/src/main/java/se/leap/bitmaskclient/ProviderApiSetupBroadcastReceiver.java b/app/src/main/java/se/leap/bitmaskclient/providersetup/ProviderApiSetupBroadcastReceiver.java index 890d3b67..710aee0f 100644 --- a/app/src/main/java/se/leap/bitmaskclient/ProviderApiSetupBroadcastReceiver.java +++ b/app/src/main/java/se/leap/bitmaskclient/providersetup/ProviderApiSetupBroadcastReceiver.java @@ -14,7 +14,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -package se.leap.bitmaskclient; +package se.leap.bitmaskclient.providersetup; import android.content.BroadcastReceiver; import android.content.Context; @@ -24,7 +24,10 @@ import android.util.Log; import java.lang.ref.WeakReference; -import se.leap.bitmaskclient.ProviderSetupInterface.ProviderConfigState; +import se.leap.bitmaskclient.base.models.Constants; +import se.leap.bitmaskclient.base.models.Provider; +import se.leap.bitmaskclient.providersetup.ProviderSetupInterface.ProviderConfigState; +import se.leap.bitmaskclient.providersetup.activities.ProviderListBaseActivity; /** * Broadcast receiver that handles callback intents of ProviderApi during provider setup. diff --git a/app/src/main/java/se/leap/bitmaskclient/ProviderListAdapter.java b/app/src/main/java/se/leap/bitmaskclient/providersetup/ProviderListAdapter.java index 6672c575..76ee33f2 100644 --- a/app/src/main/java/se/leap/bitmaskclient/ProviderListAdapter.java +++ b/app/src/main/java/se/leap/bitmaskclient/providersetup/ProviderListAdapter.java @@ -1,4 +1,4 @@ -package se.leap.bitmaskclient; +package se.leap.bitmaskclient.providersetup; import android.view.LayoutInflater; @@ -6,6 +6,8 @@ import com.pedrogomez.renderers.AdapteeCollection; import com.pedrogomez.renderers.RendererAdapter; import com.pedrogomez.renderers.RendererBuilder; +import se.leap.bitmaskclient.base.models.Provider; + public class ProviderListAdapter extends RendererAdapter<Provider> { public ProviderListAdapter(LayoutInflater layoutInflater, RendererBuilder rendererBuilder, AdapteeCollection<Provider> collection) { diff --git a/app/src/main/java/se/leap/bitmaskclient/ProviderManager.java b/app/src/main/java/se/leap/bitmaskclient/providersetup/ProviderManager.java index c23ad270..d33a175f 100644 --- a/app/src/main/java/se/leap/bitmaskclient/ProviderManager.java +++ b/app/src/main/java/se/leap/bitmaskclient/providersetup/ProviderManager.java @@ -1,4 +1,4 @@ -package se.leap.bitmaskclient; +package se.leap.bitmaskclient.providersetup; import android.content.res.AssetManager; import androidx.annotation.VisibleForTesting; @@ -20,14 +20,16 @@ import java.util.Iterator; import java.util.List; import java.util.Set; -import static se.leap.bitmaskclient.Provider.GEOIP_URL; -import static se.leap.bitmaskclient.Provider.MAIN_URL; -import static se.leap.bitmaskclient.Provider.PROVIDER_API_IP; -import static se.leap.bitmaskclient.Provider.PROVIDER_IP; -import static se.leap.bitmaskclient.utils.FileHelper.createFile; -import static se.leap.bitmaskclient.utils.FileHelper.persistFile; -import static se.leap.bitmaskclient.utils.InputStreamHelper.getInputStreamFrom; -import static se.leap.bitmaskclient.utils.InputStreamHelper.loadInputStreamAsString; +import se.leap.bitmaskclient.base.models.Provider; + +import static se.leap.bitmaskclient.base.models.Provider.GEOIP_URL; +import static se.leap.bitmaskclient.base.models.Provider.MAIN_URL; +import static se.leap.bitmaskclient.base.models.Provider.PROVIDER_API_IP; +import static se.leap.bitmaskclient.base.models.Provider.PROVIDER_IP; +import static se.leap.bitmaskclient.base.utils.FileHelper.createFile; +import static se.leap.bitmaskclient.base.utils.FileHelper.persistFile; +import static se.leap.bitmaskclient.base.utils.InputStreamHelper.getInputStreamFrom; +import static se.leap.bitmaskclient.base.utils.InputStreamHelper.loadInputStreamAsString; /** * Created by parmegv on 4/12/14. diff --git a/app/src/main/java/se/leap/bitmaskclient/ProviderRenderer.java b/app/src/main/java/se/leap/bitmaskclient/providersetup/ProviderRenderer.java index 795c8e82..52ee4656 100644 --- a/app/src/main/java/se/leap/bitmaskclient/ProviderRenderer.java +++ b/app/src/main/java/se/leap/bitmaskclient/providersetup/ProviderRenderer.java @@ -1,4 +1,4 @@ -package se.leap.bitmaskclient; +package se.leap.bitmaskclient.providersetup; import android.content.*; import android.view.*; @@ -7,6 +7,8 @@ import android.widget.*; import com.pedrogomez.renderers.*; import butterknife.*; +import se.leap.bitmaskclient.base.models.Provider; +import se.leap.bitmaskclient.R; /** * Created by parmegv on 4/12/14. diff --git a/app/src/main/java/se/leap/bitmaskclient/ProviderRendererBuilder.java b/app/src/main/java/se/leap/bitmaskclient/providersetup/ProviderRendererBuilder.java index 5a6e857d..7d2b4742 100644 --- a/app/src/main/java/se/leap/bitmaskclient/ProviderRendererBuilder.java +++ b/app/src/main/java/se/leap/bitmaskclient/providersetup/ProviderRendererBuilder.java @@ -1,9 +1,11 @@ -package se.leap.bitmaskclient; +package se.leap.bitmaskclient.providersetup; import com.pedrogomez.renderers.*; import java.util.*; +import se.leap.bitmaskclient.base.models.Provider; + /** * Created by parmegv on 4/12/14. */ diff --git a/app/src/main/java/se/leap/bitmaskclient/ProviderSetupFailedDialog.java b/app/src/main/java/se/leap/bitmaskclient/providersetup/ProviderSetupFailedDialog.java index d64f34d8..947d1182 100644 --- a/app/src/main/java/se/leap/bitmaskclient/ProviderSetupFailedDialog.java +++ b/app/src/main/java/se/leap/bitmaskclient/providersetup/ProviderSetupFailedDialog.java @@ -14,7 +14,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -package se.leap.bitmaskclient; +package se.leap.bitmaskclient.providersetup; import android.app.AlertDialog; import android.app.Dialog; @@ -27,10 +27,13 @@ import androidx.fragment.app.DialogFragment; import org.json.JSONObject; -import static se.leap.bitmaskclient.ProviderSetupFailedDialog.DOWNLOAD_ERRORS.DEFAULT; -import static se.leap.bitmaskclient.ProviderSetupFailedDialog.DOWNLOAD_ERRORS.valueOf; -import static se.leap.bitmaskclient.ProviderAPI.ERRORID; -import static se.leap.bitmaskclient.ProviderAPI.ERRORS; +import se.leap.bitmaskclient.base.models.Provider; +import se.leap.bitmaskclient.R; + +import static se.leap.bitmaskclient.providersetup.ProviderSetupFailedDialog.DOWNLOAD_ERRORS.DEFAULT; +import static se.leap.bitmaskclient.providersetup.ProviderSetupFailedDialog.DOWNLOAD_ERRORS.valueOf; +import static se.leap.bitmaskclient.providersetup.ProviderAPI.ERRORID; +import static se.leap.bitmaskclient.providersetup.ProviderAPI.ERRORS; /** * Implements a dialog to show why a download failed. diff --git a/app/src/main/java/se/leap/bitmaskclient/ProviderSetupInterface.java b/app/src/main/java/se/leap/bitmaskclient/providersetup/ProviderSetupInterface.java index 9cf4dc33..5b5c94b4 100644 --- a/app/src/main/java/se/leap/bitmaskclient/ProviderSetupInterface.java +++ b/app/src/main/java/se/leap/bitmaskclient/providersetup/ProviderSetupInterface.java @@ -14,10 +14,12 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -package se.leap.bitmaskclient; +package se.leap.bitmaskclient.providersetup; import android.os.Bundle; +import se.leap.bitmaskclient.base.models.Provider; + /** * Created by cyberta on 17.08.18. */ diff --git a/app/src/main/java/se/leap/bitmaskclient/AbstractProviderDetailActivity.java b/app/src/main/java/se/leap/bitmaskclient/providersetup/activities/AbstractProviderDetailActivity.java index a9f156a2..b7325e03 100644 --- a/app/src/main/java/se/leap/bitmaskclient/AbstractProviderDetailActivity.java +++ b/app/src/main/java/se/leap/bitmaskclient/providersetup/activities/AbstractProviderDetailActivity.java @@ -1,4 +1,4 @@ -package se.leap.bitmaskclient; +package se.leap.bitmaskclient.providersetup.activities; import android.content.Intent; import android.os.Bundle; @@ -12,9 +12,11 @@ import android.widget.TextView; import java.util.ArrayList; import butterknife.InjectView; +import se.leap.bitmaskclient.base.models.Provider; +import se.leap.bitmaskclient.R; -import static se.leap.bitmaskclient.Constants.PROVIDER_KEY; -import static se.leap.bitmaskclient.Constants.REQUEST_CODE_CONFIGURE_LEAP; +import static se.leap.bitmaskclient.base.models.Constants.PROVIDER_KEY; +import static se.leap.bitmaskclient.base.models.Constants.REQUEST_CODE_CONFIGURE_LEAP; public abstract class AbstractProviderDetailActivity extends ConfigWizardBaseActivity { diff --git a/app/src/main/java/se/leap/bitmaskclient/AddProviderBaseActivity.java b/app/src/main/java/se/leap/bitmaskclient/providersetup/activities/AddProviderBaseActivity.java index e0bb0061..0031f48d 100644 --- a/app/src/main/java/se/leap/bitmaskclient/AddProviderBaseActivity.java +++ b/app/src/main/java/se/leap/bitmaskclient/providersetup/activities/AddProviderBaseActivity.java @@ -1,4 +1,4 @@ -package se.leap.bitmaskclient; +package se.leap.bitmaskclient.providersetup.activities; import android.content.Intent; import android.os.Bundle; @@ -10,8 +10,9 @@ import android.view.View; import android.widget.Button; import butterknife.InjectView; +import se.leap.bitmaskclient.R; -import static se.leap.bitmaskclient.ProviderListBaseActivity.EXTRAS_KEY_INVALID_URL; +import static se.leap.bitmaskclient.providersetup.activities.ProviderListBaseActivity.EXTRAS_KEY_INVALID_URL; /** * Created by cyberta on 30.06.18. diff --git a/app/src/main/java/se/leap/bitmaskclient/ButterKnifeActivity.java b/app/src/main/java/se/leap/bitmaskclient/providersetup/activities/ButterKnifeActivity.java index 4f27f88a..22edd9ee 100644 --- a/app/src/main/java/se/leap/bitmaskclient/ButterKnifeActivity.java +++ b/app/src/main/java/se/leap/bitmaskclient/providersetup/activities/ButterKnifeActivity.java @@ -14,7 +14,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -package se.leap.bitmaskclient; +package se.leap.bitmaskclient.providersetup.activities; import androidx.appcompat.app.AppCompatActivity; import android.view.View; diff --git a/app/src/main/java/se/leap/bitmaskclient/ConfigWizardBaseActivity.java b/app/src/main/java/se/leap/bitmaskclient/providersetup/activities/ConfigWizardBaseActivity.java index 2d163859..3712c544 100644 --- a/app/src/main/java/se/leap/bitmaskclient/ConfigWizardBaseActivity.java +++ b/app/src/main/java/se/leap/bitmaskclient/providersetup/activities/ConfigWizardBaseActivity.java @@ -1,4 +1,4 @@ -package se.leap.bitmaskclient; +package se.leap.bitmaskclient.providersetup.activities; import android.content.SharedPreferences; import android.graphics.PorterDuff; @@ -20,13 +20,15 @@ import android.widget.ProgressBar; import butterknife.InjectView; import butterknife.Optional; -import se.leap.bitmaskclient.views.ProviderHeaderView; +import se.leap.bitmaskclient.base.models.Provider; +import se.leap.bitmaskclient.R; +import se.leap.bitmaskclient.base.views.ProviderHeaderView; import static android.content.res.Configuration.ORIENTATION_LANDSCAPE; import static android.view.View.GONE; import static android.view.View.VISIBLE; -import static se.leap.bitmaskclient.Constants.PROVIDER_KEY; -import static se.leap.bitmaskclient.Constants.SHARED_PREFERENCES; +import static se.leap.bitmaskclient.base.models.Constants.PROVIDER_KEY; +import static se.leap.bitmaskclient.base.models.Constants.SHARED_PREFERENCES; /** * Base Activity for configuration wizard activities diff --git a/app/src/main/java/se/leap/bitmaskclient/CustomProviderSetupActivity.java b/app/src/main/java/se/leap/bitmaskclient/providersetup/activities/CustomProviderSetupActivity.java index 0974f427..161c53d3 100644 --- a/app/src/main/java/se/leap/bitmaskclient/CustomProviderSetupActivity.java +++ b/app/src/main/java/se/leap/bitmaskclient/providersetup/activities/CustomProviderSetupActivity.java @@ -14,17 +14,22 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -package se.leap.bitmaskclient; +package se.leap.bitmaskclient.providersetup.activities; import android.content.Intent; import android.os.Bundle; import androidx.annotation.NonNull; import androidx.annotation.Nullable; -import static se.leap.bitmaskclient.Constants.REQUEST_CODE_CONFIGURE_LEAP; -import static se.leap.bitmaskclient.ProviderAPI.SET_UP_PROVIDER; -import static se.leap.bitmaskclient.ProviderSetupInterface.ProviderConfigState.SETTING_UP_PROVIDER; -import static se.leap.bitmaskclient.utils.ConfigHelper.preferAnonymousUsage; +import se.leap.bitmaskclient.BuildConfig; +import se.leap.bitmaskclient.base.models.Provider; +import se.leap.bitmaskclient.providersetup.ProviderAPICommand; +import se.leap.bitmaskclient.R; + +import static se.leap.bitmaskclient.base.models.Constants.REQUEST_CODE_CONFIGURE_LEAP; +import static se.leap.bitmaskclient.providersetup.ProviderAPI.SET_UP_PROVIDER; +import static se.leap.bitmaskclient.providersetup.ProviderSetupInterface.ProviderConfigState.SETTING_UP_PROVIDER; +import static se.leap.bitmaskclient.base.utils.ConfigHelper.preferAnonymousUsage; /** * Created by cyberta on 17.08.18. diff --git a/app/src/main/java/se/leap/bitmaskclient/LoginActivity.java b/app/src/main/java/se/leap/bitmaskclient/providersetup/activities/LoginActivity.java index 15166c67..a8bac6d8 100644 --- a/app/src/main/java/se/leap/bitmaskclient/LoginActivity.java +++ b/app/src/main/java/se/leap/bitmaskclient/providersetup/activities/LoginActivity.java @@ -1,9 +1,10 @@ -package se.leap.bitmaskclient; +package se.leap.bitmaskclient.providersetup.activities; import android.os.Bundle; import androidx.annotation.Nullable; import butterknife.OnClick; +import se.leap.bitmaskclient.R; /** * Activity to login to chosen Provider diff --git a/app/src/main/java/se/leap/bitmaskclient/ProviderCredentialsBaseActivity.java b/app/src/main/java/se/leap/bitmaskclient/providersetup/activities/ProviderCredentialsBaseActivity.java index c61caead..91d0de56 100644 --- a/app/src/main/java/se/leap/bitmaskclient/ProviderCredentialsBaseActivity.java +++ b/app/src/main/java/se/leap/bitmaskclient/providersetup/activities/ProviderCredentialsBaseActivity.java @@ -14,7 +14,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -package se.leap.bitmaskclient; +package se.leap.bitmaskclient.providersetup.activities; import android.content.BroadcastReceiver; import android.content.Context; @@ -45,22 +45,26 @@ import org.json.JSONException; import butterknife.InjectView; import butterknife.OnClick; -import se.leap.bitmaskclient.Constants.CREDENTIAL_ERRORS; +import se.leap.bitmaskclient.base.models.Constants.CREDENTIAL_ERRORS; +import se.leap.bitmaskclient.base.models.Provider; +import se.leap.bitmaskclient.providersetup.ProviderAPI; +import se.leap.bitmaskclient.providersetup.ProviderAPICommand; +import se.leap.bitmaskclient.R; import static android.text.TextUtils.isEmpty; import static android.view.View.GONE; import static android.view.View.VISIBLE; import static android.view.inputmethod.EditorInfo.IME_ACTION_DONE; -import static se.leap.bitmaskclient.Constants.BROADCAST_PROVIDER_API_EVENT; -import static se.leap.bitmaskclient.Constants.BROADCAST_RESULT_CODE; -import static se.leap.bitmaskclient.Constants.BROADCAST_RESULT_KEY; -import static se.leap.bitmaskclient.Constants.CREDENTIALS_PASSWORD; -import static se.leap.bitmaskclient.Constants.CREDENTIALS_USERNAME; -import static se.leap.bitmaskclient.Constants.PROVIDER_KEY; -import static se.leap.bitmaskclient.ProviderAPI.DOWNLOAD_VPN_CERTIFICATE; -import static se.leap.bitmaskclient.ProviderAPI.LOG_IN; -import static se.leap.bitmaskclient.ProviderAPI.SIGN_UP; -import static se.leap.bitmaskclient.ProviderAPI.USER_MESSAGE; +import static se.leap.bitmaskclient.base.models.Constants.BROADCAST_PROVIDER_API_EVENT; +import static se.leap.bitmaskclient.base.models.Constants.BROADCAST_RESULT_CODE; +import static se.leap.bitmaskclient.base.models.Constants.BROADCAST_RESULT_KEY; +import static se.leap.bitmaskclient.base.models.Constants.CREDENTIALS_PASSWORD; +import static se.leap.bitmaskclient.base.models.Constants.CREDENTIALS_USERNAME; +import static se.leap.bitmaskclient.base.models.Constants.PROVIDER_KEY; +import static se.leap.bitmaskclient.providersetup.ProviderAPI.DOWNLOAD_VPN_CERTIFICATE; +import static se.leap.bitmaskclient.providersetup.ProviderAPI.LOG_IN; +import static se.leap.bitmaskclient.providersetup.ProviderAPI.SIGN_UP; +import static se.leap.bitmaskclient.providersetup.ProviderAPI.USER_MESSAGE; /** * Base Activity for activities concerning a provider interaction diff --git a/app/src/main/java/se/leap/bitmaskclient/ProviderListBaseActivity.java b/app/src/main/java/se/leap/bitmaskclient/providersetup/activities/ProviderListBaseActivity.java index 44258a7b..46a40d11 100644 --- a/app/src/main/java/se/leap/bitmaskclient/ProviderListBaseActivity.java +++ b/app/src/main/java/se/leap/bitmaskclient/providersetup/activities/ProviderListBaseActivity.java @@ -15,7 +15,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -package se.leap.bitmaskclient; +package se.leap.bitmaskclient.providersetup.activities; import android.content.Intent; import android.os.Bundle; @@ -32,11 +32,18 @@ import javax.inject.Inject; import butterknife.InjectView; import butterknife.OnItemClick; - -import static se.leap.bitmaskclient.Constants.REQUEST_CODE_ADD_PROVIDER; -import static se.leap.bitmaskclient.Constants.REQUEST_CODE_CONFIGURE_LEAP; -import static se.leap.bitmaskclient.ProviderSetupInterface.ProviderConfigState.SETTING_UP_PROVIDER; -import static se.leap.bitmaskclient.ProviderSetupInterface.ProviderConfigState.SHOW_FAILED_DIALOG; +import se.leap.bitmaskclient.providersetup.AddProviderActivity; +import se.leap.bitmaskclient.base.models.Provider; +import se.leap.bitmaskclient.providersetup.ProviderListActivity; +import se.leap.bitmaskclient.providersetup.ProviderRenderer; +import se.leap.bitmaskclient.providersetup.ProviderRendererBuilder; +import se.leap.bitmaskclient.R; +import se.leap.bitmaskclient.providersetup.ProviderListAdapter; + +import static se.leap.bitmaskclient.base.models.Constants.REQUEST_CODE_ADD_PROVIDER; +import static se.leap.bitmaskclient.base.models.Constants.REQUEST_CODE_CONFIGURE_LEAP; +import static se.leap.bitmaskclient.providersetup.ProviderSetupInterface.ProviderConfigState.SETTING_UP_PROVIDER; +import static se.leap.bitmaskclient.providersetup.ProviderSetupInterface.ProviderConfigState.SHOW_FAILED_DIALOG; /** * abstract base Activity that builds and shows the list of known available providers. diff --git a/app/src/main/java/se/leap/bitmaskclient/ProviderSetupBaseActivity.java b/app/src/main/java/se/leap/bitmaskclient/providersetup/activities/ProviderSetupBaseActivity.java index 0994927f..e54fb048 100644 --- a/app/src/main/java/se/leap/bitmaskclient/ProviderSetupBaseActivity.java +++ b/app/src/main/java/se/leap/bitmaskclient/providersetup/activities/ProviderSetupBaseActivity.java @@ -14,7 +14,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -package se.leap.bitmaskclient; +package se.leap.bitmaskclient.providersetup.activities; import android.content.Intent; import android.content.IntentFilter; @@ -30,18 +30,27 @@ import org.jetbrains.annotations.NotNull; import org.json.JSONException; import org.json.JSONObject; -import static se.leap.bitmaskclient.Constants.BROADCAST_PROVIDER_API_EVENT; -import static se.leap.bitmaskclient.Constants.PROVIDER_KEY; -import static se.leap.bitmaskclient.Constants.REQUEST_CODE_CONFIGURE_LEAP; -import static se.leap.bitmaskclient.ProviderAPI.DOWNLOAD_VPN_CERTIFICATE; -import static se.leap.bitmaskclient.ProviderAPI.ERRORS; -import static se.leap.bitmaskclient.ProviderAPI.UPDATE_PROVIDER_DETAILS; -import static se.leap.bitmaskclient.ProviderSetupInterface.ProviderConfigState.PENDING_SHOW_FAILED_DIALOG; -import static se.leap.bitmaskclient.ProviderSetupInterface.ProviderConfigState.PENDING_SHOW_PROVIDER_DETAILS; -import static se.leap.bitmaskclient.ProviderSetupInterface.ProviderConfigState.PROVIDER_NOT_SET; -import static se.leap.bitmaskclient.ProviderSetupInterface.ProviderConfigState.SETTING_UP_PROVIDER; -import static se.leap.bitmaskclient.ProviderSetupInterface.ProviderConfigState.SHOWING_PROVIDER_DETAILS; -import static se.leap.bitmaskclient.ProviderSetupInterface.ProviderConfigState.SHOW_FAILED_DIALOG; +import se.leap.bitmaskclient.base.FragmentManagerEnhanced; +import se.leap.bitmaskclient.base.models.Provider; +import se.leap.bitmaskclient.providersetup.ProviderAPICommand; +import se.leap.bitmaskclient.providersetup.ProviderDetailActivity; +import se.leap.bitmaskclient.providersetup.ProviderApiSetupBroadcastReceiver; +import se.leap.bitmaskclient.providersetup.ProviderManager; +import se.leap.bitmaskclient.providersetup.ProviderSetupFailedDialog; +import se.leap.bitmaskclient.providersetup.ProviderSetupInterface; + +import static se.leap.bitmaskclient.base.models.Constants.BROADCAST_PROVIDER_API_EVENT; +import static se.leap.bitmaskclient.base.models.Constants.PROVIDER_KEY; +import static se.leap.bitmaskclient.base.models.Constants.REQUEST_CODE_CONFIGURE_LEAP; +import static se.leap.bitmaskclient.providersetup.ProviderAPI.DOWNLOAD_VPN_CERTIFICATE; +import static se.leap.bitmaskclient.providersetup.ProviderAPI.ERRORS; +import static se.leap.bitmaskclient.providersetup.ProviderAPI.UPDATE_PROVIDER_DETAILS; +import static se.leap.bitmaskclient.providersetup.ProviderSetupInterface.ProviderConfigState.PENDING_SHOW_FAILED_DIALOG; +import static se.leap.bitmaskclient.providersetup.ProviderSetupInterface.ProviderConfigState.PENDING_SHOW_PROVIDER_DETAILS; +import static se.leap.bitmaskclient.providersetup.ProviderSetupInterface.ProviderConfigState.PROVIDER_NOT_SET; +import static se.leap.bitmaskclient.providersetup.ProviderSetupInterface.ProviderConfigState.SETTING_UP_PROVIDER; +import static se.leap.bitmaskclient.providersetup.ProviderSetupInterface.ProviderConfigState.SHOWING_PROVIDER_DETAILS; +import static se.leap.bitmaskclient.providersetup.ProviderSetupInterface.ProviderConfigState.SHOW_FAILED_DIALOG; /** * Created by cyberta on 19.08.18. diff --git a/app/src/main/java/se/leap/bitmaskclient/SignupActivity.java b/app/src/main/java/se/leap/bitmaskclient/providersetup/activities/SignupActivity.java index abd3d224..c0245845 100644 --- a/app/src/main/java/se/leap/bitmaskclient/SignupActivity.java +++ b/app/src/main/java/se/leap/bitmaskclient/providersetup/activities/SignupActivity.java @@ -14,12 +14,13 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -package se.leap.bitmaskclient; +package se.leap.bitmaskclient.providersetup.activities; import android.os.Bundle; import androidx.annotation.Nullable; import butterknife.OnClick; +import se.leap.bitmaskclient.R; import static android.view.View.VISIBLE; diff --git a/app/src/main/java/se/leap/bitmaskclient/DnsResolver.java b/app/src/main/java/se/leap/bitmaskclient/providersetup/connectivity/DnsResolver.java index 92f70492..44de1e6d 100644 --- a/app/src/main/java/se/leap/bitmaskclient/DnsResolver.java +++ b/app/src/main/java/se/leap/bitmaskclient/providersetup/connectivity/DnsResolver.java @@ -1,4 +1,4 @@ -package se.leap.bitmaskclient; +package se.leap.bitmaskclient.providersetup.connectivity; import org.jetbrains.annotations.NotNull; @@ -8,7 +8,9 @@ import java.util.ArrayList; import java.util.List; import okhttp3.Dns; -import se.leap.bitmaskclient.utils.IPAddress; +import se.leap.bitmaskclient.base.models.Provider; +import se.leap.bitmaskclient.base.models.ProviderObservable; +import se.leap.bitmaskclient.base.utils.IPAddress; class DnsResolver implements Dns { diff --git a/app/src/main/java/se/leap/bitmaskclient/OkHttpClientGenerator.java b/app/src/main/java/se/leap/bitmaskclient/providersetup/connectivity/OkHttpClientGenerator.java index 576e76e0..2077a8b9 100644 --- a/app/src/main/java/se/leap/bitmaskclient/OkHttpClientGenerator.java +++ b/app/src/main/java/se/leap/bitmaskclient/providersetup/connectivity/OkHttpClientGenerator.java @@ -15,11 +15,11 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -package se.leap.bitmaskclient; +package se.leap.bitmaskclient.providersetup.connectivity; -import android.content.SharedPreferences; import android.content.res.Resources; import android.os.Build; + import androidx.annotation.NonNull; import org.json.JSONException; @@ -46,13 +46,13 @@ import okhttp3.OkHttpClient; import okhttp3.TlsVersion; import static android.text.TextUtils.isEmpty; -import static se.leap.bitmaskclient.ProviderAPI.ERRORS; import static se.leap.bitmaskclient.R.string.certificate_error; import static se.leap.bitmaskclient.R.string.error_io_exception_user_message; import static se.leap.bitmaskclient.R.string.error_no_such_algorithm_exception_user_message; import static se.leap.bitmaskclient.R.string.keyChainAccessError; import static se.leap.bitmaskclient.R.string.server_unreachable_message; -import static se.leap.bitmaskclient.utils.ConfigHelper.getProviderFormattedString; +import static se.leap.bitmaskclient.providersetup.ProviderAPI.ERRORS; +import static se.leap.bitmaskclient.base.utils.ConfigHelper.getProviderFormattedString; /** * Created by cyberta on 08.01.18. diff --git a/app/src/main/java/se/leap/bitmaskclient/TLSCompatSocketFactory.java b/app/src/main/java/se/leap/bitmaskclient/providersetup/connectivity/TLSCompatSocketFactory.java index 32652964..5357fd74 100644 --- a/app/src/main/java/se/leap/bitmaskclient/TLSCompatSocketFactory.java +++ b/app/src/main/java/se/leap/bitmaskclient/providersetup/connectivity/TLSCompatSocketFactory.java @@ -1,4 +1,4 @@ -package se.leap.bitmaskclient; +package se.leap.bitmaskclient.providersetup.connectivity; import android.text.TextUtils; @@ -22,7 +22,7 @@ import javax.net.ssl.TrustManagerFactory; import javax.net.ssl.X509TrustManager; import okhttp3.OkHttpClient; -import se.leap.bitmaskclient.utils.ConfigHelper; +import se.leap.bitmaskclient.base.utils.ConfigHelper; /** * Created by cyberta on 24.10.17. diff --git a/app/src/main/java/se/leap/bitmaskclient/LeapSRPSession.java b/app/src/main/java/se/leap/bitmaskclient/providersetup/models/LeapSRPSession.java index d1f1ed21..8e9d3e32 100644 --- a/app/src/main/java/se/leap/bitmaskclient/LeapSRPSession.java +++ b/app/src/main/java/se/leap/bitmaskclient/providersetup/models/LeapSRPSession.java @@ -14,7 +14,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -package se.leap.bitmaskclient; +package se.leap.bitmaskclient.providersetup.models; import org.jboss.security.srp.SRPParameters; @@ -26,7 +26,7 @@ import java.security.NoSuchAlgorithmException; import java.security.SecureRandom; import java.util.Arrays; -import se.leap.bitmaskclient.utils.ConfigHelper; +import se.leap.bitmaskclient.base.utils.ConfigHelper; /** * Implements all SRP algorithm logic. @@ -330,11 +330,11 @@ public class LeapSRPSession { return valid; } - protected static void setToken(String token) { + public static void setToken(String token) { LeapSRPSession.token = token; } - protected static String getToken() { + public static String getToken() { return token; } diff --git a/app/src/main/java/se/leap/bitmaskclient/SrpCredentials.java b/app/src/main/java/se/leap/bitmaskclient/providersetup/models/SrpCredentials.java index c1815ac5..46a62626 100644 --- a/app/src/main/java/se/leap/bitmaskclient/SrpCredentials.java +++ b/app/src/main/java/se/leap/bitmaskclient/providersetup/models/SrpCredentials.java @@ -1,4 +1,4 @@ -package se.leap.bitmaskclient; +package se.leap.bitmaskclient.providersetup.models; import com.google.gson.Gson; diff --git a/app/src/main/java/se/leap/bitmaskclient/SrpRegistrationData.java b/app/src/main/java/se/leap/bitmaskclient/providersetup/models/SrpRegistrationData.java index d4e00308..31228edf 100644 --- a/app/src/main/java/se/leap/bitmaskclient/SrpRegistrationData.java +++ b/app/src/main/java/se/leap/bitmaskclient/providersetup/models/SrpRegistrationData.java @@ -1,4 +1,4 @@ -package se.leap.bitmaskclient; +package se.leap.bitmaskclient.providersetup.models; import com.google.gson.Gson; diff --git a/app/src/main/java/se/leap/bitmaskclient/tethering/TetheringStateManager.java b/app/src/main/java/se/leap/bitmaskclient/tethering/TetheringStateManager.java index 44e9da6e..d74175f5 100644 --- a/app/src/main/java/se/leap/bitmaskclient/tethering/TetheringStateManager.java +++ b/app/src/main/java/se/leap/bitmaskclient/tethering/TetheringStateManager.java @@ -18,7 +18,6 @@ package se.leap.bitmaskclient.tethering; import android.content.Context; import android.content.IntentFilter; -import androidx.annotation.VisibleForTesting; import java.net.Inet4Address; import java.net.InterfaceAddress; @@ -26,11 +25,11 @@ import java.net.NetworkInterface; import java.util.Enumeration; import java.util.List; -import se.leap.bitmaskclient.utils.Cmd; +import se.leap.bitmaskclient.base.utils.Cmd; -import static se.leap.bitmaskclient.utils.PreferenceHelper.isBluetoothTetheringAllowed; -import static se.leap.bitmaskclient.utils.PreferenceHelper.isUsbTetheringAllowed; -import static se.leap.bitmaskclient.utils.PreferenceHelper.isWifiTetheringAllowed; +import static se.leap.bitmaskclient.base.utils.PreferenceHelper.isBluetoothTetheringAllowed; +import static se.leap.bitmaskclient.base.utils.PreferenceHelper.isUsbTetheringAllowed; +import static se.leap.bitmaskclient.base.utils.PreferenceHelper.isWifiTetheringAllowed; /** * This manager tries to figure out the current tethering states for Wifi, USB and Bluetooth diff --git a/app/src/main/res/layout-xlarge-port/a_add_provider.xml b/app/src/main/res/layout-xlarge-port/a_add_provider.xml index 2ec2f1b7..9d1614aa 100644 --- a/app/src/main/res/layout-xlarge-port/a_add_provider.xml +++ b/app/src/main/res/layout-xlarge-port/a_add_provider.xml @@ -5,7 +5,7 @@ style="@style/BitmaskActivity" android:layout_width="match_parent" android:layout_height="match_parent" - tools:context=".ProviderCredentialsBaseActivity"> + tools:context=".providersetup.activities.ProviderCredentialsBaseActivity"> <androidx.appcompat.widget.AppCompatImageView android:layout_width="match_parent" diff --git a/app/src/main/res/layout-xlarge-port/a_custom_provider_setup.xml b/app/src/main/res/layout-xlarge-port/a_custom_provider_setup.xml index 1f285968..da813a23 100644 --- a/app/src/main/res/layout-xlarge-port/a_custom_provider_setup.xml +++ b/app/src/main/res/layout-xlarge-port/a_custom_provider_setup.xml @@ -6,7 +6,7 @@ style="@style/BitmaskActivity" android:layout_width="match_parent" android:layout_height="match_parent" - tools:context=".CustomProviderSetupActivity"> + tools:context=".providersetup.activities.CustomProviderSetupActivity"> <androidx.appcompat.widget.AppCompatImageView android:layout_width="match_parent" diff --git a/app/src/main/res/layout-xlarge-port/a_provider_credentials.xml b/app/src/main/res/layout-xlarge-port/a_provider_credentials.xml index 73c2131c..75f6244a 100644 --- a/app/src/main/res/layout-xlarge-port/a_provider_credentials.xml +++ b/app/src/main/res/layout-xlarge-port/a_provider_credentials.xml @@ -5,7 +5,7 @@ style="@style/BitmaskActivity" android:layout_width="match_parent" android:layout_height="match_parent" - tools:context=".ProviderCredentialsBaseActivity"> + tools:context=".providersetup.activities.ProviderCredentialsBaseActivity"> <androidx.appcompat.widget.AppCompatImageView android:layout_width="match_parent" diff --git a/app/src/main/res/layout-xlarge-port/a_provider_detail.xml b/app/src/main/res/layout-xlarge-port/a_provider_detail.xml index cb2045c9..7d1e8444 100644 --- a/app/src/main/res/layout-xlarge-port/a_provider_detail.xml +++ b/app/src/main/res/layout-xlarge-port/a_provider_detail.xml @@ -5,7 +5,7 @@ android:id="@+id/provider_list_layout" android:layout_width="match_parent" android:layout_height="match_parent" - tools:context=".ProviderDetailActivity" + tools:context=".providersetup.ProviderDetailActivity" style="@style/BitmaskActivity"> <androidx.appcompat.widget.AppCompatImageView diff --git a/app/src/main/res/layout-xlarge-port/a_provider_list.xml b/app/src/main/res/layout-xlarge-port/a_provider_list.xml index 94829b42..87ca6427 100644 --- a/app/src/main/res/layout-xlarge-port/a_provider_list.xml +++ b/app/src/main/res/layout-xlarge-port/a_provider_list.xml @@ -6,7 +6,7 @@ style="@style/BitmaskActivity" android:layout_width="match_parent" android:layout_height="match_parent" - tools:context=".ProviderListActivity"> + tools:context=".providersetup.ProviderListActivity"> <androidx.appcompat.widget.AppCompatImageView android:layout_width="match_parent" diff --git a/app/src/main/res/layout-xlarge/a_add_provider.xml b/app/src/main/res/layout-xlarge/a_add_provider.xml index 8cfd43c5..e4ebdadf 100644 --- a/app/src/main/res/layout-xlarge/a_add_provider.xml +++ b/app/src/main/res/layout-xlarge/a_add_provider.xml @@ -5,7 +5,7 @@ style="@style/BitmaskActivity" android:layout_width="match_parent" android:layout_height="match_parent" - tools:context=".ProviderCredentialsBaseActivity"> + tools:context=".providersetup.activities.ProviderCredentialsBaseActivity"> <androidx.appcompat.widget.AppCompatImageView android:layout_width="match_parent" diff --git a/app/src/main/res/layout-xlarge/a_custom_provider_setup.xml b/app/src/main/res/layout-xlarge/a_custom_provider_setup.xml index 7c9a1798..23bf7d40 100644 --- a/app/src/main/res/layout-xlarge/a_custom_provider_setup.xml +++ b/app/src/main/res/layout-xlarge/a_custom_provider_setup.xml @@ -6,7 +6,7 @@ style="@style/BitmaskActivity" android:layout_width="match_parent" android:layout_height="match_parent" - tools:context=".CustomProviderSetupActivity"> + tools:context=".providersetup.activities.CustomProviderSetupActivity"> <androidx.appcompat.widget.AppCompatImageView android:layout_width="match_parent" diff --git a/app/src/main/res/layout-xlarge/a_provider_credentials.xml b/app/src/main/res/layout-xlarge/a_provider_credentials.xml index 2cf9e16a..c5b35fdc 100644 --- a/app/src/main/res/layout-xlarge/a_provider_credentials.xml +++ b/app/src/main/res/layout-xlarge/a_provider_credentials.xml @@ -5,7 +5,7 @@ style="@style/BitmaskActivity" android:layout_width="match_parent" android:layout_height="match_parent" - tools:context=".ProviderCredentialsBaseActivity"> + tools:context=".providersetup.activities.ProviderCredentialsBaseActivity"> <androidx.appcompat.widget.AppCompatImageView android:layout_width="match_parent" diff --git a/app/src/main/res/layout-xlarge/a_provider_detail.xml b/app/src/main/res/layout-xlarge/a_provider_detail.xml index bead7d92..59e9c18d 100644 --- a/app/src/main/res/layout-xlarge/a_provider_detail.xml +++ b/app/src/main/res/layout-xlarge/a_provider_detail.xml @@ -5,7 +5,7 @@ android:id="@+id/provider_list_layout" android:layout_width="match_parent" android:layout_height="match_parent" - tools:context=".ProviderDetailActivity" + tools:context=".providersetup.ProviderDetailActivity" style="@style/BitmaskActivity"> <androidx.appcompat.widget.AppCompatImageView diff --git a/app/src/main/res/layout-xlarge/a_provider_list.xml b/app/src/main/res/layout-xlarge/a_provider_list.xml index 58d75246..6504db10 100644 --- a/app/src/main/res/layout-xlarge/a_provider_list.xml +++ b/app/src/main/res/layout-xlarge/a_provider_list.xml @@ -6,7 +6,7 @@ style="@style/BitmaskActivity" android:layout_width="match_parent" android:layout_height="match_parent" - tools:context=".ProviderListActivity"> + tools:context=".providersetup.ProviderListActivity"> <androidx.appcompat.widget.AppCompatImageView android:layout_width="match_parent" diff --git a/app/src/main/res/layout-xlarge/f_about.xml b/app/src/main/res/layout-xlarge/f_about.xml index 1d915da4..704a7319 100644 --- a/app/src/main/res/layout-xlarge/f_about.xml +++ b/app/src/main/res/layout-xlarge/f_about.xml @@ -5,7 +5,7 @@ android:layout_height="match_parent" android:orientation="vertical" android:layout_marginLeft="12sp" - tools:context=".MainActivity" > + tools:context=".base.MainActivity" > <LinearLayout android:layout_width="match_parent" diff --git a/app/src/main/res/layout-xlarge/f_eip.xml b/app/src/main/res/layout-xlarge/f_eip.xml index fdaab8ca..d4a51b8d 100644 --- a/app/src/main/res/layout-xlarge/f_eip.xml +++ b/app/src/main/res/layout-xlarge/f_eip.xml @@ -69,7 +69,7 @@ app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" /> - <se.leap.bitmaskclient.views.VpnStateImage + <se.leap.bitmaskclient.base.views.VpnStateImage android:id="@+id/vpn_state_image" android:layout_width="0dp" android:layout_height="0dp" diff --git a/app/src/main/res/layout/a_add_provider.xml b/app/src/main/res/layout/a_add_provider.xml index eab1693e..c78db432 100644 --- a/app/src/main/res/layout/a_add_provider.xml +++ b/app/src/main/res/layout/a_add_provider.xml @@ -6,7 +6,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:padding="@dimen/stdpadding" - tools:context=".AddProviderActivity"> + tools:context=".providersetup.AddProviderActivity"> <LinearLayout android:id="@+id/content" @@ -18,7 +18,7 @@ android:orientation="vertical"> <!-- the header contains the mask--> - <se.leap.bitmaskclient.views.ProviderHeaderView + <se.leap.bitmaskclient.base.views.ProviderHeaderView android:id="@+id/header" android:layout_width="match_parent" android:layout_height="wrap_content"/> diff --git a/app/src/main/res/layout/a_add_provider_tablet_scrollview.xml b/app/src/main/res/layout/a_add_provider_tablet_scrollview.xml index 31c8d07c..4debbf9f 100644 --- a/app/src/main/res/layout/a_add_provider_tablet_scrollview.xml +++ b/app/src/main/res/layout/a_add_provider_tablet_scrollview.xml @@ -23,7 +23,7 @@ android:layout_height="wrap_content" android:orientation="vertical"> - <se.leap.bitmaskclient.views.ProviderHeaderView + <se.leap.bitmaskclient.base.views.ProviderHeaderView android:id="@+id/header" android:layout_width="match_parent" android:layout_height="wrap_content"/> diff --git a/app/src/main/res/layout/a_custom_provider_setup.xml b/app/src/main/res/layout/a_custom_provider_setup.xml index 34c59259..782537d9 100644 --- a/app/src/main/res/layout/a_custom_provider_setup.xml +++ b/app/src/main/res/layout/a_custom_provider_setup.xml @@ -4,7 +4,7 @@ android:id="@+id/custom_provider_setup_layout" android:layout_width="match_parent" android:layout_height="match_parent" - tools:context=".CustomProviderSetupActivity" + tools:context=".providersetup.activities.CustomProviderSetupActivity" android:padding="@dimen/stdpadding" style="@style/BitmaskActivity" > @@ -15,7 +15,7 @@ android:layout_height="0dp" android:layout_width="0dp" android:id="@id/content"> - <se.leap.bitmaskclient.views.ProviderHeaderView + <se.leap.bitmaskclient.base.views.ProviderHeaderView android:id="@+id/header" android:layout_width="match_parent" android:layout_height="wrap_content" diff --git a/app/src/main/res/layout/a_custom_provider_setup_tablet_linear_layout.xml b/app/src/main/res/layout/a_custom_provider_setup_tablet_linear_layout.xml index 9fb67092..4879c76f 100644 --- a/app/src/main/res/layout/a_custom_provider_setup_tablet_linear_layout.xml +++ b/app/src/main/res/layout/a_custom_provider_setup_tablet_linear_layout.xml @@ -18,7 +18,7 @@ android:layout_height="0dp" android:layout_width="0dp" android:id="@id/content"> - <se.leap.bitmaskclient.views.ProviderHeaderView + <se.leap.bitmaskclient.base.views.ProviderHeaderView android:id="@+id/header" android:layout_width="match_parent" android:layout_height="wrap_content" diff --git a/app/src/main/res/layout/a_main.xml b/app/src/main/res/layout/a_main.xml index 1977be74..4e921a9c 100644 --- a/app/src/main/res/layout/a_main.xml +++ b/app/src/main/res/layout/a_main.xml @@ -5,7 +5,7 @@ android:id="@+id/drawer_layout" android:layout_width="match_parent" android:layout_height="match_parent" - tools:context="se.leap.bitmaskclient.MainActivity"> + tools:context="se.leap.bitmaskclient.base.MainActivity"> <!-- As the main content view, the view below consumes the entire @@ -34,7 +34,7 @@ the container. --> <fragment android:id="@+id/navigation_drawer" - android:name="se.leap.bitmaskclient.drawer.NavigationDrawerFragment" + android:name="se.leap.bitmaskclient.base.drawer.NavigationDrawerFragment" android:layout_width="@dimen/navigation_drawer_width" android:layout_height="match_parent" android:layout_gravity="start" diff --git a/app/src/main/res/layout/a_provider_credentials.xml b/app/src/main/res/layout/a_provider_credentials.xml index 93f44208..b5dfa088 100644 --- a/app/src/main/res/layout/a_provider_credentials.xml +++ b/app/src/main/res/layout/a_provider_credentials.xml @@ -16,7 +16,7 @@ android:layout_height="match_parent" > - <se.leap.bitmaskclient.views.ProviderHeaderView + <se.leap.bitmaskclient.base.views.ProviderHeaderView android:id="@+id/header" android:layout_width="match_parent" android:layout_height="wrap_content" /> diff --git a/app/src/main/res/layout/a_provider_credentials_tablet_linear_layout.xml b/app/src/main/res/layout/a_provider_credentials_tablet_linear_layout.xml index bf022d51..ea0b6dd4 100644 --- a/app/src/main/res/layout/a_provider_credentials_tablet_linear_layout.xml +++ b/app/src/main/res/layout/a_provider_credentials_tablet_linear_layout.xml @@ -23,7 +23,7 @@ android:id="@+id/content" android:orientation="vertical"> - <se.leap.bitmaskclient.views.ProviderHeaderView + <se.leap.bitmaskclient.base.views.ProviderHeaderView android:id="@+id/header" android:layout_width="match_parent" android:layout_height="wrap_content"/> diff --git a/app/src/main/res/layout/a_provider_detail.xml b/app/src/main/res/layout/a_provider_detail.xml index 840d60df..bdc17ee9 100644 --- a/app/src/main/res/layout/a_provider_detail.xml +++ b/app/src/main/res/layout/a_provider_detail.xml @@ -15,7 +15,7 @@ android:layout_width="match_parent" android:layout_height="match_parent"> - <se.leap.bitmaskclient.views.ProviderHeaderView + <se.leap.bitmaskclient.base.views.ProviderHeaderView android:id="@+id/header" android:layout_width="match_parent" android:layout_height="wrap_content" /> diff --git a/app/src/main/res/layout/a_provider_detail_tablet_linear_layout.xml b/app/src/main/res/layout/a_provider_detail_tablet_linear_layout.xml index 51c5ab0f..0c7e02d1 100644 --- a/app/src/main/res/layout/a_provider_detail_tablet_linear_layout.xml +++ b/app/src/main/res/layout/a_provider_detail_tablet_linear_layout.xml @@ -23,7 +23,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content"> - <se.leap.bitmaskclient.views.ProviderHeaderView + <se.leap.bitmaskclient.base.views.ProviderHeaderView android:id="@+id/header" android:layout_width="match_parent" android:layout_height="wrap_content"/> diff --git a/app/src/main/res/layout/a_provider_list.xml b/app/src/main/res/layout/a_provider_list.xml index 2e2573eb..5d7efae7 100644 --- a/app/src/main/res/layout/a_provider_list.xml +++ b/app/src/main/res/layout/a_provider_list.xml @@ -3,7 +3,7 @@ android:id="@+id/provider_list_layout" android:layout_width="match_parent" android:layout_height="match_parent" - tools:context=".ProviderListActivity" + tools:context=".providersetup.ProviderListActivity" android:padding="@dimen/stdpadding" style="@style/BitmaskActivity" > @@ -15,7 +15,7 @@ android:layout_height="match_parent" android:orientation="vertical"> - <se.leap.bitmaskclient.views.ProviderHeaderView + <se.leap.bitmaskclient.base.views.ProviderHeaderView android:id="@+id/header" android:layout_width="match_parent" android:layout_height="wrap_content" /> diff --git a/app/src/main/res/layout/a_provider_list_tablet_linear_layout.xml b/app/src/main/res/layout/a_provider_list_tablet_linear_layout.xml index 107f25fb..487edd1d 100644 --- a/app/src/main/res/layout/a_provider_list_tablet_linear_layout.xml +++ b/app/src/main/res/layout/a_provider_list_tablet_linear_layout.xml @@ -22,7 +22,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content"> - <se.leap.bitmaskclient.views.ProviderHeaderView + <se.leap.bitmaskclient.base.views.ProviderHeaderView android:id="@+id/header" android:layout_width="match_parent" android:layout_height="wrap_content"/> diff --git a/app/src/main/res/layout/d_checkbox_confirm.xml b/app/src/main/res/layout/d_checkbox_confirm.xml index b2b61eca..f8aace6e 100644 --- a/app/src/main/res/layout/d_checkbox_confirm.xml +++ b/app/src/main/res/layout/d_checkbox_confirm.xml @@ -24,7 +24,7 @@ android:textStyle="bold" /> - <se.leap.bitmaskclient.views.IconTextView + <se.leap.bitmaskclient.base.views.IconTextView android:id="@+id/user_message" android:layout_width="match_parent" android:layout_height="wrap_content" diff --git a/app/src/main/res/layout/f_about.xml b/app/src/main/res/layout/f_about.xml index 22053054..ec7369ef 100644 --- a/app/src/main/res/layout/f_about.xml +++ b/app/src/main/res/layout/f_about.xml @@ -5,7 +5,7 @@ android:layout_height="match_parent" android:orientation="vertical" android:layout_marginLeft="8sp" - tools:context=".MainActivity" > + tools:context=".base.MainActivity" > <LinearLayout android:layout_width="match_parent" diff --git a/app/src/main/res/layout/f_drawer_main.xml b/app/src/main/res/layout/f_drawer_main.xml index 5a0977da..be60e620 100644 --- a/app/src/main/res/layout/f_drawer_main.xml +++ b/app/src/main/res/layout/f_drawer_main.xml @@ -4,7 +4,7 @@ android:layout_height="match_parent" android:layout_width="match_parent" android:background="@color/colorBackground" - tools:context="se.leap.bitmaskclient.drawer.NavigationDrawerFragment" + tools:context=".base.drawer.NavigationDrawerFragment" android:clickable="true" android:focusable="true" android:fillViewport="true" @@ -37,13 +37,13 @@ app:srcCompat="@drawable/drawer_logo" /> </FrameLayout> - <se.leap.bitmaskclient.views.IconTextEntry + <se.leap.bitmaskclient.base.views.IconTextEntry android:id="@+id/account" android:layout_height="wrap_content" android:layout_width="wrap_content" /> - <se.leap.bitmaskclient.views.IconTextEntry + <se.leap.bitmaskclient.base.views.IconTextEntry android:id="@+id/switch_provider" android:layout_height="wrap_content" android:layout_width="wrap_content" @@ -60,7 +60,7 @@ android:background="@color/black800_high_transparent" /> - <se.leap.bitmaskclient.views.IconSwitchEntry + <se.leap.bitmaskclient.base.views.IconSwitchEntry android:id="@+id/battery_switch" android:layout_width="wrap_content" android:layout_height="wrap_content" @@ -69,7 +69,7 @@ app:icon="@drawable/ic_battery_36" /> - <se.leap.bitmaskclient.views.IconSwitchEntry + <se.leap.bitmaskclient.base.views.IconSwitchEntry android:id="@+id/bridges_switch" android:layout_width="wrap_content" android:layout_height="wrap_content" @@ -79,7 +79,7 @@ android:visibility="gone" /> - <se.leap.bitmaskclient.views.IconTextEntry + <se.leap.bitmaskclient.base.views.IconTextEntry android:id="@+id/always_on_vpn" android:layout_width="wrap_content" android:layout_height="wrap_content" @@ -89,7 +89,7 @@ android:visibility="gone" /> - <se.leap.bitmaskclient.views.IconTextEntry + <se.leap.bitmaskclient.base.views.IconTextEntry android:id="@+id/exclude_apps" android:layout_width="wrap_content" android:layout_height="wrap_content" @@ -110,7 +110,7 @@ android:background="@color/black800_high_transparent" /> - <se.leap.bitmaskclient.views.IconSwitchEntry + <se.leap.bitmaskclient.base.views.IconSwitchEntry android:id="@+id/enableIPv6Firewall" android:layout_width="wrap_content" android:layout_height="wrap_content" @@ -121,7 +121,7 @@ tools:visibility="visible" /> - <se.leap.bitmaskclient.views.IconTextEntry + <se.leap.bitmaskclient.base.views.IconTextEntry android:id="@+id/tethering" android:layout_width="wrap_content" android:layout_height="wrap_content" @@ -141,7 +141,7 @@ tools:visibility="visible" /> - <se.leap.bitmaskclient.views.IconTextEntry + <se.leap.bitmaskclient.base.views.IconTextEntry android:id="@+id/donate" android:layout_width="wrap_content" android:layout_height="wrap_content" @@ -150,7 +150,7 @@ android:visibility="gone" /> - <se.leap.bitmaskclient.views.IconTextEntry + <se.leap.bitmaskclient.base.views.IconTextEntry android:id="@+id/log" android:layout_width="wrap_content" android:layout_height="wrap_content" @@ -158,7 +158,7 @@ app:icon="@drawable/ic_log_36" /> - <se.leap.bitmaskclient.views.IconTextEntry + <se.leap.bitmaskclient.base.views.IconTextEntry android:id="@+id/about" android:layout_width="wrap_content" android:layout_height="wrap_content" diff --git a/app/src/main/res/layout/f_eip.xml b/app/src/main/res/layout/f_eip.xml index 01feb0cd..3309eb5d 100644 --- a/app/src/main/res/layout/f_eip.xml +++ b/app/src/main/res/layout/f_eip.xml @@ -70,7 +70,7 @@ app:layout_constraintTop_toTopOf="parent" /> - <se.leap.bitmaskclient.views.VpnStateImage + <se.leap.bitmaskclient.base.views.VpnStateImage android:id="@+id/vpn_state_image" android:layout_width="0dp" android:layout_height="0dp" diff --git a/app/src/main/res/values/untranslatable.xml b/app/src/main/res/values/untranslatable.xml index 0d680b96..9c6afadd 100644 --- a/app/src/main/res/values/untranslatable.xml +++ b/app/src/main/res/values/untranslatable.xml @@ -44,4 +44,5 @@ <string name="circleImageView" translatable="false">CircleImageView</string> <string name="copyright_circleImageView" translatable="false">Copyright 2014 - 2020 Henning Dodenhof. Licensed under the Apache License, Version 2.0 </string> -</resources> + +</resources>
\ No newline at end of file |