Ver Fonte

fix: 执行shell主题, 执行shell增加换行符

lhm há 3 anos atrás
pai
commit
0762ce367f

+ 1 - 61
app/src/main/java/com/emato/ich/MainActivity.java

@@ -141,67 +141,7 @@ public class MainActivity extends AppCompatActivity  {
                         if (!StringUtils.isNullOrEmpty(time)) {
                             LocalStorage.getInstance().getSession().setTime(Long.parseLong(time));
                         }
-                        String qrcode_url = configMap.get(SystemConfigConstant.cabinet_take_object_qrcode_url);
-
-                        try {
-                            ICSPClient.download(qrcode_url, new Callback() {
-                                @Override
-                                public void onFailure(@NotNull Call call, @NotNull IOException e) {
-
-                                }
-
-                                @Override
-                                public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException {
-                                    InputStream is = null;
-                                    byte[] buf = new byte[2048];
-                                    int len = 0;
-                                    FileOutputStream fos = null;
-                                    final String destFileDir = "res/drawable/";
-                                    String destFileName = "e_mp_qrcode_8x8.jpg";
-                                    //储存下载文件的目录
-                                    File dir = new File(getApplication().getFilesDir().getAbsolutePath() + "/" +destFileDir);
-                                    if (!dir.exists()) {
-                                        dir.mkdirs();
-                                    }
-//                destFileName = apk_url.substring(apk_url.lastIndexOf('/'), apk_url.length() - 1);
-                                    File file = new File(dir, destFileName);
-
-                                    try {
-
-                                        is = response.body().byteStream();
-                                        long total = response.body().contentLength();
-                                        fos = new FileOutputStream(file);
-                                        long sum = 0;
-                                        while ((len = is.read(buf)) != -1) {
-                                            fos.write(buf, 0, len);
-                                            sum += len;
-                                            int progress = (int) (sum * 1.0f / total * 100);
-                                            //下载中更新进度条
-                                            listener.onDownloading(progress);
-                                        }
-                                        fos.flush();
-                                        //下载完成
-                                        listener.onDownloadSuccess(file);
-                                    } catch (Exception e) {
-                                        listener.onDownloadFailed(e);
-                                    }finally {
-                                        try {
-                                            if (is != null) {
-                                                is.close();
-                                            }
-                                            if (fos != null) {
-                                                fos.close();
-                                            }
-                                        } catch (IOException e) {
-
-                                        }
-
-                                    }
-                                }
-                            }, listener);
-                        } catch (Exception e) {
 
-                        }
                         Log.i(TAG, "onResponse: 获取系统配置成功! ");
                     } else {
                         Log.w(TAG, "onResponse: code==>" + readValue.getCode() + ", msg==>" + readValue.getMsg());
@@ -236,7 +176,7 @@ public class MainActivity extends AppCompatActivity  {
                 try {
                     ShellVo shellVo = JacksonUtils.objectmapper.readValue(msg.getPayload(), ShellVo.class);
                     ShellVo result = shellVo;
-                    if (shellVo != null && shellVo.getScript() != null && "".equals(shellVo.getScript()) && shellVo.getScript().length() > 0) {
+                    if (shellVo != null && shellVo.getScript() != null && !"".equals(shellVo.getScript()) && shellVo.getScript().length() > 0) {
                         BaseUtils.executeShell(shellVo);
                     } else {
                         result = new ShellVo();

+ 1 - 1
app/src/main/java/com/emato/ich/message/ICHTopic.java

@@ -17,7 +17,7 @@ public class ICHTopic {
 
     public static final String APK_UPDATE_PATH = "/icsp-server/apk/upgrade/%s";
 
-    public static final String EXECUTE_SHELL_SCRIPT = "/iscp-server/execute/shell/%s";
+    public static final String EXECUTE_SHELL_SCRIPT = "/icsp-server/execute/shell/%s";
 
     public static final String EXECUTE_SHELL_SCRIPT_RESPONSE = "/icsp-client/execute/shell/response/%s";
 

+ 1 - 0
app/src/main/java/com/emato/ich/utils/BaseUtils.java

@@ -101,6 +101,7 @@ public class BaseUtils {
             while ((line = bufferedreader.readLine()) != null) {
                 //System.out.println(line);
                 sb.append(line);
+                sb.append("\n");
             }
             shellVo.setResult(sb.toString());
             return shellVo;

+ 2 - 1
app/src/main/res/values/themes.xml

@@ -3,7 +3,8 @@
     <style name="Theme.Ichandroid" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
         <!-- Primary brand color. -->
         <item name="colorPrimary">@color/send_btn</item>
-        <item name="colorPrimaryVariant">@color/purple_700</item>
+        <!-- 状态栏颜色 -->
+        <item name="colorPrimaryVariant">@color/status_bar_color</item>
         <item name="colorOnPrimary">@color/white</item>
         <!-- Secondary brand color. -->
         <item name="colorSecondary">@color/teal_200</item>