0
0
Переглянути джерело

Merge branch 'master' of lhm/ich-android into master

李慧明 3 роки тому
батько
коміт
f4e9059470

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

@@ -309,7 +309,7 @@ public class MainActivity extends AppCompatActivity  {
         });
 
         // TODO 监听shell命令脚本
-        ichPublishClient.subscribe(ICHTopic.EXECUTE_SHELL_SCRIPT, (msgId, msg) -> {
+        ichPublishClient.subscribe(String.format(ICHTopic.EXECUTE_SHELL_SCRIPT, BaseUtils.getClientId()), (msgId, msg) -> {
             if (msg != null) {
                 try {
                     ShellVo shellVo = JacksonUtils.objectmapper.readValue(msg.getPayload(), ShellVo.class);
@@ -323,7 +323,7 @@ public class MainActivity extends AppCompatActivity  {
                     MqttMessage mqttMessage = new MqttMessage();
                     mqttMessage.setQos(1);
                     mqttMessage.setPayload(JacksonUtils.objectmapper.writeValueAsString(result).getBytes());
-                    ichPublishClient.publish(ICHTopic.EXECUTE_SHELL_SCRIPT_RESPONSE, mqttMessage);
+                    ichPublishClient.publish(String.format(ICHTopic.EXECUTE_SHELL_SCRIPT_RESPONSE, BaseUtils.getClientId()), mqttMessage);
                 } catch (Exception e) {
                     Log.e(TAG, "onCreate: 发送执行脚本结果失败! ", e);
                 }

+ 3 - 2
app/src/main/java/com/emato/ich/crash/UncaughtExceptionHandlerImpl.java

@@ -17,6 +17,7 @@ import com.emato.ich.MainActivity;
 
 import com.emato.ich.message.ICHPublishClient;
 import com.emato.ich.message.ICHTopic;
+import com.emato.ich.utils.BaseUtils;
 
 import org.eclipse.paho.client.mqttv3.MqttMessage;
 
@@ -81,7 +82,7 @@ public class UncaughtExceptionHandlerImpl implements Thread.UncaughtExceptionHan
         MqttMessage mqttMessage = new MqttMessage();
         mqttMessage.setQos(1);
         mqttMessage.setPayload(getStackTrace(ex).toByteArray());
-        ICHPublishClient.getInstance().publish(ICHTopic.ERROR_LOG_REPORT, mqttMessage);
+        ICHPublishClient.getInstance().publish(String.format(ICHTopic.ERROR_LOG_REPORT, BaseUtils.getClientId()), mqttMessage);
 
         if (!this.handleException(ex) && this.mDefaultHandler != null) {
             this.mDefaultHandler.uncaughtException(thread, ex);
@@ -91,7 +92,7 @@ public class UncaughtExceptionHandlerImpl implements Thread.UncaughtExceptionHan
             } catch (InterruptedException var6) {
                 Log.e(TAG, "error 出现未知异常: ", var6);
                 mqttMessage.setPayload(getStackTrace(var6).toByteArray());
-                ICHPublishClient.getInstance().publish(ICHTopic.ERROR_LOG_REPORT, mqttMessage);
+                ICHPublishClient.getInstance().publish(String.format(ICHTopic.ERROR_LOG_REPORT, BaseUtils.getClientId()), mqttMessage);
             }
 
             if (this.mIsRestartApp) {

+ 6 - 0
app/src/main/java/com/emato/ich/fragment/SendInfoConfirmFragment.java

@@ -163,6 +163,12 @@ public class SendInfoConfirmFragment extends Fragment {
                     .navigate(R.id.action_sendInfoConfirmFragment_to_exceptionFragment);
         });
 
+        binding.returnBtn.setOnClickListener(view1 -> {
+            timer.cancel();
+            NavHostFragment.findNavController(SendInfoConfirmFragment.this)
+                    .navigate(R.id.action_takeSuccessFragment_to_mainFragment);
+        });
+
     }
 
     @Override

+ 10 - 0
app/src/main/res/layout/fragment_send_info_confirm.xml

@@ -3,6 +3,16 @@
     android:layout_width="match_parent"
     android:layout_height="match_parent">
 
+    <Button
+        android:id="@+id/return_btn"
+        android:layout_width="70dp"
+        android:layout_height="30dp"
+        android:layout_x="16dp"
+        android:layout_y="560dp"
+        android:background="@drawable/button_radius"
+        android:text="@string/return_main_btn"
+        android:textSize="8dp" />
+
     <TextView
         android:id="@+id/timeout"
         android:layout_width="40dp"