Esempio n. 1
0
        public static WechatPlugin instance(Action <string> codeCallBack = null)
        {
            if (plugin == null)
            {
                plugin = new WechatPlugin();
            }

            if (codeCallBack != null)
            {
                plugin.codeCallBack = codeCallBack;
            }

            return(plugin);
        }
Esempio n. 2
0
        static void pushPage(string type, string subType, string id, bool isPush = false)
        {
            if (type != "rank" && id.isEmpty())
            {
                return;
            }

            if (VersionManager.needForceUpdate())
            {
                return;
            }

            if (type == "project")
            {
                if (subType == "article")
                {
                    AnalyticsManager.ClickEnterArticleDetail("Push_Article", id, $"PushArticle_{id}");
                    if (CTemporaryValue.currentPageModelId.isNotEmpty() && id == CTemporaryValue.currentPageModelId)
                    {
                        return;
                    }

                    StoreProvider.store.dispatcher.dispatch(
                        new MainNavigatorPushToArticleDetailAction {
                        articleId = id, isPush = isPush
                    });
                }
            }
            else if (type == "event")
            {
                var eventType = EventType.offline;
                if (subType == "online")
                {
                    eventType = EventType.online;
                }

                AnalyticsManager.ClickEnterEventDetail("Push_Event", id, $"PushEvent_{id}", eventType.ToString());

                if (CTemporaryValue.currentPageModelId.isNotEmpty() && id == CTemporaryValue.currentPageModelId)
                {
                    return;
                }

                StoreProvider.store.dispatcher.dispatch(
                    new MainNavigatorPushToEventDetailAction {
                    eventId = id, eventType = eventType
                });
            }
            else if (type == "team")
            {
                if (CTemporaryValue.currentPageModelId.isNotEmpty() && id == CTemporaryValue.currentPageModelId)
                {
                    return;
                }

                if (subType == "follower")
                {
                    StoreProvider.store.dispatcher.dispatch(
                        new MainNavigatorPushToTeamDetailAction {
                        teamId = id
                    });
                }
            }
            else if (type == "user")
            {
                if (CTemporaryValue.currentPageModelId.isNotEmpty() && id == CTemporaryValue.currentPageModelId)
                {
                    return;
                }

                if (subType == "follower")
                {
                    StoreProvider.store.dispatcher.dispatch(new MainNavigatorPushToUserDetailAction {
                        userId = id
                    });
                }
            }
            else if (type == "webView")
            {
                StoreProvider.store.dispatcher.dispatch(
                    new MainNavigatorPushToWebViewAction {
                    url = id
                });
            }
            else if (type == "messenger")
            {
                if (CTemporaryValue.currentPageModelId.isNotEmpty() && id == CTemporaryValue.currentPageModelId)
                {
                    return;
                }

                if (isPush)
                {
                    if (UserInfoManager.isLogin())
                    {
                        StoreProvider.store.dispatcher.dispatch(new MainNavigatorPushToChannelAction {
                            channelId = id
                        });
                    }
                    else
                    {
                        Router.navigator.pushNamed(routeName: MainNavigatorRoutes.Login);
                    }
                }
                else
                {
                    StoreProvider.store.dispatcher.dispatch(new MainNavigatorPushToChannelShareAction {
                        channelId = id
                    });
                }
            }
            else if (type == "rank")
            {
                if (CTemporaryValue.currentPageModelId.isNotEmpty() && id == CTemporaryValue.currentPageModelId)
                {
                    return;
                }
                var initIndex = 0;
                switch (subType)
                {
                case "column": {
                    initIndex = 1;
                    break;
                }

                case "blogger": {
                    initIndex = 2;
                    break;
                }
                }
                StoreProvider.store.dispatcher.dispatch(new MainNavigatorPushToLeaderBoardAction {
                    initIndex = initIndex
                });
            }
            else if (type == "weixin")
            {
                if (subType == "miniprogram")
                {
                    if (WechatPlugin.instance().isInstalled())
                    {
                        var path = CStringUtils.CreateMiniPath(id: id,
                                                               title: "");
                        WechatPlugin.instance().toOpenMiNi(path);
                    }
                }
            }
        }