public VideoInfomationPageViewModel( ILoggerFactory loggerFactory, ApplicationLayoutManager applicationLayoutManager, AppearanceSettings appearanceSettings, VideoFilteringSettings ngSettings, NiconicoSession niconicoSession, LoginUserOwnedMylistManager userMylistManager, NicoVideoProvider nicoVideoProvider, LoginUserMylistProvider loginUserMylistProvider, SubscriptionManager subscriptionManager, NicoVideoSessionProvider nicoVideo, PageManager pageManager, Services.NotificationService notificationService, Services.DialogService dialogService, VideoPlayWithQueueCommand videoPlayWithQueueCommand, MylistAddItemCommand addMylistCommand, LocalPlaylistAddItemCommand localPlaylistAddItemCommand, AddSubscriptionCommand addSubscriptionCommand, OpenLinkCommand openLinkCommand, CopyToClipboardCommand copyToClipboardCommand, CopyToClipboardWithShareTextCommand copyToClipboardWithShareTextCommand, OpenShareUICommand openShareUICommand, CacheAddRequestCommand cacheAddRequestCommand, RecommendProvider recommendProvider, UserFollowProvider userFollowProvider, ChannelFollowProvider channelFollowProvider ) { _logger = loggerFactory.CreateLogger <VideoInfomationPageViewModel>(); ApplicationLayoutManager = applicationLayoutManager; AppearanceSettings = appearanceSettings; NgSettings = ngSettings; NiconicoSession = niconicoSession; UserMylistManager = userMylistManager; NicoVideoProvider = nicoVideoProvider; LoginUserMylistProvider = loginUserMylistProvider; SubscriptionManager = subscriptionManager; NicoVideo = nicoVideo; PageManager = pageManager; NotificationService = notificationService; DialogService = dialogService; VideoPlayWithQueueCommand = videoPlayWithQueueCommand; AddMylistCommand = addMylistCommand; LocalPlaylistAddItemCommand = localPlaylistAddItemCommand; AddSubscriptionCommand = addSubscriptionCommand; OpenLinkCommand = openLinkCommand; CopyToClipboardCommand = copyToClipboardCommand; CopyToClipboardWithShareTextCommand = copyToClipboardWithShareTextCommand; OpenShareUICommand = openShareUICommand; CacheAddRequestCommand = cacheAddRequestCommand; _recommendProvider = recommendProvider; _userFollowProvider = userFollowProvider; _channelFollowProvider = channelFollowProvider; NowLoading = new ReactiveProperty <bool>(false); IsLoadFailed = new ReactiveProperty <bool>(false); }
public SearchResultTagPageViewModel( ILoggerFactory loggerFactory, ApplicationLayoutManager applicationLayoutManager, NiconicoSession niconicoSession, SearchProvider searchProvider, TagFollowProvider tagFollowProvider, SubscriptionManager subscriptionManager, PageManager pageManager, SearchHistoryRepository searchHistoryRepository, Services.DialogService dialogService, VideoPlayWithQueueCommand videoPlayWithQueueCommand, PlaylistPlayAllCommand playlistPlayAllCommand, AddTagSearchSubscriptionCommand addTagSearchSubscriptionCommand, SelectionModeToggleCommand selectionModeToggleCommand ) : base(loggerFactory.CreateLogger <SearchResultTagPageViewModel>()) { SearchProvider = searchProvider; _tagFollowProvider = tagFollowProvider; SubscriptionManager = subscriptionManager; PageManager = pageManager; _searchHistoryRepository = searchHistoryRepository; ApplicationLayoutManager = applicationLayoutManager; NiconicoSession = niconicoSession; HohoemaDialogService = dialogService; VideoPlayWithQueueCommand = videoPlayWithQueueCommand; PlaylistPlayAllCommand = playlistPlayAllCommand; AddTagSearchSubscriptionCommand = addTagSearchSubscriptionCommand; SelectionModeToggleCommand = selectionModeToggleCommand; FailLoading = new ReactiveProperty <bool>(false) .AddTo(_CompositeDisposable); LoadedPage = new ReactiveProperty <int>(1) .AddTo(_CompositeDisposable); SelectedSearchTarget = new ReactiveProperty <SearchTarget>(); CurrentPlaylistToken = Observable.CombineLatest( this.ObserveProperty(x => x.SearchVideoPlaylist), this.ObserveProperty(x => x.SelectedSortOption), (x, y) => new PlaylistToken(x, y) ) .ToReadOnlyReactivePropertySlim() .AddTo(_CompositeDisposable); }
public NiconicoLoginService( NiconicoSession niconicoSession, NoUIProcessScreenContext noProcessUIScreenContext, DialogService dialogService, NotificationService notificationService, IMessenger messenger ) { NiconicoSession = niconicoSession; _noProcessUIScreenContext = noProcessUIScreenContext; DialogService = dialogService; NotificationService = notificationService; _messenger = messenger; // 二要素認証を求められるケースに対応する // 起動後の自動ログイン時に二要素認証を要求されることもある _messenger.Register <NiconicoSessionLoginRequireTwoFactorAsyncRequestMessage>(this); NiconicoSession.LogIn += NiconicoSession_LogIn; NiconicoSession.LogInFailed += NiconicoSession_LogInFailed; NiconicoSession.LogOut += NiconicoSession_LogOut; }
// コメントの取得、とアプリケーションドメインなコメントモデルへの変換 // コメントの投稿可否判断と投稿処理 public CommentClient(NiconicoSession niconicoSession, string rawVideoid) { _niconicoSession = niconicoSession; RawVideoId = rawVideoid; }
private async Task StartLoginSequence() { var dialog = new Dialogs.NiconicoLoginDialog(); var currentStatus = await NiconicoSession.CheckSignedInStatus(); if (currentStatus == NiconicoSessionStatus.ServiceUnavailable) { dialog.WarningText = "UnavailableNiconicoService".Translate(); NotificationService.ShowLiteInAppNotification("UnavailableNiconicoService".Translate(), DisplayDuration.MoreAttention, Windows.UI.Xaml.Controls.Symbol.Important); } var account = await AccountManager.GetPrimaryAccount(); if (account != null) { dialog.Mail = account.Item1; dialog.Password = account.Item2; dialog.IsRememberPassword = true; } bool isLoginSuccess = false; bool isCanceled = false; while (!isLoginSuccess) { var result = await dialog.ShowAsync(); if (result != Windows.UI.Xaml.Controls.ContentDialogResult.Primary) { isCanceled = true; break; } dialog.WarningText = string.Empty; _twoFactorAuthLoginCts = new TaskCompletionSource <long>(); var loginResult = await NiconicoSession.SignIn(dialog.Mail, dialog.Password, true); if (loginResult == NiconicoSessionStatus.RequireTwoFactorAuth) { await _twoFactorAuthLoginCts.Task; loginResult = await NiconicoSession.CheckSignedInStatus(); } _twoFactorAuthLoginCts = null; if (loginResult == NiconicoSessionStatus.ServiceUnavailable) { // サービス障害中 // 何か通知を出す? NotificationService.ShowLiteInAppNotification("UnavailableNiconicoService".Translate(), DisplayDuration.MoreAttention, Windows.UI.Xaml.Controls.Symbol.Important); break; } else if (loginResult == NiconicoSessionStatus.Failed) { dialog.WarningText = "LoginFailed_WrongMailOrPassword".Translate(); } isLoginSuccess = loginResult == NiconicoSessionStatus.Success; } // ログインを選択していた場合にのみアカウント情報を更新する // (キャンセル時は影響を発生させない) if (!isCanceled) { if (account != null) { AccountManager.RemoveAccount(account.Item1); } AccountManager.SetPrimaryAccountId(dialog.Mail); if (dialog.IsRememberPassword) { await AccountManager.AddOrUpdateAccount(dialog.Mail, dialog.Password); } } }
// TODO: 視聴開始(会場後のみ、チャンネル会員限定やチケット必要な場合あり) // TODO: タイムシフト予約(tsがある場合のみ、会場前のみ、プレミアムの場合は会場後でも可) // TODO: 後からタイムシフト予約(プレミアムの場合のみ) // TODO: 配信説明 // TODO: タグ // TODO: 配信者(チャンネルやコミュニティ)の概要説明 // TODO: 配信者(チャンネルやコミュニティ)のフォロー // TODO: オススメ生放送(放送中、放送予定を明示) // TODO: ニコニコ市場 // TODO: SNS共有 // gateとwatchをどちらも扱った上でその差を意識させないように表現する // LiveInfo.Video.CurrentStatusは開演前、放送中は時間の経過によって変化する可能性がある public LiveInfomationPageViewModel( ApplicationLayoutManager applicationLayoutManager, AppearanceSettings appearanceSettings, PageManager pageManager, NiconicoSession niconicoSession, NicoLiveProvider nicoLiveProvider, DialogService dialogService, OpenLiveContentCommand openLiveContentCommand, OpenLinkCommand openLinkCommand, CopyToClipboardCommand copyToClipboardCommand, CopyToClipboardWithShareTextCommand copyToClipboardWithShareTextCommand ) { ApplicationLayoutManager = applicationLayoutManager; _appearanceSettings = appearanceSettings; PageManager = pageManager; NiconicoSession = niconicoSession; NicoLiveProvider = nicoLiveProvider; HohoemaDialogService = dialogService; OpenLiveContentCommand = openLiveContentCommand; OpenLinkCommand = openLinkCommand; CopyToClipboardCommand = copyToClipboardCommand; CopyToClipboardWithShareTextCommand = copyToClipboardWithShareTextCommand; IsLoadFailed = new ReactiveProperty <bool>(false) .AddTo(_CompositeDisposable); LoadFailedMessage = new ReactiveProperty <string>() .AddTo(_CompositeDisposable); IsLiveIdAvairable = this.ObserveProperty(x => x.LiveId) .Select(x => x != default(LiveId)) .ToReadOnlyReactiveProperty() .AddTo(_CompositeDisposable); IsLoggedIn = NiconicoSession.ObserveProperty(x => x.IsLoggedIn) .ToReadOnlyReactiveProperty() .AddTo(_CompositeDisposable); IsPremiumAccount = NiconicoSession.ObserveProperty(x => x.IsPremiumAccount) .ToReadOnlyReactiveProperty() .AddTo(_CompositeDisposable); _IsTsPreserved = new ReactiveProperty <bool>(false) .AddTo(_CompositeDisposable); LiveTags = new ReadOnlyObservableCollection <LiveTagViewModel>(_LiveTags); IchibaItems = new ReadOnlyObservableCollection <IchibaItem>(_IchibaItems); /* * ReccomendItems = _ReccomendItems.ToReadOnlyReactiveCollection(x => * { * var liveId = x.ProgramId; * var liveInfoVM = new LiveInfoListItemViewModel(liveId); * liveInfoVM.Setup(x); * * var reserve = _Reservations?.ReservedProgram.FirstOrDefault(reservation => liveId == reservation.Id); * if (reserve != null) * { * liveInfoVM.SetReservation(reserve); * } * * return liveInfoVM; * }) * .AddTo(_CompositeDisposable); */ IsShowOpenLiveContentButton = new[] { this.ObserveProperty(x => LiveProgram).ToUnit(), NiconicoSession.ObserveProperty(x => x.IsLoggedIn).ToUnit(), _IsTsPreserved.ToUnit() } .Merge() .Select(x => { if (LiveProgram == null) { return(false); } if (NiconicoSession.IsPremiumAccount) { if (LiveProgram.OnAirTime.BeginAt > DateTime.Now) { return(false); } return(LiveProgram.Timeshift.Enabled); } else { // 一般アカウントは放送中のみ if (LiveProgram.OnAirTime.BeginAt > DateTime.Now) { return(false); } if (_IsTsPreserved.Value) { return(true); } if (LiveProgram.OnAirTime.EndAt < DateTime.Now) { return(false); } return(true); } }) .ToReadOnlyReactiveProperty() .AddTo(_CompositeDisposable); IsShowAddTimeshiftButton = new [] { this.ObserveProperty(x => LiveProgram).ToUnit(), NiconicoSession.ObserveProperty(x => x.IsLoggedIn).ToUnit(), _IsTsPreserved.ToUnit() } .Merge() .Select(x => { if (LiveProgram == null) { return(false); } if (!LiveProgram.Timeshift.Enabled) { return(false); } if (!NiconicoSession.IsLoggedIn) { return(false); } if (!NiconicoSession.IsPremiumAccount) { // 一般アカウントは放送開始の30分前からタイムシフトの登録はできなくなる if ((LiveProgram.ShowTime.BeginAt - TimeSpan.FromMinutes(30)) < DateTime.Now) { return(false); } } // 放送前、及び放送中はタイムシフトボタンを非表示…? // プレ垢なら常に表示しておいていいんじゃないの? //if (LiveProgram.ShowTime.EndAt > DateTime.Now) { return false; } // タイムシフト予約済み if (_IsTsPreserved.Value) { return(false); } return(true); }) .ToReadOnlyReactiveProperty() .AddTo(_CompositeDisposable); IsShowDeleteTimeshiftButton = _IsTsPreserved; }
public UserInfoPageViewModel( ApplicationLayoutManager applicationLayoutManager, UserProvider userProvider, UserFollowProvider userFollowProvider, VideoFilteringSettings ngSettings, NiconicoSession niconicoSession, SubscriptionManager subscriptionManager, LoginUserOwnedMylistManager userMylistManager, PageManager pageManager, MylistResolver mylistRepository, VideoPlayWithQueueCommand videoPlayWithQueueCommand, AddSubscriptionCommand addSubscriptionCommand, OpenLinkCommand openLinkCommand ) { NiconicoSession = niconicoSession; SubscriptionManager = subscriptionManager; UserMylistManager = userMylistManager; PageManager = pageManager; _mylistRepository = mylistRepository; VideoPlayWithQueueCommand = videoPlayWithQueueCommand; AddSubscriptionCommand = addSubscriptionCommand; OpenLinkCommand = openLinkCommand; ApplicationLayoutManager = applicationLayoutManager; UserProvider = userProvider; _userFollowProvider = userFollowProvider; NgSettings = ngSettings; HasOwnerVideo = true; VideoInfoItems = new ObservableCollection <VideoListItemControlViewModel>(); OpenUserVideoPageCommand = VideoInfoItems.ObserveProperty(x => x.Count) .Select(x => x > 0) .ToReactiveCommand() .AddTo(_CompositeDisposable); OpenUserVideoPageCommand.Subscribe(x => { PageManager.OpenPageWithId(HohoemaPageType.UserVideo, UserId); }) .AddTo(_CompositeDisposable); IsNGVideoOwner = new ReactiveProperty <bool>(false, ReactivePropertyMode.DistinctUntilChanged); IsNGVideoOwner.Subscribe(isNgVideoOwner => { if (isNgVideoOwner) { NgSettings.AddHiddenVideoOwnerId(UserId, Nickname); IsNGVideoOwner.Value = true; Debug.WriteLine(Nickname + "をNG動画投稿者として登録しました。"); } else { NgSettings.RemoveHiddenVideoOwnerId(UserId); IsNGVideoOwner.Value = false; Debug.WriteLine(Nickname + "をNG動画投稿者の指定を解除しました。"); } }); }