1
0
mirror of https://github.com/bitwarden/mobile synced 2025-12-18 01:03:24 +00:00

attach and detach event handlers onappearing and ondisappearing to free up views for GC

This commit is contained in:
Kyle Spearrin
2017-02-15 00:28:05 -05:00
parent 56c33ee82b
commit f5e7f9249c
18 changed files with 332 additions and 106 deletions

View File

@@ -53,7 +53,6 @@ namespace Bit.App.Pages
Text = "!@#$%^&*",
On = _settings.GetValueOrDefault(Constants.PasswordGeneratorSpecial, true)
};
SpecialCell.OnChanged += SpecialCell_OnChanged;
NumbersCell = new ExtendedSwitchCell
{
@@ -67,7 +66,6 @@ namespace Bit.App.Pages
Text = AppResources.AvoidAmbiguousCharacters,
On = !_settings.GetValueOrDefault(Constants.PasswordGeneratorAmbiguous, false)
};
AvoidAmbiguousCell.OnChanged += AvoidAmbiguousCell_OnChanged; ;
NumbersMinCell = new StepperCell(AppResources.MinNumbers,
_settings.GetValueOrDefault(Constants.PasswordGeneratorMinNumbers, 1), 0, 5, 1);
@@ -111,8 +109,19 @@ namespace Bit.App.Pages
Content = table;
}
protected override void OnAppearing()
{
base.OnAppearing();
SpecialCell.OnChanged += SpecialCell_OnChanged;
AvoidAmbiguousCell.OnChanged += AvoidAmbiguousCell_OnChanged;
}
protected override void OnDisappearing()
{
base.OnDisappearing();
SpecialCell.OnChanged -= SpecialCell_OnChanged;
AvoidAmbiguousCell.OnChanged -= AvoidAmbiguousCell_OnChanged;
_settings.AddOrUpdateValue(Constants.PasswordGeneratorMinNumbers,
Convert.ToInt32(NumbersMinCell.Stepper.Value));