mirror of https://github.com/M66B/NetGuard.git
parent
262f07e69a
commit
7f9e435504
|
@ -79,6 +79,7 @@ public class ActivityMain extends AppCompatActivity implements SharedPreferences
|
|||
|
||||
public static final String ACTION_RULES_CHANGED = "eu.faircode.netguard.ACTION_RULES_CHANGED";
|
||||
public static final String EXTRA_SEARCH = "Search";
|
||||
public static final String EXTRA_APPROVE = "Approve";
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
|
@ -103,10 +104,12 @@ public class ActivityMain extends AppCompatActivity implements SharedPreferences
|
|||
// Upgrade
|
||||
Receiver.upgrade(initialized, this);
|
||||
|
||||
if (enabled)
|
||||
SinkholeService.start("UI", this);
|
||||
else
|
||||
SinkholeService.stop("UI", this);
|
||||
if (!getIntent().hasExtra(EXTRA_APPROVE)) {
|
||||
if (enabled)
|
||||
SinkholeService.start("UI", this);
|
||||
else
|
||||
SinkholeService.stop("UI", this);
|
||||
}
|
||||
|
||||
// Action bar
|
||||
View actionView = getLayoutInflater().inflate(R.layout.action, null);
|
||||
|
@ -277,6 +280,12 @@ public class ActivityMain extends AppCompatActivity implements SharedPreferences
|
|||
} catch (Throwable ex) {
|
||||
Log.e(TAG, ex.toString() + "\n" + Log.getStackTraceString(ex));
|
||||
}
|
||||
|
||||
// Approve request
|
||||
if (getIntent().hasExtra(EXTRA_APPROVE) && !enabled) {
|
||||
Log.i(TAG, "Requesting VPN approval");
|
||||
swEnabled.toggle();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1528,6 +1528,7 @@ public class SinkholeService extends VpnService implements SharedPreferences.OnS
|
|||
|
||||
private void showAutoStartNotification() {
|
||||
Intent main = new Intent(this, ActivityMain.class);
|
||||
main.putExtra(ActivityMain.EXTRA_APPROVE, true);
|
||||
PendingIntent pi = PendingIntent.getActivity(this, 0, main, PendingIntent.FLAG_UPDATE_CURRENT);
|
||||
|
||||
TypedValue tv = new TypedValue();
|
||||
|
|
Loading…
Reference in New Issue