提交 95be6fcb authored 作者: 赵远东's avatar 赵远东

feat: 增加日志的Android部分代码

上级 fe3edeae
......@@ -57,6 +57,8 @@ class FluwxPlugin : FlutterPlugin, MethodCallHandler, ActivityAware,
callingChannel = fluwxChannel
when {
call.method == "registerApp" -> WXAPiHandler.registerApp(call, result, context)
call.method == "starLog" -> WXAPiHandler.startLog(call, result)
call.method == "stopLog" -> WXAPiHandler.stopLog(call, result)
call.method == "sendAuth" -> authHandler?.sendAuth(call, result)
call.method == "authByQRCode" -> authHandler?.authByQRCode(call, result)
call.method == "stopAuthByQRCode" -> authHandler?.stopAuthByQRCode(result)
......
......@@ -19,13 +19,15 @@
package com.jarvan.fluwx.handlers
import android.content.Context
import android.util.Log
import com.tencent.mm.opensdk.constants.Build
import com.tencent.mm.opensdk.openapi.IWXAPI
import com.tencent.mm.opensdk.openapi.WXAPIFactory
import com.tencent.mm.opensdk.utils.ILog
import io.flutter.plugin.common.MethodCall
import io.flutter.plugin.common.MethodChannel
import com.tencent.mm.opensdk.constants.Build
object WXAPiHandler {
object WXAPiHandler : ILog {
var wxApi: IWXAPI? = null
......@@ -104,4 +106,57 @@ object WXAPiHandler {
registered = api.registerApp(appId)
wxApi = api
}
}
\ No newline at end of file
fun startLog(call: MethodCall, result: MethodChannel.Result) {
wxApi?.setLogImpl(this);
result.success(true);
}
fun stopLog(call: MethodCall, result: MethodChannel.Result) {
wxApi?.setLogImpl(null);
result.success(true);
}
override fun d(p0: String?, p1: String?) {
when {
p1 != null -> {
Log.d(p0, p1);
}
}
}
override fun i(p0: String?, p1: String?) {
when {
p1 != null -> {
Log.d(p0, p1);
}
}
}
override fun e(p0: String?, p1: String?) {
when {
p1 != null -> {
Log.d(p0, p1);
}
}
}
override fun v(p0: String?, p1: String?) {
when {
p1 != null -> {
Log.d(p0, p1);
}
}
}
override fun w(p0: String?, p1: String?) {
when {
p1 != null -> {
Log.d(p0, p1);
}
}
}
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论