diff --git a/.gradle/5.6.4/executionHistory/executionHistory.bin b/.gradle/5.6.4/executionHistory/executionHistory.bin index dc60665..976805d 100644 Binary files a/.gradle/5.6.4/executionHistory/executionHistory.bin and b/.gradle/5.6.4/executionHistory/executionHistory.bin differ diff --git a/.gradle/5.6.4/executionHistory/executionHistory.lock b/.gradle/5.6.4/executionHistory/executionHistory.lock index a373e32..24f4de8 100644 Binary files a/.gradle/5.6.4/executionHistory/executionHistory.lock and b/.gradle/5.6.4/executionHistory/executionHistory.lock differ diff --git a/.gradle/5.6.4/fileHashes/fileHashes.bin b/.gradle/5.6.4/fileHashes/fileHashes.bin index af39b31..7c7ecc7 100644 Binary files a/.gradle/5.6.4/fileHashes/fileHashes.bin and b/.gradle/5.6.4/fileHashes/fileHashes.bin differ diff --git a/.gradle/5.6.4/fileHashes/fileHashes.lock b/.gradle/5.6.4/fileHashes/fileHashes.lock index a682a41..223baa8 100644 Binary files a/.gradle/5.6.4/fileHashes/fileHashes.lock and b/.gradle/5.6.4/fileHashes/fileHashes.lock differ diff --git a/.gradle/5.6.4/fileHashes/resourceHashesCache.bin b/.gradle/5.6.4/fileHashes/resourceHashesCache.bin index eb300c5..cdea640 100644 Binary files a/.gradle/5.6.4/fileHashes/resourceHashesCache.bin and b/.gradle/5.6.4/fileHashes/resourceHashesCache.bin differ diff --git a/.gradle/5.6.4/javaCompile/classAnalysis.bin b/.gradle/5.6.4/javaCompile/classAnalysis.bin index 10a254f..8a5ed16 100644 Binary files a/.gradle/5.6.4/javaCompile/classAnalysis.bin and b/.gradle/5.6.4/javaCompile/classAnalysis.bin differ diff --git a/.gradle/5.6.4/javaCompile/jarAnalysis.bin b/.gradle/5.6.4/javaCompile/jarAnalysis.bin index 00f2d0c..0efbd77 100644 Binary files a/.gradle/5.6.4/javaCompile/jarAnalysis.bin and b/.gradle/5.6.4/javaCompile/jarAnalysis.bin differ diff --git a/.gradle/5.6.4/javaCompile/javaCompile.lock b/.gradle/5.6.4/javaCompile/javaCompile.lock index 11fb4bb..abeb043 100644 Binary files a/.gradle/5.6.4/javaCompile/javaCompile.lock and b/.gradle/5.6.4/javaCompile/javaCompile.lock differ diff --git a/.gradle/5.6.4/javaCompile/taskHistory.bin b/.gradle/5.6.4/javaCompile/taskHistory.bin index 94e7268..a9f3ef6 100644 Binary files a/.gradle/5.6.4/javaCompile/taskHistory.bin and b/.gradle/5.6.4/javaCompile/taskHistory.bin differ diff --git a/.gradle/buildOutputCleanup/buildOutputCleanup.lock b/.gradle/buildOutputCleanup/buildOutputCleanup.lock index 4d49910..d297c0b 100644 Binary files a/.gradle/buildOutputCleanup/buildOutputCleanup.lock and b/.gradle/buildOutputCleanup/buildOutputCleanup.lock differ diff --git a/app/build.gradle b/app/build.gradle index efe13df..c135b6c 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -21,8 +21,8 @@ android { applicationId "net.sysolution.taxiapp" minSdkVersion 21 targetSdkVersion 29 - versionCode 249 - versionName "3.3.3-beta26.4.0.8-debug" + versionCode 251 + versionName "3.3.3-beta26.4.0.9-release" //alphaxx - 预览版本,不会对外发布,由测试人员测试,会有很多bug //Betaxx - 公开测试版本,会发给其他工作人员,会有较多版本 diff --git a/app/src/main/java/cn/trans88/taxiappkotlin/Configurations.java b/app/src/main/java/cn/trans88/taxiappkotlin/Configurations.java index 76aa19f..8343e7d 100644 --- a/app/src/main/java/cn/trans88/taxiappkotlin/Configurations.java +++ b/app/src/main/java/cn/trans88/taxiappkotlin/Configurations.java @@ -454,6 +454,14 @@ public class Configurations { context.getSharedPreferences("config", Context.MODE_PRIVATE).edit().putInt("logInterval", logInterval).apply(); } + public String progressList(){ + return context.getSharedPreferences("config", Context.MODE_PRIVATE).getString("progressList", ""); + } + + public void progressListSave(String s){ + context.getSharedPreferences("config", Context.MODE_PRIVATE).edit().putString("progressList", s).apply(); + } + } diff --git a/app/src/main/java/cn/trans88/taxiappkotlin/TaxiApp.kt b/app/src/main/java/cn/trans88/taxiappkotlin/TaxiApp.kt index c97f8ef..5809d10 100644 --- a/app/src/main/java/cn/trans88/taxiappkotlin/TaxiApp.kt +++ b/app/src/main/java/cn/trans88/taxiappkotlin/TaxiApp.kt @@ -15,6 +15,7 @@ import cn.trans88.taxiappkotlin.logic.dao.DaoSession import cn.trans88.taxiappkotlin.logic.dao.HelperDaoDB import cn.trans88.taxiappkotlin.logic.exception.CrashHandler import cn.trans88.taxiappkotlin.logic.model.Advertise +import cn.trans88.taxiappkotlin.logic.model.AdvertiseProcess import cn.trans88.taxiappkotlin.logic.model.BackgroundType import cn.trans88.taxiappkotlin.logic.model.Regions import cn.trans88.taxiappkotlin.logic.network.JoeyDownloadManager @@ -39,6 +40,7 @@ import java.util.* import java.util.concurrent.CopyOnWriteArrayList import kotlin.collections.ArrayList import kotlin.collections.HashMap +import kotlin.collections.HashSet class TaxiApp:Application() { @@ -67,6 +69,8 @@ class TaxiApp:Application() { val timerTaskMap = HashMap>() //存储定时广告的列表 var timedAds:ArrayList = ArrayList() + //存储未上传成功的下载进度 + var processList:HashSet = HashSet() var activity:PlayActivity? = null //gps日志定时器 diff --git a/app/src/main/java/cn/trans88/taxiappkotlin/logic/model/AdvertiseProcess.java b/app/src/main/java/cn/trans88/taxiappkotlin/logic/model/AdvertiseProcess.java index 14b3972..eec0b93 100644 --- a/app/src/main/java/cn/trans88/taxiappkotlin/logic/model/AdvertiseProcess.java +++ b/app/src/main/java/cn/trans88/taxiappkotlin/logic/model/AdvertiseProcess.java @@ -1,5 +1,7 @@ package cn.trans88.taxiappkotlin.logic.model; +import java.util.Objects; + public class AdvertiseProcess { private String type = "notify_download_ad_progress"; private String ad_id; @@ -20,4 +22,19 @@ public class AdvertiseProcess { public void setProgress(String progress) { this.progress = progress; } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + AdvertiseProcess that = (AdvertiseProcess) o; + return Objects.equals(type, that.type) && + Objects.equals(ad_id, that.ad_id) && + Objects.equals(progress, that.progress); + } + + @Override + public int hashCode() { + return Objects.hash(type, ad_id, progress); + } } diff --git a/app/src/main/java/cn/trans88/taxiappkotlin/logic/network/JoeyDownloadManager.java b/app/src/main/java/cn/trans88/taxiappkotlin/logic/network/JoeyDownloadManager.java index 0a995b8..576d408 100644 --- a/app/src/main/java/cn/trans88/taxiappkotlin/logic/network/JoeyDownloadManager.java +++ b/app/src/main/java/cn/trans88/taxiappkotlin/logic/network/JoeyDownloadManager.java @@ -192,6 +192,7 @@ public class JoeyDownloadManager { downloadListener = new JoeyDownloadListener() { @Override protected void completed(BaseDownloadTask task) { + YoungUtil.YoungLog("下载完成 --》 completed"); YoungUtil.YoungLog("Download " + task.getUrl() + " successful, [Size/Speed ==> " @@ -226,7 +227,7 @@ public class JoeyDownloadManager { advertiseProcess.setProgress(String.valueOf(100)); String progressJson = new Gson().toJson(advertiseProcess); YoungUtil.YoungLog("广告:"+task.getTag()+",下载完成进度100"); - WsManager.INSTANCE.send(progressJson); +// WsManager.INSTANCE.send(progressJson); try { RefreshPlayer.refresh(); @@ -313,11 +314,12 @@ public class JoeyDownloadManager { advertiseProcess.setProgress(String.valueOf(100)); String progressJson = new Gson().toJson(advertiseProcess); YoungUtil.YoungLog("广告:"+task.getTag().toString()+",下载完成进度100"); - WsManager.INSTANCE.send(progressJson); - try{ - Thread.sleep(500); - }catch (Exception e){} - WsManager.INSTANCE.send(progressJson); +// WsManager.INSTANCE.send(progressJson); + +// try{ +// Thread.sleep(500); +// }catch (Exception e){} +// WsManager.INSTANCE.send(progressJson); } // if (progress%5==0){ // AdvertiseProcess advertiseProcess =new AdvertiseProcess(); diff --git a/app/src/main/java/cn/trans88/taxiappkotlin/logic/network/ProcessingCommands.kt b/app/src/main/java/cn/trans88/taxiappkotlin/logic/network/ProcessingCommands.kt index 7ef182e..65f63cb 100644 --- a/app/src/main/java/cn/trans88/taxiappkotlin/logic/network/ProcessingCommands.kt +++ b/app/src/main/java/cn/trans88/taxiappkotlin/logic/network/ProcessingCommands.kt @@ -22,6 +22,7 @@ import cn.trans88.taxiappkotlin.ui.play.isOverdue import cn.trans88.taxiappkotlin.util.YoungUtil import com.google.gson.Gson import com.google.gson.JsonParser +import com.google.gson.reflect.TypeToken import com.trs88.kurolibrary.execute.KuroExecutor import com.trs88.kurolibrary.file.KuroFileUtil import java.io.* @@ -298,6 +299,7 @@ object ProcessingCommands { //edit by ljh @2024/3/14 Configurations.config(TaxiApp.instance()).isSoftDecodeSave(loggerSwitch.isSoftDeCode) taxiApp.isSoftDecode = loggerSwitch.isSoftDeCode + "是否软解码:${taxiApp.isSoftDecode}".logd() baseResponse.type = type val response = gson.toJson(baseResponse) @@ -356,6 +358,7 @@ object ProcessingCommands { beatTimer!!.cancel() beatTimer!!.purge() beatTimer = null + } beatTimer = Timer() @@ -395,9 +398,25 @@ object ProcessingCommands { } /** - *发送所有广告信息 + * 发送所有广告信息 */ private fun sendAllAdvertiseInfo(task: String, type: String) { + //提交未上传成功的下载进度 + try { + val progressListJson = Configurations.config(taxiApp).progressList() + if (!progressListJson.isNullOrEmpty()){ + "progressListJson:$progressListJson".logd() + val progressList = gson.fromJson(progressListJson,object : TypeToken>(){}.type) as HashSet + for (advertiseProcess in progressList) { + send(gson.toJson(advertiseProcess)) + } + Configurations.config(taxiApp).progressListSave("") + taxiApp.processList.clear() + } + } catch (e: Exception) { + "exception:${e?.message}".loge() + } + val baseResponse = gson.fromJson(task) val positionAdvertises = DaoUtil.getPositionAdvertise().loadAll() @@ -593,7 +612,7 @@ object ProcessingCommands { val sanleResponse = SanleResponse() sanleResponse.task_id = taskId - sanleResponse.id =id + sanleResponse.id = id sanleResponse.type = type val response = gson.toJson(sanleResponse) send(response) @@ -826,6 +845,12 @@ object ProcessingCommands { sanleResponse.type = type val response = gson.toJson(sanleResponse) send(response) + + val advertiseProcess = AdvertiseProcess() + advertiseProcess.ad_id = positionAdvertise.task_id + advertiseProcess.progress = 100.toString() + val progressJson = Gson().toJson(advertiseProcess) + send(progressJson) } /** @@ -1042,6 +1067,12 @@ object ProcessingCommands { sanleResponse.type = type val response = gson.toJson(sanleResponse) send(response) + + val advertiseProcess = AdvertiseProcess() + advertiseProcess.ad_id = sanleAdvertise.task_id + advertiseProcess.progress = 100.toString() + val progressJson = Gson().toJson(advertiseProcess) + send(progressJson) // send("服务器日志 ${Xixun.getCardId()} 添加广告 id =${sanleAdvertise.id}") } diff --git a/app/src/main/java/cn/trans88/taxiappkotlin/logic/network/WsManager.kt b/app/src/main/java/cn/trans88/taxiappkotlin/logic/network/WsManager.kt index 1aeb211..2ce8365 100644 --- a/app/src/main/java/cn/trans88/taxiappkotlin/logic/network/WsManager.kt +++ b/app/src/main/java/cn/trans88/taxiappkotlin/logic/network/WsManager.kt @@ -14,6 +14,7 @@ import cn.trans88.taxiappkotlin.ext.logd import cn.trans88.taxiappkotlin.ext.loge import cn.trans88.taxiappkotlin.logic.Repository import cn.trans88.taxiappkotlin.logic.dao.DaoUtil +import cn.trans88.taxiappkotlin.logic.model.AdvertiseProcess import cn.trans88.taxiappkotlin.logic.model.CurrentPlayAdvertises import cn.trans88.taxiappkotlin.util.KuroTimer import cn.trans88.taxiappkotlin.util.KuroTimerTask @@ -357,7 +358,22 @@ object WsManager { // if(!(heartbeatContext.equals(msg))){ // Repository.taxiApp.saveLog("回复服务器 $msg") // } - + if (msg.contains("notify_download_ad_progress")) { + "notify_download_ad_progress ----> $msg".logd() + if (mWebSocket == null) { + try { + val process = Repository.taxiApp.gson.fromJson( + msg, + AdvertiseProcess::class.java + ) + Repository.taxiApp.processList.add(process) + val json = Repository.taxiApp.gson.toJson(Repository.taxiApp.processList) + Configurations.config(Repository.taxiApp).progressListSave(json) + } catch (e:Exception){ + "exception:${e?.message}".loge() + } + } + } mWebSocket?.send(msg) // mWebSocket?.send(msg) ?: throw IllegalArgumentException("mWebSocket is null not send!") } diff --git a/app/src/main/java/cn/trans88/taxiappkotlin/ui/play/PlayerRule.kt b/app/src/main/java/cn/trans88/taxiappkotlin/ui/play/PlayerRule.kt index 58e444a..b498f0b 100644 --- a/app/src/main/java/cn/trans88/taxiappkotlin/ui/play/PlayerRule.kt +++ b/app/src/main/java/cn/trans88/taxiappkotlin/ui/play/PlayerRule.kt @@ -35,11 +35,11 @@ fun Advertise.isReady(): Boolean { if(media_type != MaterialType.Text.ordinal){ /* 这里exist判断不准,文件存在被判定为不存在 略作改动 - if (!File(this.pathName).exists()) { - YoungUtil.YoungLog("${this.pathName}的广告本地不存在,重新下载 ready返回false") - downloadFile() - ready = false - } + if (!File(this.pathName).exists()) { + YoungUtil.YoungLog("${this.pathName}的广告本地不存在,重新下载 ready返回false") + downloadFile() + ready = false + } */ //edit by yzd @20211222 val file = File(this.pathName) diff --git a/local.properties b/local.properties index d70b3ff..d288f8f 100644 --- a/local.properties +++ b/local.properties @@ -4,5 +4,5 @@ # Location of the SDK. This is only used by Gradle. # For customization when using a Version Control System, please read the # header note. -#Mon Mar 18 15:40:17 GMT+08:00 2024 +#Thu Mar 21 16:48:54 GMT+08:00 2024 sdk.dir=D\:\\Android\\sdk diff --git a/release/output.json b/release/output.json index fcc39a0..a4ccdcf 100644 --- a/release/output.json +++ b/release/output.json @@ -1 +1 @@ -[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":249,"versionName":"3.3.3-beta26.4.0.8-debug","enabled":true,"outputFile":"TaxiApp_v3.3.3-beta26.4.0.8-debug{249}.apk","fullName":"release","baseName":"release","dirName":""},"path":"TaxiApp_v3.3.3-beta26.4.0.8-debug{249}.apk","properties":{}}] \ No newline at end of file +[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":251,"versionName":"3.3.3-beta26.4.0.9-release","enabled":true,"outputFile":"TaxiApp_v3.3.3-beta26.4.0.9-release{251}.apk","fullName":"release","baseName":"release","dirName":""},"path":"TaxiApp_v3.3.3-beta26.4.0.9-release{251}.apk","properties":{}}] \ No newline at end of file