mirror of
https://github.com/viq/NewsBlur.git
synced 2025-09-18 21:43:31 +00:00
#1304 (not restoring state)
- Fixed issue with background operations that could result in the app getting killed.
This commit is contained in:
parent
95f3f3b3a6
commit
bfe81aff54
2 changed files with 7 additions and 9 deletions
|
@ -55,7 +55,6 @@
|
|||
@property (readwrite) BOOL isHidingStory;
|
||||
@property (readwrite) BOOL feedDetailIsVisible;
|
||||
@property (readwrite) BOOL keyboardIsShown;
|
||||
@property (nonatomic) UIBackgroundTaskIdentifier reorientBackgroundTask;
|
||||
|
||||
@end
|
||||
|
||||
|
@ -230,11 +229,9 @@
|
|||
if (self.feedDetailIsVisible) {
|
||||
// Defer this in the background, to avoid misaligning the detail views
|
||||
if ([UIApplication sharedApplication].applicationState != UIApplicationStateActive) {
|
||||
self.reorientBackgroundTask = [[UIApplication sharedApplication] beginBackgroundTaskWithExpirationHandler:^{
|
||||
[[UIApplication sharedApplication] endBackgroundTask:self.reorientBackgroundTask];
|
||||
self.reorientBackgroundTask = UIBackgroundTaskInvalid;
|
||||
}];
|
||||
[self performSelector:@selector(delayedReorientPages) withObject:nil afterDelay:0.5];
|
||||
NSString *networkOperationIdentifier = [appDelegate beginNetworkOperation];
|
||||
|
||||
[self performSelector:@selector(delayedReorientPages:) withObject:networkOperationIdentifier afterDelay:0.5];
|
||||
} else {
|
||||
[self.storyPageControl reorientPages];
|
||||
}
|
||||
|
@ -268,10 +265,9 @@
|
|||
}
|
||||
}
|
||||
|
||||
- (void)delayedReorientPages {
|
||||
- (void)delayedReorientPages:(NSString *)identifier {
|
||||
[self.storyPageControl reorientPages];
|
||||
[[UIApplication sharedApplication] endBackgroundTask:self.reorientBackgroundTask];
|
||||
self.reorientBackgroundTask = UIBackgroundTaskInvalid;
|
||||
[appDelegate endNetworkOperation:identifier];
|
||||
}
|
||||
|
||||
- (void)checkSize:(CGSize)size {
|
||||
|
|
|
@ -342,6 +342,8 @@ SFSafariViewControllerDelegate> {
|
|||
- (void)recalculateIntelligenceScores:(id)feedId;
|
||||
|
||||
- (void)cancelRequests;
|
||||
- (NSString *)beginNetworkOperation;
|
||||
- (void)endNetworkOperation:(NSString *)networkOperationIdentifier;
|
||||
|
||||
- (void)GET:(NSString *)urlString parameters:(id)parameters
|
||||
success:(void (^)(NSURLSessionDataTask *, id))success
|
||||
|
|
Loading…
Add table
Reference in a new issue