ruirui1128

Results 17 comments of ruirui1128

这个问题,本身是后台不规范导致的问题。如果他们不愿意改,你可以在拦截器中直接把data,字段改掉。 ``` class ResponseInterceptor : Interceptor { override fun intercept(chain: Interceptor.Chain): Response { val response = chain.proceed(chain.request()) if (response.body != null) { try { var body = response.body?.string() val model...

api接口是suspend关键字修饰的,只要能开启协程,就要能进行网络请求。

如果在这个项目中要实现这个功能,需要在封装一些功能。 实现的原理是,在dialog cancel 的时候,手动将job.cancel。

这个需要根据实际业务进行处理,比如说zip三个请求,如果其中一个业务code不正确,是忽略其中一个还是整体不成立,由业务觉决定。 ``` fun request() = flow { emit(apiService.request()) } fun request2() = flow { emit(apiService.request2()) } fun request3() = flow { emit(apiService.request3()) } viewModelScope.launch { request() .zip(request()2){ r1,r2->{ val list=...

at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:513) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1055) Caused by: java.lang.IllegalArgumentException: Internal error: Failed to apply delegate: Following operations are not supported by GPU delegate: FULLY_CONNECTED: Max version supported: 4. Requested version 9. 180...

也可以自定义协程的扩展 在Dialog使用MainScope() ``` fun CoroutineScope.http( request: suspend () -> BaseResponse, response: (T) -> Unit, error: (Throwable) -> Unit = {} ): Job { return launch { kotlin.runCatching { request() }.onSuccess...

扩展一点来讲,api接口是suspend关键字修饰的,只要可以开启协程都可以进行网络请求 如在自定义线程中,执行网络任务 ``` class TaskTask1() : Runnable { override fun run() { val data = runBlocking { //阻塞当前线程 try { ApiClient.appApi.getBanner() } catch (e: Exception) { null } } //线程继续执行...

我用的NavigatorController路由控制, LocalLifecycleOwner.current可以实现当前屏幕compose生命周期的监听. 关于卡顿,建议你可以贴出代码。之前写compose的时候,单纯绘制UI都会卡顿,不过基础没有这个问题了。

> 你可以提下代码,我给你合入 发自我的iPhone > […](#) > 在 2022年7月29日,17:00,ruirui1128 ***@***.***> 写道:  复现:断网情况下,在首页点击搜索图标 (必现) 手机型号:华为Mate 30 Pro android版本:10 日志 2022-07-29 16:57:17.376 7663-7776/com.zj.play E/AndroidRuntime: FATAL EXCEPTION: DefaultDispatcher-worker-1 Process: com.zj.play, PID: 7663 —...

只要在凌晨定时重新初始化一下,反射customFormatName参数为空就可以了 ``` /** * 主要作用 再app不重新启动的情况下重新生成日志 */ private fun initLog() { // 日志同步 LogUtils.getLog2FileConfig()?.flushAsync() delay(100L) { // 此处用反射修改Log2FileConfigImpl.customFormatName=null 会重建日志(在不启动的情况下) val class1 = Class.forName("com.apkfuns.logutils.Log2FileConfigImpl") val customFormatName = class1.getDeclaredField("customFormatName") customFormatName.isAccessible = true...