dns66 icon indicating copy to clipboard operation
dns66 copied to clipboard

ON/OFF Toggle Widget

Open jerryn70 opened this issue 7 years ago • 12 comments

Adding ON/OFF Toggle Widget will help users to quickly switch ON and OFF adblocking. Then you might think why switching OFF adblocking , the answer is some applications won't work when vpn is enabled example 'shareit' . So we are forced to turn OFF vpn to use that apps. At this point toggle widget if helpful

jerryn70 avatar Dec 27 '16 18:12 jerryn70

some applications won't work when vpn is enabled

You can blacklist apps in DNS66.

debagos avatar Jan 06 '17 15:01 debagos

@debagos That won't work. We need to to completely stop vpn to make that app work

jerryn70 avatar Jan 18 '17 07:01 jerryn70

A quick settings tile would be useful as well.

jarettmillard avatar Jan 29 '17 15:01 jarettmillard

If you are only interested in being able to pause the app while it is running, I'd suggest adding an action to the notification.

If you want to be able to cold start as well, you could (in addition to a widget, since this is api 24+ only) support a quick settings tile.

That's done by adding this to your manifest:

<service
    android:name=".receiver.TileReciever"
    android:icon="@drawable/toggle_icon"
    android:label="@string/app_name"
    android:permission="android.permission.BIND_QUICK_SETTINGS_TILE">
    <intent-filter>
        <action android:name="android.service.quicksettings.action.QS_TILE" />
    </intent-filter>
</service>

and then you add a class (in this case, TileReciever) that inherits from TileService(), and override the onClick() method.

smichel17 avatar Mar 07 '17 14:03 smichel17

@smichel17 PR #62 has an implementation of a quick settings tile (which is issue #26).

We can't have an action in the notification. Well we could, but it would automatically reconnect on connectivity changes (there's only one paused state - the waiting for network state). Quick settings and widgets have the advantage of not needing a second pause state.

That said, this all depends on the work in the hostdb branch - currently, pausing anything is a fairly wasteful affair (we re-read all hosts files after unpausing...). And well, Android is buggy, so even though I don't need to re-read host files, I'll probably have to add a 2 second sleep before establishing a new VPN connection, as Android otherwise goes mad and no packets reach the service anymore...

With the new refactoring in hostdb brach, we could easily have more states, as the service can be controlled more accurately now - by sending it commands via a file descriptor. So we could easily have a PAUSE_FULLY command.

julian-klode avatar Mar 07 '17 15:03 julian-klode

The way we do it in Red Moon (a screen filter) is:

  • Action in the notification to stop the filter.
  • When the filter is stopped, stop the service running in the foreground, and send a non-sticky notification.
  • When the filter is stopped in the background, do the same, but dismiss the notification.

So, we don't add any additional state for that, it's either on or off, but a user can stop the service and then start it again (provided they don't swipe the notification away while it's stopped).

smichel17 avatar Mar 07 '17 15:03 smichel17

Brief user input: the irritation of notification screen clutter greatly outweighs the ability to quickly pause something that remains running the vast majority of the time.

-------- Original Message -------- From: smichel17 [email protected] Sent: Tue Mar 07 09:19:14 CST 2017 To: julian-klode/dns66 [email protected] Cc: Subscribed [email protected] Subject: Re: [julian-klode/dns66] ON/OFF Toggle Widget (#67)

The way we do it in Red Moon (a screen filter) is:

Action in the notification to stop the filter. When the filter is stopped, stop the service running in the foreground, and send a non-sticky notification. When the filter is stopped in the background, do the same, but dismiss the notification.

So, we don't add any additional state for that, it's either on or off, but a user can stop the service and then start it again (provided they don't swipe the notification away while it's stopped).

-- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/julian-klode/dns66/issues/67#issuecomment-284751203

Redoregon avatar Mar 07 '17 15:03 Redoregon

@redoregon DNS66's notification can be disabled in its menu. Although I agree, that notification clutter is annoying.

smichel17 avatar Mar 07 '17 15:03 smichel17

Yes, of course as long as the notification remains deselectable, all is well :-)

-------- Original Message -------- From: smichel17 [email protected] Sent: Tue Mar 07 09:29:51 CST 2017 To: julian-klode/dns66 [email protected] Cc: Redoregon [email protected], Mention [email protected] Subject: Re: [julian-klode/dns66] ON/OFF Toggle Widget (#67)

@redoregon DNS66's notification can be disabled in its menu. Although I agree, that notification clutter is annoying.

-- You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub: https://github.com/julian-klode/dns66/issues/67#issuecomment-284754603

Redoregon avatar Mar 07 '17 15:03 Redoregon

I would not call a lowest-priority notification clutter. It's always at the end of the notification list, and not even shown on the lock screen. If you have about 3 other notifications, you'd have to scroll down to see it. The real reason to have it is to prevent Android from killing the service (well, to make it less likely).

julian-klode avatar Mar 07 '17 15:03 julian-klode

Also, the android system can disable any notification.

Maybe instead of allowing the user to turn off the notification via the app, we should have a link to the place in the android system where they can turn off notifications from DNS66. That way we can always startForeground(), and users can still hide the notification.

smichel17 avatar Mar 07 '17 17:03 smichel17

@smichel17 The notification thing is implemented in 86af494

julian-klode avatar Apr 17 '17 00:04 julian-klode