分享lua代码封装方便调用

--分享
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
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。