Esempio n. 1
0
 public MyFavoriteScreen(
     MyFavoriteScreenActionModel actionModel,
     Key key = null
     ) : base(key: key)
 {
     this.actionModel = actionModel;
 }
Esempio n. 2
0
 public override Widget build(BuildContext context)
 {
     return(new StoreConnector <AppState, MyFavoriteScreenViewModel>(
                converter: state => new MyFavoriteScreenViewModel {
         myFavoriteLoading = state.favoriteState.favoriteTagLoading,
         myFavoriteIds = state.favoriteState.favoriteTagIds,
         myFavoriteHasMore = state.favoriteState.favoriteTagHasMore,
         currentUserId = state.loginState.loginInfo.userId ?? "",
         favoriteTagDict = state.favoriteState.favoriteTagDict
     },
                builder: (context1, viewModel, dispatcher) => {
         var actionModel = new MyFavoriteScreenActionModel {
             mainRouterPop = () => dispatcher.dispatch(new MainNavigatorPopAction()),
             startFetchMyFavorite = () => dispatcher.dispatch(new StartFetchFavoriteTagAction()),
             fetchMyFavorite = offset =>
                               dispatcher.dispatch <IPromise>(Actions.fetchFavoriteTags(userId: viewModel.currentUserId,
                                                                                        offset: offset)),
             deleteFavoriteTag = tagId =>
                                 dispatcher.dispatch <IPromise>(Actions.deleteFavoriteTag(tagId: tagId)),
             pushToCreateFavorite = tagId => dispatcher.dispatch(
                 new MainNavigatorPushToEditFavoriteAction {
                 tagId = tagId
             }),
             pushToFavoriteDetail = (userId, tagId) => dispatcher.dispatch(
                 new MainNavigatorPushToFavoriteDetailAction {
                 userId = userId,
                 tagId = tagId
             })
         };
         return new MyFavoriteScreen(viewModel: viewModel, actionModel: actionModel);
     }
                ));
 }
Esempio n. 3
0
 public override Widget build(BuildContext context)
 {
     return(new StoreConnector <AppState, MyFavoriteScreenViewModel>(
                converter: state => {
         var currentUserId = state.loginState.loginInfo.userId ?? "";
         var myFollowFavoriteIds = state.favoriteState.followFavoriteTagIdDict.ContainsKey(key: currentUserId)
                 ? state.favoriteState.followFavoriteTagIdDict[key: currentUserId]
                 : new List <string>();
         return new MyFavoriteScreenViewModel {
             myFollowFavoriteLoading = state.favoriteState.followFavoriteTagLoading,
             myFollowFavoriteIds = myFollowFavoriteIds,
             myFollowFavoriteHasMore = state.favoriteState.followFavoriteTagHasMore,
             currentUserId = currentUserId,
             favoriteTagDict = state.favoriteState.favoriteTagDict
         };
     },
                builder: (context1, viewModel, dispatcher) => {
         var actionModel = new MyFavoriteScreenActionModel {
             startFetchFollowFavorite = () => dispatcher.dispatch(new StartFetchFollowFavoriteTagAction()),
             fetchFollowFavorite = offset =>
                                   dispatcher.dispatch <IPromise>(Actions.fetchFollowFavoriteTags(userId: viewModel.currentUserId,
                                                                                                  offset: offset)),
             deleteFavoriteTag = tagId =>
                                 dispatcher.dispatch <IPromise>(Actions.deleteFavoriteTag(tagId: tagId)),
             pushToFavoriteDetail = (userId, tagId) => dispatcher.dispatch(
                 new MainNavigatorPushToFavoriteDetailAction {
                 userId = userId,
                 tagId = tagId,
                 type = FavoriteType.follow
             })
         };
         return new MyFollowFavoriteScreen(viewModel: viewModel, actionModel: actionModel);
     }
                ));
 }
Esempio n. 4
0
 public MyCreateFavoriteScreen(
     MyFavoriteScreenViewModel viewModel,
     MyFavoriteScreenActionModel actionModel,
     Key key = null
     ) : base(key: key)
 {
     this.viewModel   = viewModel;
     this.actionModel = actionModel;
 }
Esempio n. 5
0
 public override Widget build(BuildContext context)
 {
     return(new StoreConnector <AppState, object>(
                converter: state => null,
                builder: (context1, viewModel, dispatcher) => {
         var actionModel = new MyFavoriteScreenActionModel {
             mainRouterPop = () => dispatcher.dispatch(new MainNavigatorPopAction()),
             pushToCreateFavorite = tagId => dispatcher.dispatch(
                 new MainNavigatorPushToEditFavoriteAction {
                 tagId = tagId
             })
         };
         return new MyFavoriteScreen(actionModel: actionModel);
     }
                ));
 }
Esempio n. 6
0
 public override Widget build(BuildContext context)
 {
     return(new StoreConnector <AppState, MyFavoriteScreenViewModel>(
                converter: state => {
         var currentUserId = state.loginState.loginInfo.userId ?? "";
         var myFavoriteIds = state.favoriteState.favoriteTagIdDict.ContainsKey(key: currentUserId)
                 ? state.favoriteState.favoriteTagIdDict[key: currentUserId]
                 : new List <string>();
         return new MyFavoriteScreenViewModel {
             myFavoriteLoading = state.favoriteState.favoriteTagLoading,
             myFavoriteIds = myFavoriteIds,
             myFavoriteHasMore = state.favoriteState.favoriteTagHasMore,
             currentUserId = currentUserId,
             article = state.articleState.articleDict[key: this.articleId],
             favoriteTagDict = state.favoriteState.favoriteTagDict
         };
     },
                builder: (context1, viewModel, dispatcher) => {
         var actionModel = new MyFavoriteScreenActionModel {
             mainRouterPop = () => dispatcher.dispatch(new MainNavigatorPopAction()),
             startFetchMyFavorite = () => dispatcher.dispatch(new StartFetchFavoriteTagAction()),
             fetchMyFavorite = offset =>
                               dispatcher.dispatch <IPromise>(Actions.fetchFavoriteTags(userId: viewModel.currentUserId,
                                                                                        offset: offset)),
             favoriteArticle = tagIds =>
                               dispatcher.dispatch <IPromise>(Actions.favoriteArticle(articleId: this.articleId,
                                                                                      tagIds: tagIds)),
             pushToCreateFavorite = tagId => dispatcher.dispatch(
                 new MainNavigatorPushToEditFavoriteAction {
                 tagId = tagId
             })
         };
         return new FavoriteSheet(viewModel: viewModel, actionModel: actionModel);
     }
                ));
 }