示例#1
0
        private static void OnCurrentSnapshot(IDocumentSnapshot?snapshot)
        {
            Current = snapshot?.ToObject <DonorUser>();
            CurrentUpdated?.Invoke(Current);
            if (previousUID != Current?.UID)
            {
                previousUID = Current?.UID;
                CurrentChanged?.Invoke(Current);
                CrossFirebasePushNotification.Current.UnsubscribeAll();
                if (!(Current is null))
                {
                    CrossFirebasePushNotification.Current.Subscribe("Urgent_Project");
                }
            }
            _ = DonationBundle.SetCurrentAsync(Current?.CurrentDonationBundle);
            if (!(Current is null) && ThemeEngine.SetTheme(Current.DesiredTheme))
            {
                SecureStorage.SetAsync("ThemePreference", Current.DesiredTheme.ToString());
            }
            var newTopics = Current?.DonatedProjectUIDs.Select(x => "Project_" + x)
                            .Where(x => !CrossFirebasePushNotification.Current.SubscribedTopics.Contains(x));

            if (newTopics?.Any() ?? false)
            {
                CrossFirebasePushNotification.Current.Subscribe(newTopics.ToArray());
            }
            System.Diagnostics.Debug.WriteLine(string.Join(", ", CrossFirebasePushNotification.Current.SubscribedTopics));
        }
示例#2
0
        private void PanGestureRecognizer_PanUpdated(object sender, PanUpdatedEventArgs e)
        {
            if (animationStarted)
            {
                return;
            }

            if (LogoImage.TranslationY > -50 && LogoImage.TranslationY <= 0)
            {
                LogoImage.TranslationY += e.TotalY;
                if (LogoImage.TranslationY > 0)
                {
                    LogoImage.TranslationY = 0;
                }
                return;
            }

            animationStarted = true;
            Animating?.Invoke();
            MaterialFrame.FadeTo(0.99, 160u * (uint)InputSL.Children.Count, Easing.CubicInOut); // Opacity 1.0 causes text above to become blurred?
            LogoImage.TranslateTo(0, Height * -0.35d, 400, Easing.CubicOut);
            TitleSL.FadeTo(1, 600, Easing.CubicInOut);
            TitleSL.TranslateTo(0, 0, 600, Easing.CubicInOut);
            ChevronSL.FadeTo(0, 100, Easing.CubicOut);
            EmailEntry.IsEnabled = PasswordEntry.IsEnabled = PasswordConfirmationEntry.IsEnabled = true;
            int t = 0;

            foreach (VisualElement v in InputSL.Children)
            {
                t += 160;
                v.TranslationX = -v.Width;
                Device.StartTimer(TimeSpan.FromMilliseconds(t), () =>
                {
                    if (!_signUp)
                    {
                        if (v == Button)
                        {
                            v.TranslateTo(0, -(PasswordConfirmationSL.Height + 4), 400, Easing.SinOut);
                            v.FadeTo(1, 400, Easing.SinOut);
                            return(false);
                        }
                        else if (v == PasswordConfirmationSL)
                        {
                            v.TranslateTo(0, 0, 400, Easing.SinOut);
                            return(false);
                        }
                    }
                    v.TranslateTo(0, 0, 400, Easing.SinOut);
                    v.FadeTo(1, 400, Easing.SinOut);
                    return(false);
                });
            }
            ThemeEngine.RefreshTheme(); // Set nav colours to what they should be on android
        }
示例#3
0
 private static void OnCurrentSnapshot(IDocumentSnapshot?snapshot)
 {
     Current = snapshot?.ToObject <PartnerUser>();
     CurrentUpdated?.Invoke(Current);
     if (Current?.UID != previousUID)
     {
         previousUID = Current?.UID;
         CurrentChanged?.Invoke(Current);
     }
     if (Current?.TeamConfirmed ?? false)
     {
         Team.SetCurrent(Current.TeamUID);
     }
     if (!(Current is null) && ThemeEngine.SetTheme(Current.DesiredTheme))
     {
         SecureStorage.SetAsync("ThemePreference", Current.DesiredTheme.ToString());
     }
 }
示例#4
0
        protected override async void OnStart()
        {
            // Set the most likely-to-be-accurate theme before user account is loaded but not interfere with login screen theming on android
            string themePreference = await SecureStorage.GetAsync("ThemePreference");

            ThemeEngine.SetTheme(string.IsNullOrEmpty(themePreference) ? Theme.System : (Theme)Enum.Parse(typeof(Theme), themePreference),
                                 Shell.Current.CurrentState.Location.OriginalString != "//Login");

            // Check photo access permission
            try
            {
                var result = await Permissions.CheckStatusAsync <Permissions.Media>();

                if (result != PermissionStatus.Granted)
                {
                    await Permissions.RequestAsync <Permissions.Media>();
                }
            }
            catch { } // Absorb
        }
示例#5
0
        private void PanGestureRecognizer_PanUpdated(object sender, PanUpdatedEventArgs e)
        {
            if (animationStarted)
            {
                return;
            }

            if (LogoImage.TranslationY > -50 && LogoImage.TranslationY <= 0)
            {
                LogoImage.TranslationY += e.TotalY;
                if (LogoImage.TranslationY > 0)
                {
                    LogoImage.TranslationY = 0;
                }
                return;
            }

            animationStarted = true;
            Animating?.Invoke();
            MaterialFrame.FadeTo(0.99, 160u * (uint)ButtonSL.Children.Count, Easing.CubicInOut); // Opacity 1.0 causes text above to become blurred?
            LogoImage.TranslateTo(0, Height * -0.35d, 400, Easing.CubicOut);
            TitleSL.FadeTo(1, 600, Easing.CubicInOut);
            TitleSL.TranslateTo(0, 0, 600, Easing.CubicInOut);
            ChevronSL.FadeTo(0, 100, Easing.CubicOut);
            int t = 0;

            foreach (Frame f in ButtonSL.Children)
            {
                t += 160;
                f.TranslationX = -f.Width;
                Device.StartTimer(TimeSpan.FromMilliseconds(t), () =>
                {
                    f.TranslateTo(0, 0, 400, Easing.SinOut);
                    f.FadeTo(1, 400, Easing.SinOut);
                    return(false);
                });
            }
            ThemeEngine.RefreshTheme(); // Set nav colours to what they should be on android
        }
示例#6
0
 public Main()
 {
     InitializeComponent();
     ThemeEngine.ApplyTheme(this, @".\Theme\default.json");
 }