Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed crashes with ios offline manager #724

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
3 changes: 3 additions & 0 deletions ios/Classes/OfflineManagerUtils.swift
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ class OfflineManagerUtils {
}
})
if let packToRemoveUnwrapped = packToRemove {
packToRemoveUnwrapped.suspend()
felix-ht marked this conversation as resolved.
Show resolved Hide resolved
OfflineManagerUtils.releaseDownloader(id: id)

offlineStorage.removePack(packToRemoveUnwrapped) { error in
if let error = error {
result(FlutterError(
Expand Down
3 changes: 1 addition & 2 deletions ios/Classes/OfflinePackDownloadManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,6 @@ class OfflinePackDownloader {
))
if let region = OfflineRegion.fromOfflinePack(pack) {
OfflineManagerUtils.deleteRegion(result: result, id: region.id)
OfflineManagerUtils.releaseDownloader(id: region.id)
felix-ht marked this conversation as resolved.
Show resolved Hide resolved
}
}

Expand Down Expand Up @@ -193,7 +192,7 @@ class OfflinePackDownloader {
return false
}
// We can tell whether 2 packs are the same by comparing metadata we assigned earlier
return pack.context == currentlyManagedPack.context
return pack.state != .invalid && pack.context == currentlyManagedPack.context
}

private func calculateDownloadingProgress(
Expand Down