Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7004cda

Browse files
committed
Merge pull request slackhq#428 from slackhq/cache-fix
Makes sure to cache text even if the view isn't visible
2 parents 6ed26f3 + f8b94bf commit 7004cda

1 file changed

Lines changed: 4 additions & 10 deletions

File tree

Source/SLKTextViewController.m

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1561,14 +1561,6 @@ - (void)slk_willShowOrHideTypeIndicatorView:(UIView <SLKTypingIndicatorProtocol>
15611561
}];
15621562
}
15631563

1564-
- (void)slk_willTerminateApplication:(NSNotification *)notification
1565-
{
1566-
// Caches the text before it's too late!
1567-
if (self.isViewVisible) {
1568-
[self slk_cacheTextView];
1569-
}
1570-
}
1571-
15721564

15731565
#pragma mark - KVO Events
15741566

@@ -2237,8 +2229,9 @@ - (void)slk_registerNotifications
22372229
[notificationCenter addObserver:self selector:@selector(slk_didShakeTextView:) name:SLKTextViewDidShakeNotification object:nil];
22382230

22392231
// Application notifications
2240-
[notificationCenter addObserver:self selector:@selector(slk_willTerminateApplication:) name:UIApplicationWillTerminateNotification object:nil];
2241-
[notificationCenter addObserver:self selector:@selector(slk_willTerminateApplication:) name:UIApplicationDidReceiveMemoryWarningNotification object:nil];
2232+
[notificationCenter addObserver:self selector:@selector(slk_cacheTextView) name:UIApplicationWillTerminateNotification object:nil];
2233+
[notificationCenter addObserver:self selector:@selector(slk_cacheTextView) name:UIApplicationDidEnterBackgroundNotification object:nil];
2234+
[notificationCenter addObserver:self selector:@selector(slk_cacheTextView) name:UIApplicationDidReceiveMemoryWarningNotification object:nil];
22422235
}
22432236

22442237
- (void)slk_unregisterNotifications
@@ -2270,6 +2263,7 @@ - (void)slk_unregisterNotifications
22702263

22712264
// Application notifications
22722265
[notificationCenter removeObserver:self name:UIApplicationWillTerminateNotification object:nil];
2266+
[notificationCenter removeObserver:self name:UIApplicationDidEnterBackgroundNotification object:nil];
22732267
[notificationCenter removeObserver:self name:UIApplicationDidReceiveMemoryWarningNotification object:nil];
22742268
}
22752269

0 commit comments

Comments
 (0)