diff options
author | Vitaly Takmazov | 2021-06-08 00:56:07 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2021-06-08 00:56:07 +0300 |
commit | c3f57abfbd9bf9b97a3a230c7303a27a3c0b691f (patch) | |
tree | 2b4d4afa3a26322d52e3d0171762f91bd3bd9766 | |
parent | b0fc6a10a0f30a648c98b143ef5e0479515c7e46 (diff) |
Refresh user status on app activation
-rw-r--r-- | Juick/ViewControllers/JuickNavigationController.m | 10 |
1 files changed, 10 insertions, 0 deletions
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 |