8000 屏幕常亮API System.keepScreenOn(true/false) · pythonzz/LuaViewSDK@3469fe5 · GitHub
[go: up one dir, main page]

Skip to content

Commit 3469fe5

Browse files
城西Lamod
authored andcommitted
屏幕常亮API System.keepScreenOn(true/false)
1 parent 5a94578 commit 3469fe5

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

IOS/LuaViewSDK/Classes/lvsdk/LVSystem.m

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,15 @@ static int netWorkType (lv_State *L) {
5353
return 1;
5454
}
5555

56+
// 屏幕常亮
57+
static int keepScreenOn (lv_State *L) {
58+
if( lv_gettop(L)>0 ){
59+
BOOL yes = lv_toboolean(L, -1);
60+
[[UIApplication sharedApplication] setIdleTimerDisabled:yes] ;
61+
}
62+
return 0;
63+
}
64+
5665
static int scale (lv_State *L) {
5766
CGFloat s = [UIScreen mainScreen].scale;
5867
lv_pushnumber( L, s);
@@ -134,6 +143,7 @@ +(int) classDefine:(lv_State *)L {
134143
{"ios", ios},
135144
{"android", android},
136145
{"network", netWorkType},
146+
{"keepScreenOn", keepScreenOn},// 保持屏幕常亮接口
137147
{NULL, NULL}
138148
};
139149
lvL_openlib(L, "System", staticFunctions, 0);

0 commit comments

Comments
 (0)
0