分享lua代码封装方便调用
2019-01-28 本文已影响0人
Zi_Fi
--分享
function bridge.shareBySys(descstr,callback)
gt.log("===: bridge shareBySys");
local desc = descstr or gt.getLocationString("LTKey_006",gt.AppName,gt.game_url)
local title = title or gt.getLocationString("LTKey_004")
local Dialog = Dialog or gt.getLocationString("LTKey_005")
if gt.isAndroidPlatform() then
local args = {title, desc, Dialog} --参数
local sig = "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V" --参数类型和返回值类型
local ok, result = gt.luaBridge.callStaticMethod("com/zzg/FreshChopping/AppActivity", "shareBySys", args, sig)
elseif gt.isIOSPlatform() then
gt.luaBridge.callStaticMethod("SystemShareInterface","getInstance",nil)
gt.luaBridge.callStaticMethod("SystemShareInterface","registerSysShareCallFun",{scriptHandler = callback})
gt.luaBridge.callStaticMethod("SystemShareInterface","shareBySys",{shareUrl = gt.game_url ,description = desc,iconPath = nil,shareplatform = "shareBySys"})
end
end