Commit 76ac5caa authored by Daniel Wolf's avatar Daniel Wolf
Browse files

Added a dialog shown when the app doesn't have access to the vpn yet and an...

Added a dialog shown when the app doesn't have access to the vpn yet and an overlay seems to be active

Implements #143
parent 66e796ce
......@@ -8,6 +8,7 @@ import
import android.os.Bundle
import android.view.LayoutInflater
import android.view.MotionEvent
import android.view.View
import android.view.ViewGroup
import android.view.animation.Animation
......@@ -19,14 +20,11 @@ import
import com.frostnerd.dnstunnelproxy.DnsServerInformation
import com.frostnerd.general.service.isServiceRunning
import com.frostnerd.smokescreen.R
import com.frostnerd.smokescreen.*
import com.frostnerd.smokescreen.activity.SpeedTestActivity
import com.frostnerd.smokescreen.dialog.ServerChoosalDialog
import com.frostnerd.smokescreen.getPreferences
import com.frostnerd.smokescreen.registerLocalReceiver
import com.frostnerd.smokescreen.service.Command
import com.frostnerd.smokescreen.service.DnsVpnService
import com.frostnerd.smokescreen.unregisterLocalReceiver
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch
......@@ -80,6 +78,30 @@ class MainFragment : Fragment() {
startButton.setOnTouchListener { _, event ->
if(proxyRunning || proxyStarting) {
} else {
if(event.flags and MotionEvent.FLAG_WINDOW_IS_OBSCURED != 0) {
if(event.action == MotionEvent.ACTION_UP) {
if(VpnService.prepare(context!!) != null) {
positiveButton = null,
negativeButton = null,
neutralButton = getString(android.R.string.ok) to { dialog, _ ->
proxyStarting = true
} else false
} else false
}else false
speedTest.setOnClickListener {
......@@ -152,4 +152,7 @@
<string name="dialog_servicekilled_message">The app detected that it wasn\'t stopped properly the last time it was active. This strongly indicates that your system chose to force stop the app without any possibility for the app to restart itself.\n\nOn most devices you have a few options to prevent or at least delay the system from stopping the app.\nYou can for example disable battery optimizations for the app in the system settings or avoid clearing the app from the list of recents.\n\nIf you chose to ignore this you won\'t see this dialog again. You can read more and receive tips for solving this with the button below (opens an external website in your browser).</string>
<string name="dialog_servicekilled_more_info">More information</string>
<string name="dialog_overlaydetected_title">System-wide overlay detected</string>
<string name="dialog_overlaydetected_message">There seems to be a system-wide overlay (e.g. a chat bubble, color- or nightfilter) active. Most device don\'t allow you to enable a VPN in this case.\n\nIf you can\'t click OK in the next dialog please disable the overlay.</string>
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment