Skip to content

Add shareOverLan switch for mobile version #3196

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
12 changes: 10 additions & 2 deletions core/src/main/rust/linker-wrapper.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from __future__ import absolute_import, print_function, unicode_literals

import os
import pipes
import shutil
import subprocess
import sys
Expand All @@ -25,6 +24,15 @@ def win2posix(path):

args = [rustcc, os.environ['RUST_ANDROID_GRADLE_CC_LINK_ARG']] + sys.argv[1:]

def cmd_quote(string):
import sys
if int(sys.version[2]) < 3:
import pipes
return pipes.quote(string)
else:
import shlex
return shlex.quote(string)

def update_in_place(arglist):
# The `gcc` library is not included starting from NDK version 23.
# Work around by using `unwind` replacement.
Expand Down Expand Up @@ -68,7 +76,7 @@ def posix2win(path):


# This only appears when the subprocess call fails, but it's helpful then.
printable_cmd = " ".join(pipes.quote(arg) for arg in args)
printable_cmd = " ".join(cmd_quote(arg) for arg in args)
print(printable_cmd)

code = subprocess.call(args)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ class GlobalSettingsPreferenceFragment : PreferenceFragmentCompat() {
} else canToggleLocked.remove()

val serviceMode = findPreference<Preference>(Key.serviceMode)!!
val shareOverLan = findPreference<Preference>(Key.shareOverLan)!!
val portProxy = findPreference<EditTextPreference>(Key.portProxy)!!
portProxy.setOnBindEditTextListener(EditTextPreferenceModifiers.Port)
val portLocalDns = findPreference<EditTextPreference>(Key.portLocalDns)!!
Expand All @@ -66,6 +67,7 @@ class GlobalSettingsPreferenceFragment : PreferenceFragmentCompat() {
val listener: (BaseService.State) -> Unit = {
val stopped = it == BaseService.State.Stopped
serviceMode.isEnabled = stopped
shareOverLan.isEnabled = stopped
portProxy.isEnabled = stopped
portLocalDns.isEnabled = stopped
if (stopped) onServiceModeChange.onPreferenceChange(serviceMode, DataStore.serviceMode) else {
Expand Down
3 changes: 3 additions & 0 deletions mobile/src/main/res/xml/pref_global.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
app:defaultValue="vpn"
app:title="@string/service_mode"
app:useSimpleSummaryProvider="true"/>
<SwitchPreference
app:key="shareOverLan"
app:title="@string/share_over_lan"/>
<EditTextPreference
app:key="portProxy"
app:icon="@drawable/ic_maps_directions_boat"
Expand Down