Example #1
0
        private async Task SubmitCommunityContentSuggestion(string communityId)
        {
            var hohoemaApp = App.Current.Container.Resolve <HohoemaApp>();

            Mntone.Nico2.Communities.Detail.CommunityDetailResponse communityDetail = null;
            try
            {
                communityDetail = await hohoemaApp.ContentProvider.GetCommunityDetail(communityId);
            }
            catch { }

            if (communityDetail == null || !communityDetail.IsStatusOK)
            {
                return;
            }

            var communityInfo = communityDetail.CommunitySammary.CommunityDetail;

            PublishInAppNotification(new InAppNotificationPayload()
            {
                Content             = $"{communityInfo.Name} をお探しですか?",
                ShowDuration        = DefaultNotificationShowDuration,
                SymbolIcon          = Symbol.Video,
                IsShowDismissButton = true,
                Commands            =
                {
                    new InAppNotificationCommand()
                    {
                        Label   = "コミュニティを開く",
                        Command = new DelegateCommand(() =>
                        {
                            var pageManager = App.Current.Container.Resolve <PageManager>();
                            pageManager.OpenPage(HohoemaPageType.Community, communityId);

                            DismissInAppNotification();
                        })
                    },
                }
            });
        }
        private async Task <InAppNotificationPayload> SubmitCommunityContentSuggestion(string communityId)
        {
            Mntone.Nico2.Communities.Detail.CommunityDetailResponse communityDetail = null;
            try
            {
                communityDetail = await CommunityProvider.GetCommunityDetail(communityId);
            }
            catch { }

            if (communityDetail == null || !communityDetail.IsStatusOK)
            {
                return(null);
            }

            var communityInfo = communityDetail.CommunitySammary.CommunityDetail;

            return(new InAppNotificationPayload()
            {
                Content = $"{communityInfo.Name} をお探しですか?",
                ShowDuration = DefaultNotificationShowDuration,
                SymbolIcon = Symbol.Video,
                IsShowDismissButton = true,
                Commands =
                {
                    new InAppNotificationCommand()
                    {
                        Label = "コミュニティを開く",
                        Command = new DelegateCommand(() =>
                        {
                            PageManager.OpenPageWithId(HohoemaPageType.Community, communityId);

                            NotificationService.DismissInAppNotification();
                        })
                    },
                }
            });
        }