コード例 #1
0
 public override Widget build(BuildContext context)
 {
     return(new StoreConnector <AppState, ArticleDetailScreenViewModel>(
                converter: state => new ArticleDetailScreenViewModel {
         articleId = this.articleId,
         loginUserId = state.loginState.loginInfo.userId,
         isLoggedIn = state.loginState.isLoggedIn,
         articleDetailLoading = state.articleState.articleDetailLoading,
         articleDict = state.articleState.articleDict,
         channelMessageList = state.messageState.channelMessageList,
         channelMessageDict = state.messageState.channelMessageDict,
         userDict = state.userState.userDict,
         teamDict = state.teamState.teamDict
     },
                builder: (context1, viewModel, dispatcher) => {
         var actionModel = new ArticleDetailScreenActionModel {
             mainRouterPop = () => dispatcher.dispatch(new MainNavigatorPopAction()),
             pushToLogin = () => dispatcher.dispatch(new MainNavigatorPushToAction {
                 routeName = MainNavigatorRoutes.Login
             }),
             openUrl = url => dispatcher.dispatch(new MainNavigatorPushToWebViewAction {
                 url = url
             }),
             playVideo = url => dispatcher.dispatch(new PlayVideoAction {
                 url = url
             }),
             pushToArticleDetail = id => dispatcher.dispatch(
                 new MainNavigatorPushToArticleDetailAction {
                 articleId = id
             }),
             pushToReport = (reportId, reportType) => dispatcher.dispatch(
                 new MainNavigatorPushToReportAction {
                 reportId = reportId,
                 reportType = reportType
             }
                 ),
             pushToBlock = articleId => {
                 dispatcher.dispatch(new BlockArticleAction {
                     articleId = articleId
                 });
                 dispatcher.dispatch(new DeleteArticleHistoryAction {
                     articleId = articleId
                 });
             },
             startFetchArticleDetail = () => dispatcher.dispatch(new StartFetchArticleDetailAction()),
             fetchArticleDetail = id =>
                                  dispatcher.dispatch <IPromise>(Actions.FetchArticleDetail(id)),
             fetchArticleComments = (channelId, currOldestMessageId) =>
                                    dispatcher.dispatch <IPromise>(
                 Actions.fetchArticleComments(channelId, currOldestMessageId)
                 ),
             likeArticle = id => {
                 AnalyticsManager.ClickLike("Article", this.articleId);
                 return dispatcher.dispatch <IPromise>(Actions.likeArticle(id));
             },
             likeComment = message => {
                 AnalyticsManager.ClickLike("Article_Comment", this.articleId, message.id);
                 return dispatcher.dispatch <IPromise>(Actions.likeComment(message));
             },
             removeLikeComment =
                 message => {
                 AnalyticsManager.ClickLike("Article_Remove_Comment", this.articleId, message.id);
                 return dispatcher.dispatch <IPromise>(Actions.removeLikeComment(message));
             },
             sendComment = (channelId, content, nonce, parentMessageId) => {
                 AnalyticsManager.ClickPublishComment(
                     parentMessageId == null ? "Article" : "Article_Comment", channelId, parentMessageId);
                 CustomDialogUtils.showCustomDialog(child: new CustomLoadingDialog());
                 return dispatcher.dispatch <IPromise>(
                     Actions.sendComment(this.articleId, channelId, content, nonce, parentMessageId));
             },
             shareToWechat = (type, title, description, linkUrl, imageUrl) => dispatcher.dispatch <IPromise>(
                 Actions.shareToWechat(type, title, description, linkUrl, imageUrl))
         };
         return new ArticleDetailScreen(viewModel, actionModel);
     }
                ));
 }
コード例 #2
0
 public override Widget build(BuildContext context)
 {
     return(new StoreConnector <AppState, ArticleDetailScreenViewModel>(
                converter: state => new ArticleDetailScreenViewModel {
         articleId = this.articleId,
         loginUserId = state.loginState.loginInfo.userId,
         isLoggedIn = state.loginState.isLoggedIn,
         articleDetailLoading = state.articleState.articleDetailLoading,
         articleDict = state.articleState.articleDict,
         channelMessageList = state.messageState.channelMessageList,
         channelMessageDict = state.messageState.channelMessageDict,
         userDict = state.userState.userDict,
         userLicenseDict = state.userState.userLicenseDict,
         teamDict = state.teamState.teamDict,
         followMap = state.followState.followDict.ContainsKey(state.loginState.loginInfo.userId ?? "")
                 ? state.followState.followDict[state.loginState.loginInfo.userId ?? ""]
                 : new Dictionary <string, bool>()
     },
                builder: (context1, viewModel, dispatcher) => {
         var actionModel = new ArticleDetailScreenActionModel {
             mainRouterPop = () => dispatcher.dispatch(new MainNavigatorPopAction()),
             pushToLogin = () => dispatcher.dispatch(new MainNavigatorPushToAction {
                 routeName = MainNavigatorRoutes.Login
             }),
             openUrl = url => OpenUrlUtil.OpenUrl(url, dispatcher),
             playVideo = (url, needUpdate, limitSeconds) => {
                 dispatcher.dispatch(new MainNavigatorPushToVideoPlayerAction {
                     url = url,
                     needUpdate = needUpdate,
                     limitSeconds = limitSeconds
                 });
             },
             browserImage = url => {
                 dispatcher.dispatch(new MainNavigatorPushToPhotoViewAction {
                     urls = ContentDescription.imageUrls,
                     url = url
                 });
             },
             pushToArticleDetail = id => dispatcher.dispatch(
                 new MainNavigatorPushToArticleDetailAction {
                 articleId = id
             }
                 ),
             pushToUserDetail = userId => dispatcher.dispatch(
                 new MainNavigatorPushToUserDetailAction {
                 userId = userId
             }
                 ),
             pushToTeamDetail = teamId => dispatcher.dispatch(
                 new MainNavigatorPushToTeamDetailAction {
                 teamId = teamId
             }
                 ),
             pushToReport = (reportId, reportType) => dispatcher.dispatch(
                 new MainNavigatorPushToReportAction {
                 reportId = reportId,
                 reportType = reportType
             }
                 ),
             pushToBlock = articleId => {
                 dispatcher.dispatch(new BlockArticleAction {
                     articleId = articleId
                 });
                 dispatcher.dispatch(new DeleteArticleHistoryAction {
                     articleId = articleId
                 });
             },
             startFetchArticleDetail = () => dispatcher.dispatch(new StartFetchArticleDetailAction()),
             fetchArticleDetail = id =>
                                  dispatcher.dispatch <IPromise>(
                 Actions.FetchArticleDetail(articleId: id, isPush: this.isPush)),
             fetchArticleComments = (channelId, currOldestMessageId) =>
                                    dispatcher.dispatch <IPromise>(
                 Actions.fetchArticleComments(channelId: channelId,
                                              currOldestMessageId: currOldestMessageId)
                 ),
             likeArticle = id => {
                 AnalyticsManager.ClickLike("Article", articleId: this.articleId);
                 return dispatcher.dispatch <IPromise>(Actions.likeArticle(articleId: id));
             },
             likeComment = message => {
                 AnalyticsManager.ClickLike("Article_Comment", articleId: this.articleId,
                                            commentId: message.id);
                 return dispatcher.dispatch <IPromise>(Actions.likeComment(message: message));
             },
             removeLikeComment = message => {
                 AnalyticsManager.ClickLike("Article_Remove_Comment", articleId: this.articleId,
                                            commentId: message.id);
                 return dispatcher.dispatch <IPromise>(Actions.removeLikeComment(message: message));
             },
             sendComment = (channelId, content, nonce, parentMessageId, upperMessageId) => {
                 AnalyticsManager.ClickPublishComment(
                     parentMessageId == null ? "Article" : "Article_Comment", channelId: channelId,
                     commentId: parentMessageId);
                 CustomDialogUtils.showCustomDialog(child: new CustomLoadingDialog());
                 return dispatcher.dispatch <IPromise>(
                     Actions.sendComment(articleId: this.articleId, channelId: channelId, content: content,
                                         nonce: nonce, parentMessageId: parentMessageId, upperMessageId: upperMessageId));
             },
             startFollowUser = userId =>
                               dispatcher.dispatch(new StartFollowUserAction {
                 followUserId = userId
             }),
             followUser = userId =>
                          dispatcher.dispatch <IPromise>(Actions.fetchFollowUser(followUserId: userId)),
             startUnFollowUser = userId =>
                                 dispatcher.dispatch(new StartUnFollowUserAction {
                 unFollowUserId = userId
             }),
             unFollowUser = userId =>
                            dispatcher.dispatch <IPromise>(Actions.fetchUnFollowUser(unFollowUserId: userId)),
             startFollowTeam = teamId =>
                               dispatcher.dispatch(new StartFetchFollowTeamAction {
                 followTeamId = teamId
             }),
             followTeam = teamId =>
                          dispatcher.dispatch <IPromise>(Actions.fetchFollowTeam(followTeamId: teamId)),
             startUnFollowTeam = teamId =>
                                 dispatcher.dispatch(new StartFetchUnFollowTeamAction {
                 unFollowTeamId = teamId
             }),
             unFollowTeam = teamId =>
                            dispatcher.dispatch <IPromise>(Actions.fetchUnFollowTeam(unFollowTeamId: teamId)),
             shareToWechat = (type, title, description, linkUrl, imageUrl) => dispatcher.dispatch <IPromise>(
                 Actions.shareToWechat(type: type, title: title, description: description, linkUrl: linkUrl,
                                       imageUrl: imageUrl))
         };
         return new ArticleDetailScreen(viewModel: viewModel, actionModel: actionModel);
     }
                ));
 }