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

Download Issues: URLSession Error logging #1495

Draft
wants to merge 1 commit into
base: trunk
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 8 additions & 0 deletions podcasts.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1597,6 +1597,7 @@
F5DBA58A2B756A8700AED77F /* AppSettings+ImportUserDefaultsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F5DBA5892B756A8700AED77F /* AppSettings+ImportUserDefaultsTests.swift */; };
F5E431D62B50888500A71DB3 /* PlusLabel.swift in Sources */ = {isa = PBXBuildFile; fileRef = F5E431D52B50888500A71DB3 /* PlusLabel.swift */; };
F5E949DA2B61762E002DAFC3 /* TokenHelperTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F5E949D92B61762E002DAFC3 /* TokenHelperTests.swift */; };
F5FEF8382B92C5910010635E /* FirebaseCrashlytics in Frameworks */ = {isa = PBXBuildFile; productRef = F5FEF8372B92C5910010635E /* FirebaseCrashlytics */; };
FF8970762B5FFC5E004ADB23 /* SubscriptionPriceAndOfferView.swift in Sources */ = {isa = PBXBuildFile; fileRef = FF8970752B5FFC5E004ADB23 /* SubscriptionPriceAndOfferView.swift */; };
FF91A0F62B64159D002A0590 /* UIScreen+Sizes.swift in Sources */ = {isa = PBXBuildFile; fileRef = FF91A0F52B64159D002A0590 /* UIScreen+Sizes.swift */; };
FF91A0F82B6BBF33002A0590 /* UpgradeRoundedSegmentedControl.swift in Sources */ = {isa = PBXBuildFile; fileRef = FF91A0F72B6BBF33002A0590 /* UpgradeRoundedSegmentedControl.swift */; };
Expand Down Expand Up @@ -3483,6 +3484,7 @@
8BE36E002873552500E35313 /* PocketCastsServer in Frameworks */,
BDD239BD267C869B0047750C /* SwipeCellKit in Frameworks */,
8B1762772B6808F700F44450 /* JLRoutes in Frameworks */,
F5FEF8382B92C5910010635E /* FirebaseCrashlytics in Frameworks */,
8B17627A2B684E7100F44450 /* Kingfisher in Frameworks */,
1C312783007F5948E428F709 /* libPods-podcasts.a in Frameworks */,
);
Expand Down Expand Up @@ -7489,6 +7491,7 @@
8B365E4F2B62E82000143DAC /* Agrume */,
8B1762762B6808F700F44450 /* JLRoutes */,
8B1762792B684E7100F44450 /* Kingfisher */,
F5FEF8372B92C5910010635E /* FirebaseCrashlytics */,
);
productName = podcasts;
productReference = BDBD53EC17019B2A0048C8C5 /* podcasts.app */;
Expand Down Expand Up @@ -11610,6 +11613,11 @@
isa = XCSwiftPackageProductDependency;
productName = PocketCastsUtils;
};
F5FEF8372B92C5910010635E /* FirebaseCrashlytics */ = {
isa = XCSwiftPackageProductDependency;
package = 468F00CD27CD575C00FFAAAA /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */;
productName = FirebaseCrashlytics;
};
/* End XCSwiftPackageProductDependency section */
};
rootObject = BDBD53E417019B290048C8C5 /* Project object */;
Expand Down
9 changes: 9 additions & 0 deletions podcasts/DownloadManager+URLSessionDelegate.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import Foundation
#if !os(watchOS)
import FirebaseCrashlytics
#endif
import PocketCastsDataModel
import PocketCastsServer
import PocketCastsUtils
Expand Down Expand Up @@ -68,6 +71,12 @@ extension DownloadManager: URLSessionDelegate, URLSessionDownloadDelegate {
}

return
} else if error.code != NSURLErrorNotConnectedToInternet {
if Settings.analyticsOptOut() == false {
#if !os(watchOS)
Crashlytics.crashlytics().record(error: error)
#endif
}
}

DataManager.sharedManager.saveEpisode(downloadStatus: .downloadFailed, downloadError: error.localizedDescription, downloadTaskId: nil, episode: episode)
Expand Down