feat: 完善了获取设备名称 Android 平台的实现

This commit is contained in:
PeanutMelonSeedBigAlmond
2024-02-02 18:25:02 +08:00
parent 88ab0ec2d8
commit afe7bdb4b5

View File

@@ -2,6 +2,7 @@ package com.lifegpc.ehf
import android.app.Activity
import android.content.Intent
import android.os.Build
import android.view.WindowManager
import com.lifegpc.ehf.annotation.ChannelMethod
import com.lifegpc.ehf.eventbus.SAFAuthEvent
@@ -31,6 +32,11 @@ class MainActivity : FlutterActivity() {
flutterEngine,
this
)
MethodChannelUtils.registerMethodChannel(
"lifegpc.eh_downloader_flutter/device",
flutterEngine,
this
)
}
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
@@ -59,4 +65,8 @@ class MainActivity : FlutterActivity() {
private fun disableFlagSecure() {
window.clearFlags(WindowManager.LayoutParams.FLAG_SECURE)
}
@ChannelMethod(methodName = "deviceName")
@Suppress("unused")
private fun getDeviceName(): String = Build.MODEL
}