Beispiel #1
0
        public static object favoriteArticle(string articleId, List <string> tagIds)
        {
            if (HttpManager.isNetWorkError())
            {
                CustomDialogUtils.showToast("请检查网络", iconData: Icons.sentiment_dissatisfied);
                return(null);
            }

            CustomDialogUtils.showCustomDialog(
                child: new CustomLoadingDialog(
                    message: "操作中"
                    )
                );
            return(new ThunkAction <AppState>((dispatcher, getState) => {
                return ArticleApi.FavoriteArticle(articleId: articleId, tagIds: tagIds)
                .Then(favoriteArticleResponse => {
                    CustomDialogUtils.hiddenCustomDialog();
                    CustomDialogUtils.showToast("操作成功", iconData: Icons.sentiment_satisfied);
                    dispatcher.dispatch(new FavoriteArticleSuccessAction {
                        favorites = favoriteArticleResponse,
                        articleId = articleId
                    });
                    AnalyticsManager.AnalyticsFavoriteArticle(articleId: articleId, favoriteTagIds: tagIds);
                })
                .Catch(error => {
                    CustomDialogUtils.hiddenCustomDialog();
                    Debuger.LogError(message: error);
                });
            }));
        }