From 67d63a1dcc2875638014c65cc24f140e10fb6c40 Mon Sep 17 00:00:00 2001 From: cyBerta Date: Fri, 17 Aug 2018 18:00:45 +0200 Subject: #8896 move preconfigured providers to flavor normal and custom --- app/assets/calyx.net.json | 37 ------------------- app/assets/calyx.net.pem | 31 ---------------- app/assets/demo.bitmask.net.json | 42 ---------------------- app/assets/demo.bitmask.net.pem | 32 ----------------- app/assets/riseup.net.json | 37 ------------------- app/assets/riseup.net.pem | 32 ----------------- app/assets/urls/calyx.net.url | 3 -- app/assets/urls/demo.bitmask.net.url | 3 -- app/assets/urls/riseup.net.url | 3 -- app/src/custom/assets/riseup.net.json | 37 +++++++++++++++++++ app/src/custom/assets/riseup.net.pem | 32 +++++++++++++++++ .../bitmaskclient/CustomProviderSetupActivity.java | 8 +++++ .../leap/bitmaskclient/ProviderSetupInterface.java | 8 +++++ app/src/normal/assets/calyx.net.json | 37 +++++++++++++++++++ app/src/normal/assets/calyx.net.pem | 31 ++++++++++++++++ app/src/normal/assets/demo.bitmask.net.json | 42 ++++++++++++++++++++++ app/src/normal/assets/demo.bitmask.net.pem | 32 +++++++++++++++++ app/src/normal/assets/riseup.net.json | 37 +++++++++++++++++++ app/src/normal/assets/riseup.net.pem | 32 +++++++++++++++++ app/src/normal/assets/urls/calyx.net.url | 3 ++ app/src/normal/assets/urls/demo.bitmask.net.url | 3 ++ app/src/normal/assets/urls/riseup.net.url | 3 ++ 22 files changed, 305 insertions(+), 220 deletions(-) delete mode 100644 app/assets/calyx.net.json delete mode 100644 app/assets/calyx.net.pem delete mode 100644 app/assets/demo.bitmask.net.json delete mode 100644 app/assets/demo.bitmask.net.pem delete mode 100644 app/assets/riseup.net.json delete mode 100644 app/assets/riseup.net.pem delete mode 100644 app/assets/urls/calyx.net.url delete mode 100644 app/assets/urls/demo.bitmask.net.url delete mode 100644 app/assets/urls/riseup.net.url create mode 100644 app/src/custom/assets/riseup.net.json create mode 100644 app/src/custom/assets/riseup.net.pem create mode 100644 app/src/main/java/se/leap/bitmaskclient/CustomProviderSetupActivity.java create mode 100644 app/src/main/java/se/leap/bitmaskclient/ProviderSetupInterface.java create mode 100644 app/src/normal/assets/calyx.net.json create mode 100644 app/src/normal/assets/calyx.net.pem create mode 100644 app/src/normal/assets/demo.bitmask.net.json create mode 100644 app/src/normal/assets/demo.bitmask.net.pem create mode 100644 app/src/normal/assets/riseup.net.json create mode 100644 app/src/normal/assets/riseup.net.pem create mode 100644 app/src/normal/assets/urls/calyx.net.url create mode 100644 app/src/normal/assets/urls/demo.bitmask.net.url create mode 100644 app/src/normal/assets/urls/riseup.net.url (limited to 'app') diff --git a/app/assets/calyx.net.json b/app/assets/calyx.net.json deleted file mode 100644 index 69e1c2a6..00000000 --- a/app/assets/calyx.net.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "api_uri": "https://api.calyx.net:4430", - "api_version": "1", - "ca_cert_fingerprint": "SHA256: 43683c9ba3862c5384a8c1885072fcac40b5d2d4dd67331443f13a3077fa2e69", - "ca_cert_uri": "https://calyx.net/ca.crt", - "default_language": "en", - "description": { - "en": "Calyx Institute privacy focused ISP testbed" - }, - "domain": "calyx.net", - "enrollment_policy": "open", - "languages": [ - "en" - ], - "name": { - "en": "calyx" - }, - "service": { - "allow_anonymous": false, - "allow_free": true, - "allow_limited_bandwidth": false, - "allow_paid": false, - "allow_registration": true, - "allow_unlimited_bandwidth": true, - "bandwidth_limit": 102400, - "default_service_level": 1, - "levels": { - "1": { - "description": "Please donate.", - "name": "free" - } - } - }, - "services": [ - "openvpn" - ] -} \ No newline at end of file diff --git a/app/assets/calyx.net.pem b/app/assets/calyx.net.pem deleted file mode 100644 index cedb2e38..00000000 --- a/app/assets/calyx.net.pem +++ /dev/null @@ -1,31 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIFYzCCA0ugAwIBAgIBATANBgkqhkiG9w0BAQ0FADBEMQ4wDAYDVQQKDAVjYWx5 -eDEaMBgGA1UECwwRaHR0cHM6Ly9jYWx5eC5uZXQxFjAUBg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ggIBAOpXi5o3g/2o2rPa53iG7Zgcy8RpePGgZk6xknGYWeLamEqSh+XWQZ2w -2kQP54bf8HfPj3ugJBWsVtYAs/ltJwzeBfYDrwEJd1N8tw2IRuGlQOWiTAVVLBj4 -Zs+dikSuMoA399f/7BlUIEpVLUiV/emTtbkjFnDeKEV9zql6ypR0BtR8Knf8ALvL -YfMsWLvTe4rXeypzxIaE2pn8ttcXLYAX0ml2MofTi5xcDhMn1vznKIvs82xhncQx -I1MJMWqPHNHgJUJpA+y1IFh5LPbpag9PKQ0yQ9sM+/dyGumF2jElsMw71flh/Txr -2dEv8+FNV1pPK26XJZBK24rNWFs30eAFfH9EQCwVla174I4PDoWqsIR7vtQMObDt -Bq34R3TjjJJIt2sCSlYLooWwiK7Q+d/SgYqA+MSDmmwhzm86ToK6cwbCsvuw1AxR -X6VIs4U8wOotgljzX/CSpKqlxcqZjhnAuelZ1+KiN8RHKPj7AzSLYOv/YwTjLTIq -EOxquoNR58uDa5pBG22a7xWbSaKosn/mEl8SrUr6klzzc8Vh09IMoxrw74uLdAg2 -1jnrhm7qg91Ttb0aXiqbV+Kg/qQzojdewnnoBFnv4jaQ3y8zDCfMhsBtWlWz4Knb -Zqga1WyRm3Gj1j6IV0oOincYMrw5YA7bgXpwop/Lo/mmliMA14ps ------END CERTIFICATE----- \ No newline at end of file diff --git a/app/assets/demo.bitmask.net.json b/app/assets/demo.bitmask.net.json deleted file mode 100644 index e7fe6099..00000000 --- a/app/assets/demo.bitmask.net.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "api_uri": "https://api.demo.bitmask.net:4430", - "api_version": "1", - "ca_cert_fingerprint": "SHA256: 0f17c033115f6b76ff67871872303ff65034efe7dd1b910062ca323eb4da5c7e", - "ca_cert_uri": "https://demo.bitmask.net/ca.crt", - "default_language": "en", - "description": { - "el": "demo.bitmask.net allows you to test the Bitmask application. User accounts may be periodically deleted.", - "en": "demo.bitmask.net allows you to test the Bitmask application. User accounts may be periodically deleted.", - "es": "demo.bitmask.net allows you to test the Bitmask application. User accounts may be periodically deleted." - }, - "domain": "demo.bitmask.net", - "enrollment_policy": "open", - "languages": [ - "de", - "en", - "es", - "pt" - ], - "name": { - "en": "Bitmask" - }, - "service": { - "allow_anonymous": true, - "allow_free": true, - "allow_limited_bandwidth": false, - "allow_paid": false, - "allow_registration": true, - "allow_unlimited_bandwidth": true, - "bandwidth_limit": 102400, - "default_service_level": 1, - "levels": { - "1": { - "description": "Please donate.", - "name": "free" - } - } - }, - "services": [ - "openvpn" - ] -} \ No newline at end of file diff --git a/app/assets/demo.bitmask.net.pem b/app/assets/demo.bitmask.net.pem deleted file mode 100644 index 9a422161..00000000 --- a/app/assets/demo.bitmask.net.pem +++ /dev/null @@ -1,32 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIFbzCCA1egAwIBAgIBATANBgkqhkiG9w0BAQ0FADBKMRgwFgYDVQQDDA9CaXRt -YXNrIFJvb3QgQ0ExEDAOBgNVBAoMB0JpdG1hc2sxHDAaBgNVBAsME2h0dHBzOi8v -Yml0bWFzay5uZXQwHhcNMTIxMTA2MDAwMDAwWhcNMjIxMTA2MDAwMDAwWjBKMRgw -FgYDVQQDDA9CaXRtYXNrIFJvb3QgQ0ExEDAOBgNVBAoMB0JpdG1hc2sxHDAaBgNV -BAsME2h0dHBzOi8vYml0bWFzay5uZXQwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAw -ggIKAoICAQC1eV4YvayaU+maJbWrD4OHo3d7S1BtDlcvkIRS1Fw3iYDjsyDkZxai -dHp4EUasfNQ+EVtXUvtk6170EmLco6Elg8SJBQ27trE6nielPRPCfX3fQzETRfvB -7tNvGw4Jn2YKiYoMD79kkjgyZjkJ2r/bEHUSevmR09BRp86syHZerdNGpXYhcQ84 -CA1+V+603GFIHnrP+uQDdssW93rgDNYu+exT+Wj6STfnUkugyjmPRPjL7wh0tzy+ -znCeLl4xiV3g9sjPnc7r2EQKd5uaTe3j71sDPF92KRk0SSUndREz+B1+Dbe/R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Lvxdk6q37kIFnWCd8L3kmES5q4wjyFK47Co -Ja8zlx64jmMZPg/t3wWqkZgXZ14qnbyG5/lGsj5CwVtfDljrhN0oCWK1FZaUmW3d -69db12/g4f6phldhxiWuGC/W6fCW5kre7nmhshcltqAJJuU47iX+DarBFiIj816e -yV8e ------END CERTIFICATE----- \ No newline at end of file diff --git a/app/assets/riseup.net.json b/app/assets/riseup.net.json deleted file mode 100644 index 82290ecd..00000000 --- a/app/assets/riseup.net.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "api_uri": "https://api.black.riseup.net:443", - "api_version": "1", - "ca_cert_fingerprint": "SHA256: a5244308a1374709a9afce95e3ae47c1b44bc2398c0a70ccbf8b3a8a97f29494", - "ca_cert_uri": "https://black.riseup.net/ca.crt", - "default_language": "en", - "description": { - "en": "Riseup is a non-profit collective in Seattle that provides online communication tools for people and groups working toward liberatory social change." - }, - "domain": "riseup.net", - "enrollment_policy": "open", - "languages": [ - "en" - ], - "name": { - "en": "Riseup Networks" - }, - "service": { - "allow_anonymous": true, - "allow_free": true, - "allow_limited_bandwidth": false, - "allow_paid": false, - "allow_registration": true, - "allow_unlimited_bandwidth": true, - "bandwidth_limit": 102400, - "default_service_level": 1, - "levels": { - "1": { - "description": "Please donate.", - "name": "free" - } - } - }, - "services": [ - "openvpn" - ] -} \ No newline at end of file diff --git a/app/assets/riseup.net.pem b/app/assets/riseup.net.pem deleted file mode 100644 index c890aff4..00000000 --- a/app/assets/riseup.net.pem +++ /dev/null @@ -1,32 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIFjTCCA3WgAwIBAgIBATANBgkqhkiG9w0BAQ0FADBZMRgwFgYDVQQKDA9SaXNl -dXAgTmV0d29ya3MxGzAZBgNVBAsMEmh0dHBzOi8vcmlzZXVwLm5ldDEgMB4GA1UE -AwwXUmlzZXVwIE5ldHdvcmtzIFJvb3QgQ0EwHhcNMTQwNDI4MDAwMDAwWhcNMjQw -NDI4MDAwMDAwWjBZMRgwFgYDVQQKD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SXiS8jx1j/6/Luk6PpFbT7QYm4QLs1f4BlfZOti2KE8r7KRDPIecUsUXW6P/ -3GJAVYH/+7OjA39za9AieM7+H5BELGccGrM5wfl7JeEz8in+V2ZWDzHQO4hMkiTQ -4ZckuaL201F68YpiItBNnJ9N5nHr1MRiGyApHmLXY/wvlrOpclh95qn+lG6/2jk7 -3AmihLOKYMlPwPakJg4PYczm3icFLgTpjV5sq2md9bRyAg3oPGfAuWHmKj2Ikqch -Td5CHKGxEEWbGUWEMP0s1A/JHWiCbDigc4Cfxhy56CWG4q0tYtnc2GMw8OAUO6Wf -Xu5pYKNkzKSEtT/MrNJt44tTZWbKV/Pi/N2Fx36my7TgTUj7g3xcE9eF4JV2H/sg -tsK3pwE0FEqGnT4qMFbixQmc8bGyuakr23wjMvfO7eZUxBuWYR2SkcP26sozF9PF -tGhbZHQVGZUTVPyvwahMUEhbPGVerOW0IYpxkm0x/eaWdTc4vPpf/rIlgbAjarnJ -UN9SaWRlWKSdP4haujnzCoJbM7dU9bjvlGZNyXEekgeT0W2qFeGGp+yyUWw8tNsp -0BuC1b7uW/bBn/xKm319wXVDvBgZgcktMolak39V7DVO ------END CERTIFICATE----- \ No newline at end of file diff --git a/app/assets/urls/calyx.net.url b/app/assets/urls/calyx.net.url deleted file mode 100644 index 807e9e18..00000000 --- a/app/assets/urls/calyx.net.url +++ /dev/null @@ -1,3 +0,0 @@ -{ - "main_url" : "https://calyx.net" -} diff --git a/app/assets/urls/demo.bitmask.net.url b/app/assets/urls/demo.bitmask.net.url deleted file mode 100644 index 0c4de648..00000000 --- a/app/assets/urls/demo.bitmask.net.url +++ /dev/null @@ -1,3 +0,0 @@ -{ - "main_url" : "https://demo.bitmask.net" -} diff --git a/app/assets/urls/riseup.net.url b/app/assets/urls/riseup.net.url deleted file mode 100644 index 42cdb979..00000000 --- a/app/assets/urls/riseup.net.url +++ /dev/null @@ -1,3 +0,0 @@ -{ - "main_url" : "https://riseup.net" -} diff --git a/app/src/custom/assets/riseup.net.json b/app/src/custom/assets/riseup.net.json new file mode 100644 index 00000000..82290ecd --- /dev/null +++ b/app/src/custom/assets/riseup.net.json @@ -0,0 +1,37 @@ +{ + "api_uri": "https://api.black.riseup.net:443", + "api_version": "1", + "ca_cert_fingerprint": "SHA256: a5244308a1374709a9afce95e3ae47c1b44bc2398c0a70ccbf8b3a8a97f29494", + "ca_cert_uri": "https://black.riseup.net/ca.crt", + "default_language": "en", + "description": { + "en": "Riseup is a non-profit collective in Seattle that provides online communication tools for people and groups working toward liberatory social change." + }, + "domain": "riseup.net", + "enrollment_policy": "open", + "languages": [ + "en" + ], + "name": { + "en": "Riseup Networks" + }, + "service": { + "allow_anonymous": true, + "allow_free": true, + "allow_limited_bandwidth": false, + "allow_paid": false, + "allow_registration": true, + "allow_unlimited_bandwidth": true, + "bandwidth_limit": 102400, + "default_service_level": 1, + "levels": { + "1": { + "description": "Please donate.", + "name": "free" + } + } + }, + "services": [ + "openvpn" + ] +} \ No newline at end of file diff --git a/app/src/custom/assets/riseup.net.pem b/app/src/custom/assets/riseup.net.pem new file mode 100644 index 00000000..c890aff4 --- /dev/null +++ b/app/src/custom/assets/riseup.net.pem @@ -0,0 +1,32 @@ +-----BEGIN CERTIFICATE----- +MIIFjTCCA3WgAwIBAgIBATANBgkqhkiG9w0BAQ0FADBZMRgwFgYDVQQKDA9SaXNl +dXAgTmV0d29ya3MxGzAZBgNVBAsMEmh0dHBzOi8vcmlzZXVwLm5ldDEgMB4GA1UE +AwwXUmlzZXVwIE5ldHdvcmtzIFJvb3QgQ0EwHhcNMTQwNDI4MDAwMDAwWhcNMjQw +NDI4MDAwMDAwWjBZMRgwFgYDVQQKDA9SaXNldXAgTmV0d29ya3MxGzAZBgNVBAsM +Emh0dHBzOi8vcmlzZXVwLm5ldDEgMB4GA1UEAwwXUmlzZXVwIE5ldHdvcmtzIFJv +b3QgQ0EwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC76J4ciMJ8Sg0m +TP7DF2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n+lG6/2jk7 +3AmihLOKYMlPwPakJg4PYczm3icFLgTpjV5sq2md9bRyAg3oPGfAuWHmKj2Ikqch +Td5CHKGxEEWbGUWEMP0s1A/JHWiCbDigc4Cfxhy56CWG4q0tYtnc2GMw8OAUO6Wf +Xu5pYKNkzKSEtT/MrNJt44tTZWbKV/Pi/N2Fx36my7TgTUj7g3xcE9eF4JV2H/sg +tsK3pwE0FEqGnT4qMFbixQmc8bGyuakr23wjMvfO7eZUxBuWYR2SkcP26sozF9PF +tGhbZHQVGZUTVPyvwahMUEhbPGVerOW0IYpxkm0x/eaWdTc4vPpf/rIlgbAjarnJ +UN9SaWRlWKSdP4haujnzCoJbM7dU9bjvlGZNyXEekgeT0W2qFeGGp+yyUWw8tNsp +0BuC1b7uW/bBn/xKm319wXVDvBgZgcktMolak39V7DVO +-----END CERTIFICATE----- \ No newline at end of file diff --git a/app/src/main/java/se/leap/bitmaskclient/CustomProviderSetupActivity.java b/app/src/main/java/se/leap/bitmaskclient/CustomProviderSetupActivity.java new file mode 100644 index 00000000..3d4f801b --- /dev/null +++ b/app/src/main/java/se/leap/bitmaskclient/CustomProviderSetupActivity.java @@ -0,0 +1,8 @@ +package se.leap.bitmaskclient; + +/** + * Created by cyberta on 17.08.18. + */ + +public class CustomProviderSetupActivity { +} diff --git a/app/src/main/java/se/leap/bitmaskclient/ProviderSetupInterface.java b/app/src/main/java/se/leap/bitmaskclient/ProviderSetupInterface.java new file mode 100644 index 00000000..30277b0e --- /dev/null +++ b/app/src/main/java/se/leap/bitmaskclient/ProviderSetupInterface.java @@ -0,0 +1,8 @@ +package se.leap.bitmaskclient; + +/** + * Created by cyberta on 17.08.18. + */ + +public interface ProviderSetupInterface { +} diff --git a/app/src/normal/assets/calyx.net.json b/app/src/normal/assets/calyx.net.json new file mode 100644 index 00000000..69e1c2a6 --- /dev/null +++ b/app/src/normal/assets/calyx.net.json @@ -0,0 +1,37 @@ +{ + "api_uri": "https://api.calyx.net:4430", + "api_version": "1", + "ca_cert_fingerprint": "SHA256: 43683c9ba3862c5384a8c1885072fcac40b5d2d4dd67331443f13a3077fa2e69", + "ca_cert_uri": "https://calyx.net/ca.crt", + "default_language": "en", + "description": { + "en": "Calyx Institute privacy focused ISP testbed" + }, + "domain": "calyx.net", + "enrollment_policy": "open", + "languages": [ + "en" + ], + "name": { + "en": "calyx" + }, + "service": { + "allow_anonymous": false, + "allow_free": true, + "allow_limited_bandwidth": false, + "allow_paid": false, + "allow_registration": true, + "allow_unlimited_bandwidth": true, + "bandwidth_limit": 102400, + "default_service_level": 1, + "levels": { + "1": { + "description": "Please donate.", + "name": "free" + } + } + }, + "services": [ + "openvpn" + ] +} \ No newline at end of file diff --git a/app/src/normal/assets/calyx.net.pem b/app/src/normal/assets/calyx.net.pem new file mode 100644 index 00000000..cedb2e38 --- /dev/null +++ b/app/src/normal/assets/calyx.net.pem @@ -0,0 +1,31 @@ +-----BEGIN CERTIFICATE----- +MIIFYzCCA0ugAwIBAgIBATANBgkqhkiG9w0BAQ0FADBEMQ4wDAYDVQQKDAVjYWx5 +eDEaMBgGA1UECwwRaHR0cHM6Ly9jYWx5eC5uZXQxFjAUBgNVBAMMDWNhbHl4IFJv +b3QgQ0EwHhcNMTMwNzAyMDAwMDAwWhcNMjMwNzAyMDAwMDAwWjBEMQ4wDAYDVQQK +DAVjYWx5eDEaMBgGA1UECwwRaHR0cHM6Ly9jYWx5eC5uZXQxFjAUBgNVBAMMDWNh +bHl4IFJvb3QgQ0EwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDupdnx +Bgat537XOqrZOulE/RvjoXB1S07sy9/MMtksXFoQuWJZRCSTp1Jaqg3H/e9o1nct +LQO91+izfJe07TUyajFl7CfllYgMeyKTYcT85dFwNX4pcIHZr8UpmO0MpGBoR4W1 +8cPa3vxAG0CsyUmrASJVyhRouk4qazRosM5RwBxTdMzCK7L3SwqPQoxlY9YmRJlD +XYZlK5VMJd0dj9XxhMeFs5n43R0bsDENryrExSbux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Is4U8wOotgljzX/CSpKqlxcqZjhnAuelZ1+KiN8RHKPj7AzSLYOv/YwTjLTIq +EOxquoNR58uDa5pBG22a7xWbSaKosn/mEl8SrUr6klzzc8Vh09IMoxrw74uLdAg2 +1jnrhm7qg91Ttb0aXiqbV+Kg/qQzojdewnnoBFnv4jaQ3y8zDCfMhsBtWlWz4Knb +Zqga1WyRm3Gj1j6IV0oOincYMrw5YA7bgXpwop/Lo/mmliMA14ps +-----END CERTIFICATE----- \ No newline at end of file diff --git a/app/src/normal/assets/demo.bitmask.net.json b/app/src/normal/assets/demo.bitmask.net.json new file mode 100644 index 00000000..e7fe6099 --- /dev/null +++ b/app/src/normal/assets/demo.bitmask.net.json @@ -0,0 +1,42 @@ +{ + "api_uri": "https://api.demo.bitmask.net:4430", + "api_version": "1", + "ca_cert_fingerprint": "SHA256: 0f17c033115f6b76ff67871872303ff65034efe7dd1b910062ca323eb4da5c7e", + "ca_cert_uri": "https://demo.bitmask.net/ca.crt", + "default_language": "en", + "description": { + "el": "demo.bitmask.net allows you to test the Bitmask application. User accounts may be periodically deleted.", + "en": "demo.bitmask.net allows you to test the Bitmask application. User accounts may be periodically deleted.", + "es": "demo.bitmask.net allows you to test the Bitmask application. User accounts may be periodically deleted." + }, + "domain": "demo.bitmask.net", + "enrollment_policy": "open", + "languages": [ + "de", + "en", + "es", + "pt" + ], + "name": { + "en": "Bitmask" + }, + "service": { + "allow_anonymous": true, + "allow_free": true, + "allow_limited_bandwidth": false, + "allow_paid": false, + "allow_registration": true, + "allow_unlimited_bandwidth": true, + "bandwidth_limit": 102400, + "default_service_level": 1, + "levels": { + "1": { + "description": "Please donate.", + "name": "free" + } + } + }, + "services": [ + "openvpn" + ] +} \ No newline at end of file diff --git a/app/src/normal/assets/demo.bitmask.net.pem b/app/src/normal/assets/demo.bitmask.net.pem new file mode 100644 index 00000000..9a422161 --- /dev/null +++ b/app/src/normal/assets/demo.bitmask.net.pem @@ -0,0 +1,32 @@ +-----BEGIN CERTIFIC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DLL2sswnYpHHvProt1JU+D48wDgYDVR0PAQH/BAQDAgIE +MAwGA1UdEwQFMAMBAf8wHwYDVR0jBBgwFoAUuYGDLL2sswnYpHHvProt1JU+D48w +DQYJKoZIhvcNAQENBQADggIBADeG67vaFcbITGpi51264kHPYPEWaXUa5XYbtmBl +cXYyB6hY5hv/YNuVGJ1gWsDmdeXEyj0j2icGQjYdHRfwhrbEri+h1EZOm1cSBDuY +k/P5+ctHyOXx8IE79DBsZ6IL61UKIaKhqZBfLGYcWu17DVV6+LT+AKtHhOrv3TSj +RnAcKnCbKqXLhUPXpK0eTjPYS2zQGQGIhIy9sQXVXJJJsGrPgMxna1Xw2JikBOCG +htD/JKwt6xBmNwktH0GI/LVtVgSp82Clbn9C4eZN9E5YbVYjLkIEDhpByeC71QhX +EIQ0ZR56bFuJA/CwValBqV/G9gscTPQqd+iETp8yrFpAVHOW+YzSFbxjTEkBte1J +aF0vmbqdMAWLk+LEFPQRptZh0B88igtx6tV5oVd+p5IVRM49poLhuPNJGPvMj99l +mlZ4+AeRUnbOOeAEuvpLJbel4rhwFzmUiGoeTVoPZyMevWcVFq6BMkS+jRR2w0jK +G6b0v5XDHlcFYPOgUrtsOBFJVwbutLvxdk6q37kIFnWCd8L3kmES5q4wjyFK47Co +Ja8zlx64jmMZPg/t3wWqkZgXZ14qnbyG5/lGsj5CwVtfDljrhN0oCWK1FZaUmW3d +69db12/g4f6phldhxiWuGC/W6fCW5kre7nmhshcltqAJJuU47iX+DarBFiIj816e +yV8e +-----END CERTIFICATE----- \ No newline at end of file diff --git a/app/src/normal/assets/riseup.net.json b/app/src/normal/assets/riseup.net.json new file mode 100644 index 00000000..82290ecd --- /dev/null +++ b/app/src/normal/assets/riseup.net.json @@ -0,0 +1,37 @@ +{ + "api_uri": "https://api.black.riseup.net:443", + "api_version": "1", + "ca_cert_fingerprint": "SHA256: a5244308a1374709a9afce95e3ae47c1b44bc2398c0a70ccbf8b3a8a97f29494", + "ca_cert_uri": "https://black.riseup.net/ca.crt", + "default_language": "en", + "description": { + "en": "Riseup is a non-profit collective in Seattle that provides online communication tools for people and groups working toward liberatory social change." + }, + "domain": "riseup.net", + "enrollment_policy": "open", + "languages": [ + "en" + ], + "name": { + "en": "Riseup Networks" + }, + "service": { + "allow_anonymous": true, + "allow_free": true, + "allow_limited_bandwidth": false, + "allow_paid": false, + "allow_registration": true, + "allow_unlimited_bandwidth": true, + "bandwidth_limit": 102400, + "default_service_level": 1, + "levels": { + "1": { + "description": "Please donate.", + "name": "free" + } + } + }, + "services": [ + "openvpn" + ] +} \ No newline at end of file diff --git a/app/src/normal/assets/riseup.net.pem b/app/src/normal/assets/riseup.net.pem new file mode 100644 index 00000000..c890aff4 --- /dev/null +++ b/app/src/normal/assets/riseup.net.pem @@ -0,0 +1,32 @@ +-----BEGIN CERTIFICATE----- +MIIFjTCCA3WgAwIBAgIBATANBgkqhkiG9w0BAQ0FADBZMRgwFgYDVQQKDA9SaXNl +dXAgTmV0d29ya3MxGzAZBgNVBAsMEmh0dHBzOi8vcmlzZXVwLm5ldDEgMB4GA1UE +AwwXUmlzZXVwIE5ldHdvcmtzIFJvb3QgQ0EwHhcNMTQwNDI4MDAwMDAwWhcNMjQw +NDI4MDAwMDAwWjBZMRgwFgYDVQQKDA9SaXNldXAgTmV0d29ya3MxGzAZBgNVBAsM +Emh0dHBzOi8vcmlzZXVwLm5ldDEgMB4GA1UEAwwXUmlzZXVwIE5ldHdvcmtzIFJv +b3QgQ0EwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC76J4ciMJ8Sg0m +TP7DF2DT9zNe0Csk4myoMFC57rfJeqsAlJCv1XMzBmXrw8wq/9z7XHv6n/0sWU7a +7cF2hLR33ktjwODlx7vorU39/lXLndo492ZBhXQtG1INMShyv+nlmzO6GT7ESfNE +LliFitEzwIegpMqxCIHXFuobGSCWF4N0qLHkq/SYUMoOJ96O3hmPSl1kFDRMtWXY +iw1SEKjUvpyDJpVs3NGxeLCaA7bAWh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3pwE0FEqGnT4qMFbixQmc8bGyuakr23wjMvfO7eZUxBuWYR2SkcP26sozF9PF +tGhbZHQVGZUTVPyvwahMUEhbPGVerOW0IYpxkm0x/eaWdTc4vPpf/rIlgbAjarnJ +UN9SaWRlWKSdP4haujnzCoJbM7dU9bjvlGZNyXEekgeT0W2qFeGGp+yyUWw8tNsp +0BuC1b7uW/bBn/xKm319wXVDvBgZgcktMolak39V7DVO +-----END CERTIFICATE----- \ No newline at end of file diff --git a/app/src/normal/assets/urls/calyx.net.url b/app/src/normal/assets/urls/calyx.net.url new file mode 100644 index 00000000..807e9e18 --- /dev/null +++ b/app/src/normal/assets/urls/calyx.net.url @@ -0,0 +1,3 @@ +{ + "main_url" : "https://calyx.net" +} diff --git a/app/src/normal/assets/urls/demo.bitmask.net.url b/app/src/normal/assets/urls/demo.bitmask.net.url new file mode 100644 index 00000000..0c4de648 --- /dev/null +++ b/app/src/normal/assets/urls/demo.bitmask.net.url @@ -0,0 +1,3 @@ +{ + "main_url" : "https://demo.bitmask.net" +} diff --git a/app/src/normal/assets/urls/riseup.net.url b/app/src/normal/assets/urls/riseup.net.url new file mode 100644 index 00000000..42cdb979 --- /dev/null +++ b/app/src/normal/assets/urls/riseup.net.url @@ -0,0 +1,3 @@ +{ + "main_url" : "https://riseup.net" +} -- cgit v1.2.3 From c5f6902399bcb6ebbd56489c70c51912f7ccca0c Mon Sep 17 00:00:00 2001 From: cyBerta Date: Fri, 17 Aug 2018 18:01:53 +0200 Subject: rename custom/normal flavor dimension to branding --- app/build.gradle | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'app') diff --git a/app/build.gradle b/app/build.gradle index 53af1aff..75fe40b5 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -44,7 +44,7 @@ android { } } - flavorDimensions "mode","implementation" + flavorDimensions "branding", "implementation" productFlavors { production { dimension "implementation" @@ -53,15 +53,19 @@ android { dimension "implementation" } normal { - dimension "mode" + dimension "branding" } + + + //************************************************************************** + //************************************************************************** //Configurations for custom branded app. custom { - dimension "mode" + dimension "branding" //Change the package name as needed - applicationId "org.sample.custom" + applicationId "net.riseup.black" //Set app name here - appName = "Custom" + appName = "Riseup VPN" resValue "string", "app_name", appName //Change the versionCode as needed versionCode 1 @@ -78,8 +82,10 @@ android { buildConfigField 'boolean', 'enable_donation_reminder', 'true' //The duration in days to trigger the donation reminder buildConfigField 'int', 'donation_reminder_duration', '30' - } + //************************************************************************** + //************************************************************************** + } buildTypes { -- cgit v1.2.3 From 52486b7940dc9cc302fdb7360b3b8d3fc1b49847 Mon Sep 17 00:00:00 2001 From: cyBerta Date: Fri, 17 Aug 2018 18:15:04 +0200 Subject: #8896 get rid of intent member variable as state holder... && extract ProviderApi broadcast receiver for reuse --- .../leap/bitmaskclient/ProviderListActivity.java | 5 +- .../ProviderApiSetupBroadcastReceiver.java | 63 ++++++++++ .../bitmaskclient/ProviderListBaseActivity.java | 129 ++++++++------------- .../leap/bitmaskclient/ProviderSetupInterface.java | 16 +++ .../leap/bitmaskclient/ProviderListActivity.java | 8 +- 5 files changed, 132 insertions(+), 89 deletions(-) create mode 100644 app/src/main/java/se/leap/bitmaskclient/ProviderApiSetupBroadcastReceiver.java (limited to 'app') diff --git a/app/src/insecure/java/se/leap/bitmaskclient/ProviderListActivity.java b/app/src/insecure/java/se/leap/bitmaskclient/ProviderListActivity.java index 3190d651..9107e641 100644 --- a/app/src/insecure/java/se/leap/bitmaskclient/ProviderListActivity.java +++ b/app/src/insecure/java/se/leap/bitmaskclient/ProviderListActivity.java @@ -27,6 +27,7 @@ import java.net.URL; import se.leap.bitmaskclient.ProviderListContent.ProviderItem; import static se.leap.bitmaskclient.ProviderAPI.SET_UP_PROVIDER; +import static se.leap.bitmaskclient.ProviderSetupInterface.ProviderConfigState.SETTING_UP_PROVIDER; /** * Activity that builds and shows the list of known available providers. @@ -56,7 +57,7 @@ public class ProviderListActivity extends ProviderListBaseActivity { * @param danger_on tells if HTTPS client should bypass certificate errors */ public void setUpProvider(boolean danger_on) { - configState.setAction(SETTING_UP_PROVIDER); + providerConfigState = SETTING_UP_PROVIDER; Bundle parameters = new Bundle(); parameters.putBoolean(ProviderItem.DANGER_ON, danger_on); @@ -69,7 +70,7 @@ public class ProviderListActivity extends ProviderListBaseActivity { */ @Override public void retrySetUpProvider(@NonNull Provider provider) { - configState.setAction(SETTING_UP_PROVIDER); + providerConfigState = SETTING_UP_PROVIDER; ProviderAPICommand.execute(this, SET_UP_PROVIDER, provider); } diff --git a/app/src/main/java/se/leap/bitmaskclient/ProviderApiSetupBroadcastReceiver.java b/app/src/main/java/se/leap/bitmaskclient/ProviderApiSetupBroadcastReceiver.java new file mode 100644 index 00000000..6ae44013 --- /dev/null +++ b/app/src/main/java/se/leap/bitmaskclient/ProviderApiSetupBroadcastReceiver.java @@ -0,0 +1,63 @@ +package se.leap.bitmaskclient; + +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import android.os.Bundle; +import android.util.Log; + +import se.leap.bitmaskclient.ProviderSetupInterface.ProviderConfigState; + +/** + * Broadcast receiver that handles callback intents of ProviderApi during provider setup. + * It is used by CustomProviderSetupActivity for custom branded apps and ProviderListActivity + * for 'normal' Bitmask. + * + * Created by cyberta on 17.08.18. + */ + +public class ProviderApiSetupBroadcastReceiver extends BroadcastReceiver { + private final ProviderSetupInterface setupInterface; + + public ProviderApiSetupBroadcastReceiver(ProviderSetupInterface setupInterface) { + this.setupInterface = setupInterface; + } + + @Override + public void onReceive(Context context, Intent intent) { + Log.d(ProviderListBaseActivity.TAG, "received Broadcast"); + + String action = intent.getAction(); + if (action == null || !action.equalsIgnoreCase(Constants.BROADCAST_PROVIDER_API_EVENT)) { + return; + } + + if (setupInterface.getConfigState() != null && + setupInterface.getConfigState() == ProviderConfigState.SETTING_UP_PROVIDER) { + int resultCode = intent.getIntExtra(Constants.BROADCAST_RESULT_CODE, ProviderListBaseActivity.RESULT_CANCELED); + Log.d(ProviderListBaseActivity.TAG, "Broadcast resultCode: " + Integer.toString(resultCode)); + + Bundle resultData = intent.getParcelableExtra(Constants.BROADCAST_RESULT_KEY); + Provider handledProvider = resultData.getParcelable(Constants.PROVIDER_KEY); + + if (handledProvider != null && setupInterface.getProvider() != null && + handledProvider.getDomain().equalsIgnoreCase(setupInterface.getProvider().getDomain())) { + switch (resultCode) { + case ProviderAPI.PROVIDER_OK: + setupInterface.handleProviderSetUp(handledProvider); + break; + case ProviderAPI.PROVIDER_NOK: + setupInterface.handleProviderSetupFailed(resultData); + break; + case ProviderAPI.CORRECTLY_DOWNLOADED_VPN_CERTIFICATE: + setupInterface.handleCorrectlyDownloadedCertificate(handledProvider); + break; + case ProviderAPI.INCORRECTLY_DOWNLOADED_VPN_CERTIFICATE: + setupInterface.handleIncorrectlyDownloadedCertificate(); + break; + } + } + } + } + +} \ No newline at end of file diff --git a/app/src/main/java/se/leap/bitmaskclient/ProviderListBaseActivity.java b/app/src/main/java/se/leap/bitmaskclient/ProviderListBaseActivity.java index cc8aceec..c786a6fa 100644 --- a/app/src/main/java/se/leap/bitmaskclient/ProviderListBaseActivity.java +++ b/app/src/main/java/se/leap/bitmaskclient/ProviderListBaseActivity.java @@ -17,8 +17,6 @@ package se.leap.bitmaskclient; -import android.content.BroadcastReceiver; -import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.os.Bundle; @@ -48,19 +46,18 @@ import butterknife.OnItemClick; import se.leap.bitmaskclient.fragments.AboutFragment; 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.PROVIDER_KEY; 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.ProviderAPI.CORRECTLY_DOWNLOADED_VPN_CERTIFICATE; import static se.leap.bitmaskclient.ProviderAPI.DOWNLOAD_VPN_CERTIFICATE; import static se.leap.bitmaskclient.ProviderAPI.ERRORS; -import static se.leap.bitmaskclient.ProviderAPI.INCORRECTLY_DOWNLOADED_VPN_CERTIFICATE; -import static se.leap.bitmaskclient.ProviderAPI.PROVIDER_NOK; -import static se.leap.bitmaskclient.ProviderAPI.PROVIDER_OK; import static se.leap.bitmaskclient.ProviderAPI.PROVIDER_SET_UP; 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.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; /** * abstract base Activity that builds and shows the list of known available providers. @@ -74,7 +71,7 @@ import static se.leap.bitmaskclient.ProviderAPI.UPDATE_PROVIDER_DETAILS; */ public abstract class ProviderListBaseActivity extends ConfigWizardBaseActivity - implements ProviderSetupFailedDialog.DownloadFailedDialogInterface, ProviderAPIResultReceiver.Receiver { + implements ProviderSetupInterface, ProviderSetupFailedDialog.DownloadFailedDialogInterface, ProviderAPIResultReceiver.Receiver { @InjectView(R.id.provider_list) protected ListView providerListView; @@ -82,23 +79,17 @@ public abstract class ProviderListBaseActivity extends ConfigWizardBaseActivity protected ProviderListAdapter adapter; private ProviderManager providerManager; - protected Intent configState = new Intent(PROVIDER_NOT_SET); final public static String TAG = ProviderListActivity.class.getSimpleName(); final private static String ACTIVITY_STATE = "ACTIVITY STATE"; - final protected static String PROVIDER_NOT_SET = "PROVIDER NOT SET"; - final protected static String SETTING_UP_PROVIDER = "PROVIDER GETS SET"; - final private static String SHOWING_PROVIDER_DETAILS = "SHOWING PROVIDER DETAILS"; - final private static String PENDING_SHOW_FAILED_DIALOG = "SHOW FAILED DIALOG PENDING"; - final private static String SHOW_FAILED_DIALOG = "SHOW FAILED DIALOG"; + protected ProviderConfigState providerConfigState = PROVIDER_NOT_SET; final private static String REASON_TO_FAIL = "REASON TO FAIL"; - final protected static String SERVICES_RETRIEVED = "SERVICES RETRIEVED"; final protected static String EXTRAS_KEY_INVALID_URL = "INVALID_URL"; public ProviderAPIResultReceiver providerAPIResultReceiver; - private ProviderAPIBroadcastReceiver providerAPIBroadcastReceiver; + private ProviderApiSetupBroadcastReceiver providerAPIBroadcastReceiver; private FragmentManagerEnhanced fragmentManager; @@ -120,7 +111,7 @@ public abstract class ProviderListBaseActivity extends ConfigWizardBaseActivity @Override public void onSaveInstanceState(@NotNull Bundle outState) { - outState.putString(ACTIVITY_STATE, configState.getAction()); + outState.putString(ACTIVITY_STATE, providerConfigState.toString()); outState.putString(REASON_TO_FAIL, reasonToFail); super.onSaveInstanceState(outState); @@ -131,7 +122,7 @@ public abstract class ProviderListBaseActivity extends ConfigWizardBaseActivity if (savedInstanceState == null) { return; } - configState.setAction(savedInstanceState.getString(ACTIVITY_STATE, PROVIDER_NOT_SET)); + this.providerConfigState = ProviderConfigState.valueOf(savedInstanceState.getString(ACTIVITY_STATE, PROVIDER_NOT_SET.toString())); if (savedInstanceState.containsKey(REASON_TO_FAIL)) { reasonToFail = savedInstanceState.getString(REASON_TO_FAIL); } @@ -140,6 +131,7 @@ public abstract class ProviderListBaseActivity extends ConfigWizardBaseActivity @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); + fragmentManager = new FragmentManagerEnhanced(getSupportFragmentManager()); providerManager = ProviderManager.getInstance(getAssets(), getExternalFilesDir(null)); @@ -150,19 +142,19 @@ public abstract class ProviderListBaseActivity extends ConfigWizardBaseActivity @Override protected void onResume() { - Log.d(TAG, "resuming with ConfigState: " + configState.getAction()); + Log.d(TAG, "resuming with ConfigState: " + providerConfigState.toString()); super.onResume(); setUpProviderAPIResultReceiver(); isActivityShowing = true; - if (SETTING_UP_PROVIDER.equals(configState.getAction())) { + if (SETTING_UP_PROVIDER == providerConfigState) { showProgressBar(); checkProviderSetUp(); - } else if (PENDING_SHOW_FAILED_DIALOG.equals(configState.getAction())) { + } else if (PENDING_SHOW_FAILED_DIALOG == providerConfigState) { showProgressBar(); showDownloadFailedDialog(); - } else if (SHOW_FAILED_DIALOG.equals(configState.getAction())) { + } else if (SHOW_FAILED_DIALOG == providerConfigState) { showProgressBar(); - } else if (SHOWING_PROVIDER_DETAILS.equals(configState.getAction())) { + } else if (SHOWING_PROVIDER_DETAILS == providerConfigState) { cancelSettingUpProvider(); } } @@ -223,38 +215,50 @@ public abstract class ProviderListBaseActivity extends ConfigWizardBaseActivity private void setUpProviderAPIResultReceiver() { providerAPIResultReceiver = new ProviderAPIResultReceiver(new Handler(), this); - providerAPIBroadcastReceiver = new ProviderAPIBroadcastReceiver(); + providerAPIBroadcastReceiver = new ProviderApiSetupBroadcastReceiver(this); IntentFilter updateIntentFilter = new IntentFilter(BROADCAST_PROVIDER_API_EVENT); updateIntentFilter.addCategory(Intent.CATEGORY_DEFAULT); LocalBroadcastManager.getInstance(this).registerReceiver(providerAPIBroadcastReceiver, updateIntentFilter); } - void handleProviderSetUp(Provider handledProvider) { + @Override + public void handleProviderSetUp(Provider handledProvider) { this.provider = handledProvider; adapter.add(provider); adapter.saveProviders(); if (provider.allowsAnonymous()) { - configState.putExtra(SERVICES_RETRIEVED, true); + //FIXME: providerApiBroadcastReceiver.getConfigState().putExtra(SERVICES_RETRIEVED, true); DEAD CODE??? downloadVpnCertificate(); } else { showProviderDetails(); } } - void handleProviderSetupFailed(Bundle resultData) { + @Override + public void handleProviderSetupFailed(Bundle resultData) { reasonToFail = resultData.getString(ERRORS); showDownloadFailedDialog(); } - void handleCorrectlyDownloadedCertificate(Provider handledProvider) { + @Override + public void handleCorrectlyDownloadedCertificate(Provider handledProvider) { this.provider = handledProvider; showProviderDetails(); } - void handleIncorrectlyDownloadedCertificate() { + @Override + public void handleIncorrectlyDownloadedCertificate() { cancelSettingUpProvider(); - setResult(RESULT_CANCELED, configState); + setResult(RESULT_CANCELED, new Intent(getConfigState().toString())); + } + + public Provider getProvider() { + return provider; + } + + public ProviderConfigState getConfigState() { + return providerConfigState; } @Override @@ -270,8 +274,8 @@ public abstract class ProviderListBaseActivity extends ConfigWizardBaseActivity @OnItemClick(R.id.provider_list) void onItemSelected(int position) { - if (SETTING_UP_PROVIDER.equals(configState.getAction()) || - SHOW_FAILED_DIALOG.equals(configState.getAction())) { + if (SETTING_UP_PROVIDER == getConfigState() || + SHOW_FAILED_DIALOG == getConfigState()) { return; } @@ -279,7 +283,7 @@ public abstract class ProviderListBaseActivity extends ConfigWizardBaseActivity provider = adapter.getItem(position); if (provider != null && !provider.isDefault()) { //TODO Code 2 pane view - configState.setAction(SETTING_UP_PROVIDER); + providerConfigState = SETTING_UP_PROVIDER; showProgressBar(); onItemSelectedLogic(); } else { @@ -289,8 +293,8 @@ public abstract class ProviderListBaseActivity extends ConfigWizardBaseActivity @Override public void onBackPressed() { - if (SETTING_UP_PROVIDER.equals(configState.getAction()) || - SHOW_FAILED_DIALOG.equals(configState.getAction())) { + if (SETTING_UP_PROVIDER == providerConfigState || + SHOW_FAILED_DIALOG == providerConfigState) { cancelSettingUpProvider(); } else { super.onBackPressed(); @@ -299,14 +303,14 @@ public abstract class ProviderListBaseActivity extends ConfigWizardBaseActivity @Override public void cancelSettingUpProvider() { - configState.setAction(PROVIDER_NOT_SET); + providerConfigState = PROVIDER_NOT_SET; provider = null; hideProgressBar(); } @Override public void updateProviderDetails() { - configState.setAction(SETTING_UP_PROVIDER); + providerConfigState = SETTING_UP_PROVIDER; ProviderAPICommand.execute(this, UPDATE_PROVIDER_DETAILS, provider); } @@ -346,7 +350,7 @@ public abstract class ProviderListBaseActivity extends ConfigWizardBaseActivity */ public void showDownloadFailedDialog() { try { - configState.setAction(SHOW_FAILED_DIALOG); + providerConfigState = SHOW_FAILED_DIALOG; FragmentTransaction fragmentTransaction = fragmentManager.removePreviousFragment(ProviderSetupFailedDialog.TAG); DialogFragment newFragment; try { @@ -362,7 +366,7 @@ public abstract class ProviderListBaseActivity extends ConfigWizardBaseActivity newFragment.show(fragmentTransaction, ProviderSetupFailedDialog.TAG); } catch (IllegalStateException e) { e.printStackTrace(); - configState.setAction(PENDING_SHOW_FAILED_DIALOG); + providerConfigState = PENDING_SHOW_FAILED_DIALOG; } } @@ -373,52 +377,13 @@ public abstract class ProviderListBaseActivity extends ConfigWizardBaseActivity */ public void showProviderDetails() { // show only if current activity is shown - if (isActivityShowing && configState.getAction() != null && - !configState.getAction().equalsIgnoreCase(SHOWING_PROVIDER_DETAILS)) { - configState.setAction(SHOWING_PROVIDER_DETAILS); + if (isActivityShowing && + providerConfigState != SHOWING_PROVIDER_DETAILS) { + providerConfigState = SHOWING_PROVIDER_DETAILS; Intent intent = new Intent(this, ProviderDetailActivity.class); intent.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION); intent.putExtra(PROVIDER_KEY, provider); startActivityForResult(intent, REQUEST_CODE_CONFIGURE_LEAP); } } - - public class ProviderAPIBroadcastReceiver extends BroadcastReceiver { - @Override - public void onReceive(Context context, Intent intent) { - Log.d(TAG, "received Broadcast"); - - String action = intent.getAction(); - if (action == null || !action.equalsIgnoreCase(BROADCAST_PROVIDER_API_EVENT)) { - return; - } - - if (configState.getAction() != null && - configState.getAction().equalsIgnoreCase(SETTING_UP_PROVIDER)) { - int resultCode = intent.getIntExtra(BROADCAST_RESULT_CODE, RESULT_CANCELED); - Log.d(TAG, "Broadcast resultCode: " + Integer.toString(resultCode)); - - Bundle resultData = intent.getParcelableExtra(BROADCAST_RESULT_KEY); - Provider handledProvider = resultData.getParcelable(PROVIDER_KEY); - - if (handledProvider != null && provider != null && - handledProvider.getDomain().equalsIgnoreCase(provider.getDomain())) { - switch (resultCode) { - case PROVIDER_OK: - handleProviderSetUp(handledProvider); - break; - case PROVIDER_NOK: - handleProviderSetupFailed(resultData); - break; - case CORRECTLY_DOWNLOADED_VPN_CERTIFICATE: - handleCorrectlyDownloadedCertificate(handledProvider); - break; - case INCORRECTLY_DOWNLOADED_VPN_CERTIFICATE: - handleIncorrectlyDownloadedCertificate(); - break; - } - } - } - } - } } diff --git a/app/src/main/java/se/leap/bitmaskclient/ProviderSetupInterface.java b/app/src/main/java/se/leap/bitmaskclient/ProviderSetupInterface.java index 30277b0e..167db604 100644 --- a/app/src/main/java/se/leap/bitmaskclient/ProviderSetupInterface.java +++ b/app/src/main/java/se/leap/bitmaskclient/ProviderSetupInterface.java @@ -1,8 +1,24 @@ package se.leap.bitmaskclient; +import android.os.Bundle; + /** * Created by cyberta on 17.08.18. */ public interface ProviderSetupInterface { + enum ProviderConfigState { + PROVIDER_NOT_SET, + SETTING_UP_PROVIDER, + SHOWING_PROVIDER_DETAILS, + PENDING_SHOW_FAILED_DIALOG, + SHOW_FAILED_DIALOG, + } + + void handleProviderSetUp(Provider provider); + void handleProviderSetupFailed(Bundle resultData); + void handleCorrectlyDownloadedCertificate(Provider provider); + void handleIncorrectlyDownloadedCertificate(); + Provider getProvider(); + ProviderConfigState getConfigState(); } diff --git a/app/src/production/java/se/leap/bitmaskclient/ProviderListActivity.java b/app/src/production/java/se/leap/bitmaskclient/ProviderListActivity.java index 172c9e61..7c617e29 100644 --- a/app/src/production/java/se/leap/bitmaskclient/ProviderListActivity.java +++ b/app/src/production/java/se/leap/bitmaskclient/ProviderListActivity.java @@ -18,10 +18,8 @@ package se.leap.bitmaskclient; import android.support.annotation.NonNull; -import java.net.MalformedURLException; -import java.net.URL; - import static se.leap.bitmaskclient.ProviderAPI.SET_UP_PROVIDER; +import static se.leap.bitmaskclient.ProviderSetupInterface.ProviderConfigState.SETTING_UP_PROVIDER; /** * Activity that builds and shows the list of known available providers. @@ -44,13 +42,13 @@ public class ProviderListActivity extends ProviderListBaseActivity { * */ public void setUpProvider() { - configState.setAction(SETTING_UP_PROVIDER); + providerConfigState = SETTING_UP_PROVIDER; ProviderAPICommand.execute(this, SET_UP_PROVIDER, provider); } @Override public void retrySetUpProvider(@NonNull Provider provider) { - configState.setAction(SETTING_UP_PROVIDER); + providerConfigState = SETTING_UP_PROVIDER; ProviderAPICommand.execute(this, SET_UP_PROVIDER, provider); } -- cgit v1.2.3 From f20745dcf2ab15bbfa81756602779b0186602584 Mon Sep 17 00:00:00 2001 From: cyBerta Date: Fri, 31 Aug 2018 14:40:39 +0200 Subject: #8896 skip onboarding for custom branded apps, allow to specify if anonymous usage is preferred over login/signup --- app/build.gradle | 29 ++- app/src/main/AndroidManifest.xml | 10 +- .../bitmaskclient/ConfigWizardBaseActivity.java | 16 +- .../main/java/se/leap/bitmaskclient/Constants.java | 2 + .../bitmaskclient/CustomProviderSetupActivity.java | 115 +++++++++- .../java/se/leap/bitmaskclient/EipFragment.java | 23 +- .../java/se/leap/bitmaskclient/MainActivity.java | 1 + .../leap/bitmaskclient/ProviderApiManagerBase.java | 1 + .../bitmaskclient/ProviderListBaseActivity.java | 199 ++--------------- .../bitmaskclient/ProviderSetupBaseActivity.java | 235 +++++++++++++++++++++ .../bitmaskclient/ProviderSetupFailedDialog.java | 2 +- .../java/se/leap/bitmaskclient/StartActivity.java | 8 +- .../leap/bitmaskclient/TLSCompatSocketFactory.java | 2 +- .../drawer/NavigationDrawerFragment.java | 12 +- .../se/leap/bitmaskclient/utils/ConfigHelper.java | 10 + .../main/res/layout/a_custom_provider_setup.xml | 30 +++ 16 files changed, 487 insertions(+), 208 deletions(-) create mode 100644 app/src/main/java/se/leap/bitmaskclient/ProviderSetupBaseActivity.java create mode 100644 app/src/main/res/layout/a_custom_provider_setup.xml (limited to 'app') diff --git a/app/build.gradle b/app/build.gradle index 75fe40b5..b7522e07 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -11,10 +11,13 @@ android { defaultConfig { applicationId "se.leap.bitmaskclient" + versionCode 134 + versionName "0.9.8" resValue "string", "app_name", appName vectorDrawables.useSupportLibrary = true buildConfigField 'boolean', 'openvpn3', 'false' + //Build Config Fields for default donation details //This is the default donation URL and should be set to the donation page of LEAP @@ -28,6 +31,11 @@ android { buildConfigField 'boolean', 'enable_donation_reminder', 'true' //The duration in days to trigger the donation reminder buildConfigField 'int', 'donation_reminder_duration', '30' + //skip the account creation / login screen if the provider offers anonymous vpn usage, use directly the anonymous cert instead + buildConfigField 'boolean', 'priotize_anonymous_usage', 'false' + //ignore the following config, only used in custom flavor + buildConfigField "String", "customProviderUrl", '""' + testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" dexOptions { jumboMode true @@ -57,21 +65,29 @@ android { } - //************************************************************************** - //************************************************************************** - //Configurations for custom branded app. custom { dimension "branding" + + //************************************************************************** + //************************************************************************** + //Configurations for custom branded app. + //Change the package name as needed applicationId "net.riseup.black" //Set app name here appName = "Riseup VPN" resValue "string", "app_name", appName + //Provider base url, e.g. '"https://example.com"' + def customProviderUrl = '"https://riseup.net"' + buildConfigField "String", "customProviderUrl", customProviderUrl //Change the versionCode as needed versionCode 1 //Change the versionName as needed versionName "1.0" + //skip the account creation / login screen if the provider offers anonymous vpn usage, use directly the anonymous cert instead + buildConfigField 'boolean', 'priotize_anonymous_usage', 'true' + //Build Config Fields for default donation details //This is the donation URL and should be set to the relevant donation page. @@ -82,10 +98,11 @@ android { buildConfigField 'boolean', 'enable_donation_reminder', 'true' //The duration in days to trigger the donation reminder buildConfigField 'int', 'donation_reminder_duration', '30' - } - //************************************************************************** - //************************************************************************** + //************************************************************************** + //************************************************************************** + + } } buildTypes { diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index b1131850..66f36256 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -15,10 +15,8 @@ limitations under the License. --> - + package="se.leap.bitmaskclient"> + @@ -93,6 +91,10 @@ android:name=".ProviderListActivity" android:label="@string/configuration_wizard_title" /> + + diff --git a/app/src/main/java/se/leap/bitmaskclient/ConfigWizardBaseActivity.java b/app/src/main/java/se/leap/bitmaskclient/ConfigWizardBaseActivity.java index 227c8cf4..7aa50add 100644 --- a/app/src/main/java/se/leap/bitmaskclient/ConfigWizardBaseActivity.java +++ b/app/src/main/java/se/leap/bitmaskclient/ConfigWizardBaseActivity.java @@ -12,7 +12,6 @@ import android.support.constraint.ConstraintLayout; import android.support.constraint.Guideline; import android.support.v4.content.ContextCompat; import android.support.v7.widget.AppCompatTextView; -import android.util.Log; import android.view.View; import android.view.ViewGroup; import android.view.ViewTreeObserver; @@ -72,6 +71,8 @@ public abstract class ConfigWizardBaseActivity extends ButterKnifeActivity { protected Provider provider; protected boolean isCompactLayout = false; + protected boolean isActivityShowing; + private float defaultGuidelineTopPercentage; private float defaultGuidelineBottomPercentage; @@ -79,7 +80,6 @@ public abstract class ConfigWizardBaseActivity extends ButterKnifeActivity { protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); preferences = getSharedPreferences(SHARED_PREFERENCES, MODE_PRIVATE); - provider = getIntent().getParcelableExtra(PROVIDER_KEY); } @@ -135,6 +135,18 @@ public abstract class ConfigWizardBaseActivity extends ButterKnifeActivity { } } + @Override + protected void onPause() { + super.onPause(); + isActivityShowing = false; + } + + @Override + protected void onResume() { + super.onResume(); + isActivityShowing = true; + } + protected void restoreState(Bundle savedInstanceState) { if (savedInstanceState != null && savedInstanceState.containsKey(PROVIDER_KEY)) { provider = savedInstanceState.getParcelable(PROVIDER_KEY); diff --git a/app/src/main/java/se/leap/bitmaskclient/Constants.java b/app/src/main/java/se/leap/bitmaskclient/Constants.java index 2efc2c1f..15bec955 100644 --- a/app/src/main/java/se/leap/bitmaskclient/Constants.java +++ b/app/src/main/java/se/leap/bitmaskclient/Constants.java @@ -30,6 +30,8 @@ public interface Constants { String APP_ACTION_QUIT = "quit"; String APP_ACTION_CONFIGURE_ALWAYS_ON_PROFILE = "configure always-on profile"; + String DEFAULT_BITMASK = "normal"; + String CUSTOM_BITMASK = "custom"; ////////////////////////////////////////////// diff --git a/app/src/main/java/se/leap/bitmaskclient/CustomProviderSetupActivity.java b/app/src/main/java/se/leap/bitmaskclient/CustomProviderSetupActivity.java index 3d4f801b..3763f506 100644 --- a/app/src/main/java/se/leap/bitmaskclient/CustomProviderSetupActivity.java +++ b/app/src/main/java/se/leap/bitmaskclient/CustomProviderSetupActivity.java @@ -1,8 +1,121 @@ +/** + * Copyright (c) 2018 LEAP Encryption Access Project and contributers + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ package se.leap.bitmaskclient; +import android.content.Intent; +import android.os.Bundle; +import android.support.annotation.NonNull; +import android.support.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; + /** * Created by cyberta on 17.08.18. */ -public class CustomProviderSetupActivity { +public class CustomProviderSetupActivity extends ProviderSetupBaseActivity { + + @Override + public void onCreate(@Nullable Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setUpInitialUI(); + restoreState(savedInstanceState); + setProvider(new Provider(BuildConfig.customProviderUrl)); + } + + @Override + protected void onResume() { + super.onResume(); + if (getConfigState() == ProviderConfigState.PROVIDER_NOT_SET) { + showProgressBar(); + setupProvider(); + } + } + + private void setUpInitialUI() { + setContentView(R.layout.a_custom_provider_setup); + setProviderHeaderText(R.string.setup_provider); + hideProgressBar(); + } + + private void setupProvider() { + setProviderConfigState(SETTING_UP_PROVIDER); + ProviderAPICommand.execute(this, SET_UP_PROVIDER, getProvider()); + } + + // ------- ProviderSetupInterface ---v + @Override + public void handleProviderSetUp(Provider provider) { + setProvider(provider); + if (provider.allowsAnonymous()) { + downloadVpnCertificate(); + } else { + showProviderDetails(); + } + } + + @Override + public void handleCorrectlyDownloadedCertificate(Provider provider) { + if (preferAnonymousUsage()) { + finishWithSetupWithProvider(provider); + } else { + this.provider = provider; + showProviderDetails(); + } + } + + // ------- DownloadFailedDialogInterface ---v + @Override + public void retrySetUpProvider(@NonNull Provider provider) { + setupProvider(); + showProgressBar(); + } + + @Override + public void cancelSettingUpProvider() { + super.cancelSettingUpProvider(); + finish(); + } + + @Override + public void addAndSelectNewProvider(String url) { + // ignore + } + + private void finishWithSetupWithProvider(Provider provider) { + Intent intent = new Intent(); + intent.putExtra(Provider.KEY, provider); + setResult(RESULT_OK, intent); + finish(); + } + + @Override + public void onReceiveResult(int resultCode, Bundle resultData) { + + } + + @Override + protected void onActivityResult(int requestCode, int resultCode, Intent data) { + if (requestCode == REQUEST_CODE_CONFIGURE_LEAP) { + setResult(resultCode, data); + finish(); + } + } } diff --git a/app/src/main/java/se/leap/bitmaskclient/EipFragment.java b/app/src/main/java/se/leap/bitmaskclient/EipFragment.java index a168059f..fb4f16c7 100644 --- a/app/src/main/java/se/leap/bitmaskclient/EipFragment.java +++ b/app/src/main/java/se/leap/bitmaskclient/EipFragment.java @@ -58,14 +58,17 @@ import se.leap.bitmaskclient.views.VpnStateImage; 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.DEFAULT_BITMASK; 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.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; public class EipFragment extends Fragment implements Observer { @@ -113,18 +116,30 @@ public class EipFragment extends Fragment implements Observer { if (arguments != null) { provider = arguments.getParcelable(PROVIDER_KEY); if (provider == null) { - activity.startActivityForResult(new Intent(activity, ProviderListActivity.class), REQUEST_CODE_SWITCH_PROVIDER); + handleNoProvider(activity); } else { Log.d(TAG, provider.getName() + " configured as provider"); } } else { - Log.e(TAG, "no provider given - starting ProviderListActivity"); - activity.startActivityForResult(new Intent(activity, ProviderListActivity.class), REQUEST_CODE_SWITCH_PROVIDER); + handleNoProvider(activity); } } } - @Override + private void handleNoProvider(Activity activity) { + if (isDefaultBitmask()) { + activity.startActivityForResult(new Intent(activity, ProviderListActivity.class), REQUEST_CODE_SWITCH_PROVIDER); + } else { + Log.e(TAG, "no provider given - try to reconfigure custom provider"); + startActivityForResult(new Intent(activity, CustomProviderSetupActivity.class), REQUEST_CODE_CONFIGURE_LEAP); + + } + + } + + + + @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); openVpnConnection = new EipFragmentServiceConnection(); diff --git a/app/src/main/java/se/leap/bitmaskclient/MainActivity.java b/app/src/main/java/se/leap/bitmaskclient/MainActivity.java index c44e8a3e..84c7c16a 100644 --- a/app/src/main/java/se/leap/bitmaskclient/MainActivity.java +++ b/app/src/main/java/se/leap/bitmaskclient/MainActivity.java @@ -190,6 +190,7 @@ public class MainActivity extends AppCompatActivity { EipCommand.stopVPN(this); break; case REQUEST_CODE_CONFIGURE_LEAP: + Log.d(TAG, "REQUEST_CODE_CONFIGURE_LEAP - onActivityResult - MainActivity"); break; case REQUEST_CODE_LOG_IN: EipCommand.startVPN(this, true); diff --git a/app/src/main/java/se/leap/bitmaskclient/ProviderApiManagerBase.java b/app/src/main/java/se/leap/bitmaskclient/ProviderApiManagerBase.java index 8f3acf1d..113b07f5 100644 --- a/app/src/main/java/se/leap/bitmaskclient/ProviderApiManagerBase.java +++ b/app/src/main/java/se/leap/bitmaskclient/ProviderApiManagerBase.java @@ -145,6 +145,7 @@ public abstract class ProviderApiManagerBase { Provider provider = command.getParcelableExtra(PROVIDER_KEY); if (provider == null) { + //TODO: consider returning error back e.g. NO_PROVIDER Log.e(TAG, action +" called without provider!"); return; } diff --git a/app/src/main/java/se/leap/bitmaskclient/ProviderListBaseActivity.java b/app/src/main/java/se/leap/bitmaskclient/ProviderListBaseActivity.java index c786a6fa..a29d4b61 100644 --- a/app/src/main/java/se/leap/bitmaskclient/ProviderListBaseActivity.java +++ b/app/src/main/java/se/leap/bitmaskclient/ProviderListBaseActivity.java @@ -49,7 +49,6 @@ 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_ADD_PROVIDER; 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.PROVIDER_SET_UP; import static se.leap.bitmaskclient.ProviderAPI.UPDATE_PROVIDER_DETAILS; @@ -70,32 +69,24 @@ import static se.leap.bitmaskclient.ProviderSetupInterface.ProviderConfigState.S * @author cyberta */ -public abstract class ProviderListBaseActivity extends ConfigWizardBaseActivity - implements ProviderSetupInterface, ProviderSetupFailedDialog.DownloadFailedDialogInterface, ProviderAPIResultReceiver.Receiver { +public abstract class ProviderListBaseActivity extends ProviderSetupBaseActivity { @InjectView(R.id.provider_list) protected ListView providerListView; @Inject protected ProviderListAdapter adapter; - private ProviderManager providerManager; - final public static String TAG = ProviderListActivity.class.getSimpleName(); - - final private static String ACTIVITY_STATE = "ACTIVITY STATE"; - - protected ProviderConfigState providerConfigState = PROVIDER_NOT_SET; - final private static String REASON_TO_FAIL = "REASON TO FAIL"; final protected static String EXTRAS_KEY_INVALID_URL = "INVALID_URL"; - public ProviderAPIResultReceiver providerAPIResultReceiver; - private ProviderApiSetupBroadcastReceiver providerAPIBroadcastReceiver; - private FragmentManagerEnhanced fragmentManager; - - private boolean isActivityShowing; - private String reasonToFail; - private boolean testNewURL; + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setUpInitialUI(); + initProviderList(); + restoreState(savedInstanceState); + } public abstract void retrySetUpProvider(@NonNull Provider provider); @@ -105,80 +96,16 @@ public abstract class ProviderListBaseActivity extends ConfigWizardBaseActivity List> prototypes = new ArrayList<>(); prototypes.add(new ProviderRenderer(this)); ProviderRendererBuilder providerRendererBuilder = new ProviderRendererBuilder(prototypes); - adapter = new ProviderListAdapter(getLayoutInflater(), providerRendererBuilder, providerManager); + adapter = new ProviderListAdapter(getLayoutInflater(), providerRendererBuilder, getProviderManager()); providerListView.setAdapter(adapter); } - @Override - public void onSaveInstanceState(@NotNull Bundle outState) { - outState.putString(ACTIVITY_STATE, providerConfigState.toString()); - outState.putString(REASON_TO_FAIL, reasonToFail); - - super.onSaveInstanceState(outState); - } - - protected void restoreState(Bundle savedInstanceState) { - super.restoreState(savedInstanceState); - if (savedInstanceState == null) { - return; - } - this.providerConfigState = ProviderConfigState.valueOf(savedInstanceState.getString(ACTIVITY_STATE, PROVIDER_NOT_SET.toString())); - if (savedInstanceState.containsKey(REASON_TO_FAIL)) { - reasonToFail = savedInstanceState.getString(REASON_TO_FAIL); - } - } - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - - fragmentManager = new FragmentManagerEnhanced(getSupportFragmentManager()); - providerManager = ProviderManager.getInstance(getAssets(), getExternalFilesDir(null)); - - setUpInitialUI(); - initProviderList(); - restoreState(savedInstanceState); - } - - @Override - protected void onResume() { - Log.d(TAG, "resuming with ConfigState: " + providerConfigState.toString()); - super.onResume(); - setUpProviderAPIResultReceiver(); - isActivityShowing = true; - if (SETTING_UP_PROVIDER == providerConfigState) { - showProgressBar(); - checkProviderSetUp(); - } else if (PENDING_SHOW_FAILED_DIALOG == providerConfigState) { - showProgressBar(); - showDownloadFailedDialog(); - } else if (SHOW_FAILED_DIALOG == providerConfigState) { - showProgressBar(); - } else if (SHOWING_PROVIDER_DETAILS == providerConfigState) { - cancelSettingUpProvider(); - } - } - private void setUpInitialUI() { setContentView(R.layout.a_provider_list); setProviderHeaderText(R.string.setup_provider); hideProgressBar(); } - @Override - protected void onPause() { - super.onPause(); - isActivityShowing = false; - if (providerAPIBroadcastReceiver != null) - LocalBroadcastManager.getInstance(this).unregisterReceiver(providerAPIBroadcastReceiver); - } - - @Override - protected void onDestroy() { - super.onDestroy(); - providerAPIResultReceiver = null; - } - @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == REQUEST_CODE_CONFIGURE_LEAP) { @@ -212,16 +139,7 @@ public abstract class ProviderListBaseActivity extends ConfigWizardBaseActivity showProgressBar(); } - - private void setUpProviderAPIResultReceiver() { - providerAPIResultReceiver = new ProviderAPIResultReceiver(new Handler(), this); - providerAPIBroadcastReceiver = new ProviderApiSetupBroadcastReceiver(this); - - IntentFilter updateIntentFilter = new IntentFilter(BROADCAST_PROVIDER_API_EVENT); - updateIntentFilter.addCategory(Intent.CATEGORY_DEFAULT); - LocalBroadcastManager.getInstance(this).registerReceiver(providerAPIBroadcastReceiver, updateIntentFilter); - } - + // ------- ProviderSetupInterface ---v @Override public void handleProviderSetUp(Provider handledProvider) { this.provider = handledProvider; @@ -235,40 +153,21 @@ public abstract class ProviderListBaseActivity extends ConfigWizardBaseActivity } } - @Override - public void handleProviderSetupFailed(Bundle resultData) { - reasonToFail = resultData.getString(ERRORS); - showDownloadFailedDialog(); - } - @Override public void handleCorrectlyDownloadedCertificate(Provider handledProvider) { this.provider = handledProvider; showProviderDetails(); } + // ----------------------------------------- - @Override - public void handleIncorrectlyDownloadedCertificate() { - cancelSettingUpProvider(); - setResult(RESULT_CANCELED, new Intent(getConfigState().toString())); - } - - public Provider getProvider() { - return provider; - } - - public ProviderConfigState getConfigState() { - return providerConfigState; - } - + //TODO: only keep empty method for testing purposes @Override public void onReceiveResult(int resultCode, Bundle resultData) { - if (resultCode == ProviderAPI.PROVIDER_OK) { - Provider provider = resultData.getParcelable(PROVIDER_KEY); - handleProviderSetUp(provider); - } else if (resultCode == AboutFragment.VIEWED) { + super.onReceiveResult(resultCode, resultData); + if (resultCode == AboutFragment.VIEWED) { // Do nothing, right now // I need this for CW to wait for the About activity to end before going back to Dashboard. + //FIXME: WEEEIRD! } } @@ -301,31 +200,6 @@ public abstract class ProviderListBaseActivity extends ConfigWizardBaseActivity } } - @Override - public void cancelSettingUpProvider() { - providerConfigState = PROVIDER_NOT_SET; - provider = null; - hideProgressBar(); - } - - @Override - public void updateProviderDetails() { - providerConfigState = SETTING_UP_PROVIDER; - ProviderAPICommand.execute(this, UPDATE_PROVIDER_DETAILS, provider); - } - - public void checkProviderSetUp() { - ProviderAPICommand.execute(this, PROVIDER_SET_UP, provider, providerAPIResultReceiver); - } - - /** - * Asks ProviderApiService to download an anonymous (anon) VPN certificate. - */ - private void downloadVpnCertificate() { - ProviderAPICommand.execute(this, DOWNLOAD_VPN_CERTIFICATE, provider); - } - - /** * Open the new provider dialog */ @@ -344,46 +218,5 @@ public abstract class ProviderListBaseActivity extends ConfigWizardBaseActivity intent.putExtra(EXTRAS_KEY_INVALID_URL, url); startActivityForResult(intent, REQUEST_CODE_ADD_PROVIDER); } - - /** - * Shows an error dialog, if configuring of a provider failed. - */ - public void showDownloadFailedDialog() { - try { - providerConfigState = SHOW_FAILED_DIALOG; - FragmentTransaction fragmentTransaction = fragmentManager.removePreviousFragment(ProviderSetupFailedDialog.TAG); - DialogFragment newFragment; - try { - JSONObject errorJson = new JSONObject(reasonToFail); - newFragment = ProviderSetupFailedDialog.newInstance(provider, errorJson, testNewURL); - } catch (JSONException e) { - e.printStackTrace(); - newFragment = ProviderSetupFailedDialog.newInstance(provider, reasonToFail); - } catch (NullPointerException e) { - //reasonToFail was null - return; - } - newFragment.show(fragmentTransaction, ProviderSetupFailedDialog.TAG); - } catch (IllegalStateException e) { - e.printStackTrace(); - providerConfigState = PENDING_SHOW_FAILED_DIALOG; - } - } - - /** - * Once selected a provider, this fragment offers the user to log in, - * use it anonymously (if possible) - * or cancel his/her election pressing the back button. - */ - public void showProviderDetails() { - // show only if current activity is shown - if (isActivityShowing && - providerConfigState != SHOWING_PROVIDER_DETAILS) { - providerConfigState = SHOWING_PROVIDER_DETAILS; - Intent intent = new Intent(this, ProviderDetailActivity.class); - intent.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION); - intent.putExtra(PROVIDER_KEY, provider); - startActivityForResult(intent, REQUEST_CODE_CONFIGURE_LEAP); - } - } + } diff --git a/app/src/main/java/se/leap/bitmaskclient/ProviderSetupBaseActivity.java b/app/src/main/java/se/leap/bitmaskclient/ProviderSetupBaseActivity.java new file mode 100644 index 00000000..8731a2cc --- /dev/null +++ b/app/src/main/java/se/leap/bitmaskclient/ProviderSetupBaseActivity.java @@ -0,0 +1,235 @@ +package se.leap.bitmaskclient; + +import android.content.Intent; +import android.content.IntentFilter; +import android.os.Bundle; +import android.os.Handler; +import android.os.PersistableBundle; +import android.support.annotation.Nullable; +import android.support.v4.app.DialogFragment; +import android.support.v4.app.FragmentTransaction; +import android.support.v4.content.LocalBroadcastManager; +import android.util.Log; + +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.PROVIDER_SET_UP; +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.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; + +/** + * Created by cyberta on 19.08.18. + */ + +public abstract class ProviderSetupBaseActivity extends ConfigWizardBaseActivity implements ProviderAPIResultReceiver.Receiver, ProviderSetupInterface, ProviderSetupFailedDialog.DownloadFailedDialogInterface { + final public static String TAG = "PoviderSetupActivity"; + final private static String ACTIVITY_STATE = "ACTIVITY STATE"; + final private static String REASON_TO_FAIL = "REASON TO FAIL"; + + protected ProviderSetupInterface.ProviderConfigState providerConfigState = PROVIDER_NOT_SET; + private ProviderManager providerManager; + private FragmentManagerEnhanced fragmentManager; + + private String reasonToFail; + protected boolean testNewURL; + + private ProviderApiSetupBroadcastReceiver providerAPIBroadcastReceiver; + private ProviderAPIResultReceiver providerAPIResultReceiver; + + @Override + public void onCreate(@Nullable Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + fragmentManager = new FragmentManagerEnhanced(getSupportFragmentManager()); + providerManager = ProviderManager.getInstance(getAssets(), getExternalFilesDir(null)); + } + + @Override + protected void onResume() { + super.onResume(); + Log.d(TAG, "resuming with ConfigState: " + providerConfigState.toString()); + setUpProviderAPIResultReceiver(); + if (SETTING_UP_PROVIDER == providerConfigState) { + showProgressBar(); + checkProviderSetUp(); + } else if (PENDING_SHOW_FAILED_DIALOG == providerConfigState) { + showProgressBar(); + showDownloadFailedDialog(); + } else if (SHOW_FAILED_DIALOG == providerConfigState) { + showProgressBar(); + } else if (SHOWING_PROVIDER_DETAILS == providerConfigState) { + cancelSettingUpProvider(); + } + } + + @Override + protected void onPause() { + super.onPause(); + if (providerAPIBroadcastReceiver != null) + LocalBroadcastManager.getInstance(this).unregisterReceiver(providerAPIBroadcastReceiver); + } + + @Override + protected void onDestroy() { + super.onDestroy(); + providerAPIResultReceiver = null; + } + + + @Override + public void onSaveInstanceState(@NotNull Bundle outState) { + outState.putString(ACTIVITY_STATE, providerConfigState.toString()); + outState.putString(REASON_TO_FAIL, reasonToFail); + + super.onSaveInstanceState(outState); + } + + protected FragmentManagerEnhanced getFragmentManagerEnhanced() { + return fragmentManager; + } + + protected ProviderManager getProviderManager() { + return providerManager; + } + + protected void setProviderConfigState(ProviderConfigState state) { + this.providerConfigState = state; + } + + protected void setProvider(Provider provider) { + this.provider = provider; + } + + // --------- ProviderSetupInterface ---v + @Override + public Provider getProvider() { + return provider; + } + + @Override + public ProviderConfigState getConfigState() { + return providerConfigState; + } + + @Override + public void handleProviderSetupFailed(Bundle resultData) { + reasonToFail = resultData.getString(ERRORS); + showDownloadFailedDialog(); + } + + @Override + public void handleIncorrectlyDownloadedCertificate() { + cancelSettingUpProvider(); + setResult(RESULT_CANCELED, new Intent(getConfigState().toString())); + } + + // -------- DownloadFailedDialogInterface ---v + @Override + public void cancelSettingUpProvider() { + providerConfigState = PROVIDER_NOT_SET; + provider = null; + hideProgressBar(); + } + + @Override + public void updateProviderDetails() { + providerConfigState = SETTING_UP_PROVIDER; + ProviderAPICommand.execute(this, UPDATE_PROVIDER_DETAILS, provider); + } + + // -------- ProviderAPIResultReceiver.Receiver ---v + @Override + public void onReceiveResult(int resultCode, Bundle resultData) { + if (resultCode == ProviderAPI.PROVIDER_OK) { + Provider provider = resultData.getParcelable(PROVIDER_KEY); + handleProviderSetUp(provider); + } + } + + protected void restoreState(Bundle savedInstanceState) { + super.restoreState(savedInstanceState); + if (savedInstanceState == null) { + return; + } + this.providerConfigState = ProviderSetupInterface.ProviderConfigState.valueOf(savedInstanceState.getString(ACTIVITY_STATE, PROVIDER_NOT_SET.toString())); + if (savedInstanceState.containsKey(REASON_TO_FAIL)) { + reasonToFail = savedInstanceState.getString(REASON_TO_FAIL); + } + } + + private void setUpProviderAPIResultReceiver() { + providerAPIResultReceiver = new ProviderAPIResultReceiver(new Handler(), this); + providerAPIBroadcastReceiver = new ProviderApiSetupBroadcastReceiver(this); + + IntentFilter updateIntentFilter = new IntentFilter(BROADCAST_PROVIDER_API_EVENT); + updateIntentFilter.addCategory(Intent.CATEGORY_DEFAULT); + LocalBroadcastManager.getInstance(this).registerReceiver(providerAPIBroadcastReceiver, updateIntentFilter); + } + + /** + * Asks ProviderApiService to download an anonymous (anon) VPN certificate. + */ + protected void downloadVpnCertificate() { + ProviderAPICommand.execute(this, DOWNLOAD_VPN_CERTIFICATE, provider); + } + + /* + * + */ + public void checkProviderSetUp() { + ProviderAPICommand.execute(this, PROVIDER_SET_UP, provider, providerAPIResultReceiver); + } + + /** + * Once selected a provider, this fragment offers the user to log in, + * use it anonymously (if possible) + * or cancel his/her election pressing the back button. + */ + public void showProviderDetails() { + // show only if current activity is shown + if (isActivityShowing && + providerConfigState != SHOWING_PROVIDER_DETAILS) { + providerConfigState = SHOWING_PROVIDER_DETAILS; + Intent intent = new Intent(this, ProviderDetailActivity.class); + intent.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION); + intent.putExtra(PROVIDER_KEY, provider); + startActivityForResult(intent, REQUEST_CODE_CONFIGURE_LEAP); + } + } + + /** + * Shows an error dialog, if configuring of a provider failed. + */ + public void showDownloadFailedDialog() { + try { + providerConfigState = SHOW_FAILED_DIALOG; + FragmentTransaction fragmentTransaction = fragmentManager.removePreviousFragment(ProviderSetupFailedDialog.TAG); + DialogFragment newFragment; + try { + JSONObject errorJson = new JSONObject(reasonToFail); + newFragment = ProviderSetupFailedDialog.newInstance(provider, errorJson, testNewURL); + } catch (JSONException e) { + e.printStackTrace(); + newFragment = ProviderSetupFailedDialog.newInstance(provider, reasonToFail); + } catch (NullPointerException e) { + //reasonToFail was null + return; + } + newFragment.show(fragmentTransaction, ProviderSetupFailedDialog.TAG); + } catch (IllegalStateException e) { + e.printStackTrace(); + providerConfigState = PENDING_SHOW_FAILED_DIALOG; + } + } + +} diff --git a/app/src/main/java/se/leap/bitmaskclient/ProviderSetupFailedDialog.java b/app/src/main/java/se/leap/bitmaskclient/ProviderSetupFailedDialog.java index 3cfae776..71b67df1 100644 --- a/app/src/main/java/se/leap/bitmaskclient/ProviderSetupFailedDialog.java +++ b/app/src/main/java/se/leap/bitmaskclient/ProviderSetupFailedDialog.java @@ -171,8 +171,8 @@ public class ProviderSetupFailedDialog extends DialogFragment { @Override public void onCancel(DialogInterface dialog) { - interfaceWithConfigurationWizard.cancelSettingUpProvider(); dialog.dismiss(); + interfaceWithConfigurationWizard.cancelSettingUpProvider(); } @Override diff --git a/app/src/main/java/se/leap/bitmaskclient/StartActivity.java b/app/src/main/java/se/leap/bitmaskclient/StartActivity.java index 33c13b90..28eebb07 100644 --- a/app/src/main/java/se/leap/bitmaskclient/StartActivity.java +++ b/app/src/main/java/se/leap/bitmaskclient/StartActivity.java @@ -18,6 +18,7 @@ import se.leap.bitmaskclient.userstatus.User; import se.leap.bitmaskclient.utils.ConfigHelper; import static se.leap.bitmaskclient.Constants.APP_ACTION_CONFIGURE_ALWAYS_ON_PROFILE; +import static se.leap.bitmaskclient.Constants.DEFAULT_BITMASK; 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; @@ -25,6 +26,7 @@ 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.getSavedProviderFromSharedPreferences; import static se.leap.bitmaskclient.utils.PreferenceHelper.providerInSharedPreferences; import static se.leap.bitmaskclient.utils.PreferenceHelper.storeProviderInPreferences; @@ -181,7 +183,11 @@ public class StartActivity extends Activity{ if (getIntent().hasExtra(APP_ACTION_CONFIGURE_ALWAYS_ON_PROFILE)) { getIntent().removeExtra(APP_ACTION_CONFIGURE_ALWAYS_ON_PROFILE); } - startActivityForResult(new Intent(this, ProviderListActivity.class), REQUEST_CODE_CONFIGURE_LEAP); + if (isDefaultBitmask()) { + startActivityForResult(new Intent(this, ProviderListActivity.class), REQUEST_CODE_CONFIGURE_LEAP); + } else { // custom branded app + startActivityForResult(new Intent(this, CustomProviderSetupActivity.class), REQUEST_CODE_CONFIGURE_LEAP); + } } @Override diff --git a/app/src/main/java/se/leap/bitmaskclient/TLSCompatSocketFactory.java b/app/src/main/java/se/leap/bitmaskclient/TLSCompatSocketFactory.java index cca75bdf..32652964 100644 --- a/app/src/main/java/se/leap/bitmaskclient/TLSCompatSocketFactory.java +++ b/app/src/main/java/se/leap/bitmaskclient/TLSCompatSocketFactory.java @@ -73,7 +73,7 @@ public class TLSCompatSocketFactory extends SSLSocketFactory { trustManager = trustManagers[0]; - // Create an SSLContext that uses our TrustManager + // Create a SSLContext that uses our TrustManager SSLContext sslContext = SSLContext.getInstance("TLS"); sslContext.init(null, tmf.getTrustManagers(), null); internalSSLSocketFactory = sslContext.getSocketFactory(); diff --git a/app/src/main/java/se/leap/bitmaskclient/drawer/NavigationDrawerFragment.java b/app/src/main/java/se/leap/bitmaskclient/drawer/NavigationDrawerFragment.java index 6e9879dd..769bd887 100644 --- a/app/src/main/java/se/leap/bitmaskclient/drawer/NavigationDrawerFragment.java +++ b/app/src/main/java/se/leap/bitmaskclient/drawer/NavigationDrawerFragment.java @@ -50,7 +50,6 @@ import android.widget.ArrayAdapter; import android.widget.CompoundButton; import android.widget.ListView; -import se.leap.bitmaskclient.utils.ConfigHelper; import se.leap.bitmaskclient.DrawerSettingsAdapter; import se.leap.bitmaskclient.DrawerSettingsAdapter.DrawerSettingsItem; import se.leap.bitmaskclient.EipFragment; @@ -64,11 +63,11 @@ import se.leap.bitmaskclient.fragments.LogFragment; import static android.content.Context.MODE_PRIVATE; 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.DONATION_URL; -import static se.leap.bitmaskclient.Constants.ENABLE_DONATION; import static se.leap.bitmaskclient.DrawerSettingsAdapter.ABOUT; import static se.leap.bitmaskclient.DrawerSettingsAdapter.ALWAYS_ON; import static se.leap.bitmaskclient.DrawerSettingsAdapter.BATTERY_SAVER; @@ -78,14 +77,15 @@ import static se.leap.bitmaskclient.DrawerSettingsAdapter.DrawerSettingsItem.get import static se.leap.bitmaskclient.DrawerSettingsAdapter.LOG; import static se.leap.bitmaskclient.DrawerSettingsAdapter.SWITCH_PROVIDER; import static se.leap.bitmaskclient.R.string.about_fragment_title; +import static se.leap.bitmaskclient.R.string.donate_title; import static se.leap.bitmaskclient.R.string.log_fragment_title; import static se.leap.bitmaskclient.R.string.switch_provider_menu_option; +import static se.leap.bitmaskclient.utils.ConfigHelper.isDefaultBitmask; import static se.leap.bitmaskclient.utils.PreferenceHelper.getProviderName; import static se.leap.bitmaskclient.utils.PreferenceHelper.getSaveBattery; import static se.leap.bitmaskclient.utils.PreferenceHelper.getSavedProviderFromSharedPreferences; import static se.leap.bitmaskclient.utils.PreferenceHelper.getShowAlwaysOnDialog; import static se.leap.bitmaskclient.utils.PreferenceHelper.saveBattery; -import static se.leap.bitmaskclient.R.string.donate_title; /** * Fragment used for managing interactions for and presentation of a navigation drawer. @@ -286,7 +286,9 @@ public class NavigationDrawerFragment extends Fragment { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { settingsListAdapter.addItem(getSimpleTextInstance(getString(R.string.always_on_vpn), ALWAYS_ON)); } - settingsListAdapter.addItem(getSimpleTextInstance(getString(switch_provider_menu_option), SWITCH_PROVIDER)); + if (isDefaultBitmask()) { + settingsListAdapter.addItem(getSimpleTextInstance(getString(switch_provider_menu_option), SWITCH_PROVIDER)); + } settingsListAdapter.addItem(getSimpleTextInstance(getString(log_fragment_title), LOG)); if (ENABLE_DONATION) { settingsListAdapter.addItem(getSimpleTextInstance(getString(donate_title), DONATE)); diff --git a/app/src/main/java/se/leap/bitmaskclient/utils/ConfigHelper.java b/app/src/main/java/se/leap/bitmaskclient/utils/ConfigHelper.java index 5bb637b7..326139c0 100644 --- a/app/src/main/java/se/leap/bitmaskclient/utils/ConfigHelper.java +++ b/app/src/main/java/se/leap/bitmaskclient/utils/ConfigHelper.java @@ -40,8 +40,11 @@ import java.security.interfaces.RSAPrivateKey; import java.security.spec.InvalidKeySpecException; import java.security.spec.PKCS8EncodedKeySpec; +import se.leap.bitmaskclient.BuildConfig; import se.leap.bitmaskclient.ProviderAPI; +import static se.leap.bitmaskclient.Constants.DEFAULT_BITMASK; + /** * Stores constants, and implements auxiliary methods used across all Bitmask Android classes. * @@ -167,4 +170,11 @@ public class ConfigHelper { } } + public static boolean isDefaultBitmask() { + return BuildConfig.FLAVOR_branding.equals(DEFAULT_BITMASK); + } + + public static boolean preferAnonymousUsage() { + return BuildConfig.priotize_anonymous_usage; + } } diff --git a/app/src/main/res/layout/a_custom_provider_setup.xml b/app/src/main/res/layout/a_custom_provider_setup.xml new file mode 100644 index 00000000..34c59259 --- /dev/null +++ b/app/src/main/res/layout/a_custom_provider_setup.xml @@ -0,0 +1,30 @@ + + + + + + + + + + -- cgit v1.2.3 From 71eb3340558026be31b65ed2ad469c84f8f46bdd Mon Sep 17 00:00:00 2001 From: cyBerta Date: Fri, 31 Aug 2018 17:06:00 +0200 Subject: #8896 add layout for tablets --- .../a_custom_provider_setup.xml | 48 ++++++++++++++++++++++ .../res/layout-xlarge/a_custom_provider_setup.xml | 48 ++++++++++++++++++++++ ..._custom_provider_setup_tablet_linear_layout.xml | 33 +++++++++++++++ 3 files changed, 129 insertions(+) create mode 100644 app/src/main/res/layout-sw600dp-port/a_custom_provider_setup.xml create mode 100644 app/src/main/res/layout-xlarge/a_custom_provider_setup.xml create mode 100644 app/src/main/res/layout/a_custom_provider_setup_tablet_linear_layout.xml (limited to 'app') diff --git a/app/src/main/res/layout-sw600dp-port/a_custom_provider_setup.xml b/app/src/main/res/layout-sw600dp-port/a_custom_provider_setup.xml new file mode 100644 index 00000000..f32cdd65 --- /dev/null +++ b/app/src/main/res/layout-sw600dp-port/a_custom_provider_setup.xml @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + 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 new file mode 100644 index 00000000..a6578c2a --- /dev/null +++ b/app/src/main/res/layout-xlarge/a_custom_provider_setup.xml @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + 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 new file mode 100644 index 00000000..b3df1950 --- /dev/null +++ b/app/src/main/res/layout/a_custom_provider_setup_tablet_linear_layout.xml @@ -0,0 +1,33 @@ + + + + + + + + \ No newline at end of file -- cgit v1.2.3