Skip to content
This repository has been archived by the owner on Jun 21, 2023. It is now read-only.

Remove pausing of file sources in background #639

Merged
merged 2 commits into from
Nov 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 0 additions & 28 deletions platform/darwin/src/MGLOfflineStorage.mm
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ @interface MGLOfflineStorage ()
@property (nonatomic) std::shared_ptr<mbgl::DatabaseFileSource> mbglDatabaseFileSource;
@property (nonatomic) std::shared_ptr<mbgl::FileSource> mbglOnlineFileSource;
@property (nonatomic) std::shared_ptr<mbgl::FileSource> mbglFileSource;
@property (nonatomic, getter=isPaused) BOOL paused;
@end

@implementation MGLOfflineStorage {
Expand All @@ -63,10 +62,6 @@ + (instancetype)sharedOfflineStorage {
static MGLOfflineStorage *sharedOfflineStorage;
dispatch_once(&onceToken, ^{
sharedOfflineStorage = [[self alloc] init];
#if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR
[[NSNotificationCenter defaultCenter] addObserver:sharedOfflineStorage selector:@selector(unpauseFileSource:) name:UIApplicationWillEnterForegroundNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:sharedOfflineStorage selector:@selector(pauseFileSource:) name:UIApplicationDidEnterBackgroundNotification object:nil];
#endif
[sharedOfflineStorage reloadPacks];
});

Expand All @@ -80,28 +75,6 @@ + (instancetype)sharedOfflineStorage {
return sharedOfflineStorage;
}

#if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR
- (void)pauseFileSource:(__unused NSNotification *)notification {
if (self.isPaused) {
return;
}

_mbglOnlineFileSource->pause();
_mbglDatabaseFileSource->pause();
self.paused = YES;
}

- (void)unpauseFileSource:(__unused NSNotification *)notification {
if (!self.isPaused) {
return;
}

_mbglOnlineFileSource->resume();
_mbglDatabaseFileSource->resume();
self.paused = NO;
}
#endif

- (void)setDelegate:(id<MGLOfflineStorageDelegate>)newValue {
MGLLogDebug(@"Setting delegate: %@", newValue);
_delegate = newValue;
Expand Down Expand Up @@ -188,7 +161,6 @@ - (instancetype)init {
}

- (void)dealloc {
[[NSNotificationCenter defaultCenter] removeObserver:self];
[[MGLAccountManager sharedManager] removeObserver:self forKeyPath:@"apiBaseURL"];
[[MGLAccountManager sharedManager] removeObserver:self forKeyPath:@"accessToken"];

Expand Down
4 changes: 4 additions & 0 deletions platform/ios/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

Mapbox welcomes participation and contributions from everyone. Please read [CONTRIBUTING.md](../../CONTRIBUTING.md) to get started.

## main

* Fixed watchdog termination caused by pausing file sources when entering the background. ([#639](https://github.com/mapbox/mapbox-gl-native-ios/pull/639))

## 6.4.0 - September 27, 2021

This version does not support Apple Silicon Macs (arm64).
Expand Down