Skip to content

Commit 6c2e741

Browse files
committed
fix bug and adapt iOS 13
1 parent cbb7bb6 commit 6c2e741

File tree

10 files changed

+84
-231
lines changed

10 files changed

+84
-231
lines changed

VideoPlsLuaViewManagerSDK/VideoPlsLuaViewManagerSDK/VideoPlsLuaViewManagerSDK/VPLua/Applets/Landscape/VPHybirdAppletLandscapeContainer.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ - (void)updateNaviTitleWithParameters:(NSDictionary *)params {
208208
if (!dict) {
209209
return;
210210
}
211-
if (!VPUP_IsStrictExist([dict objectForKey:@"title"])) {
211+
if (VPUP_IsStrictExist([dict objectForKey:@"title"])) {
212212
[self.naviBar updateNaviTitle:[dict objectForKey:@"title"]];
213213
}
214214
}

VideoPlsLuaViewManagerSDK/VideoPlsLuaViewManagerSDK/VideoPlsLuaViewManagerSDK/VPLua/LuaView/VPLuaNativeScanner.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ - (void)showPhotoPickerController:(NSString *)requestMethod {
5959
[LVUtil unregistry :l key:weakSelf];
6060
}
6161
};
62-
62+
imagePicker.modalPresentationStyle = UIModalPresentationFullScreen;
6363
[[VPUPTopViewController topViewController] presentViewController:imagePicker animated:YES completion:nil];
6464

6565
}

VideoPlsLuaViewManagerSDK/VideoPlsLuaViewManagerSDK/VideoPlsLuaViewManagerSDK/VPLua/LuaView/VPLuaSVGAView.m

Lines changed: 69 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,13 @@
1616

1717
typedef NS_ENUM(NSInteger, VPLuaSVGAViewCallback) {
1818
kVPLuaSVGAViewCallbackOnFinished = 1,
19-
kVPLuaSVGAViewCallbackOnStep
19+
kVPLuaSVGAViewCallbackOnStep,
20+
kVPLuaSVGAViewCallbackOnClick
2021
};
2122

22-
static char *callbackSVGAViewKeys[] = { "", "onFinished", "onStep"};
23+
static char *callbackSVGAViewKeys[] = { "", "onFinished", "onStep", "onClick"};
2324

25+
#define META_TABLE_SVGAView "UI.SVGAView"
2426

2527
@interface VPLuaSVGAView () <VPUPSVGAPlayerDelegate>
2628

@@ -74,7 +76,7 @@ static int lvNewSVGAView(lua_State *L) {
7476
userData->object = CFBridgingRetain(svgaView);// 脚本对象引用native对象
7577
svgaView.lv_userData = userData;//native对象引用脚本对象
7678

77-
luaL_getmetatable(L, META_TABLE_UIView); // 获取svgaView对应的类方法列表
79+
luaL_getmetatable(L, META_TABLE_SVGAView); // 获取svgaView对应的类方法列表
7880
lua_setmetatable(L, -2); // 设置刚才创建的lua对象的方法列表是类svgaView的方法列表
7981
}
8082
LuaViewCore* view = LV_LUASTATE_VIEW(L);// 获取当前LuaView对应的LuaViewCore
@@ -179,46 +181,50 @@ static int svga (lua_State *L) {
179181
return 0;
180182
}
181183

182-
static int svgaCallback(lua_State *L) {
183-
LVUserDataInfo *data = (LVUserDataInfo *)lua_touserdata(L, 1);
184-
if (LVIsType(data, View) && lua_type(L, 2) == LUA_TTABLE) {
185-
lua_pushvalue(L, 2);
186-
lua_pushnil(L);
187-
188-
while (lua_next(L, -2)) {
189-
if (lua_type(L, -2) != LUA_TSTRING) {
190-
continue;
191-
}
192-
const char* key = lua_tostring(L, -2);
193-
int idx = 0;
194-
for (int i = 0; i < sizeof(callbackSVGAViewKeys) / sizeof(callbackSVGAViewKeys[0]); ++i) {
195-
if (strcmp(key, callbackSVGAViewKeys[i]) == 0) {
196-
idx = i;
197-
break;
198-
}
199-
}
200-
201-
if (idx != 0) {
202-
lua_pushvalue(L, 1);
203-
if (lua_type(L, -2) == LUA_TFUNCTION) {
204-
lua_pushvalue(L, -2);
205-
} else {
206-
lua_pushnil(L);
207-
}
208-
lv_udataRef(L, idx);
209-
lua_pop(L, 2);
210-
} else {
211-
lua_pop(L, 1);
212-
}
213-
}
214-
lua_pop(L, 1);
215-
}
216-
217-
lv_pushUserdata(L, data);
218-
219-
return 1;
184+
static int svgaCallback (lua_State *L) {
185+
return lv_setCallbackByKey(L, nil, NO);
220186
}
221187

188+
//static int svgaCallback(lua_State *L) {
189+
// LVUserDataInfo *data = (LVUserDataInfo *)lua_touserdata(L, 1);
190+
// if (LVIsType(data, View) && lua_type(L, 2) == LUA_TTABLE) {
191+
// lua_pushvalue(L, 2);
192+
// lua_pushnil(L);
193+
//
194+
// while (lua_next(L, -2)) {
195+
// if (lua_type(L, -2) != LUA_TSTRING) {
196+
// continue;
197+
// }
198+
// const char* key = lua_tostring(L, -2);
199+
// int idx = 0;
200+
// for (int i = 0; i < sizeof(callbackSVGAViewKeys) / sizeof(callbackSVGAViewKeys[0]); ++i) {
201+
// if (strcmp(key, callbackSVGAViewKeys[i]) == 0) {
202+
// idx = i;
203+
// break;
204+
// }
205+
// }
206+
//
207+
// if (idx != 0) {
208+
// lua_pushvalue(L, 1);
209+
// if (lua_type(L, -2) == LUA_TFUNCTION) {
210+
// lua_pushvalue(L, -2);
211+
// } else {
212+
// lua_pushnil(L);
213+
// }
214+
// lv_udataRef(L, idx);
215+
// lua_pop(L, 2);
216+
// } else {
217+
// lua_pop(L, 1);
218+
// }
219+
// }
220+
// lua_pop(L, 1);
221+
// }
222+
//
223+
// lv_pushUserdata(L, data);
224+
//
225+
// return 1;
226+
//}
227+
222228
static int startAnimation (lua_State *L) {
223229
LVUserDataInfo * user = (LVUserDataInfo *)lua_touserdata(L, 1);// 获取第一个参数(self,lua的userdata, 对象自身)
224230
if( user ){
@@ -329,12 +335,20 @@ static int setCallback(lua_State *L, int idx) {
329335
return 1;
330336
}
331337

338+
//static int onFinished (lua_State *L) {
339+
// return setCallback(L, kVPLuaSVGAViewCallbackOnFinished);
340+
//}
341+
//
342+
//static int onStep (lua_State *L) {
343+
// return setCallback(L, kVPLuaSVGAViewCallbackOnStep);
344+
//}
345+
332346
static int onFinished (lua_State *L) {
333-
return setCallback(L, kVPLuaSVGAViewCallbackOnFinished);
347+
return lv_setCallbackByKey(L, callbackSVGAViewKeys[kVPLuaSVGAViewCallbackOnFinished], NO);
334348
}
335349

336350
static int onStep (lua_State *L) {
337-
return setCallback(L, kVPLuaSVGAViewCallbackOnStep);
351+
return lv_setCallbackByKey(L, callbackSVGAViewKeys[kVPLuaSVGAViewCallbackOnStep], NO);
338352
}
339353

340354
/*
@@ -346,7 +360,6 @@ +(int) lvClassDefine:(lua_State *)L globalName:(NSString*) globalName{
346360

347361
// lua SVGAView构造方法创建的对象对应的方法列表
348362
const struct luaL_Reg memberFunctions [] = {
349-
350363
{"loops", loops},
351364
{"readyToPlay", readyToPlay},
352365
{"fps", fps},
@@ -365,22 +378,31 @@ +(int) lvClassDefine:(lua_State *)L globalName:(NSString*) globalName{
365378
};
366379

367380
// 创建SVGAView类的方法列表
368-
lv_createClassMetaTable(L, META_TABLE_UIView);
381+
lv_createClassMetaTable(L, META_TABLE_SVGAView);
369382

370383
luaL_openlib(L, NULL, [LVBaseView baseMemberFunctions], 0); // 继承基类View的所有方法列表
371384
luaL_openlib(L, NULL, memberFunctions, 0); // 当前类SVGAView特有的方法列表
385+
386+
const char* keys[] = { "addView", NULL};//列出需要移除的多余API
387+
lv_luaTableRemoveKeys(L, keys );// 移除冗余API 兼容安卓
388+
372389
return 1;
373390
}
374391

375392
- (void)svgaPlayerDidFinishedAnimation:(id<VPUPSVGAPlayerProtocol>)player {
376393
dispatch_async(dispatch_get_main_queue(), ^{
377-
[self callback:kVPLuaSVGAViewCallbackOnFinished];
394+
[self lv_callLuaCallback:@"OnFinish" key2:nil argN:1];
378395
});
379396
}
380397

381398
- (void)svgaPlayerDidAnimatedToFrame:(NSInteger)frame {
382399
dispatch_async(dispatch_get_main_queue(), ^{
383-
[self callback:kVPLuaSVGAViewCallbackOnStep progress:frame];
400+
lua_State* l = self.lv_luaviewCore.l;
401+
if( l ){
402+
lua_checkstack32(l);
403+
lua_pushnumber(l, frame);
404+
[self lv_callLuaCallback:@"onStep" key2:nil argN:1];
405+
}
384406
});
385407
}
386408

VideoPlsLuaViewManagerSDK/VideoPlsLuaViewManagerSDK/VideoPlsLuaViewManagerSDK/VPLua/LuaView/VPLuaTextField.m

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ - (id)init:(lua_State* )l {
3737
- (void)didMoveToWindow {
3838
[super didMoveToWindow];
3939
if (@available(iOS 11.2, *)) {
40+
if (@available(iOS 13.0, *)) {
41+
return;
42+
}
4043
NSString *keyPath = @"textContentView.provider";
4144
@try {
4245
if (self.window) {

VideoPlsLuaViewManagerSDK/VideoPlsLuaViewManagerSDK/VideoPlsLuaViewManagerSDK/VPLua/Manager/VPLuaNativeBridge.m

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,6 @@ static int getVideoId(lua_State *L) {
480480
}
481481

482482
static int isDebug(lua_State *L) {
483-
// lua_pushboolean(L, [[VPUPDebugSwitch sharedDebugSwitch] debugState] > 1);
484483
lua_pushnumber(L, [[VPUPDebugSwitch sharedDebugSwitch] debugState]);
485484
return 1;
486485
}

VideoPlsLuaViewManagerSDK/VideoPlsLuaViewManagerSDK/VideoPlsLuaViewManagerSDK/VPLua/Manager/VPLuaServiceVideoMode.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ - (void)downloadFileFromData:(NSDictionary *)data {
179179
}
180180
}
181181
}
182-
if (dataArray.count == jsonList.count) {
182+
if (dataArray.count > 0) {
183183
weakSelf.videoModeData = @{@"data" : dataArray};
184184
}
185185
else {

VideoPlsUtilsPlatformSDK/VideoPlsUtilsPlatformSDK/VideoPlsUtilsPlatformSDK/Common/Route/VPUPDefaultRoutesRegister.m

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ + (void)load {
5353
UIViewController *viewController = [[class alloc] init];
5454

5555
[self paramToObject:viewController param:parameters];
56+
viewController.modalPresentationStyle = UIModalPresentationFullScreen;
5657
[[VPUPTopViewController topViewController] presentViewController:viewController animated:YES completion:nil];
5758
return YES;
5859
}];

VideoPlsUtilsPlatformSDK/VideoPlsUtilsPlatformSDK/VideoPlsUtilsPlatformSDK/Common/WebView/VPUPUIWebViewJSBridge.h

Lines changed: 0 additions & 36 deletions
This file was deleted.

VideoPlsUtilsPlatformSDK/VideoPlsUtilsPlatformSDK/VideoPlsUtilsPlatformSDK/Common/WebView/VPUPUIWebViewJSBridge.m

Lines changed: 0 additions & 94 deletions
This file was deleted.

0 commit comments

Comments
 (0)