Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfixes #405

Merged
merged 4 commits into from
Nov 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ android {
"\"RWQKqtqvd0R7rUDp0rWzbtYPA3towPWcLDCl7eY9pBMMI/ohCmrS0WiM\"" + // RoSp
"}"
buildConfigField "boolean", "API_DISCOVERY_ENABLED", "true" // If false, you can only enter server URLs manually.
buildConfigField "String", "HELP_URI", "\"https://www.eduvpn.org/faq.html\""

// API
buildConfigField "String", "OAUTH_CLIENT_ID", "\"org.eduvpn.app.android\""
Expand Down Expand Up @@ -95,6 +96,7 @@ android {
buildConfigField "boolean", "API_DISCOVERY_ENABLED", "false"
buildConfigField "String", "OAUTH_CLIENT_ID", "\"org.govvpn.app.android\""
buildConfigField "String", "OAUTH_REDIRECT_URI", "\"org.govvpn.app:/api/callback\""
buildConfigField "String", "HELP_URI", "\"https://govroam.nl/govvpn\""

manifestPlaceholders = [
'redirectScheme': 'org.govvpn.app.android'
Expand Down
1 change: 1 addition & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_SPECIAL_USE" />

<application
android:name=".EduVPNApplication"
Expand Down
3 changes: 0 additions & 3 deletions app/src/main/java/nl/eduvpn/app/Constants.kt
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@ object Constants {
@JvmField
val DEBUG = BuildConfig.BUILD_TYPE.equals("debug", ignoreCase = true)

@JvmField
val HELP_URI = Uri.parse("https://www.eduvpn.org/faq.html")

@JvmField
val LOCALE = Locale.getDefault()
val ENGLISH_LOCALE = Locale.ENGLISH
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/nl/eduvpn/app/LicenseActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class LicenseActivity : BaseActivity<ActivityLicensesBinding>() {
binding.webView.loadUrl("file:///android_asset/licenses.html");
binding.toolbar.settingsButton.isVisible = false
binding.toolbar.helpButton.setOnClickListener {
startActivity(Intent(Intent.ACTION_VIEW, Constants.HELP_URI))
startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(BuildConfig.HELP_URI)))
}
}

Expand Down
9 changes: 2 additions & 7 deletions app/src/main/java/nl/eduvpn/app/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -152,13 +152,8 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
}
_parseIntentOnStart = true
binding.toolbar.settingsButton.setOnClickListener { _: View? -> onSettingsButtonClicked() }
binding.toolbar.helpButton.setOnClickListener { _: View? ->
startActivity(
Intent(
Intent.ACTION_VIEW,
Constants.HELP_URI
)
)
binding.toolbar.helpButton.setOnClickListener {
startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(BuildConfig.HELP_URI)))
}
createCertExpiryNotificationChannel()
createVPNConnectionNotificationChannel()
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/java/nl/eduvpn/app/SettingsActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package nl.eduvpn.app

import android.content.Intent
import android.content.res.ColorStateList
import android.net.Uri
import android.os.Bundle
import android.view.MenuItem
import android.view.View
Expand All @@ -43,7 +44,7 @@ class SettingsActivity : BaseActivity<ActivitySettingsBinding>() {
binding.toolbar.settingsButton.imageTintList =
ColorStateList.valueOf(ContextCompat.getColor(this, R.color.buttonBackgroundColor))
binding.toolbar.helpButton.setOnClickListener { _: View ->
startActivity(Intent(Intent.ACTION_VIEW, Constants.HELP_URI))
startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(BuildConfig.HELP_URI)))
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ class ConnectionStatusFragment : BaseFragment<FragmentConnectionStatusBinding>()
bc?.bytesOut
)
}.asLiveData()
binding.protocol = vpnService.getProtocol()
binding.ips = viewModel.ipFLow.asLiveData()
binding.connectionSwitch.setOnCheckedChangeListener { _, isChecked ->
if (isAutomaticCheckChange) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import androidx.lifecycle.FlowLiveDataConversions;
import androidx.lifecycle.LiveData;

import org.eduvpn.common.Protocol;
import org.jetbrains.annotations.NotNull;

import java.io.IOException;
Expand Down Expand Up @@ -316,8 +317,9 @@ public void updateState(String state, String logmessage, int localizedResId, Con
});
}

@NotNull
public String getProtocolName() {
return "OpenVPN";
@NonNull
@Override
public Protocol getProtocol() {
return Protocol.OpenVPN;
}
}
5 changes: 3 additions & 2 deletions app/src/main/java/nl/eduvpn/app/service/VPNService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import androidx.lifecycle.LiveData
import kotlinx.coroutines.flow.Flow
import nl.eduvpn.app.livedata.ByteCount
import nl.eduvpn.app.livedata.IPs
import org.eduvpn.common.Protocol

abstract class VPNService : LiveData<VPNService.VPNStatus>() {

Expand Down Expand Up @@ -44,7 +45,7 @@ abstract class VPNService : LiveData<VPNService.VPNStatus>() {
abstract fun getStatus(): VPNStatus

/**
* Name of the VPN protocol.
* Type of the VPN protocol this service implements.
*/
abstract fun getProtocolName(): String
abstract fun getProtocol(): Protocol
}
5 changes: 3 additions & 2 deletions app/src/main/java/nl/eduvpn/app/service/WireGuardService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import nl.eduvpn.app.livedata.IPs
import nl.eduvpn.app.livedata.TunnelData
import nl.eduvpn.app.utils.Log
import nl.eduvpn.app.utils.WireGuardTunnel
import org.eduvpn.common.Protocol
import java.net.Inet4Address
import java.util.concurrent.Executors
import kotlin.coroutines.resume
Expand Down Expand Up @@ -158,8 +159,8 @@ class WireGuardService(private val context: Context, timer: Flow<Unit>): VPNServ
}
}

override fun getProtocolName(): String {
return "WireGuard"
override fun getProtocol(): Protocol {
return Protocol.WireGuard
}

companion object {
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/layout/activity_settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

<include
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="80dp"
layout="@layout/include_toolbar"/>

</RelativeLayout>
Expand Down
28 changes: 27 additions & 1 deletion app/src/main/res/layout/fragment_connection_status.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

<import type="androidx.lifecycle.LiveData" />
<import type="nl.eduvpn.app.livedata.IPs" />
<import type="org.eduvpn.common.Protocol" />

<variable
name="viewModel"
Expand All @@ -28,6 +29,11 @@
name="ips"
type="LiveData&lt;IPs>" />

<variable
name="protocol"
type="org.eduvpn.common.Protocol"
/>

<import type="android.view.View" />
</data>

Expand Down Expand Up @@ -344,12 +350,32 @@
app:layout_constraintTop_toBottomOf="@id/label_ipv6"
tools:text="2001:610:450:40::2:100b" />

<TextView
android:id="@+id/label_protocol"
style="@style/ConnectionInfoLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/connection_info_protocol"
app:layout_constraintLeft_toLeftOf="@id/guide_vertical_divide"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintWidth_percent="0.5" />

<TextView
android:id="@+id/value_protocol"
style="@style/ConnectionInfoValue"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@{protocol == Protocol.OpenVPN ? @string/connection_info_protocol_name_openvpn : @string/connection_info_protocol_name_wireguard}"
app:layout_constraintLeft_toLeftOf="@id/value_uploaded"
app:layout_constraintTop_toTopOf="parent"
tools:text="WireGuard" />

<androidx.constraintlayout.widget.Guideline
android:id="@+id/guide_vertical_divide"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_percent="0.55" />
app:layout_constraintGuide_percent="0.52" />


</androidx.constraintlayout.widget.ConstraintLayout>
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/layout/include_toolbar.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
android:contentDescription="@string/content_description_settings_button"
android:padding="8dp"
android:src="@drawable/ic_settings"
android:tint="@color/iconColor"
app:tint="@color/iconColor"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />

Expand All @@ -68,7 +68,7 @@
android:contentDescription="@string/content_description_settings_button"
android:padding="8dp"
android:src="@drawable/ic_help"
android:tint="@color/iconColor"
app:tint="@color/iconColor"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toRightOf="parent" />

Expand Down
3 changes: 3 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@
<string name="connection_info_uploaded">UPLOADED</string>
<string name="connection_info_ipv4">IPv4 ADDRESS</string>
<string name="connection_info_ipv6">IPv6 ADDRESS</string>
<string name="connection_info_protocol">PROTOCOL</string>
<string name="connection_info_protocol_name_wireguard">WireGuard</string>
<string name="connection_info_protocol_name_openvpn">OpenVPN</string>

<string name="connection_info_state_connecting">Connecting</string>
<string name="connection_info_state_connected">Connected</string>
Expand Down