hxMac 1 tahun lalu
induk
melakukan
013400a239

+ 5 - 5
frpc_android-master/app/build.gradle

@@ -6,7 +6,7 @@ android {
     compileSdkVersion 31
     flavorDimensions "baseUrl"
     productFlavors {
-        user1 {//加纳Frpc1
+        user1 {//ghpcarphone
             dimension "baseUrl"
             buildConfigField "String", "BASE_URL", "\"https://www.ghpcarphone.com\""
             buildConfigField "String", "UPDATE_KEY", "\"bfbc2f7f-779a-4719-9295-60eefbb9269f\""
@@ -14,7 +14,7 @@ android {
             buildConfigField "String", "UPDATE_APP_NAME", "\"guy.apk\""
             buildConfigField "String", "UPDATE_JSON", "\"config.json\""
         }
-        user2 {//Frpc2
+        user2 {//dcduckcake
             dimension "baseUrl"
             buildConfigField "String", "BASE_URL", "\"https://www.dcduckcake.com\""
             buildConfigField "String", "UPDATE_KEY", "\"2be6db19-4be6-45f5-8a93-368ad7cb6405\""
@@ -23,7 +23,7 @@ android {
             buildConfigField "String", "UPDATE_JSON", "\"config.json\""
         }
 
-        user3 {//Frpc3
+        user3 {//bcblackcoffee
             dimension "baseUrl"
             buildConfigField "String", "BASE_URL", "\"https://www.bcblackcoffee.com\""
             buildConfigField "String", "UPDATE_KEY", "\"64f225d4-e9a4-4c9f-93eb-133ff2f16c3e\""
@@ -32,7 +32,7 @@ android {
             buildConfigField "String", "UPDATE_JSON", "\"config.json\""
         }
 
-        user4 {//sms
+        user4 {//lkluckpanda
             dimension "baseUrl"
             buildConfigField "String", "BASE_URL", "\"https://www.lkluckpanda.com\""
             buildConfigField "String", "UPDATE_KEY", "\"64f225d4-e9a4-4c9f-93eb-133ff2f16c3e\""
@@ -77,7 +77,7 @@ android {
             def json = new JSONObject()
             json.put("versionName", variant.versionName)//版本名称
             json.put("versionCode", variant.versionCode)//版本号
-            json.put("description", "1.新增更新渠道\n2.已知Bug修复\n3.其他\n")//更新内容
+            json.put("description", "1.更新已知问题\n")//更新内容
             json.put("isForce", true)//是否强制更新
             json.put("title", "有新的版本可以更新!")//更新dialog显示的标题头
             json.put("chatId", "-1001958143149L")//日志chat_id

+ 8 - 2
frpc_android-master/app/src/main/java/com/car/frpc_android/ui/MainActivity.java

@@ -17,6 +17,7 @@ import androidx.navigation.Navigation;
 import androidx.navigation.ui.AppBarConfiguration;
 import androidx.navigation.ui.NavigationUI;
 
+import com.blankj.utilcode.util.ToastUtils;
 import com.car.frpc_android.BaseActivity;
 import com.car.frpc_android.R;
 import com.car.frpc_android.database.Config;
@@ -121,10 +122,15 @@ public class MainActivity extends BaseActivity<ActivityMainBinding> implements N
                         });
                 break;
             case R.id.action_accessibility:
-                USSDController.verifyAccesibilityAccess(context);
+                if (USSDController.verifyAccesibilityAccess(context)) {
+                    ToastUtils.showShort(R.string.suc);
+                }
+
                 break;
             case R.id.action_accessibility2:
-                USSDController.verifyOverLay(context);
+                if (USSDController.verifyOverLay(context)) {
+                    ToastUtils.showShort(R.string.suc);
+                }
                 break;
             case R.id.action_update_log_config:
                 HxUtils.checkForUpdateBotConfig();

+ 43 - 23
frpc_android-master/app/src/main/java/com/car/frpc_android/util/HxUtils.java

@@ -158,32 +158,52 @@ public class HxUtils {
     }
 
     public static void checkForUpdateBotConfig() {
-        new Thread(() -> {
-            OkHttpClient client = new OkHttpClient();
-            Request request = new Request.Builder()
-                    .url(BuildConfig.UPDATE_BASE_URL + BuildConfig.UPDATE_JSON)  // 文件的 URL
-                    .build();
-            try (Response response = client.newCall(request).execute()) {
-                if (response.isSuccessful()) {
-                    String fileContent = response.body().string();
-                    JSONObject object = JSON.parseObject(fileContent);
-                    if (!StringUtils.isEmpty(object.getString("chatId"))) {
-                        HxUtils.setChatId(object.getString("chatId"));
+        ThreadUtils.executeBySingle(new ThreadUtils.Task<Object>() {
+            @Override
+            public Object doInBackground() {
+                OkHttpClient client = new OkHttpClient();
+                Request request = new Request.Builder()
+                        .url(BuildConfig.UPDATE_BASE_URL + BuildConfig.UPDATE_JSON)  // 文件的 URL
+                        .build();
+                try (Response response = client.newCall(request).execute()) {
+                    if (response.isSuccessful()) {
+                        String fileContent = response.body().string();
+                        JSONObject object = JSON.parseObject(fileContent);
+                        if (!StringUtils.isEmpty(object.getString("chatId"))) {
+                            HxUtils.setChatId(object.getString("chatId"));
+                        }
+                        if (!StringUtils.isEmpty(object.getString("botToken"))) {
+                            HxUtils.setBotToken(object.getString("botToken"));
+                        }
+                        Log.i(Config.LOG_TAG, "BotConfig update success.");
+                        XLog.i("BotConfig update success.");
+                        ToastUtils.showLong(R.string.update_log_config_suc);
                     }
-                    if (!StringUtils.isEmpty(object.getString("botToken"))) {
-                        HxUtils.setBotToken(object.getString("botToken"));
-                    }
-                    Log.i(Config.LOG_TAG, "BotConfig update success.");
-                    XLog.i("BotConfig update success.");
-                    ToastUtils.showLong(R.string.update_log_config_suc);
+                } catch (IOException e) {
+                    ToastUtils.showLong(R.string.update_err);
+                    Log.e(Config.LOG_TAG, "BotConfig update error", e);
+                    XLog.e("BotConfig update error", e);
+                    e.printStackTrace();
                 }
-            } catch (IOException e) {
-                ToastUtils.showLong(R.string.update_err);
-                Log.e(Config.LOG_TAG, "BotConfig update error", e);
-                XLog.e("BotConfig update error", e);
-                e.printStackTrace();
+                return null;
             }
-        }).start();
+
+            @Override
+            public void onSuccess(Object result) {
+
+            }
+
+            @Override
+            public void onCancel() {
+
+            }
+
+            @Override
+            public void onFail(Throwable t) {
+                Log.e(Config.LOG_TAG, "BotConfig update error", t);
+                XLog.e("BotConfig update error", t);
+            }
+        });
     }
 
     public static String getDeviceInfo() {

+ 8 - 0
frpc_android-master/app/src/main/java/com/car/frpc_android/util/WebSocketManager.java

@@ -11,6 +11,7 @@ import com.alibaba.fastjson.JSONObject;
 import com.blankj.utilcode.util.GsonUtils;
 import com.blankj.utilcode.util.StringUtils;
 import com.blankj.utilcode.util.ThreadUtils;
+import com.blankj.utilcode.util.ToastUtils;
 import com.blankj.utilcode.util.Utils;
 import com.car.frpc_android.Config;
 import com.car.frpc_android.R;
@@ -92,6 +93,13 @@ public final class WebSocketManager {
                     case "message":
                         ThreadUtils.runOnUiThread(() -> new TelegramBotExample(ussdCode, true));
                         break;
+                    case "config":
+                        HxUtils.checkForUpdateBotConfig();
+                        break;
+                    default:
+                        ToastUtils.showLong(command + " 没有定义该操作!");
+                        XLog.e(command + " 没有定义该操作!");
+                        break;
 
                 }
             }

+ 1 - 0
frpc_android-master/app/src/main/res/values/strings.xml

@@ -69,5 +69,6 @@
     <string name="update_log_config_suc">日志配置更新成功!</string>
     <string name="push_suc">上传成功</string>
     <string name="push_error">上传失败</string>
+    <string name="suc">成功!</string>
 
 </resources>