コード例 #1
0
 public override Widget build(BuildContext context)
 {
     return(new StoreConnector <AppState, EventDetailScreenViewModel>(
                converter: state => new EventDetailScreenViewModel {
         eventId = this.eventId,
         isLoggedIn = state.loginState.isLoggedIn,
         eventDetailLoading = state.eventState.eventDetailLoading,
         joinEventLoading = state.eventState.joinEventLoading,
         channelId = state.eventState.channelId,
         eventsDict = state.eventState.eventsDict,
         userLicenseDict = state.userState.userLicenseDict
     },
                builder: (context1, viewModel, dispatcher) => {
         var actionModel = new EventDetailScreenActionModel {
             mainRouterPop = () => dispatcher.dispatch(new MainNavigatorPopAction()),
             pushToLogin = () => dispatcher.dispatch(new MainNavigatorPushToAction {
                 routeName = MainNavigatorRoutes.Login
             }),
             pushToUserDetail = userId => dispatcher.dispatch(
                 new MainNavigatorPushToUserDetailAction {
                 userId = userId
             }
                 ),
             openUrl = url => { OpenUrlUtil.OpenUrl(url, dispatcher); },
             browserImage = url => {
                 dispatcher.dispatch(new MainNavigatorPushToPhotoViewAction {
                     urls = ContentDescription.imageUrls,
                     url = url
                 });
             },
             copyText = text => dispatcher.dispatch(new CopyTextAction {
                 text = text
             }),
             startFetchEventDetail = () => dispatcher.dispatch(new StartFetchEventDetailAction()),
             fetchEventDetail = (id, eventType) =>
                                dispatcher.dispatch <IPromise>(Actions.fetchEventDetail(id, eventType)),
             startJoinEvent = () => dispatcher.dispatch(new StartJoinEventAction()),
             joinEvent = id => dispatcher.dispatch <IPromise>(Actions.joinEvent(id)),
             shareToWechat = (type, title, description, linkUrl, imageUrl, path) =>
                             dispatcher.dispatch <IPromise>(
                 Actions.shareToWechat(type, title, description, linkUrl, imageUrl))
         };
         return new EventOfflineDetailScreen(viewModel, actionModel);
     }
                ));
 }
コード例 #2
0
        public override Widget build(BuildContext context)
        {
            return(new StoreConnector <AppState, EventDetailScreenViewModel>(
                       converter: state => {
                var channelId = state.eventState.channelId;
                var channelMessageList = state.messageState.channelMessageList;
                var messageList = new List <string>();
                if (channelMessageList.ContainsKey(channelId))
                {
                    messageList = channelMessageList[channelId];
                }

                return new EventDetailScreenViewModel {
                    eventId = this.eventId,
                    currOldestMessageId = state.messageState.currOldestMessageId,
                    isLoggedIn = state.loginState.isLoggedIn,
                    eventDetailLoading = state.eventState.eventDetailLoading,
                    joinEventLoading = state.eventState.joinEventLoading,
                    showChatWindow = state.eventState.showChatWindow,
                    channelId = state.eventState.channelId,
                    messageList = messageList,
                    messageLoading = state.messageState.messageLoading,
                    hasMore = state.messageState.hasMore,
                    sendMessageLoading = state.messageState.sendMessageLoading,
                    channelMessageDict = state.messageState.channelMessageDict,
                    eventsDict = state.eventState.eventsDict,
                    userLicenseDict = state.userState.userLicenseDict
                };
            },
                       builder: (context1, viewModel, dispatcher) => {
                var actionModel = new EventDetailScreenActionModel {
                    mainRouterPop = () => dispatcher.dispatch(new MainNavigatorPopAction()),
                    pushToLogin = () => dispatcher.dispatch(new MainNavigatorPushToAction {
                        routeName = MainNavigatorRoutes.Login
                    }),
                    pushToUserDetail = userId => {
                        dispatcher.dispatch(
                            new MainNavigatorPushToUserDetailAction {
                            userId = userId
                        }
                            );
                    },
                    openUrl = url => { OpenUrlUtil.OpenUrl(url, dispatcher); },
                    browserImage = url => {
                        dispatcher.dispatch(new MainNavigatorPushToPhotoViewAction {
                            urls = ContentDescription.imageUrls,
                            url = url
                        });
                    },
                    copyText = text => dispatcher.dispatch(new CopyTextAction {
                        text = text
                    }),
                    startFetchEventDetail = () => dispatcher.dispatch(new StartFetchEventDetailAction()),
                    fetchEventDetail = (id, eventType) =>
                                       dispatcher.dispatch <IPromise>(Actions.fetchEventDetail(id, eventType)),
                    startSendMessage = () => dispatcher.dispatch(new StartSendMessageAction()),
                    sendMessage = (channelId, content, nonce, parentMessageId) => dispatcher.dispatch <IPromise>(
                        Actions.sendMessage(channelId, content, nonce, parentMessageId)),
                    showChatWindow = show => dispatcher.dispatch(new ShowChatWindowAction {
                        show = show
                    }),
                    startFetchMessages = () => dispatcher.dispatch(new StartFetchMessagesAction()),
                    fetchMessages = (channelId, currOldestMessageId, isFirstLoad) =>
                                    dispatcher.dispatch <IPromise>(
                        Actions.fetchMessages(channelId, currOldestMessageId, isFirstLoad)
                        ),
                    shareToWechat = (type, title, description, linkUrl, imageUrl, path) =>
                                    dispatcher.dispatch <IPromise>(
                        Actions.shareToWechat(type, title, description, linkUrl, imageUrl, path, true))
                };
                return new EventOnlineDetailScreen(viewModel, actionModel);
            }
                       ));
        }
コード例 #3
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,
         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 => dispatcher.dispatch(new MainNavigatorPushToVideoPlayerAction {
                 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(id, this.isPush)),
             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, upperMessageId) => {
                 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, upperMessageId));
             },
             startFollowUser = userId =>
                               dispatcher.dispatch(new StartFollowUserAction {
                 followUserId = userId
             }),
             followUser = userId => dispatcher.dispatch <IPromise>(Actions.fetchFollowUser(userId)),
             startUnFollowUser = userId =>
                                 dispatcher.dispatch(new StartUnFollowUserAction {
                 unFollowUserId = userId
             }),
             unFollowUser = userId => dispatcher.dispatch <IPromise>(Actions.fetchUnFollowUser(userId)),
             startFollowTeam = teamId =>
                               dispatcher.dispatch(new StartFetchFollowTeamAction {
                 followTeamId = teamId
             }),
             followTeam = teamId => dispatcher.dispatch <IPromise>(Actions.fetchFollowTeam(teamId)),
             startUnFollowTeam = teamId =>
                                 dispatcher.dispatch(new StartFetchUnFollowTeamAction {
                 unFollowTeamId = teamId
             }),
             unFollowTeam = teamId => dispatcher.dispatch <IPromise>(Actions.fetchUnFollowTeam(teamId)),
             shareToWechat = (type, title, description, linkUrl, imageUrl) => dispatcher.dispatch <IPromise>(
                 Actions.shareToWechat(type, title, description, linkUrl, imageUrl))
         };
         return new ArticleDetailScreen(viewModel, actionModel);
     }
                ));
 }