Merge branch 'master' of https://gitea.lihaink.cn/weipengfei/work_order
# Conflicts: # pages/index/index.nvue # unpackage/cache/appleConfig.ini # unpackage/cache/uts_custom_ios/app-ios-debug.json # unpackage/cache/wgt/__UNI__BAAC5A9/app-service.js # unpackage/cache/wgt/__UNI__BAAC5A9/app-view.js # unpackage/cache/wgt/__UNI__BAAC5A9/manifest.json # unpackage/cache/wgt/__UNI__BAAC5A9/pages/index/index.js # unpackage/debug/iOS_debug.ipa # unpackage/dist/build/app-plus/app-service.js # unpackage/dist/build/app-plus/app-view.js # unpackage/dist/build/app-plus/manifest.json # unpackage/dist/build/app-plus/pages/index/index.js # unpackage/dist/dev/app-plus/app-config-service.js # unpackage/dist/dev/app-plus/manifest.json # unpackage/dist/dev/app-plus/pages/index/index.js
After Width: | Height: | Size: 6.6 KiB |
After Width: | Height: | Size: 11 KiB |
After Width: | Height: | Size: 16 KiB |
After Width: | Height: | Size: 4.9 KiB |
After Width: | Height: | Size: 12 KiB |
After Width: | Height: | Size: 896 B |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 13 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 3.4 KiB |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 5.3 KiB |
After Width: | Height: | Size: 8.8 KiB |
After Width: | Height: | Size: 15 KiB |
BIN
unpackage/cache/wgt/__UNI__BAAC5A9/.manifest/icon-iphone-notification@2x.png
vendored
Normal file
After Width: | Height: | Size: 2.2 KiB |
BIN
unpackage/cache/wgt/__UNI__BAAC5A9/.manifest/icon-iphone-notification@3x.png
vendored
Normal file
After Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 3.4 KiB |
After Width: | Height: | Size: 5.8 KiB |
After Width: | Height: | Size: 5.3 KiB |
After Width: | Height: | Size: 8.8 KiB |
|
@ -0,0 +1,6 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
package="io.dcloud.uni_modules.fdm_keepalive">
|
||||||
|
<uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS"/>
|
||||||
|
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
||||||
|
</manifest>
|
3
unpackage/dist/build/app-plus/uni_modules/fdm-keepalive/utssdk/app-android/config.json
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"minSdkVersion": "23"
|
||||||
|
}
|
49
unpackage/dist/build/app-plus/uni_modules/fdm-keepalive/utssdk/app-android/src/index.kt
vendored
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
package uts.sdk.modules.fdmKeepalive;
|
||||||
|
import io.dcloud.uniapp.*;
|
||||||
|
import io.dcloud.uniapp.extapi.*;
|
||||||
|
import io.dcloud.uts.*;
|
||||||
|
import io.dcloud.uts.Map;
|
||||||
|
import io.dcloud.uts.Set;
|
||||||
|
import kotlinx.coroutines.CoroutineScope;
|
||||||
|
import kotlinx.coroutines.Deferred;
|
||||||
|
import kotlinx.coroutines.Dispatchers;
|
||||||
|
import kotlinx.coroutines.async;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.os.PowerManager;
|
||||||
|
import android.provider.Settings;
|
||||||
|
import io.dcloud.uts.UTSAndroid;
|
||||||
|
import android.net.Uri;
|
||||||
|
open class WakeLockHelper {
|
||||||
|
open var context: Context;
|
||||||
|
private var wakeLock: PowerManager.WakeLock? = null;
|
||||||
|
constructor(context: Context){
|
||||||
|
this.context = context;
|
||||||
|
}
|
||||||
|
open fun acquireWakeLock() {
|
||||||
|
var powerManager = this.context.getSystemService(Context.POWER_SERVICE) as PowerManager;
|
||||||
|
this.wakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "MyApp::TestWakeLock");
|
||||||
|
this.wakeLock?.acquire();
|
||||||
|
}
|
||||||
|
open fun releaseWakeLock() {
|
||||||
|
this.wakeLock?.release();
|
||||||
|
this.wakeLock = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fun addKeepalive() {
|
||||||
|
val context = UTSAndroid.getAppContext();
|
||||||
|
val pageName = context!!.getPackageName();
|
||||||
|
val manager = context!!.getSystemService(Context.POWER_SERVICE) as PowerManager;
|
||||||
|
if (!manager.isIgnoringBatteryOptimizations(pageName)) {
|
||||||
|
var jumpUrl: Uri = Uri.parse("package:" + pageName);
|
||||||
|
var intent = Intent(Settings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS, jumpUrl);
|
||||||
|
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
|
UTSAndroid.getAppContext()!!.startActivity(intent);
|
||||||
|
}
|
||||||
|
var wakeCtrl = WakeLockHelper(context);
|
||||||
|
wakeCtrl.acquireWakeLock();
|
||||||
|
console.log(manager.isInteractive(), " at uni_modules/fdm-keepalive/utssdk/app-android/index.uts:39");
|
||||||
|
}
|
||||||
|
fun addKeepaliveByJs() {
|
||||||
|
return addKeepalive();
|
||||||
|
}
|