Skip to content

Commit

Permalink
修改實現,在switchap的時候自動關閉beacon
Browse files Browse the repository at this point in the history
  • Loading branch information
qwe7002 authored and qwe7002 committed Jun 25, 2022
1 parent e5e2a56 commit d9a645b
Showing 1 changed file with 15 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
import android.util.Log;

import androidx.annotation.NonNull;
import androidx.annotation.RequiresApi;
import androidx.core.app.ActivityCompat;

import com.fitc.wifihotspot.TetherManager;
Expand Down Expand Up @@ -727,7 +726,13 @@ private void receive_handle(@NotNull JsonObject result_obj, boolean get_id_only)
Paper.book("temp").write("tether_open", false);
result_ap = getString(R.string.disable_wifi) + context.getString(R.string.action_success);
}
result_ap += "\n" + context.getString(R.string.current_battery_level) + get_battery_info(context) + "\n" + getString(R.string.current_network_connection_status) + get_network_type(context, true);
String beacon = "";
if (!Paper.book().read("disable_beacon", false)) {
Paper.book().write("disable_beacon", true);
beacon = "\n" + "Beacon monitoring status: False";

}
result_ap += "\n" + context.getString(R.string.current_battery_level) + get_battery_info(context) + "\n" + getString(R.string.current_network_connection_status) + get_network_type(context, true) + beacon;
request_body.text = getString(R.string.system_message_head) + "\n" + result_ap;
break;
} else {
Expand All @@ -749,7 +754,13 @@ private void receive_handle(@NotNull JsonObject result_obj, boolean get_id_only)
Paper.book("temp").write("wifi_open", false);
result_vpn_ap = getString(R.string.disable_wifi) + context.getString(R.string.action_success);
}
result_vpn_ap += "\n" + context.getString(R.string.current_battery_level) + get_battery_info(context) + "\n" + getString(R.string.current_network_connection_status) + get_network_type(context, true);
String beacon = "";
if (!Paper.book().read("disable_beacon", false)) {
Paper.book().write("disable_beacon", true);
beacon = "\n" + "Beacon monitoring status: False";

}
result_vpn_ap += "\n" + context.getString(R.string.current_battery_level) + get_battery_info(context) + "\n" + getString(R.string.current_network_connection_status) + get_network_type(context, true) + beacon;

request_body.text = getString(R.string.system_message_head) + "\n" + result_vpn_ap;
break;
Expand Down Expand Up @@ -1151,7 +1162,6 @@ public void onReceive(Context context, @NotNull Intent intent) {
}
}

@RequiresApi(api = Build.VERSION_CODES.M)
private class network_callback extends ConnectivityManager.NetworkCallback {
@Override
public void onAvailable(@NotNull Network network) {
Expand Down Expand Up @@ -1218,7 +1228,7 @@ public void run() {
if (error_magnification <= 59) {
++error_magnification;
}
if (error_magnification ==59 && !get_network_type(context, false).equals("WIFI")){
if (error_magnification == 59 && !get_network_type(context, false).equals("WIFI")) {
if (sharedPreferences.getBoolean("root", false)) {
com.qwe7002.telegram_rc.root_kit.network.restart_network();
error_magnification = 1;
Expand Down

0 comments on commit d9a645b

Please sign in to comment.