示例#1
0
        static void pushPage(string type, string subType, string id, bool isPush = false)
        {
            if (type == "project")
            {
                if (subType == "article")
                {
                    AnalyticsManager.ClickEnterArticleDetail("Push_Article", id, $"PushArticle_{id}");
                    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());

                StoreProvider.store.dispatcher.dispatch(
                    new MainNavigatorPushToEventDetailAction {
                    eventId = id, eventType = eventType
                });
            }
            else if (type == "team")
            {
                if (subType == "follower")
                {
                    StoreProvider.store.dispatcher.dispatch(
                        new MainNavigatorPushToTeamDetailAction {
                        teamId = id
                    });
                }
            }
            else if (type == "user")
            {
                if (subType == "follower")
                {
                    StoreProvider.store.dispatcher.dispatch(new MainNavigatorPushToUserDetailAction {
                        userId = id
                    });
                }
            }
            else if (type == "webView")
            {
                StoreProvider.store.dispatcher.dispatch(
                    new MainNavigatorPushToWebViewAction {
                    url = id
                });
            }
        }
示例#2
0
        Widget _buildNotificationCard(BuildContext context, int index)
        {
            var notifications = this.widget.viewModel.notifications;

            var notification = notifications[index : index];

            if (notification.data.userId.isEmpty() && notification.data.role.Equals("user"))
            {
                return(new Container());
            }

            User user;
            Team team;

            if (notification.type == "project_article_publish" && notification.data.role == "team")
            {
                user = null;
                team = this.widget.viewModel.teamDict[key : notification.data.teamId];
            }
            else
            {
                user = this.widget.viewModel.userDict[key : notification.data.userId];
                team = null;
            }

            return(new NotificationCard(
                       notification: notification,
                       user: user,
                       team: team,
                       mentions: this.widget.viewModel.mentions,
                       () => {
                if (notification.type == "followed" || notification.type == "team_followed")
                {
                    this.widget.actionModel.pushToUserDetail(obj: notification.data.userId);
                }
                else
                {
                    this.widget.actionModel.pushToArticleDetail(obj: notification.data.projectId);
                    AnalyticsManager.ClickEnterArticleDetail(
                        "Notification_Article",
                        articleId: notification.data.projectId,
                        articleTitle: notification.data.projectTitle
                        );
                }
            },
                       pushToUserDetail: this.widget.actionModel.pushToUserDetail,
                       pushToTeamDetail: this.widget.actionModel.pushToTeamDetail,
                       index == notifications.Count - 1,
                       new ObjectKey(value: notification.id)
                       ));
        }
        Widget _buildNotificationCard(BuildContext context, int index)
        {
            var notifications = this.widget.viewModel.notifications;

            if (index == notifications.Count)
            {
                return(new EndView(hasBottomMargin: true));
            }

            var notification = notifications[index : index];
            var user         = this.widget.viewModel.userDict[key : notification.data.userId];

            return(new NotificationCard(
                       notification: notification,
                       user: user,
                       mentions: this.widget.viewModel.mentions,
                       () => {
                if (notification.type == "followed" || notification.type == "team_followed")
                {
                    this.widget.actionModel.pushToUserDetail(obj: notification.data.userId);
                }
                else
                {
                    this.widget.actionModel.pushToArticleDetail(obj: notification.data.projectId);
                    AnalyticsManager.ClickEnterArticleDetail(
                        "Notification_Article",
                        articleId: notification.data.projectId,
                        articleTitle: notification.data.projectTitle
                        );
                }
            },
                       pushToUserDetail: this.widget.actionModel.pushToUserDetail,
                       this.widget.actionModel.pushToTeamDetail,
                       index == notifications.Count - 1,
                       new ObjectKey(value: notification.id)
                       ));
        }
示例#4
0
        static void pushPage(string type, string subType, string id)
        {
            if (type == "project")
            {
                if (subType == "article")
                {
                    AnalyticsManager.ClickEnterArticleDetail("Push_Article", id, $"PushArticle_{id}");

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

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

                StoreProvider.store.dispatcher.dispatch(
                    new MainNavigatorPushToEventDetailAction {
                    eventId = id, eventType = eventType
                });
            }
            else if (type == "webView")
            {
                StoreProvider.store.dispatcher.dispatch(
                    new MainNavigatorPushToWebViewAction {
                    url = id
                });
            }
        }
示例#5
0
        Widget _buildRelatedArticles()
        {
            var relatedArticles = this._article.projects.FindAll(item => item.type == "article");

            if (relatedArticles.Count == 0)
            {
                return(new Container());
            }

            var widgets = new List <Widget>();

            relatedArticles.ForEach(article => {
                //对文章进行过滤
                if (article.id != this._article.id)
                {
                    Widget card;
                    if (article.ownerType == OwnerType.user.ToString())
                    {
                        card = RelatedArticleCard.User(article, this._user,
                                                       () => {
                            AnalyticsManager.ClickEnterArticleDetail("ArticleDetail_Related", article.id,
                                                                     article.title);
                            this.widget.actionModel.pushToArticleDetail(article.id);
                        },
                                                       new ObjectKey(article.id));
                    }
                    else
                    {
                        card = RelatedArticleCard.Team(article, this._team,
                                                       () => {
                            AnalyticsManager.ClickEnterArticleDetail("ArticleDetail_Related", article.id,
                                                                     article.title);
                            this.widget.actionModel.pushToArticleDetail(article.id);
                        },
                                                       new ObjectKey(article.id));
                    }

                    widgets.Add(card);
                }
            });
            if (widgets.isNotEmpty())
            {
                widgets.InsertRange(0, new List <Widget> {
                    new Container(
                        height: 1,
                        color: CColors.Separator2,
                        margin: EdgeInsets.only(16, 16, 16, 40)
                        ),
                    new Container(
                        margin: EdgeInsets.only(16, bottom: 16),
                        child: new Text(
                            "推荐阅读",
                            style: CTextStyle.PLargeMedium
                            )
                        )
                });
            }

            return(new Container(
                       color: CColors.White,
                       margin: EdgeInsets.only(bottom: 16),
                       child: new Column(
                           crossAxisAlignment: CrossAxisAlignment.start,
                           children: widgets
                           )
                       ));
        }
示例#6
0
        public override Widget build(BuildContext context)
        {
            base.build(context: context);
            Widget content = new Container();

            if (this.widget.viewModel.notificationLoading && this.widget.viewModel.notifications.Count == 0)
            {
                content = new GlobalLoading();
            }
            else
            {
                if (this.widget.viewModel.notifications.Count <= 0)
                {
                    content = new Container(
                        child: new BlankView(
                            "好冷清,多和小伙伴们互动呀",
                            "image/default-notification",
                            true,
                            () => {
                        this.widget.actionModel.startFetchNotifications();
                        this.widget.actionModel.fetchNotifications(firstPageNumber);
                    }
                            )
                        );
                }
                else
                {
                    content = new Container(
                        color: CColors.Background,
                        child: new SmartRefresher(
                            controller: this._refreshController,
                            enablePullDown: true,
                            enablePullUp: this._pageNumber < this.widget.viewModel.pageTotal,
                            onRefresh: this._onRefresh,
                            child: ListView.builder(
                                physics: new AlwaysScrollableScrollPhysics(),
                                itemCount: this.widget.viewModel.notifications.Count,
                                itemBuilder: (cxt, index) => {
                        var notification = this.widget.viewModel.notifications[index];
                        var user         = this.widget.viewModel.userDict[notification.data.userId];
                        return(new NotificationCard(
                                   notification,
                                   user,
                                   this.widget.viewModel.mentions,
                                   () => {
                            this.widget.actionModel.pushToArticleDetail(notification.data.projectId);
                            AnalyticsManager.ClickEnterArticleDetail("Notification_Article",
                                                                     notification.data.projectId, notification.data.projectTitle);
                        },
                                   new ObjectKey(notification.id)
                                   ));
                    }
                                )
                            )
                        );
                }
            }

            return(new Container(
                       color: CColors.White,
                       child: new Column(
                           children: new List <Widget> {
                this._buildNavigationBar(),
                new CustomDivider(
                    color: CColors.Separator2,
                    height: 1
                    ),
                new Flexible(
                    child: new NotificationListener <ScrollNotification>(
                        onNotification: this._onNotification,
                        child: new CustomScrollbar(content)
                        )
                    )
            }
                           )
                       ));
        }
示例#7
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);
                    }
                }
            }
        }
        Widget _buildArticleList(BuildContext context)
        {
            Widget content;
            var    recommendArticleIds = this.widget.viewModel.recommendArticleIds;

            if (!this._hasBeenLoadedData || this.widget.viewModel.articlesLoading && recommendArticleIds.isEmpty())
            {
                content = ListView.builder(
                    physics: new NeverScrollableScrollPhysics(),
                    itemCount: 6,
                    itemBuilder: (cxt, index) => new ArticleLoading()
                    );
            }
            else if (0 == recommendArticleIds.Count)
            {
                content = new Container(
                    padding: EdgeInsets.only(bottom: CConstant.TabBarHeight +
                                             CCommonUtils.getSafeAreaBottomPadding(context: context)),
                    child: new BlankView(
                        "哎呀,暂无推荐文章",
                        "image/default-article",
                        true,
                        () => {
                    this.widget.actionModel.startFetchArticles();
                    this.widget.actionModel.fetchArticles(arg: initOffset);
                }
                        )
                    );
            }
            else
            {
                content = new SmartRefresher(
                    controller: this._refreshController,
                    enablePullDown: true,
                    enablePullUp: this.widget.viewModel.hottestHasMore,
                    onRefresh: this._onRefresh,
                    hasBottomMargin: true,
                    child: ListView.builder(
                        physics: new AlwaysScrollableScrollPhysics(),
                        itemCount: recommendArticleIds.Count,
                        itemBuilder: (cxt, index) => {
                    var articleId = recommendArticleIds[index: index];
                    if (this.widget.viewModel.blockArticleList.Contains(item: articleId))
                    {
                        return(new Container());
                    }

                    if (!this.widget.viewModel.articleDict.ContainsKey(key: articleId))
                    {
                        return(new Container());
                    }

                    if (!this.widget.viewModel.hottestHasMore && recommendArticleIds.Count > 0 &&
                        index + 1 == recommendArticleIds.Count)
                    {
                        return(new EndView(hasBottomMargin: true));
                    }

                    var article  = this.widget.viewModel.articleDict[key: articleId];
                    var fullName = "";
                    var userId   = "";
                    if (article.ownerType == OwnerType.user.ToString())
                    {
                        userId = article.userId;
                        if (this.widget.viewModel.userDict.ContainsKey(key: article.userId))
                        {
                            fullName = this.widget.viewModel.userDict[key: article.userId].fullName
                                       ?? this.widget.viewModel.userDict[key: article.userId].name;
                        }
                    }

                    if (article.ownerType == OwnerType.team.ToString())
                    {
                        userId = article.teamId;
                        if (this.widget.viewModel.teamDict.ContainsKey(key: article.teamId))
                        {
                            fullName = this.widget.viewModel.teamDict[key: article.teamId].name;
                        }
                    }

                    var linkUrl = CStringUtils.JointProjectShareLink(projectId: article.id);
                    return(new ArticleCard(
                               article: article,
                               () => {
                        this.widget.actionModel.pushToArticleDetail(obj: articleId);
                        AnalyticsManager.ClickEnterArticleDetail("Home_Article", articleId: article.id,
                                                                 articleTitle: article.title);
                    },
                               () => ShareManager.showArticleShareView(
                                   this.widget.viewModel.currentUserId != userId,
                                   isLoggedIn: this.widget.viewModel.isLoggedIn,
                                   () => {
                        Clipboard.setData(new ClipboardData(text: linkUrl));
                        CustomDialogUtils.showToast("复制链接成功", iconData: Icons.check_circle_outline);
                    },
                                   () => this.widget.actionModel.pushToLogin(),
                                   () => this.widget.actionModel.pushToBlock(obj: article.id),
                                   () => this.widget.actionModel.pushToReport(arg1: article.id,
                                                                              arg2: ReportType.article),
                                   type => {
                        CustomDialogUtils.showCustomDialog(
                            child: new CustomLoadingDialog()
                            );
                        string imageUrl = CImageUtils.SizeTo200ImageUrl(article.thumbnail.url);
                        this.widget.actionModel.shareToWechat(arg1: type, arg2: article.title,
                                                              arg3: article.subTitle, arg4: linkUrl, arg5: imageUrl)
                        .Then(onResolved: CustomDialogUtils.hiddenCustomDialog)
                        .Catch(_ => CustomDialogUtils.hiddenCustomDialog());
                    }
                                   ),
                               fullName: fullName,
                               key: new ObjectKey(value: article.id)
                               ));
                }
                        )
                    );
            }

            if (this.widget.viewModel.isLoggedIn)
            {
                return(new Container(
                           color: CColors.Background,
                           child: new CustomScrollbar(child: content)
                           ));
            }

            return(new NotificationListener <ScrollNotification>(
                       onNotification: this._onNotification,
                       child: new Container(
                           color: CColors.Background,
                           child: new CustomScrollbar(child: content)
                           )
                       ));
        }
示例#9
0
        Widget _buildRelatedArticles()
        {
            if (this._article.projectIds == null || this._article.projectIds.Count == 0)
            {
                return(new Container());
            }

            var widgets = new List <Widget>();

            this._article.projectIds.ForEach(articleId => {
                var article = this.widget.viewModel.articleDict[key: articleId];
                //对文章进行过滤
                if (article.id != this._article.id)
                {
                    var fullName = "";
                    if (article.ownerType == OwnerType.user.ToString())
                    {
                        fullName = this._user.fullName ?? this._user.name;
                    }

                    if (article.ownerType == OwnerType.team.ToString())
                    {
                        fullName = this._team.name;
                    }

                    Widget card = new RelatedArticleCard(
                        article: article,
                        fullName: fullName,
                        () => {
                        AnalyticsManager.ClickEnterArticleDetail(
                            "ArticleDetail_Related",
                            articleId: article.id,
                            articleTitle: article.title
                            );
                        this.widget.actionModel.pushToArticleDetail(obj: article.id);
                    },
                        key: new ObjectKey(value: article.id)
                        );
                    widgets.Add(item: card);
                }
            });
            if (widgets.isNotEmpty())
            {
                widgets.InsertRange(0, new List <Widget> {
                    new Container(
                        height: 1,
                        color: CColors.Separator2,
                        margin: EdgeInsets.only(16, 16, 16, 40)
                        ),
                    new Container(
                        margin: EdgeInsets.only(16, bottom: 16),
                        child: new Text(
                            "推荐阅读",
                            style: CTextStyle.PLargeMedium
                            )
                        )
                });
            }

            return(new Container(
                       color: CColors.White,
                       margin: EdgeInsets.only(bottom: 16),
                       child: new Column(
                           crossAxisAlignment: CrossAxisAlignment.start,
                           children: widgets
                           )
                       ));
        }
        Widget _buildAlbumCard(BuildContext context, int index)
        {
            if (index == 0)
            {
                if (this.widget.viewModel.loading)
                {
                    return(new Container(
                               height: MediaQuery.of(context).size.height - 202 - MediaQuery.of(context).padding.top,
                               child: new Center(
                                   child: new GlobalLoading(color: CColors.White)
                                   )
                               ));
                }

                if (this.widget.viewModel.articleList.isEmpty())
                {
                    return(new Container(
                               height: MediaQuery.of(context).size.height - 202 - MediaQuery.of(context).padding.top,
                               child: new BlankView(
                                   "暂无文章",
                                   "image/default-article",
                                   true,
                                   () => {
                        this.widget.actionModel.startFetchDetailList();
                        this.widget.actionModel.fetchDetailList(this._pageNumber);
                    },
                                   new BoxDecoration(
                                       color: CColors.White,
                                       borderRadius: BorderRadius.only(12, 12)
                                       ))
                               ));
                }

                return(new Container(
                           height: 16,
                           decoration: new BoxDecoration(color: CColors.White, borderRadius: BorderRadius.only(12, 12))
                           ));
            }

            var article = this.widget.viewModel.articleDict[this.widget.viewModel.articleList[index - 1]];

            if (!this.widget.viewModel.articleDict.ContainsKey(key: article.id))
            {
                return(new Container());
            }

            var fullName = "";
            var userId   = "";

            if (article.ownerType == OwnerType.user.ToString())
            {
                userId = article.userId;
                if (this.widget.viewModel.userDict.ContainsKey(key: article.userId))
                {
                    fullName = this.widget.viewModel.userDict[key : article.userId].fullName
                               ?? this.widget.viewModel.userDict[key : article.userId].name;
                }
            }

            if (article.ownerType == OwnerType.team.ToString())
            {
                userId = article.teamId;
                if (this.widget.viewModel.teamDict.ContainsKey(key: article.teamId))
                {
                    fullName = this.widget.viewModel.teamDict[key : article.teamId].name;
                }
            }

            var linkUrl = CStringUtils.JointProjectShareLink(projectId: article.id);

            return(new ArticleCard(
                       article: article,
                       () => {
                this.widget.actionModel.pushToArticleDetail(obj: article.id);
                AnalyticsManager.ClickEnterArticleDetail("Home_Article", articleId: article.id,
                                                         articleTitle: article.title);
            },
                       () => ShareManager.showArticleShareView(
                           false,
                           isLoggedIn: this.widget.viewModel.isLoggedIn,
                           () => {
                Clipboard.setData(new ClipboardData(text: linkUrl));
                CustomDialogUtils.showToast("复制链接成功", iconData: Icons.check_circle_outline);
            },
                           () => this.widget.actionModel.pushToLogin(),
                           () => this.widget.actionModel.pushToBlock(obj: article.id),
                           () => this.widget.actionModel.pushToReport(arg1: article.id,
                                                                      arg2: ReportType.article),
                           type => {
                CustomDialogUtils.showCustomDialog(
                    child: new CustomLoadingDialog()
                    );
                string imageUrl = CImageUtils.SizeTo200ImageUrl(imageUrl: article.thumbnail.url);
                this.widget.actionModel.shareToWechat(arg1: type, arg2: article.title,
                                                      arg3: article.subTitle, arg4: linkUrl, arg5: imageUrl)
                .Then(onResolved: CustomDialogUtils.hiddenCustomDialog)
                .Catch(_ => CustomDialogUtils.hiddenCustomDialog());
            }
                           ),
                       fullName: fullName,
                       new ObjectKey(value: article.id)
                       ));
        }
        Widget _buildArticleCard(BuildContext context, int index)
        {
            var recommendArticleIds = this.widget.viewModel.recommendArticleIds;

            var articleId = recommendArticleIds[index : index];

            if (this.widget.viewModel.blockArticleList.Contains(item: articleId))
            {
                return(new Container());
            }

            if (!this.widget.viewModel.articleDict.ContainsKey(key: articleId))
            {
                return(new Container());
            }

            var article  = this.widget.viewModel.articleDict[key : articleId];
            var fullName = "";
            var userId   = "";

            if (article.ownerType == OwnerType.user.ToString())
            {
                userId = article.userId;
                if (this.widget.viewModel.userDict.ContainsKey(key: article.userId))
                {
                    fullName = this.widget.viewModel.userDict[key : article.userId].fullName
                               ?? this.widget.viewModel.userDict[key : article.userId].name;
                }
            }

            if (article.ownerType == OwnerType.team.ToString())
            {
                userId = article.teamId;
                if (this.widget.viewModel.teamDict.ContainsKey(key: article.teamId))
                {
                    fullName = this.widget.viewModel.teamDict[key : article.teamId].name;
                }
            }

            var linkUrl = CStringUtils.JointProjectShareLink(projectId: article.id);

            return(new ArticleCard(
                       article: article,
                       () => {
                this.widget.actionModel.pushToArticleDetail(obj: articleId);
                AnalyticsManager.ClickEnterArticleDetail("Home_Article", articleId: article.id,
                                                         articleTitle: article.title);
            },
                       () => ShareManager.showArticleShareView(
                           this.widget.viewModel.currentUserId != userId,
                           isLoggedIn: this.widget.viewModel.isLoggedIn,
                           () => {
                Clipboard.setData(new ClipboardData(text: linkUrl));
                CustomDialogUtils.showToast("复制链接成功", iconData: Icons.check_circle_outline);
            },
                           () => this.widget.actionModel.pushToLogin(),
                           () => this.widget.actionModel.pushToBlock(obj: article.id),
                           () => this.widget.actionModel.pushToReport(arg1: article.id,
                                                                      arg2: ReportType.article),
                           type => {
                CustomDialogUtils.showCustomDialog(
                    child: new CustomLoadingDialog()
                    );
                string imageUrl = CImageUtils.SizeTo200ImageUrl(imageUrl: article.thumbnail.url);
                this.widget.actionModel.shareToWechat(arg1: type, arg2: article.title,
                                                      arg3: article.subTitle, arg4: linkUrl, arg5: imageUrl)
                .Then(onResolved: CustomDialogUtils.hiddenCustomDialog)
                .Catch(_ => CustomDialogUtils.hiddenCustomDialog());
            }
                           ),
                       fullName: fullName,
                       new ObjectKey(value: article.id)
                       ));
        }
示例#12
0
        Widget _buildArticleList()
        {
            Widget content = new Container();

            if (this.widget.viewModel.articlesLoading && this.widget.viewModel.articleList.isEmpty())
            {
                content = ListView.builder(
                    itemCount: 4,
                    itemBuilder: (cxt, index) => new ArticleLoading()
                    );
            }
            else if (this.widget.viewModel.articleList.Count <= 0)
            {
                content = new BlankView(
                    "哎呀,暂无文章",
                    "image/default-article",
                    true,
                    () => {
                    this.widget.actionModel.startFetchArticles();
                    this.widget.actionModel.fetchArticles(initOffset);
                }
                    );
            }
            else
            {
                content = new SmartRefresher(
                    controller: this._refreshController,
                    enablePullDown: true,
                    enablePullUp: this.widget.viewModel.hottestHasMore,
                    onRefresh: this._onRefresh,
                    child: ListView.builder(
                        physics: new AlwaysScrollableScrollPhysics(),
                        itemCount: this.widget.viewModel.articleList.Count,
                        itemBuilder: (cxt, index) => {
                    var articleId = this.widget.viewModel.articleList[index];
                    if (this.widget.viewModel.blockArticleList.Contains(articleId))
                    {
                        return(new Container());
                    }

                    var article  = this.widget.viewModel.articleDict[articleId];
                    var fullName = "";
                    if (article.ownerType == OwnerType.user.ToString())
                    {
                        if (this.widget.viewModel.userDict.ContainsKey(article.userId))
                        {
                            fullName = this.widget.viewModel.userDict[article.userId].fullName;
                        }
                    }

                    if (article.ownerType == OwnerType.team.ToString())
                    {
                        if (this.widget.viewModel.teamDict.ContainsKey(article.teamId))
                        {
                            fullName = this.widget.viewModel.teamDict[article.teamId].name;
                        }
                    }

                    return(new ArticleCard(
                               article,
                               () => {
                        this.widget.actionModel.pushToArticleDetail(articleId);
                        AnalyticsManager.ClickEnterArticleDetail("Home_Article", article.id, article.title);
                    },
                               () => ReportManager.showReportView(this.widget.viewModel.isLoggedIn,
                                                                  articleId,
                                                                  ReportType.article, this.widget.actionModel.pushToLogin,
                                                                  this.widget.actionModel.pushToReport, this.widget.actionModel.pushToBlock
                                                                  ),
                               fullName,
                               key: new ObjectKey(article.id)
                               ));
                }
                        )
                    );
            }

            return(new NotificationListener <ScrollNotification>(
                       onNotification: this._onNotification,
                       child: new Container(
                           color: CColors.Background,
                           child: new CustomScrollbar(content)
                           )
                       ));
        }
示例#13
0
        static void pushPage(string type, string subType, string id, bool isPush = false)
        {
            if (id.isEmpty())
            {
                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
                    });
                }
            }
        }
示例#14
0
        public static void pushPage(string type, string subType, string id, bool isPush = false)
        {
            if (id.isEmpty())
            {
                return;
            }

            if (type == "project")
            {
                if (subType == "article")
                {
                    AnalyticsManager.ClickEnterArticleDetail("Push_Article", id, $"PushArticle_{id}");
                    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());

                StoreProvider.store.dispatcher.dispatch(
                    new MainNavigatorPushToEventDetailAction {
                    eventId = id, eventType = eventType
                });
            }
            else if (type == "team")
            {
                if (subType == "follower")
                {
                    StoreProvider.store.dispatcher.dispatch(
                        new MainNavigatorPushToTeamDetailAction {
                        teamId = id
                    });
                }
            }
            else if (type == "user")
            {
                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 (MessageUtils.currentChannelId.isNotEmpty() && id == MessageUtils.currentChannelId)
                {
                    return;
                }

                if (subType == "channelAt")
                {
                    StoreProvider.store.dispatcher.dispatch(
                        new MainNavigatorPushToChannelAction {
                        channelId = id
                    });
                }
                else if (subType == "channelShare")
                {
                    StoreProvider.store.dispatcher.dispatch(
                        new MainNavigatorPushToChannelShareAction {
                        channelId = id
                    });
                }
            }
        }