Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #29 from Crequency/dev=main
[Pull Request] 优化设备页面显示, 新增设备服务状态控制, 等其它改进
- Loading branch information
Showing
42 changed files
with
2,024 additions
and
953 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
name: "Pull Request Labeler" | ||
on: | ||
pull_request: | ||
types: | ||
- closed | ||
|
||
jobs: | ||
pr-merged: | ||
if: github.event.pull_request.merged == true | ||
runs-on: ubuntu-latest | ||
permissions: | ||
issues: write | ||
steps: | ||
- uses: actions/github-script@v6 | ||
with: | ||
script: | | ||
github.rest.issues.addLabels({ | ||
issue_number: context.issue.number, | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
labels: ["merged"] | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="com.crequency.kitx.kitx_mobile"> | ||
package="com.crequency.kitx.mobile"> | ||
<!-- The INTERNET permission is required for development. Specifically, | ||
the Flutter tool needs it to communicate with the running application | ||
to allow setting breakpoints, to provide hot reload, etc. | ||
--> | ||
<uses-permission android:name="android.permission.INTERNET"/> | ||
<uses-permission android:name="android.permission.INTERNET" /> | ||
</manifest> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 0 additions & 6 deletions
6
kitx_mobile/android/app/src/main/kotlin/com/crequency/kitx/kitx_mobile/MainActivity.kt
This file was deleted.
Oops, something went wrong.
57 changes: 57 additions & 0 deletions
57
kitx_mobile/android/app/src/main/kotlin/com/crequency/kitx/mobile/MainActivity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package com.crequency.kitx.mobile | ||
|
||
import android.util.Log | ||
import android.widget.Toast | ||
import io.flutter.embedding.android.FlutterActivity | ||
import io.flutter.embedding.engine.FlutterEngine | ||
import io.flutter.plugin.common.MethodChannel | ||
import java.lang.reflect.Method | ||
import java.net.NetworkInterface | ||
import java.util.* | ||
|
||
class MainActivity : FlutterActivity() { | ||
|
||
private val CHANNEL = "com.crequency.kitx.mobile/channel"; | ||
private lateinit var channel: MethodChannel | ||
|
||
override fun configureFlutterEngine(flutterEngine: FlutterEngine) { | ||
super.configureFlutterEngine(flutterEngine) | ||
|
||
channel = MethodChannel(flutterEngine.dartExecutor.binaryMessenger, CHANNEL) | ||
channel.setMethodCallHandler { call, result -> | ||
if (call.method == "getMAC") { | ||
var mac = getMacAddress() | ||
result.success(mac) | ||
} | ||
|
||
if (call.method == "toastText") { | ||
var text = call.argument("text") ?: "" | ||
result.success(text) | ||
Toast.makeText(this, text, Toast.LENGTH_LONG).show() | ||
} | ||
} | ||
} | ||
|
||
private fun getMacAddress(): String? { | ||
var fallBackValue = "" | ||
try { | ||
val all: List<NetworkInterface> = | ||
Collections.list<NetworkInterface>(NetworkInterface.getNetworkInterfaces()) | ||
for (nif in all) { | ||
if (!nif.getName().equals("wlan0", ignoreCase = true)) continue | ||
val macBytes: ByteArray = nif.getHardwareAddress() ?: return fallBackValue | ||
val res1 = StringBuilder() | ||
for (b in macBytes) { | ||
res1.append(String.format("%02X:", b)) | ||
} | ||
if (res1.length > 0) { | ||
res1.deleteCharAt(res1.length - 1) | ||
} | ||
return res1.toString() | ||
} | ||
} catch (ex: java.lang.Exception) { | ||
return fallBackValue | ||
} | ||
return fallBackValue | ||
} | ||
} |
3 changes: 1 addition & 2 deletions
3
kitx_mobile/android/app/src/main/res/drawable-v21/launch_background.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 1 addition & 2 deletions
3
kitx_mobile/android/app/src/main/res/drawable/launch_background.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="com.crequency.kitx.kitx_mobile"> | ||
package="com.crequency.kitx.mobile"> | ||
<!-- The INTERNET permission is required for development. Specifically, | ||
the Flutter tool needs it to communicate with the running application | ||
to allow setting breakpoints, to provide hot reload, etc. | ||
--> | ||
<uses-permission android:name="android.permission.INTERNET"/> | ||
<uses-permission android:name="android.permission.INTERNET" /> | ||
</manifest> |
Oops, something went wrong.