jun7572 пре 5 година
родитељ
комит
171fa5a7e9

+ 5 - 1
android/src/main/java/com/june/flutterzip/ArchiveManager.java

@@ -26,7 +26,7 @@ import io.flutter.plugin.common.MethodChannel;
 public class ArchiveManager {
     static private  long unziplong=0;
     static private  long filesize=0;
-    static void unzip(String unzipPath, final String outPath ,final MethodChannel channel){
+    static void unzip(String unzipPath, final String outPath ,final MethodChannel channel,final MethodChannel.Result result){
                      unziplong=0;
 //        ZipUtil.unpack(new File(unzipPath), new File(outPath), Charset.forName("GBK"));
         //判断编码
@@ -66,7 +66,11 @@ public class ArchiveManager {
 
                 map.put("total",filesize);
                 map.put("percent",unziplong);
+
 //                channel.invokeMethod("process",map);
+               if(filesize==unziplong){
+                   result.success(null);
+               }
             }
         },Charset.forName(s));
         //

+ 1 - 1
android/src/main/java/com/june/flutterzip/FlutterzipPlugin.java

@@ -50,7 +50,7 @@ public class FlutterzipPlugin implements FlutterPlugin, MethodCallHandler {
       String unzipPath= map.get("unzipPath");
       String outPath=map.get("outPath");
       //
-      ArchiveManager.unzip(unzipPath,outPath ,channel);
+      ArchiveManager.unzip(unzipPath,outPath ,channel,result);
 
 
     } else {