コード例 #1
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            prepareViews();

            Title             = ViewModel.Title;
            VersionLabel.Text = ViewModel.Version;

            LoggingOutView.Hidden          = true;
            SendFeedbackSuccessView.Hidden = true;

            this.Bind(ViewModel.Email, EmailLabel.Rx().Text());
            this.Bind(ViewModel.IsSynced, SyncedView.Rx().IsVisible());
            this.Bind(ViewModel.WorkspaceName, WorkspaceLabel.Rx().Text());
            this.Bind(ViewModel.DurationFormat, DurationFormatLabel.Rx().Text());
            this.Bind(ViewModel.IsRunningSync, SyncingView.Rx().IsVisible());
            this.Bind(ViewModel.DateFormat, DateFormatLabel.Rx().Text());
            this.Bind(ViewModel.BeginningOfWeek, BeginningOfWeekLabel.Rx().Text());
            this.Bind(ViewModel.IsFeedbackSuccessViewShowing, SendFeedbackSuccessView.Rx().AnimatedIsVisible());
            this.BindVoid(ViewModel.LoggingOut, () =>
            {
                LoggingOutView.Hidden = false;
                SyncingView.Hidden    = true;
                SyncedView.Hidden     = true;
            });

            this.Bind(HelpView.Rx().Tap(), ViewModel.OpenHelpView);
            this.Bind(LogoutButton.Rx().Tap(), ViewModel.TryLogout);
            this.Bind(AboutView.Rx().Tap(), ViewModel.OpenAboutView);
            this.Bind(FeedbackView.Rx().Tap(), ViewModel.SubmitFeedback);
            this.Bind(DateFormatView.Rx().Tap(), ViewModel.SelectDateFormat);
            this.Bind(WorkspaceView.Rx().Tap(), ViewModel.PickDefaultWorkspace);
            this.Bind(DurationFormatView.Rx().Tap(), ViewModel.SelectDurationFormat);
            this.BindVoid(ManualModeSwitch.Rx().Changed(), ViewModel.ToggleManualMode);
            this.Bind(BeginningOfWeekView.Rx().Tap(), ViewModel.SelectBeginningOfWeek);
            this.Bind(CalendarSettingsView.Rx().Tap(), ViewModel.OpenCalendarSettingsAction);
            this.BindVoid(SendFeedbackSuccessView.Rx().Tap(), ViewModel.CloseFeedbackSuccessView);
            this.Bind(NotificationSettingsView.Rx().Tap(), ViewModel.OpenNotificationSettingsAction);
            this.Bind(TwentyFourHourClockSwitch.Rx().Changed(), ViewModel.ToggleUseTwentyFourHourClock);

            UIApplication.Notifications
            .ObserveWillEnterForeground((sender, e) => startAnimations())
            .DisposedBy(DisposeBag);

            if (!ViewModel.CalendarSettingsEnabled)
            {
                hideCalendarSettingsSection();
            }

            ViewModel.IsManualModeEnabled
            .FirstAsync()
            .Subscribe(isEnabled => ManualModeSwitch.SetState(isEnabled, false))
            .DisposedBy(DisposeBag);

            ViewModel.UseTwentyFourHourFormat
            .FirstAsync()
            .Subscribe(useTwentyFourHourFormat => TwentyFourHourClockSwitch.SetState(useTwentyFourHourFormat, false))
            .DisposedBy(DisposeBag);
        }
コード例 #2
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            var source = new SettingsTableViewSource(tableView);

            tableView.Source          = source;
            tableView.TableFooterView = new UIView(frame: new CGRect(0, 0, 0, bottomInset));
            tableView.BackgroundColor = Colors.Settings.Background.ToNativeColor();

            settingsSections()
            .Subscribe(tableView.Rx().ReloadSections(source))
            .DisposedBy(DisposeBag);

            source.Rx().ModelSelected()
            .Subscribe(handleSettingTap)
            .DisposedBy(DisposeBag);

            FeedbackToastTitleLabel.Text = Resources.DoneWithExclamationMark.ToUpper();
            FeedbackToastTextLabel.Text  = Resources.ThankYouForTheFeedback;

            Title = ViewModel.Title;

            SendFeedbackSuccessView.Hidden = true;

            ViewModel.IsFeedbackSuccessViewShowing
            .Subscribe(SendFeedbackSuccessView.Rx().AnimatedIsVisible())
            .DisposedBy(DisposeBag);

            SendFeedbackSuccessView.Rx().Tap()
            .Subscribe(ViewModel.CloseFeedbackSuccessView)
            .DisposedBy(DisposeBag);
        }
コード例 #3
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            prepareViews();

            Title             = ViewModel.Title;
            VersionLabel.Text = ViewModel.Version;

            LoggingOutView.Hidden          = true;
            SendFeedbackSuccessView.Hidden = true;

            this.Bind(ViewModel.Email, EmailLabel.BindText());
            this.Bind(ViewModel.IsSynced, SyncedView.BindIsVisible());
            this.Bind(ViewModel.WorkspaceName, WorkspaceLabel.BindText());
            this.Bind(ViewModel.DurationFormat, DurationFormatLabel.BindText());
            this.Bind(ViewModel.IsRunningSync, SyncingView.BindIsVisible());
            this.Bind(ViewModel.DateFormat, DateFormatLabel.BindText());
            this.Bind(ViewModel.IsManualModeEnabled, ManualModeSwitch.BindIsOn());
            this.Bind(ViewModel.BeginningOfWeek, BeginningOfWeekLabel.BindText());
            this.Bind(ViewModel.UseTwentyFourHourFormat, TwentyFourHourClockSwitch.BindIsOn());
            this.BindVoid(ViewModel.LoggingOut, () =>
            {
                LoggingOutView.Hidden = false;
                SyncingView.Hidden    = true;
                SyncedView.Hidden     = true;
            });
            this.Bind(ViewModel.IsFeedbackSuccessViewShowing, SendFeedbackSuccessView.BindAnimatedIsVisible());

            this.Bind(HelpView.Tapped(), ViewModel.OpenHelpView);
            this.Bind(LogoutButton.Tapped(), ViewModel.TryLogout);
            this.Bind(AboutView.Tapped(), ViewModel.OpenAboutView);
            this.Bind(FeedbackView.Tapped(), ViewModel.SubmitFeedback);
            this.Bind(DateFormatView.Tapped(), ViewModel.SelectDateFormat);
            this.Bind(WorkspaceView.Tapped(), ViewModel.PickDefaultWorkspace);
            this.BindVoid(ManualModeView.Tapped(), ViewModel.ToggleManualMode);
            this.Bind(DurationFormatView.Tapped(), ViewModel.SelectDurationFormat);
            this.Bind(BeginningOfWeekView.Tapped(), ViewModel.SelectBeginningOfWeek);
            this.Bind(TwentyFourHourClockView.Tapped(), ViewModel.ToggleUseTwentyFourHourClock);
            this.BindVoid(SendFeedbackSuccessView.Tapped(), ViewModel.CloseFeedbackSuccessView);

            UIApplication.Notifications
            .ObserveWillEnterForeground((sender, e) => startAnimations())
            .DisposedBy(DisposeBag);
        }
コード例 #4
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            View.BackgroundColor = ColorAssets.TableBackground;
            ((ReactiveNavigationController)NavigationController).SetBackgroundColor(ColorAssets.TableBackground);

            NavigationItem.RightBarButtonItem = ReactiveNavigationController.CreateSystemItem(
                UIBarButtonSystemItem.Done,
                () => ViewModel.Close()
                );

            var source = new SettingsTableViewSource(tableView);

            tableView.Source          = source;
            tableView.TableFooterView = new UIView(frame: new CGRect(0, 0, 0, bottomInset));
            tableView.BackgroundColor = ColorAssets.TableBackground;

            settingsSections()
            .Subscribe(tableView.Rx().ReloadSections(source))
            .DisposedBy(DisposeBag);

            source.Rx().ModelSelected()
            .Subscribe(handleSettingTap)
            .DisposedBy(DisposeBag);

            FeedbackToastTitleLabel.Text = Resources.DoneWithExclamationMark.ToUpper();
            FeedbackToastTextLabel.Text  = Resources.ThankYouForTheFeedback;

            Title = ViewModel.Title;

            SendFeedbackSuccessView.Hidden = true;

            ViewModel.IsFeedbackSuccessViewShowing
            .Subscribe(SendFeedbackSuccessView.Rx().AnimatedIsVisible())
            .DisposedBy(DisposeBag);

            SendFeedbackSuccessView.Rx().Tap()
            .Subscribe(ViewModel.CloseFeedbackSuccessView)
            .DisposedBy(DisposeBag);
        }
コード例 #5
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            GroupSimilarTimeEntriesLabel.Text = Resources.GroupTimeEntries;
            YourProfileCellLabel.Text         = Resources.YourProfile;
            WorkspaceCellLabel.Text           = Resources.Workspace;
            FormatSettingsHeaderLabel.Text    = Resources.FormatSettings;
            DateFormatCellLabel.Text          = Resources.DateFormat;
            Use24HourClockCellLabel.Text      = Resources.Use24HourClock;
            DurationFormatCellLabel.Text      = Resources.DurationFormat;
            FirstDayOfTheWeekCellLabel.Text   = Resources.FirstDayOfTheWeek;
            ManualModeCellLabel.Text          = Resources.ManualMode;
            ManualModeDescriptionLabel.Text   = Resources.ManualModeDescription;
            CalendarSettingsCellLabel.Text    = Resources.CalendarSettingsTitle;
            SmartAlertCellLabel.Text          = Resources.SmartAlerts;
            SubmitFeedbackCellLabel.Text      = Resources.SubmitFeedback;
            AboutCellLabel.Text          = Resources.About;
            HelpCellLabel.Text           = Resources.Help;
            LoggingOutLabel.Text         = Resources.LoggingOutSecurely;
            SyncingLabel.Text            = Resources.Syncing;
            SyncedLabel.Text             = Resources.SyncCompleted;
            FeedbackToastTitleLabel.Text = Resources.DoneWithExclamationMark.ToUpper();
            FeedbackToastTextLabel.Text  = Resources.ThankYouForTheFeedback;
            LogoutButton.SetTitle(Resources.SignOutOfToggl, UIControlState.Normal);

            prepareViews();

            Title             = ViewModel.Title;
            VersionLabel.Text = ViewModel.Version;

            LoggingOutView.Hidden          = true;
            SendFeedbackSuccessView.Hidden = true;

            ViewModel.Email
            .Subscribe(EmailLabel.Rx().Text())
            .DisposedBy(DisposeBag);

            ViewModel.IsSynced
            .Subscribe(SyncedView.Rx().IsVisible())
            .DisposedBy(DisposeBag);

            ViewModel.WorkspaceName
            .Subscribe(WorkspaceLabel.Rx().Text())
            .DisposedBy(DisposeBag);

            ViewModel.DurationFormat
            .Subscribe(DurationFormatLabel.Rx().Text())
            .DisposedBy(DisposeBag);

            ViewModel.IsRunningSync
            .Subscribe(SyncingView.Rx().IsVisible())
            .DisposedBy(DisposeBag);

            ViewModel.DateFormat
            .Subscribe(DateFormatLabel.Rx().Text())
            .DisposedBy(DisposeBag);

            ViewModel.BeginningOfWeek
            .Subscribe(BeginningOfWeekLabel.Rx().Text())
            .DisposedBy(DisposeBag);

            ViewModel.IsFeedbackSuccessViewShowing
            .Subscribe(SendFeedbackSuccessView.Rx().AnimatedIsVisible())
            .DisposedBy(DisposeBag);

            ViewModel.LoggingOut
            .Subscribe(_ =>
            {
                LoggingOutView.Hidden = false;
                SyncingView.Hidden    = true;
                SyncedView.Hidden     = true;
            })
            .DisposedBy(DisposeBag);

            HelpView.Rx()
            .BindAction(ViewModel.OpenHelpView)
            .DisposedBy(DisposeBag);

            LogoutButton.Rx()
            .BindAction(ViewModel.TryLogout)
            .DisposedBy(DisposeBag);

            AboutView.Rx()
            .BindAction(ViewModel.OpenAboutView)
            .DisposedBy(DisposeBag);

            FeedbackView.Rx()
            .BindAction(ViewModel.SubmitFeedback)
            .DisposedBy(DisposeBag);

            DateFormatView.Rx()
            .BindAction(ViewModel.SelectDateFormat)
            .DisposedBy(DisposeBag);

            WorkspaceView.Rx()
            .BindAction(ViewModel.PickDefaultWorkspace)
            .DisposedBy(DisposeBag);

            DurationFormatView.Rx()
            .BindAction(ViewModel.SelectDurationFormat)
            .DisposedBy(DisposeBag);

            ManualModeSwitch.Rx().Changed()
            .Subscribe(ViewModel.ToggleManualMode)
            .DisposedBy(DisposeBag);

            GroupSimilarTimeEntriesSwitch.Rx()
            .BindAction(ViewModel.ToggleTimeEntriesGrouping)
            .DisposedBy(DisposeBag);

            BeginningOfWeekView.Rx()
            .BindAction(ViewModel.SelectBeginningOfWeek)
            .DisposedBy(DisposeBag);

            CalendarSettingsView.Rx()
            .BindAction(ViewModel.OpenCalendarSettings)
            .DisposedBy(DisposeBag);

            SendFeedbackSuccessView.Rx().Tap()
            .Subscribe(ViewModel.CloseFeedbackSuccessView)
            .DisposedBy(DisposeBag);

            NotificationSettingsView.Rx()
            .BindAction(ViewModel.OpenNotificationSettings)
            .DisposedBy(DisposeBag);

            TwentyFourHourClockSwitch.Rx().Changed()
            .Subscribe(ViewModel.ToggleTwentyFourHourSettings.Inputs)
            .DisposedBy(DisposeBag);

            UIApplication.Notifications
            .ObserveWillEnterForeground((sender, e) => startAnimations())
            .DisposedBy(DisposeBag);

            if (!ViewModel.CalendarSettingsEnabled)
            {
                hideCalendarSettingsSection();
            }

            ViewModel.IsManualModeEnabled
            .FirstAsync()
            .Subscribe(isEnabled => ManualModeSwitch.SetState(isEnabled, false))
            .DisposedBy(DisposeBag);

            ViewModel.IsGroupingTimeEntries
            .FirstAsync()
            .Subscribe(isGrouping => GroupSimilarTimeEntriesSwitch.SetState(isGrouping, false))
            .DisposedBy(DisposeBag);

            ViewModel.UseTwentyFourHourFormat
            .FirstAsync()
            .Subscribe(useTwentyFourHourFormat => TwentyFourHourClockSwitch.SetState(useTwentyFourHourFormat, false))
            .DisposedBy(DisposeBag);
        }
コード例 #6
0
ファイル: MainViewController.cs プロジェクト: l0gaw/mobileapp
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            SwipeRightBubbleLabel.Text         = Resources.SwipeRightToContinue;
            SwipeLeftBubbleLabel.Text          = Resources.SwipeLeftToDelete;
            WelcomeBackLabel.Text              = Resources.LogEmptyStateTitle;
            WelcomeBackDescriptionLabel.Text   = Resources.LogEmptyStateText;
            CreatedFirstTimeEntryLabel.Text    = Resources.YouHaveCreatedYourFirstTimeEntry;
            TapToEditItLabel.Text              = Resources.TapToEditIt;
            StartTimerBubbleLabel.Text         = Resources.TapToStartTimer;
            TapToStopTimerLabel.Text           = Resources.TapToStopTimer;
            FeedbackSentSuccessTitleLabel.Text = Resources.DoneWithExclamationMark.ToUpper();
            FeedbackSentDescriptionLabel.Text  = Resources.ThankYouForTheFeedback;

            prepareViews();
            prepareOnboarding();
            setupTableViewHeader();

            tableViewSource = new TimeEntriesLogViewSource();

            TimeEntriesLogTableView.Source = tableViewSource;

            ViewModel.TimeEntries
            .Subscribe(TimeEntriesLogTableView.Rx().AnimateSections <MainLogSection, DaySummaryViewModel, LogItemViewModel, IMainLogKey>(tableViewSource))
            .DisposedBy(disposeBag);

            ViewModel.ShouldReloadTimeEntryLog
            .WithLatestFrom(ViewModel.TimeEntries, (_, timeEntries) => timeEntries)
            .Subscribe(TimeEntriesLogTableView.Rx().ReloadSections(tableViewSource))
            .DisposedBy(disposeBag);

            tableViewSource.ToggleGroupExpansion
            .Subscribe(ViewModel.TimeEntriesViewModel.ToggleGroupExpansion.Inputs)
            .DisposedBy(disposeBag);

            tableViewSource.FirstCell
            .Subscribe(f =>
            {
                onFirstTimeEntryChanged(f);
                firstTimeEntryCell = f;
            })
            .DisposedBy(DisposeBag);

            tableViewSource.Rx().Scrolled()
            .Subscribe(onTableScroll)
            .DisposedBy(DisposeBag);

            tableViewSource.ContinueTap
            .Select(item => timeEntryContinuation(item, false))
            .Subscribe(ViewModel.ContinueTimeEntry.Inputs)
            .DisposedBy(DisposeBag);

            tableViewSource.SwipeToContinue
            .Select(item => timeEntryContinuation(item, true))
            .Subscribe(ViewModel.ContinueTimeEntry.Inputs)
            .DisposedBy(DisposeBag);

            tableViewSource.SwipeToDelete
            .Select(logItem => logItem.RepresentedTimeEntriesIds)
            .Subscribe(ViewModel.TimeEntriesViewModel.DelayDeleteTimeEntries.Inputs)
            .DisposedBy(DisposeBag);

            tableViewSource.Rx().ModelSelected()
            .Select(editEventInfo)
            .Subscribe(ViewModel.SelectTimeEntry.Inputs)
            .DisposedBy(DisposeBag);

            ViewModel.TimeEntriesViewModel.TimeEntriesPendingDeletion
            .Subscribe(toggleUndoDeletion)
            .DisposedBy(DisposeBag);

            tableViewSource.SwipeToContinue
            .Subscribe(_ => swipeRightStep.Dismiss())
            .DisposedBy(disposeBag);

            tableViewSource.SwipeToDelete
            .Subscribe(_ => swipeLeftStep.Dismiss())
            .DisposedBy(disposeBag);

            // Refresh Control
            var refreshControl = new RefreshControl(
                ViewModel.SyncProgressState,
                tableViewSource.Rx().Scrolled(),
                tableViewSource.IsDragging);

            refreshControl.Refresh
            .Subscribe(ViewModel.Refresh.Inputs)
            .DisposedBy(DisposeBag);
            TimeEntriesLogTableView.CustomRefreshControl = refreshControl;

            //Actions
            settingsButton.Rx().BindAction(ViewModel.OpenSettings).DisposedBy(DisposeBag);
            syncFailuresButton.Rx().BindAction(ViewModel.OpenSyncFailures).DisposedBy(DisposeBag);
            StopTimeEntryButton.Rx().BindAction(ViewModel.StopTimeEntry, _ => TimeEntryStopOrigin.Manual).DisposedBy(DisposeBag);

            StartTimeEntryButton.Rx().BindAction(ViewModel.StartTimeEntry, _ => true).DisposedBy(DisposeBag);
            StartTimeEntryButton.Rx().BindAction(ViewModel.StartTimeEntry, _ => false, ButtonEventType.LongPress).DisposedBy(DisposeBag);

            CurrentTimeEntryCard.Rx().Tap()
            .WithLatestFrom(ViewModel.CurrentRunningTimeEntry, (_, te) => te)
            .Where(te => te != null)
            .Select(te => (new[] { te.Id }, EditTimeEntryOrigin.RunningTimeEntryCard))
            .Subscribe(ViewModel.SelectTimeEntry.Inputs)
            .DisposedBy(DisposeBag);

            //Visibility
            var shouldWelcomeBack = ViewModel.ShouldShowWelcomeBack;

            ViewModel.ShouldShowEmptyState
            .Subscribe(visible => emptyStateView.Hidden = !visible)
            .DisposedBy(DisposeBag);

            shouldWelcomeBack
            .Subscribe(WelcomeBackView.Rx().IsVisible())
            .DisposedBy(DisposeBag);

            shouldWelcomeBack
            .Subscribe(spiderContainerView.Rx().IsVisible())
            .DisposedBy(DisposeBag);

            shouldWelcomeBack
            .Subscribe(visible =>
            {
                if (visible)
                {
                    spiderBroView.Show();
                }
                else
                {
                    spiderBroView.Hide();
                }
            })
            .DisposedBy(DisposeBag);

            //Text
            ViewModel.CurrentRunningTimeEntry
            .Select(te => te?.Description)
            .Subscribe(CurrentTimeEntryDescriptionLabel.Rx().Text())
            .DisposedBy(DisposeBag);

            ViewModel.ElapsedTime
            .Subscribe(CurrentTimeEntryElapsedTimeLabel.Rx().Text())
            .DisposedBy(DisposeBag);

            var capHeight   = CurrentTimeEntryProjectTaskClientLabel.Font.CapHeight;
            var clientColor = Colors.Main.CurrentTimeEntryClientColor.ToNativeColor();

            ViewModel.CurrentRunningTimeEntry
            .Select(te => te?.ToFormattedTimeEntryString(capHeight, clientColor, shouldColorProject: true))
            .Subscribe(CurrentTimeEntryProjectTaskClientLabel.Rx().AttributedText())
            .DisposedBy(DisposeBag);

            //The start button
            var trackModeImage  = UIImage.FromBundle("playIcon");
            var manualModeImage = UIImage.FromBundle("manualIcon");

            ViewModel.IsInManualMode
            .Select(isInManualMode => isInManualMode ? manualModeImage : trackModeImage)
            .Subscribe(image => StartTimeEntryButton.SetImage(image, UIControlState.Normal))
            .DisposedBy(DisposeBag);

            //The sync failures button
            ViewModel.NumberOfSyncFailures
            .Select(numberOfSyncFailures => numberOfSyncFailures > 0)
            .Subscribe(syncFailuresButton.Rx().IsVisible())
            .DisposedBy(DisposeBag);

            ViewModel.RatingViewModel.IsFeedbackSuccessViewShowing
            .Subscribe(SendFeedbackSuccessView.Rx().AnimatedIsVisible())
            .DisposedBy(DisposeBag);

            SendFeedbackSuccessView.Rx().Tap()
            .Subscribe(ViewModel.RatingViewModel.CloseFeedbackSuccessView)
            .DisposedBy(DisposeBag);

            ViewModel.ShouldShowRatingView
            .Subscribe(showHideRatingView)
            .DisposedBy(disposeBag);

            // Suggestion View
            suggestionsView.SuggestionTapped
            .Subscribe(ViewModel.SuggestionsViewModel.StartTimeEntry.Inputs)
            .DisposedBy(DisposeBag);

            ViewModel.SuggestionsViewModel.IsEmpty.Invert()
            .Subscribe(suggestionsView.Rx().IsVisible())
            .DisposedBy(DisposeBag);

            ViewModel.SuggestionsViewModel.Suggestions
            .ReemitWhen(traitCollectionSubject)
            .Subscribe(suggestionsView.OnSuggestions)
            .DisposedBy(DisposeBag);

            View.SetNeedsLayout();
            View.LayoutIfNeeded();

            NSNotificationCenter.DefaultCenter.AddObserver(UIApplication.DidBecomeActiveNotification, onApplicationDidBecomeActive);
        }
コード例 #7
0
        void ReleaseDesignerOutlets()
        {
            if (CurrentTimeEntryCard != null)
            {
                CurrentTimeEntryCard.Dispose();
                CurrentTimeEntryCard = null;
            }

            if (CreatedFirstTimeEntryLabel != null)
            {
                CreatedFirstTimeEntryLabel.Dispose();
                CreatedFirstTimeEntryLabel = null;
            }

            if (CurrentTimeEntryDescriptionLabel != null)
            {
                CurrentTimeEntryDescriptionLabel.Dispose();
                CurrentTimeEntryDescriptionLabel = null;
            }

            if (CurrentTimeEntryElapsedTimeLabel != null)
            {
                CurrentTimeEntryElapsedTimeLabel.Dispose();
                CurrentTimeEntryElapsedTimeLabel = null;
            }

            if (CurrentTimeEntryProjectTaskClientLabel != null)
            {
                CurrentTimeEntryProjectTaskClientLabel.Dispose();
                CurrentTimeEntryProjectTaskClientLabel = null;
            }

            if (FeedbackSentDescriptionLabel != null)
            {
                FeedbackSentDescriptionLabel.Dispose();
                FeedbackSentDescriptionLabel = null;
            }

            if (FeedbackSentSuccessTitleLabel != null)
            {
                FeedbackSentSuccessTitleLabel.Dispose();
                FeedbackSentSuccessTitleLabel = null;
            }

            if (RunningEntryDescriptionFadeView != null)
            {
                RunningEntryDescriptionFadeView.Dispose();
                RunningEntryDescriptionFadeView = null;
            }

            if (SendFeedbackSuccessView != null)
            {
                SendFeedbackSuccessView.Dispose();
                SendFeedbackSuccessView = null;
            }

            if (StartTimeEntryButton != null)
            {
                StartTimeEntryButton.Dispose();
                StartTimeEntryButton = null;
            }

            if (StartTimeEntryOnboardingBubbleView != null)
            {
                StartTimeEntryOnboardingBubbleView.Dispose();
                StartTimeEntryOnboardingBubbleView = null;
            }

            if (StartTimerBubbleLabel != null)
            {
                StartTimerBubbleLabel.Dispose();
                StartTimerBubbleLabel = null;
            }

            if (StopTimeEntryButton != null)
            {
                StopTimeEntryButton.Dispose();
                StopTimeEntryButton = null;
            }

            if (StopTimeEntryOnboardingBubbleView != null)
            {
                StopTimeEntryOnboardingBubbleView.Dispose();
                StopTimeEntryOnboardingBubbleView = null;
            }

            if (TapToEditBubbleView != null)
            {
                TapToEditBubbleView.Dispose();
                TapToEditBubbleView = null;
            }

            if (TapToEditBubbleViewTopConstraint != null)
            {
                TapToEditBubbleViewTopConstraint.Dispose();
                TapToEditBubbleViewTopConstraint = null;
            }

            if (TapToEditItLabel != null)
            {
                TapToEditItLabel.Dispose();
                TapToEditItLabel = null;
            }

            if (TapToStopTimerLabel != null)
            {
                TapToStopTimerLabel.Dispose();
                TapToStopTimerLabel = null;
            }

            if (TimeEntriesLogTableView != null)
            {
                TimeEntriesLogTableView.Dispose();
                TimeEntriesLogTableView = null;
            }

            if (TimeEntriesLogTableViewBottomToTopCurrentEntryConstraint != null)
            {
                TimeEntriesLogTableViewBottomToTopCurrentEntryConstraint.Dispose();
                TimeEntriesLogTableViewBottomToTopCurrentEntryConstraint = null;
            }

            if (TopConstraint != null)
            {
                TopConstraint.Dispose();
                TopConstraint = null;
            }

            if (TopSeparator != null)
            {
                TopSeparator.Dispose();
                TopSeparator = null;
            }

            if (WelcomeBackDescriptionLabel != null)
            {
                WelcomeBackDescriptionLabel.Dispose();
                WelcomeBackDescriptionLabel = null;
            }

            if (WelcomeBackLabel != null)
            {
                WelcomeBackLabel.Dispose();
                WelcomeBackLabel = null;
            }

            if (WelcomeBackView != null)
            {
                WelcomeBackView.Dispose();
                WelcomeBackView = null;
            }
        }
コード例 #8
0
        void ReleaseDesignerOutlets()
        {
            if (AboutView != null)
            {
                AboutView.Dispose();
                AboutView = null;
            }

            if (BeginningOfWeekLabel != null)
            {
                BeginningOfWeekLabel.Dispose();
                BeginningOfWeekLabel = null;
            }

            if (BeginningOfWeekView != null)
            {
                BeginningOfWeekView.Dispose();
                BeginningOfWeekView = null;
            }

            if (DateFormatLabel != null)
            {
                DateFormatLabel.Dispose();
                DateFormatLabel = null;
            }

            if (DateFormatView != null)
            {
                DateFormatView.Dispose();
                DateFormatView = null;
            }

            if (DurationFormatLabel != null)
            {
                DurationFormatLabel.Dispose();
                DurationFormatLabel = null;
            }

            if (DurationFormatView != null)
            {
                DurationFormatView.Dispose();
                DurationFormatView = null;
            }

            if (EmailLabel != null)
            {
                EmailLabel.Dispose();
                EmailLabel = null;
            }

            if (EmailView != null)
            {
                EmailView.Dispose();
                EmailView = null;
            }

            if (FeedbackView != null)
            {
                FeedbackView.Dispose();
                FeedbackView = null;
            }

            if (FormatSettingsTitle != null)
            {
                FormatSettingsTitle.Dispose();
                FormatSettingsTitle = null;
            }

            if (HelpView != null)
            {
                HelpView.Dispose();
                HelpView = null;
            }

            if (LoggingOutActivityIndicatorView != null)
            {
                LoggingOutActivityIndicatorView.Dispose();
                LoggingOutActivityIndicatorView = null;
            }

            if (LoggingOutIndicator != null)
            {
                LoggingOutIndicator.Dispose();
                LoggingOutIndicator = null;
            }

            if (LoggingOutLabel != null)
            {
                LoggingOutLabel.Dispose();
                LoggingOutLabel = null;
            }

            if (LoggingOutView != null)
            {
                LoggingOutView.Dispose();
                LoggingOutView = null;
            }

            if (LogoutButton != null)
            {
                LogoutButton.Dispose();
                LogoutButton = null;
            }

            if (LogoutContainerView != null)
            {
                LogoutContainerView.Dispose();
                LogoutContainerView = null;
            }

            if (LogoutVerticalOffsetConstraint != null)
            {
                LogoutVerticalOffsetConstraint.Dispose();
                LogoutVerticalOffsetConstraint = null;
            }

            if (ManualModeSwitch != null)
            {
                ManualModeSwitch.Dispose();
                ManualModeSwitch = null;
            }

            if (ManualModeView != null)
            {
                ManualModeView.Dispose();
                ManualModeView = null;
            }

            if (ScrollView != null)
            {
                ScrollView.Dispose();
                ScrollView = null;
            }

            if (SyncedIcon != null)
            {
                SyncedIcon.Dispose();
                SyncedIcon = null;
            }

            if (SyncedLabel != null)
            {
                SyncedLabel.Dispose();
                SyncedLabel = null;
            }

            if (SyncedView != null)
            {
                SyncedView.Dispose();
                SyncedView = null;
            }

            if (SyncingActivityIndicatorView != null)
            {
                SyncingActivityIndicatorView.Dispose();
                SyncingActivityIndicatorView = null;
            }

            if (SyncingIndicator != null)
            {
                SyncingIndicator.Dispose();
                SyncingIndicator = null;
            }

            if (SyncingLabel != null)
            {
                SyncingLabel.Dispose();
                SyncingLabel = null;
            }

            if (SyncingView != null)
            {
                SyncingView.Dispose();
                SyncingView = null;
            }

            if (TopConstraint != null)
            {
                TopConstraint.Dispose();
                TopConstraint = null;
            }

            if (TwentyFourHourClockSwitch != null)
            {
                TwentyFourHourClockSwitch.Dispose();
                TwentyFourHourClockSwitch = null;
            }

            if (TwentyFourHourClockView != null)
            {
                TwentyFourHourClockView.Dispose();
                TwentyFourHourClockView = null;
            }

            if (VersionLabel != null)
            {
                VersionLabel.Dispose();
                VersionLabel = null;
            }

            if (WorkspaceLabel != null)
            {
                WorkspaceLabel.Dispose();
                WorkspaceLabel = null;
            }

            if (WorkspaceView != null)
            {
                WorkspaceView.Dispose();
                WorkspaceView = null;
            }

            if (SendFeedbackSuccessView != null)
            {
                SendFeedbackSuccessView.Dispose();
                SendFeedbackSuccessView = null;
            }
        }
コード例 #9
0
        void ReleaseDesignerOutlets()
        {
            if (AboutCellLabel != null)
            {
                AboutCellLabel.Dispose();
                AboutCellLabel = null;
            }

            if (AboutView != null)
            {
                AboutView.Dispose();
                AboutView = null;
            }

            if (BeginningOfWeekLabel != null)
            {
                BeginningOfWeekLabel.Dispose();
                BeginningOfWeekLabel = null;
            }

            if (BeginningOfWeekView != null)
            {
                BeginningOfWeekView.Dispose();
                BeginningOfWeekView = null;
            }

            if (CalendarSectionTopConstraint != null)
            {
                CalendarSectionTopConstraint.Dispose();
                CalendarSectionTopConstraint = null;
            }

            if (CalendarSettingsCellLabel != null)
            {
                CalendarSettingsCellLabel.Dispose();
                CalendarSettingsCellLabel = null;
            }

            if (CalendarSettingsSection != null)
            {
                CalendarSettingsSection.Dispose();
                CalendarSettingsSection = null;
            }

            if (CalendarSettingsView != null)
            {
                CalendarSettingsView.Dispose();
                CalendarSettingsView = null;
            }

            if (DateFormatCellLabel != null)
            {
                DateFormatCellLabel.Dispose();
                DateFormatCellLabel = null;
            }

            if (DateFormatLabel != null)
            {
                DateFormatLabel.Dispose();
                DateFormatLabel = null;
            }

            if (DateFormatView != null)
            {
                DateFormatView.Dispose();
                DateFormatView = null;
            }

            if (DurationFormatCellLabel != null)
            {
                DurationFormatCellLabel.Dispose();
                DurationFormatCellLabel = null;
            }

            if (DurationFormatLabel != null)
            {
                DurationFormatLabel.Dispose();
                DurationFormatLabel = null;
            }

            if (DurationFormatView != null)
            {
                DurationFormatView.Dispose();
                DurationFormatView = null;
            }

            if (EmailLabel != null)
            {
                EmailLabel.Dispose();
                EmailLabel = null;
            }

            if (EmailView != null)
            {
                EmailView.Dispose();
                EmailView = null;
            }

            if (FeedbackToastTextLabel != null)
            {
                FeedbackToastTextLabel.Dispose();
                FeedbackToastTextLabel = null;
            }

            if (FeedbackToastTitleLabel != null)
            {
                FeedbackToastTitleLabel.Dispose();
                FeedbackToastTitleLabel = null;
            }

            if (FeedbackView != null)
            {
                FeedbackView.Dispose();
                FeedbackView = null;
            }

            if (FirstDayOfTheWeekCellLabel != null)
            {
                FirstDayOfTheWeekCellLabel.Dispose();
                FirstDayOfTheWeekCellLabel = null;
            }

            if (FormatSettingsHeaderLabel != null)
            {
                FormatSettingsHeaderLabel.Dispose();
                FormatSettingsHeaderLabel = null;
            }

            if (FormatSettingsTitle != null)
            {
                FormatSettingsTitle.Dispose();
                FormatSettingsTitle = null;
            }

            if (HelpCellLabel != null)
            {
                HelpCellLabel.Dispose();
                HelpCellLabel = null;
            }

            if (HelpView != null)
            {
                HelpView.Dispose();
                HelpView = null;
            }

            if (LoggingOutActivityIndicatorView != null)
            {
                LoggingOutActivityIndicatorView.Dispose();
                LoggingOutActivityIndicatorView = null;
            }

            if (LoggingOutIndicator != null)
            {
                LoggingOutIndicator.Dispose();
                LoggingOutIndicator = null;
            }

            if (LoggingOutLabel != null)
            {
                LoggingOutLabel.Dispose();
                LoggingOutLabel = null;
            }

            if (LoggingOutView != null)
            {
                LoggingOutView.Dispose();
                LoggingOutView = null;
            }

            if (LogoutButton != null)
            {
                LogoutButton.Dispose();
                LogoutButton = null;
            }

            if (LogoutContainerView != null)
            {
                LogoutContainerView.Dispose();
                LogoutContainerView = null;
            }

            if (LogoutVerticalOffsetConstraint != null)
            {
                LogoutVerticalOffsetConstraint.Dispose();
                LogoutVerticalOffsetConstraint = null;
            }

            if (ManualModeCellLabel != null)
            {
                ManualModeCellLabel.Dispose();
                ManualModeCellLabel = null;
            }

            if (ManualModeDescriptionLabel != null)
            {
                ManualModeDescriptionLabel.Dispose();
                ManualModeDescriptionLabel = null;
            }

            if (ManualModeSwitch != null)
            {
                ManualModeSwitch.Dispose();
                ManualModeSwitch = null;
            }

            if (ManualModeView != null)
            {
                ManualModeView.Dispose();
                ManualModeView = null;
            }

            if (NotificationSettingsView != null)
            {
                NotificationSettingsView.Dispose();
                NotificationSettingsView = null;
            }

            if (ScrollView != null)
            {
                ScrollView.Dispose();
                ScrollView = null;
            }

            if (SendFeedbackSuccessView != null)
            {
                SendFeedbackSuccessView.Dispose();
                SendFeedbackSuccessView = null;
            }

            if (SmartAlertCellLabel != null)
            {
                SmartAlertCellLabel.Dispose();
                SmartAlertCellLabel = null;
            }

            if (SubmitFeedbackCellLabel != null)
            {
                SubmitFeedbackCellLabel.Dispose();
                SubmitFeedbackCellLabel = null;
            }

            if (SyncedIcon != null)
            {
                SyncedIcon.Dispose();
                SyncedIcon = null;
            }

            if (SyncedLabel != null)
            {
                SyncedLabel.Dispose();
                SyncedLabel = null;
            }

            if (SyncedView != null)
            {
                SyncedView.Dispose();
                SyncedView = null;
            }

            if (SyncingActivityIndicatorView != null)
            {
                SyncingActivityIndicatorView.Dispose();
                SyncingActivityIndicatorView = null;
            }

            if (SyncingIndicator != null)
            {
                SyncingIndicator.Dispose();
                SyncingIndicator = null;
            }

            if (SyncingLabel != null)
            {
                SyncingLabel.Dispose();
                SyncingLabel = null;
            }

            if (SyncingView != null)
            {
                SyncingView.Dispose();
                SyncingView = null;
            }

            if (TopConstraint != null)
            {
                TopConstraint.Dispose();
                TopConstraint = null;
            }

            if (TwentyFourHourClockSwitch != null)
            {
                TwentyFourHourClockSwitch.Dispose();
                TwentyFourHourClockSwitch = null;
            }

            if (TwentyFourHourClockView != null)
            {
                TwentyFourHourClockView.Dispose();
                TwentyFourHourClockView = null;
            }

            if (Use24HourClockCellLabel != null)
            {
                Use24HourClockCellLabel.Dispose();
                Use24HourClockCellLabel = null;
            }

            if (VersionLabel != null)
            {
                VersionLabel.Dispose();
                VersionLabel = null;
            }

            if (WorkspaceCellLabel != null)
            {
                WorkspaceCellLabel.Dispose();
                WorkspaceCellLabel = null;
            }

            if (WorkspaceLabel != null)
            {
                WorkspaceLabel.Dispose();
                WorkspaceLabel = null;
            }

            if (WorkspaceView != null)
            {
                WorkspaceView.Dispose();
                WorkspaceView = null;
            }

            if (YourProfileCellLabel != null)
            {
                YourProfileCellLabel.Dispose();
                YourProfileCellLabel = null;
            }

            if (GroupSimilarTimeEntriesLabel != null)
            {
                GroupSimilarTimeEntriesLabel.Dispose();
                GroupSimilarTimeEntriesLabel = null;
            }

            if (GroupSimilarTimeEntriesSwitch != null)
            {
                GroupSimilarTimeEntriesSwitch.Dispose();
                GroupSimilarTimeEntriesSwitch = null;
            }
        }
コード例 #10
0
ファイル: MainViewController.cs プロジェクト: xleon/mobileapp
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            TableShadow.Layer.MasksToBounds = false;
            TableShadow.Layer.ShadowColor   = UIColor.Black.CGColor;
            TableShadow.Layer.ShadowOffset  = new CGSize(0, 0);
            TableShadow.Layer.ShadowOpacity = 0.1f;
            TableShadow.Layer.ShadowRadius  = 4;
            TableShadow.Hidden = TraitCollection.HorizontalSizeClass != UIUserInterfaceSizeClass.Regular;

            var separator = NavigationController.NavigationBar.InsertSeparator();

            separator.BackgroundColor = ColorAssets.OpaqueSeparator;

            WelcomeBackLabel.Text              = Resources.LogEmptyStateTitle;
            WelcomeBackDescriptionLabel.Text   = Resources.LogEmptyStateText;
            CreatedFirstTimeEntryLabel.Text    = Resources.YouHaveCreatedYourFirstTimeEntry;
            TapToEditItLabel.Text              = Resources.TapToEditIt;
            StartTimerBubbleLabel.Text         = Resources.TapToStartTimer;
            TapToStopTimerLabel.Text           = Resources.TapToStopTimer;
            FeedbackSentSuccessTitleLabel.Text = Resources.DoneWithExclamationMark.ToUpper();
            FeedbackSentDescriptionLabel.Text  = Resources.ThankYouForTheFeedback;

            StartTimeEntryButton.AccessibilityLabel = Resources.StartTimeEntry;
            StopTimeEntryButton.AccessibilityLabel  = Resources.StopCurrentlyRunningTimeEntry;

            tableViewSource = new TimeEntriesLogViewSource();

            prepareViews();
            prepareOnboarding();
            setupTableViewHeader();

            ViewModel.SwipeActionsEnabled
            .Subscribe(tableViewSource.SetSwipeActionsEnabled)
            .DisposedBy(disposeBag);

            TimeEntriesLogTableView.Source          = tableViewSource;
            TimeEntriesLogTableView.BackgroundColor = ColorAssets.TableBackground;

            ViewModel.TimeEntries
            .Subscribe(TimeEntriesLogTableView.Rx().AnimateSections <MainLogSection, DaySummaryViewModel, LogItemViewModel, IMainLogKey>(tableViewSource))
            .DisposedBy(disposeBag);

            ViewModel.ShouldReloadTimeEntryLog
            .WithLatestFrom(ViewModel.TimeEntries, (_, timeEntries) => timeEntries)
            .Subscribe(TimeEntriesLogTableView.Rx().ReloadSections(tableViewSource))
            .DisposedBy(disposeBag);

            tableViewSource.ToggleGroupExpansion
            .Subscribe(ViewModel.TimeEntriesViewModel.ToggleGroupExpansion.Inputs)
            .DisposedBy(disposeBag);

            tableViewSource.FirstCell
            .Subscribe(onFirstTimeEntryChanged)
            .DisposedBy(DisposeBag);

            tableViewSource.Rx().Scrolled()
            .Subscribe(onTableScroll)
            .DisposedBy(DisposeBag);

            tableViewSource.ContinueTap
            .Select(item => timeEntryContinuation(item, false))
            .Subscribe(ViewModel.ContinueTimeEntry.Inputs)
            .DisposedBy(DisposeBag);

            tableViewSource.SwipeToContinue
            .Select(item => timeEntryContinuation(item, true))
            .Subscribe(ViewModel.ContinueTimeEntry.Inputs)
            .DisposedBy(DisposeBag);

            tableViewSource.SwipeToDelete
            .Select(logItem => logItem.RepresentedTimeEntriesIds)
            .Subscribe(ViewModel.TimeEntriesViewModel.DelayDeleteTimeEntries.Inputs)
            .DisposedBy(DisposeBag);

            tableViewSource.Rx().ModelSelected()
            .Select(editEventInfo)
            .Subscribe(ViewModel.SelectTimeEntry.Inputs)
            .DisposedBy(DisposeBag);

            tableViewSource.Rx().ItemsChanged()
            .Subscribe(updateTooltipPositions)
            .DisposedBy(DisposeBag);

            ViewModel.TimeEntriesViewModel.TimeEntriesPendingDeletion
            .Subscribe(toggleUndoDeletion)
            .DisposedBy(DisposeBag);

            // Refresh Control
            var refreshControl = new RefreshControl(
                ViewModel.SyncProgressState,
                tableViewSource.Rx().Scrolled(),
                tableViewSource.IsDragging);

            refreshControl.Refresh
            .Subscribe(ViewModel.Refresh.Inputs)
            .DisposedBy(DisposeBag);
            TimeEntriesLogTableView.CustomRefreshControl = refreshControl;

            //Actions
            settingsButton.Rx().BindAction(ViewModel.OpenSettings).DisposedBy(DisposeBag);
            syncFailuresButton.Rx().BindAction(ViewModel.OpenSyncFailures).DisposedBy(DisposeBag);
            StopTimeEntryButton.Rx().BindAction(ViewModel.StopTimeEntry, _ => TimeEntryStopOrigin.Manual).DisposedBy(DisposeBag);

            StartTimeEntryButton.Rx().BindAction(ViewModel.StartTimeEntry, _ => true).DisposedBy(DisposeBag);
            StartTimeEntryButton.Rx().BindAction(ViewModel.StartTimeEntry, _ => false, ButtonEventType.LongPress, useFeedback: true).DisposedBy(DisposeBag);

            CurrentTimeEntryCard.Rx().Tap()
            .WithLatestFrom(ViewModel.CurrentRunningTimeEntry, (_, te) => te)
            .Where(te => te != null)
            .Select(te => new EditTimeEntryInfo(EditTimeEntryOrigin.RunningTimeEntryCard, te.Id))
            .Subscribe(ViewModel.SelectTimeEntry.Inputs)
            .DisposedBy(DisposeBag);

            //Visibility
            var shouldWelcomeBack = ViewModel.ShouldShowWelcomeBack;

            ViewModel.ShouldShowEmptyState
            .Subscribe(visible => emptyStateView.Hidden = !visible)
            .DisposedBy(DisposeBag);

            shouldWelcomeBack
            .Subscribe(WelcomeBackView.Rx().IsVisible())
            .DisposedBy(DisposeBag);

            shouldWelcomeBack
            .Subscribe(spiderContainerView.Rx().IsVisible())
            .DisposedBy(DisposeBag);

            shouldWelcomeBack
            .Subscribe(visible =>
            {
                if (visible)
                {
                    spiderBroView.Show();
                }
                else
                {
                    spiderBroView.Hide();
                }
            })
            .DisposedBy(DisposeBag);

            //Text
            ViewModel.CurrentRunningTimeEntry
            .Select(te => te?.Description)
            .Subscribe(CurrentTimeEntryDescriptionLabel.Rx().Text())
            .DisposedBy(DisposeBag);

            ViewModel.ElapsedTime
            .Subscribe(CurrentTimeEntryElapsedTimeLabel.Rx().Text())
            .DisposedBy(DisposeBag);

            var capHeight   = CurrentTimeEntryProjectTaskClientLabel.Font.CapHeight;
            var clientColor = ColorAssets.Text3;

            ViewModel.CurrentRunningTimeEntry
            .Select(te => te?.ToFormattedTimeEntryString(capHeight, clientColor, shouldColorProject: true))
            .Subscribe(CurrentTimeEntryProjectTaskClientLabel.Rx().AttributedText())
            .DisposedBy(DisposeBag);

            //Accessibility
            CurrentTimeEntryCard.IsAccessibilityElementFocused
            .CombineLatest(ViewModel.CurrentRunningTimeEntry,
                           (_, runningEntry) => createAccessibilityLabelForRunningEntryCard(runningEntry))
            .Subscribe(CurrentTimeEntryCard.Rx().AccessibilityLabel())
            .DisposedBy(disposeBag);

            //The start button
            var trackModeImage  = UIImage.FromBundle("playIcon");
            var manualModeImage = UIImage.FromBundle("manualIcon");

            ViewModel.IsInManualMode
            .Select(isInManualMode => isInManualMode ? manualModeImage : trackModeImage)
            .Subscribe(image => StartTimeEntryButton.SetImage(image, UIControlState.Normal))
            .DisposedBy(DisposeBag);

            //The sync failures button
            ViewModel.NumberOfSyncFailures
            .Select(numberOfSyncFailures => numberOfSyncFailures > 0)
            .Subscribe(syncFailuresButton.Rx().IsVisible())
            .DisposedBy(DisposeBag);

            ViewModel.RatingViewModel.IsFeedbackSuccessViewShowing
            .Subscribe(SendFeedbackSuccessView.Rx().AnimatedIsVisible())
            .DisposedBy(DisposeBag);

            SendFeedbackSuccessView.Rx().Tap()
            .Subscribe(ViewModel.RatingViewModel.CloseFeedbackSuccessView)
            .DisposedBy(DisposeBag);

            ViewModel.ShouldShowRatingView
            .Subscribe(showHideRatingView)
            .DisposedBy(disposeBag);

            // Suggestion View
            suggestionsView.SuggestionTapped
            .Subscribe(ViewModel.SuggestionsViewModel.StartTimeEntry.Inputs)
            .DisposedBy(DisposeBag);

            ViewModel.SuggestionsViewModel.IsEmpty.Invert()
            .Subscribe(suggestionsView.Rx().IsVisible())
            .DisposedBy(DisposeBag);

            ViewModel.SuggestionsViewModel.Suggestions
            .ReemitWhen(traitCollectionSubject)
            .Subscribe(suggestions =>
            {
                suggestionsView.OnSuggestions(suggestions);
                layoutTableHeader();
            })
            .DisposedBy(DisposeBag);

            // Intent Donation
            IosDependencyContainer.Instance.IntentDonationService.SetDefaultShortcutSuggestions();

            Observable.Merge(
                ViewModel.ContinueTimeEntry.Elements,
                ViewModel.SuggestionsViewModel.StartTimeEntry.Elements
                )
            .Subscribe(IosDependencyContainer.Instance.IntentDonationService.DonateStartTimeEntry)
            .DisposedBy(DisposeBag);

            ViewModel.StopTimeEntry.Elements
            .Subscribe(IosDependencyContainer.Instance.IntentDonationService.DonateStopCurrentTimeEntry)
            .DisposedBy(DisposeBag);

            View.SetNeedsLayout();
            View.LayoutIfNeeded();

            NSNotificationCenter.DefaultCenter.AddObserver(UIApplication.DidBecomeActiveNotification, onApplicationDidBecomeActive);
        }
コード例 #11
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            prepareViews();
            prepareOnboarding();
            setupTableViewHeader();

            var visibilityConverter       = new MvxVisibilityValueConverter();
            var projectTaskClientCombiner = new ProjectTaskClientValueCombiner(
                CurrentTimeEntryProjectTaskClientLabel.Font.CapHeight,
                Color.Main.CurrentTimeEntryClientColor.ToNativeColor(),
                true
                );
            var startTimeEntryButtonManualModeIconConverter = new BoolToConstantValueConverter <UIImage>(
                UIImage.FromBundle("manualIcon"),
                UIImage.FromBundle("playIcon")
                );
            var durationCombiner = new DurationValueCombiner();

            var bindingSet = this.CreateBindingSet <MainViewController, MainViewModel>();

            // Table view
            tableViewSource = new TimeEntriesLogViewSource(ViewModel.TimeEntries, TimeEntriesLogViewCell.Identifier);
            TimeEntriesLogTableView
            .Rx()
            .Bind(tableViewSource)
            .DisposedBy(disposeBag);

            this.Bind(tableViewSource.FirstCell, f =>
            {
                onFirstTimeEntryChanged(f);
                firstTimeEntryCell = f;
            });

            this.Bind(tableViewSource.ScrollOffset, onTableScroll);

            var continueTimeEntry = Observable.Merge(
                tableViewSource.ContinueTap,
                tableViewSource.SwipeToContinue
                );

            this.Bind(continueTimeEntry, ViewModel.ContinueTimeEntry);
            this.Bind(tableViewSource.SwipeToDelete, ViewModel.TimeEntriesViewModel.DelayDeleteTimeEntry);
            this.Bind(tableViewSource.ItemSelected, ViewModel.SelectTimeEntry);
            this.Bind(ViewModel.TimeEntriesViewModel.ShouldShowUndo, toggleUndoDeletion);

            tableViewSource.SwipeToContinue
            .VoidSubscribe(() =>
            {
                swipeRightStep.Dismiss();
            })
            .DisposedBy(disposeBag);

            tableViewSource.SwipeToDelete
            .VoidSubscribe(() =>
            {
                swipeLeftStep.Dismiss();
            })
            .DisposedBy(disposeBag);

            // Refresh Control
            var refreshControl = new RefreshControl(ViewModel.SyncProgressState, tableViewSource);

            this.Bind(refreshControl.Refresh, ViewModel.RefreshAction);
            TimeEntriesLogTableView.CustomRefreshControl = refreshControl;

            //Commands
            bindingSet.Bind(settingsButton).To(vm => vm.OpenSettingsCommand);
            bindingSet.Bind(StopTimeEntryButton).To(vm => vm.StopTimeEntryCommand);
            bindingSet.Bind(StartTimeEntryButton).To(vm => vm.StartTimeEntryCommand);
            bindingSet.Bind(EditTimeEntryButton).To(vm => vm.EditTimeEntryCommand);
            bindingSet.Bind(syncFailuresButton).To(vm => vm.OpenSyncFailuresCommand);

            bindingSet.Bind(CurrentTimeEntryCard)
            .For(v => v.BindTap())
            .To(vm => vm.EditTimeEntryCommand);

            bindingSet.Bind(suggestionsView)
            .For(v => v.SuggestionTappedCommad)
            .To(vm => vm.SuggestionsViewModel.StartTimeEntryCommand);

            bindingSet.Bind(StartTimeEntryButton)
            .For(v => v.BindLongPress())
            .To(vm => vm.AlternativeStartTimeEntryCommand);

            //Visibility
            var shouldWelcomeBack = ViewModel.ShouldShowWelcomeBack;

            this.Bind(ViewModel.ShouldShowEmptyState, visible => emptyStateView.Hidden = !visible);
            this.Bind(shouldWelcomeBack, WelcomeBackView.Rx().IsVisible());
            this.Bind(shouldWelcomeBack, spiderContainerView.Rx().IsVisible());
            this.Bind(shouldWelcomeBack, visible =>
            {
                if (visible)
                {
                    spiderBroView.Show();
                }
                else
                {
                    spiderBroView.Hide();
                }
            });

            //Text
            bindingSet.Bind(CurrentTimeEntryDescriptionLabel).To(vm => vm.CurrentTimeEntryDescription);

            bindingSet.Bind(CurrentTimeEntryElapsedTimeLabel)
            .ByCombining(durationCombiner,
                         vm => vm.CurrentTimeEntryElapsedTime,
                         vm => vm.CurrentTimeEntryElapsedTimeFormat);

            bindingSet.Bind(CurrentTimeEntryProjectTaskClientLabel)
            .For(v => v.AttributedText)
            .ByCombining(projectTaskClientCombiner,
                         v => v.CurrentTimeEntryProject,
                         v => v.CurrentTimeEntryTask,
                         v => v.CurrentTimeEntryClient,
                         v => v.CurrentTimeEntryProjectColor);

            //The start button
            bindingSet.Bind(StartTimeEntryButton)
            .For(v => v.BindImage())
            .To(vm => vm.IsInManualMode)
            .WithConversion(startTimeEntryButtonManualModeIconConverter);

            //The sync failures button
            bindingSet.Bind(syncFailuresButton)
            .For(v => v.BindVisibility())
            .To(vm => vm.NumberOfSyncFailures)
            .WithConversion(visibilityConverter);

            bindingSet.Apply();

            this.Bind(ViewModel.RatingViewModel.IsFeedbackSuccessViewShowing,
                      SendFeedbackSuccessView.Rx().AnimatedIsVisible());
            this.BindVoid(SendFeedbackSuccessView.Rx().Tap(), ViewModel.RatingViewModel.CloseFeedbackSuccessView);

            ViewModel.ShouldReloadTimeEntryLog
            .VoidSubscribe(reload)
            .DisposedBy(disposeBag);

            View.SetNeedsLayout();
            View.LayoutIfNeeded();

            NSNotificationCenter.DefaultCenter.AddObserver(UIApplication.DidBecomeActiveNotification, onApplicationDidBecomeActive);
        }
コード例 #12
0
        void ReleaseDesignerOutlets()
        {
            if (CurrentTimeEntryCard != null)
            {
                CurrentTimeEntryCard.Dispose();
                CurrentTimeEntryCard = null;
            }

            if (CurrentTimeEntryDescriptionLabel != null)
            {
                CurrentTimeEntryDescriptionLabel.Dispose();
                CurrentTimeEntryDescriptionLabel = null;
            }

            if (CurrentTimeEntryElapsedTimeLabel != null)
            {
                CurrentTimeEntryElapsedTimeLabel.Dispose();
                CurrentTimeEntryElapsedTimeLabel = null;
            }

            if (CurrentTimeEntryProjectTaskClientLabel != null)
            {
                CurrentTimeEntryProjectTaskClientLabel.Dispose();
                CurrentTimeEntryProjectTaskClientLabel = null;
            }

            if (EditTimeEntryButton != null)
            {
                EditTimeEntryButton.Dispose();
                EditTimeEntryButton = null;
            }

            if (RunningEntryDescriptionFadeView != null)
            {
                RunningEntryDescriptionFadeView.Dispose();
                RunningEntryDescriptionFadeView = null;
            }

            if (StartTimeEntryButton != null)
            {
                StartTimeEntryButton.Dispose();
                StartTimeEntryButton = null;
            }

            if (StartTimeEntryOnboardingBubbleView != null)
            {
                StartTimeEntryOnboardingBubbleView.Dispose();
                StartTimeEntryOnboardingBubbleView = null;
            }

            if (StopTimeEntryButton != null)
            {
                StopTimeEntryButton.Dispose();
                StopTimeEntryButton = null;
            }

            if (TapToEditBubbleView != null)
            {
                TapToEditBubbleView.Dispose();
                TapToEditBubbleView = null;
            }

            if (TapToEditBubbleViewTopConstraint != null)
            {
                TapToEditBubbleViewTopConstraint.Dispose();
                TapToEditBubbleViewTopConstraint = null;
            }

            if (StopTimeEntryOnboardingBubbleView != null)
            {
                StopTimeEntryOnboardingBubbleView.Dispose();
                StopTimeEntryOnboardingBubbleView = null;
            }

            if (TimeEntriesLogTableView != null)
            {
                TimeEntriesLogTableView.Dispose();
                TimeEntriesLogTableView = null;
            }

            if (TopConstraint != null)
            {
                TopConstraint.Dispose();
                TopConstraint = null;
            }

            if (TopSeparator != null)
            {
                TopSeparator.Dispose();
                TopSeparator = null;
            }

            if (WelcomeBackView != null)
            {
                WelcomeBackView.Dispose();
                WelcomeBackView = null;
            }

            if (SendFeedbackSuccessView != null)
            {
                SendFeedbackSuccessView.Dispose();
                SendFeedbackSuccessView = null;
            }

            if (SwipeRightBubbleView != null)
            {
                SwipeRightBubbleView.Dispose();
                SwipeRightBubbleView = null;
            }

            if (SwipeLeftBubbleView != null)
            {
                SwipeLeftBubbleView.Dispose();
                SwipeLeftBubbleView = null;
            }

            if (SwipeLeftTopConstraint != null)
            {
                SwipeLeftTopConstraint.Dispose();
                SwipeLeftTopConstraint = null;
            }

            if (SwipeRightTopConstraint != null)
            {
                SwipeRightTopConstraint.Dispose();
                SwipeRightTopConstraint = null;
            }
        }