Esempio n. 1
0
        private async Task <InAppNotificationPayload> SubmitLiveContentSuggestion(string liveId)
        {
            var liveDesc = await NicoLiveProvider.GetLiveInfoAsync(liveId);

            if (liveDesc == null)
            {
                return(null);
            }

            var liveTitle = liveDesc.VideoInfo.Video.Title;

            var payload = new InAppNotificationPayload()
            {
                Content             = $"{liveTitle} をお探しですか?",
                ShowDuration        = DefaultNotificationShowDuration,
                SymbolIcon          = Symbol.Video,
                IsShowDismissButton = true,
                Commands            =
                {
                    new InAppNotificationCommand()
                    {
                        Label   = "視聴する",
                        Command = new DelegateCommand(() =>
                        {
                            Playlist.PlayLiveVideo(liveId, liveTitle);

                            NotificationService.DismissInAppNotification();
                        })
                    },
                    new InAppNotificationCommand()
                    {
                        Label   = "放送情報を確認",
                        Command = new DelegateCommand(() =>
                        {
                            PageManager.OpenPage(HohoemaPageType.LiveInfomation, liveId);

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

            if (liveDesc.VideoInfo.Community != null)
            {
                payload.Commands.Add(new InAppNotificationCommand()
                {
                    Label   = "コミュニティを開く",
                    Command = new DelegateCommand(() =>
                    {
                        PageManager.OpenPage(HohoemaPageType.Community, liveDesc.VideoInfo.Community.GlobalId);

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

            return(payload);
        }
Esempio n. 2
0
        private async Task <InAppNotificationPayload> SubmitVideoContentSuggestion(string videoId)
        {
            var nicoVideo = await NicoVideoProvider.GetNicoVideoInfo(videoId);

            if (nicoVideo.IsDeleted || string.IsNullOrEmpty(nicoVideo.Title))
            {
                return(null);
            }

            return(new InAppNotificationPayload()
            {
                Content = $"{nicoVideo.Title} をお探しですか?",
                ShowDuration = DefaultNotificationShowDuration,
                SymbolIcon = Symbol.Video,
                IsShowDismissButton = true,
                Commands =
                {
                    new InAppNotificationCommand()
                    {
                        Label = "再生",
                        Command = new DelegateCommand(() =>
                        {
                            Playlist.PlayVideo(nicoVideo.RawVideoId, nicoVideo.Title);

                            NotificationService.DismissInAppNotification();
                        })
                    },
                    new InAppNotificationCommand()
                    {
                        Label = "あとで見る",
                        Command = new DelegateCommand(() =>
                        {
                            Playlist.DefaultPlaylist.AddMylistItem(nicoVideo.RawVideoId);

                            NotificationService.DismissInAppNotification();
                        })
                    },
                    new InAppNotificationCommand()
                    {
                        Label = "動画情報を開く",
                        Command = new DelegateCommand(() =>
                        {
                            PageManager.OpenPage(HohoemaPageType.VideoInfomation, videoId);

                            NotificationService.DismissInAppNotification();
                        })
                    },
                }
            });
        }
Esempio n. 3
0
        private async Task <InAppNotificationPayload> SubmitUserSuggestion(string userId)
        {
            var user = await UserProvider.GetUser(userId);

            if (user == null)
            {
                return(null);
            }

            return(new InAppNotificationPayload()
            {
                Content = $"{user.ScreenName} をお探しですか?",
                ShowDuration = DefaultNotificationShowDuration,
                SymbolIcon = Symbol.Video,
                IsShowDismissButton = true,
                Commands =
                {
                    new InAppNotificationCommand()
                    {
                        Label = "ユーザー情報を開く",
                        Command = new DelegateCommand(() =>
                        {
                            PageManager.OpenPage(HohoemaPageType.UserInfo, userId);

                            NotificationService.DismissInAppNotification();
                        })
                    },
                    new InAppNotificationCommand()
                    {
                        Label = "動画一覧を開く",
                        Command = new DelegateCommand(() =>
                        {
                            PageManager.OpenPage(HohoemaPageType.UserVideo, userId);

                            NotificationService.DismissInAppNotification();
                        })
                    },
                }
            });
        }
Esempio n. 4
0
        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.OpenPage(HohoemaPageType.Community, communityId);

                            NotificationService.DismissInAppNotification();
                        })
                    },
                }
            });
        }
Esempio n. 5
0
        private async Task <InAppNotificationPayload> SubmitMylistContentSuggestion(string mylistId)
        {
            Mntone.Nico2.Mylist.MylistGroup.MylistGroupDetailResponse mylistDetail = null;
            try
            {
                mylistDetail = await MylistProvider.GetMylistGroupDetail(mylistId);
            }
            catch { }

            if (mylistDetail == null || !mylistDetail.IsOK)
            {
                return(null);
            }

            var mylistGroup = mylistDetail.MylistGroup;

            return(new InAppNotificationPayload()
            {
                Content = $"{mylistGroup.Name} をお探しですか?",
                ShowDuration = DefaultNotificationShowDuration,
                SymbolIcon = Symbol.Video,
                IsShowDismissButton = true,
                Commands =
                {
                    new InAppNotificationCommand()
                    {
                        Label = "マイリストを開く",
                        Command = new DelegateCommand(() =>
                        {
                            PageManager.OpenPage(HohoemaPageType.Mylist, new MylistPagePayload(mylistId).ToParameterString());

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