From c3f57abfbd9bf9b97a3a230c7303a27a3c0b691f Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Tue, 8 Jun 2021 00:56:07 +0300 Subject: Refresh user status on app activation --- Juick/ViewControllers/JuickNavigationController.m | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'Juick/ViewControllers/JuickNavigationController.m') diff --git a/Juick/ViewControllers/JuickNavigationController.m b/Juick/ViewControllers/JuickNavigationController.m index d79206c..66ad042 100644 --- a/Juick/ViewControllers/JuickNavigationController.m +++ b/Juick/ViewControllers/JuickNavigationController.m @@ -19,6 +19,8 @@ @property(nonatomic, strong) UIButton *avatarButton; +-(void) applicationActivated; + @end @implementation JuickNavigationController @@ -52,6 +54,7 @@ [super viewDidLoad]; [self refreshStatus]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(userDidSignedIn:) name:UserChangedNotificationName object:nil]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationActivated) name:UIApplicationDidBecomeActiveNotification object:nil]; } - (void)userDidSignedIn:(NSNotification *) notification { @@ -104,4 +107,11 @@ - (IBAction)showLoginForm:(id)sender { [self performSegueWithIdentifier:@"loginSegue" sender:self]; } +- (void)applicationActivated { + [self refreshStatus]; +} +- (void)dealloc +{ + [[NSNotificationCenter defaultCenter] removeObserver:self name:UIApplicationDidBecomeActiveNotification object:nil]; +} @end -- cgit v1.2.3