!function (e) {
    var i = {}, t = {}, n = 0;
    var stateChange;
    e.rocNative = {
        // 参数说明 e:回传回来的移动端服务名称; t:前端自己传递的回调JS方法
        __nativeCall: function (e, t, n) {
            ///alert(t);
            // if (t === '__gotoAuthentication') {
            //     __gotoAuthentication()
            // }
            // var a = i[e];
            // delete i[e], "function" == typeof a && a(t, n)
            if(t == '__nativeCallMsg'){
                __nativeCallMsg(n)
            }
            if(t == '__refresh'){
                __refresh(n)
            }
            if(t == '__getUserInfo'){
                __getUserInfo(n);
            }
            if(t == '__getStatusBarHeight'){
                __getStatusBarHeight(n);
            }

            if(t == 'pauseAudioView'){
                __pauseAudioView(n);
            }
            if(t == 'playAudioView'){
                __playAudioView(n);
            }
            if(t == 'closeAudioView'){
                __closeAudioView(n);
            }
            if(t == 'getToken'){
                __getToken(n);
            }
            
            

        },
        __callNative: function (t, a, o) {
            "function" == typeof o && (n++ , i[n] = o);
            var __funcName = a && a.__funcName ? a.__funcName : '__funcName__' + n
            a && a.__funcName && delete a.__funcName
            var param = a === undefined ? {} : a;
            var r = JSON.stringify({
                name: t,
                // callbackId: "function" == typeof o ? n : -1,
                callbackId: __funcName,
                param: param
            });
            //alert(r);
            if (e.__rocAndroid) {
               // alert(r);
                e.__rocAndroid.postMessage(r);
                // e.__isAndroid = true;
                return true;
            }
            if (e.webkit && window.webkit.messageHandlers.rociOS) {
                 //alert(r)
                window.webkit.messageHandlers.rociOS.postMessage(r)
                // e.__isIOS = true;
                return true;
            }
            return false;
        }, __onEvent: function (e, i) {
            if (e && i && "function" == typeof i) {
                (t[e] || (t[e] = [])).push(i)
            }
        }, __clearEvent: function (e) {
            e && delete t[e]
        }, __fireEvent: function (e, i) {
            var n = t[e];
            n && n.forEach(function (e) {
                e(i)
            })
        }, on: function (e, i) {
            rocNative.__onEvent(e, i)
        }, off: function (e) {
            rocNative.__clearEvent(e)
        }
    }, function () {
        Array.prototype.slice.apply(arguments).forEach(function (i) {
            e.rocNative[i] = function (t) {
                return new Promise(function (n, a) {
                    e.rocNative.__callNative(i, t, function (e, i) {
                        null !== e ? a({ error: e, result: i }) : n(i)
                    }) ? void 0 : n({})
                })
            }
        })
    }("dispatchEventByModuleCode", "gotoAuthentication", "shareWechat", "backPreviousPage", "bindingWechat", "gotoLogin", "getDeviceInfo", "goBack", "appBuryingPointEntrust", "getAuthPermission", "getAppVersionCode", "getToken", "gotoNewActivity", "gotoNewActivityWithParams", "gotoNewWebActivity", "gotoYidianActivity", "readMessage", "openFiveMintusAudio", "getStatusBarSize", "showNativeDialog", "showNativeToast", "gotoViewTop", "appInit", "checkPermissions", "getStatusBarHeight","setTabMiniIcon","getUserInfo","pauseAudioView")
    if (e.__rocAndroid) {
        e.__isAndroid = true
        e.__isIOS = false
        e.__isWeb = false
    } else if (e.webkit && window.webkit.messageHandlers.rociOS) {
        e.__isAndroid = false
        e.__isIOS = true
        e.__isWeb = false
    } else {
        e.__isAndroid = false
        e.__isIOS = false
        e.__isWeb = true
    }
    if(window.__isIOS){
        rocNative.appInit()
    }

}(window);
window.__gotoAuthentication = function (params) {
    alert('I am in __gotoAuthentication')
}

// console.log(33344)
// if (__isIOS){
//     // rocNative.appInit()
// }
