6363
6464import java .io .File ;
6565import java .io .FileInputStream ;
66- import java .io .InputStream ;
67- import java .security .KeyStore ;
6866import java .text .SimpleDateFormat ;
6967import java .util .ArrayList ;
7068import java .util .Date ;
8583import cn .darkal .networkdiagnosis .R ;
8684import cn .darkal .networkdiagnosis .SysApplication ;
8785import cn .darkal .networkdiagnosis .Utils .DeviceUtils ;
88- import cn .darkal .networkdiagnosis .Utils .FileUtils ;
86+ import cn .darkal .networkdiagnosis .Utils .FileUtil ;
8987import cn .darkal .networkdiagnosis .Utils .SharedPreferenceUtils ;
9088import cn .darkal .networkdiagnosis .Utils .ZipUtils ;
9189import cn .darkal .networkdiagnosis .View .LoadingDialog ;
@@ -465,6 +463,7 @@ public void installCert() {
465463
466464 if (!isInstallCert ) {
467465 Toast .makeText (this , "必须安装证书才可实现HTTPS抓包" , Toast .LENGTH_LONG ).show ();
466+ FileUtil .checkPermission (this );
468467 try {
469468 byte [] keychainBytes ;
470469
@@ -643,6 +642,7 @@ private void handleUriStartupParams() {
643642
644643 public void createZip (final Runnable callback ) {
645644 showLoading ("打包中" );
645+ FileUtil .checkPermission (this );
646646 new Thread (new Runnable () {
647647 @ Override
648648 public void run () {
@@ -702,20 +702,20 @@ public void uploadZip() {
702702
703703 public class MyUploadDelegate implements UploadStatusDelegate {
704704 @ Override
705- public void onProgress (UploadInfo uploadInfo ) {
705+ public void onProgress (Context context , UploadInfo uploadInfo ) {
706706 Log .e ("~~~~" , uploadInfo .getProgressPercent () + "" );
707707 }
708708
709709 @ Override
710- public void onError (UploadInfo uploadInfo , Exception exception ) {
710+ public void onError (Context context , UploadInfo uploadInfo , ServerResponse serverResponse , Exception exception ) {
711711 dismissLoading ();
712712 Snackbar .make (rootView , "上传失败!" , Snackbar .LENGTH_LONG ).setAction ("Action" , null ).show ();
713713 exception .printStackTrace ();
714714 CrashReport .postCatchedException (exception );
715715 }
716716
717717 @ Override
718- public void onCompleted (UploadInfo uploadInfo , ServerResponse serverResponse ) {
718+ public void onCompleted (Context context , UploadInfo uploadInfo , ServerResponse serverResponse ) {
719719 try {
720720 JSONObject jsonObject = new JSONObject (serverResponse .getBodyAsString ());
721721 if (jsonObject .getInt ("errId" ) == 0 ) {
@@ -733,7 +733,7 @@ public void onCompleted(UploadInfo uploadInfo, ServerResponse serverResponse) {
733733 }
734734
735735 @ Override
736- public void onCancelled (UploadInfo uploadInfo ) {
736+ public void onCancelled (Context context , UploadInfo uploadInfo ) {
737737 dismissLoading ();
738738 }
739739 }
@@ -791,7 +791,7 @@ public void onClick(DialogInterface dialog, int whichButton) {
791791 public void run () {
792792 String serverUrl = UPLOAD_URL + "?code=" + edtInput .getText () + "&os=Android&module=" + Build .MODEL .replace (" " , "" ) + "&key=" + key ;
793793 showLoading ("上传中" );
794- FileUtils .uploadFiles (MainActivity .this , new MyUploadDelegate (), serverUrl , "upload" , Environment .getExternalStorageDirectory () + "/test.zip" );
794+ FileUtil .uploadFiles (MainActivity .this , new MyUploadDelegate (), serverUrl , "upload" , Environment .getExternalStorageDirectory () + "/test.zip" );
795795 }
796796 };
797797 createZip (runnable );
0 commit comments