Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 5 additions & 13 deletions Sentry.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@
33EB2A912C3412E4004FED3D /* SentryWithoutUIKit.h in Headers */ = {isa = PBXBuildFile; fileRef = 33EB2A8F2C3411AE004FED3D /* SentryWithoutUIKit.h */; settings = {ATTRIBUTES = (Public, ); }; };
33EB2A922C341300004FED3D /* Sentry.h in Headers */ = {isa = PBXBuildFile; fileRef = 63AA76931EB9C1C200D153DE /* Sentry.h */; settings = {ATTRIBUTES = (Public, ); }; };
51B15F802BE88D510026A2F2 /* URLSessionTaskHelperTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51B15F7F2BE88D510026A2F2 /* URLSessionTaskHelperTests.swift */; };
620078722D38F00D0022CB67 /* SentryGeoCodable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 620078712D38F00D0022CB67 /* SentryGeoCodable.swift */; };
620078742D38F0DF0022CB67 /* SentryCodable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 620078732D38F0DF0022CB67 /* SentryCodable.swift */; };
620078782D3906BF0022CB67 /* SentryCodableTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 620078772D3906BF0022CB67 /* SentryCodableTests.swift */; };
620379DB2AFE1415005AC0C1 /* SentryBuildAppStartSpans.h in Headers */ = {isa = PBXBuildFile; fileRef = 620379DA2AFE1415005AC0C1 /* SentryBuildAppStartSpans.h */; };
Expand Down Expand Up @@ -797,8 +796,6 @@
925824C22CB5897700C9B20B /* SentrySessionReplayIntegration-Hybrid.h in Headers */ = {isa = PBXBuildFile; fileRef = D80382BE2C09C6FD0090E048 /* SentrySessionReplayIntegration-Hybrid.h */; settings = {ATTRIBUTES = (Private, ); }; };
92672BB629C9A2A9006B021C /* SentryBreadcrumb+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 92672BB529C9A2A9006B021C /* SentryBreadcrumb+Private.h */; settings = {ATTRIBUTES = (Private, ); }; };
927A5CC42DD7626B00B82404 /* SentryEnvelopeItemHeaderTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 927A5CC32DD7626400B82404 /* SentryEnvelopeItemHeaderTests.swift */; };
9286059529A5096600F96038 /* SentryGeo.h in Headers */ = {isa = PBXBuildFile; fileRef = 9286059429A5096600F96038 /* SentryGeo.h */; settings = {ATTRIBUTES = (Public, ); }; };
9286059729A5098900F96038 /* SentryGeo.m in Sources */ = {isa = PBXBuildFile; fileRef = 9286059629A5098900F96038 /* SentryGeo.m */; };
9286059929A50BAB00F96038 /* SentryGeoTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9286059829A50BAA00F96038 /* SentryGeoTests.swift */; };
92E5F3D62CDBB3BF00B7AD98 /* SentrySampling.h in Headers */ = {isa = PBXBuildFile; fileRef = 8E8C57A525EEFC42001CEEFA /* SentrySampling.h */; };
92F6726B29C8B7B100BFD34D /* SentryUser+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 92F6726A29C8B7B000BFD34D /* SentryUser+Private.h */; settings = {ATTRIBUTES = (Private, ); }; };
Expand Down Expand Up @@ -1062,8 +1059,9 @@
FA67DD182DDBD4EA00896B02 /* UIImageHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA67DCED2DDBD4EA00896B02 /* UIImageHelper.swift */; };
FA67DD192DDBD4EA00896B02 /* SwizzleClassNameExclude.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA67DCD52DDBD4EA00896B02 /* SwizzleClassNameExclude.swift */; };
FA8A36182DEAA1EB0058D883 /* SentryThread+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = FA8A36172DEAA1EB0058D883 /* SentryThread+Private.h */; };
FAEC273D2DF3933A00878871 /* NSData+Unzip.m in Sources */ = {isa = PBXBuildFile; fileRef = FAEC273C2DF3933200878871 /* NSData+Unzip.m */; };
FA8DEC322DF7FB4100C25374 /* SentryGeo.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA8DEC312DF7FB4100C25374 /* SentryGeo.swift */; };
FAEC270E2DF3526000878871 /* SentryUserFeedback.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAEC270D2DF3526000878871 /* SentryUserFeedback.swift */; };
FAEC273D2DF3933A00878871 /* NSData+Unzip.m in Sources */ = {isa = PBXBuildFile; fileRef = FAEC273C2DF3933200878871 /* NSData+Unzip.m */; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
Expand Down Expand Up @@ -1218,7 +1216,6 @@
33C374BE2D104A41004598F1 /* SentrySdkPackage.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SentrySdkPackage.h; path = include/SentrySdkPackage.h; sourceTree = "<group>"; };
33EB2A8F2C3411AE004FED3D /* SentryWithoutUIKit.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SentryWithoutUIKit.h; path = Public/SentryWithoutUIKit.h; sourceTree = "<group>"; };
51B15F7F2BE88D510026A2F2 /* URLSessionTaskHelperTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = URLSessionTaskHelperTests.swift; sourceTree = "<group>"; };
620078712D38F00D0022CB67 /* SentryGeoCodable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryGeoCodable.swift; sourceTree = "<group>"; };
620078732D38F0DF0022CB67 /* SentryCodable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryCodable.swift; sourceTree = "<group>"; };
620078772D3906BF0022CB67 /* SentryCodableTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryCodableTests.swift; sourceTree = "<group>"; };
620379DA2AFE1415005AC0C1 /* SentryBuildAppStartSpans.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SentryBuildAppStartSpans.h; path = include/SentryBuildAppStartSpans.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -2017,8 +2014,6 @@
92136D662C9D765D002A9FB8 /* SentryNSURLRequestBuilderTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryNSURLRequestBuilderTests.swift; sourceTree = "<group>"; };
92672BB529C9A2A9006B021C /* SentryBreadcrumb+Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "SentryBreadcrumb+Private.h"; path = "include/HybridPublic/SentryBreadcrumb+Private.h"; sourceTree = "<group>"; };
927A5CC32DD7626400B82404 /* SentryEnvelopeItemHeaderTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryEnvelopeItemHeaderTests.swift; sourceTree = "<group>"; };
9286059429A5096600F96038 /* SentryGeo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SentryGeo.h; path = Public/SentryGeo.h; sourceTree = "<group>"; };
9286059629A5098900F96038 /* SentryGeo.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SentryGeo.m; sourceTree = "<group>"; };
9286059829A50BAA00F96038 /* SentryGeoTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SentryGeoTests.swift; sourceTree = "<group>"; };
92F6726A29C8B7B000BFD34D /* SentryUser+Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "SentryUser+Private.h"; path = "include/HybridPublic/SentryUser+Private.h"; sourceTree = "<group>"; };
A811D866248E2770008A41EA /* SentrySystemEventBreadcrumbsTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentrySystemEventBreadcrumbsTest.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -2304,6 +2299,7 @@
FA67DCEF2DDBD4EA00896B02 /* URLSessionTaskHelper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = URLSessionTaskHelper.swift; sourceTree = "<group>"; };
FA67DCF22DDBD4EA00896B02 /* SwiftDescriptor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SwiftDescriptor.swift; sourceTree = "<group>"; };
FA8A36172DEAA1EB0058D883 /* SentryThread+Private.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "SentryThread+Private.h"; path = "include/SentryThread+Private.h"; sourceTree = "<group>"; };
FA8DEC312DF7FB4100C25374 /* SentryGeo.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryGeo.swift; sourceTree = "<group>"; };
FAEC270D2DF3526000878871 /* SentryUserFeedback.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryUserFeedback.swift; sourceTree = "<group>"; };
FAEC273C2DF3933200878871 /* NSData+Unzip.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "NSData+Unzip.m"; sourceTree = "<group>"; };
FAEC273E2DF393E000878871 /* NSData+Unzip.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "NSData+Unzip.h"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -2402,14 +2398,14 @@
620078752D38F1110022CB67 /* Codable */ = {
isa = PBXGroup;
children = (
FA8DEC312DF7FB4100C25374 /* SentryGeo.swift */,
623FD9032D3FA90900803EDA /* NSNumberDecodableWrapper.swift */,
6281C5712D3E4F06009D0978 /* DecodeArbitraryData.swift */,
623FD9012D3FA5DA00803EDA /* SentryFrameCodable.swift */,
6293F5742D422A8A002BC3BD /* SentryStacktraceCodable.swift */,
62F70E922D4234B100634054 /* SentryMechanismMetaCodable.swift */,
62F70E942D423BCA00634054 /* SentryMechanismCodable.swift */,
620467AB2D3FFD1C0025F06C /* SentryNSErrorCodable.swift */,
620078712D38F00D0022CB67 /* SentryGeoCodable.swift */,
628094732D39584700B3F18B /* SentryUserCodable.swift */,
627C77882D50B6840055E966 /* SentryBreadcrumbCodable.swift */,
628308602D50ADAC00EAEF77 /* SentryRequestCodable.swift */,
Expand Down Expand Up @@ -2550,8 +2546,6 @@
843FB3212D0CD04D00558F18 /* SentryUserAccess.h */,
843FB3222D0CD04D00558F18 /* SentryUserAccess.m */,
92F6726A29C8B7B000BFD34D /* SentryUser+Private.h */,
9286059429A5096600F96038 /* SentryGeo.h */,
9286059629A5098900F96038 /* SentryGeo.m */,
63B818F71EC34639002FDF4C /* SentryDebugMeta.h */,
63B818F81EC34639002FDF4C /* SentryDebugMeta.m */,
6360850B1ED2AFE100E8599E /* SentryBreadcrumb.h */,
Expand Down Expand Up @@ -4881,7 +4875,6 @@
84A7890A2C0E9F6400FF0803 /* SentrySpan+Private.h in Headers */,
7BC5B6FA290BCDE500D99477 /* SentryHttpStatusCodeRange+Private.h in Headers */,
7B04A9AF24EAC02C00E710B1 /* SentryRetryAfterHeaderParser.h in Headers */,
9286059529A5096600F96038 /* SentryGeo.h in Headers */,
7B98D7BC25FB607300C5A389 /* SentryWatchdogTerminationTracker.h in Headers */,
7BA61CB9247BC57B00C130A8 /* SentryCrashDefaultBinaryImageProvider.h in Headers */,
8E4E7C7D25DAB287006AB9E2 /* SentryTracer.h in Headers */,
Expand Down Expand Up @@ -5309,7 +5302,6 @@
7BCFA71627D0BB50008C662C /* SentryANRTrackerV1.m in Sources */,
8459FCC02BD73EB20038E9C9 /* SentryProfilerSerialization.mm in Sources */,
63EED6C02237923600E02400 /* SentryOptions.m in Sources */,
620078722D38F00D0022CB67 /* SentryGeoCodable.swift in Sources */,
D8CB741B2947286500A5F964 /* SentryEnvelopeItemHeader.m in Sources */,
D8CB7417294724CC00A5F964 /* SentryEnvelopeAttachmentHeader.m in Sources */,
D84793262788737D00BE8E99 /* SentryByteCountFormatter.m in Sources */,
Expand Down Expand Up @@ -5386,6 +5378,7 @@
6360850E1ED2AFE100E8599E /* SentryBreadcrumb.m in Sources */,
D82859432C3E753C009A28AA /* SentrySessionReplaySyncC.c in Sources */,
D833D57C2D10784800961E7A /* SentryRRWebOptionsEvent.swift in Sources */,
FA8DEC322DF7FB4100C25374 /* SentryGeo.swift in Sources */,
84A8891D28DBD28900C51DFD /* SentryDevice.mm in Sources */,
7B56D73324616D9500B842DA /* SentryConcurrentRateLimitsDictionary.m in Sources */,
8ECC674825C23A20000E2BF6 /* SentryTransaction.m in Sources */,
Expand Down Expand Up @@ -5528,7 +5521,6 @@
7B98D7CF25FB650F00C5A389 /* SentryWatchdogTerminationTrackingIntegration.m in Sources */,
8E5D38DD261D4A3E000D363D /* SentryPerformanceTrackingIntegration.m in Sources */,
7B4E23C2251A2C2B00060D68 /* SentryCrashIntegrationSessionHandler.m in Sources */,
9286059729A5098900F96038 /* SentryGeo.m in Sources */,
D43B26D82D70A550007747FD /* SentryTraceOrigin.m in Sources */,
D8A3649C2C91AA3300AC569B /* SentryReplayApi.m in Sources */,
7B42C48227E08F4B009B58C2 /* SentryDependencyContainer.m in Sources */,
Expand Down
1 change: 0 additions & 1 deletion Sources/Sentry/Public/Sentry.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ FOUNDATION_EXPORT const unsigned char SentryVersionString[];
# import <Sentry/SentryException.h>
# import <Sentry/SentryFeedbackAPI.h>
# import <Sentry/SentryFrame.h>
# import <Sentry/SentryGeo.h>
# import <Sentry/SentryHttpStatusCodeRange.h>
# import <Sentry/SentryHub.h>
# import <Sentry/SentryIntegrationProtocol.h>
Expand Down
49 changes: 0 additions & 49 deletions Sources/Sentry/Public/SentryGeo.h

This file was deleted.

1 change: 0 additions & 1 deletion Sources/Sentry/Public/SentryWithoutUIKit.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ FOUNDATION_EXPORT const unsigned char SentryVersionString[];
# import <SentryWithoutUIKit/SentryException.h>
# import <SentryWithoutUIKit/SentryFeedbackAPI.h>
# import <SentryWithoutUIKit/SentryFrame.h>
# import <SentryWithoutUIKit/SentryGeo.h>
# import <SentryWithoutUIKit/SentryHttpStatusCodeRange.h>
# import <SentryWithoutUIKit/SentryHub.h>
# import <SentryWithoutUIKit/SentryIntegrationProtocol.h>
Expand Down
93 changes: 0 additions & 93 deletions Sources/Sentry/SentryGeo.m

This file was deleted.

2 changes: 1 addition & 1 deletion Sources/Sentry/SentryUser.m
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#import "SentryUser.h"
#import "SentryGeo.h"
#import "SentryNSDictionarySanitize.h"
#import "SentrySwift.h"

NS_ASSUME_NONNULL_BEGIN

Expand Down
98 changes: 98 additions & 0 deletions Sources/Swift/Protocol/Codable/SentryGeo.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
import Foundation

/// Approximate geographical location of the end user or device.
///
/// Example of serialized data:
/// {
/// "geo": {
/// "country_code": "US",
/// "city": "Ashburn",
/// "region": "San Francisco"
/// }
/// }
@objc(SentryGeo)
@objcMembers
open class Geo: NSObject, NSCopying, Decodable {

private enum CodingKeys: String, CodingKey {
case city
case countryCode = "country_code"
case region
}

/// Optional: Human readable city name.
open var city: String?

/// Optional: Two-letter country code (ISO 3166-1 alpha-2).
open var countryCode: String?

/// Optional: Human readable region name or code.
open var region: String?

required public init(from decoder: Decoder) throws {
super.init()
let container = try decoder.container(keyedBy: CodingKeys.self)

self.city = try container.decodeIfPresent(String.self, forKey: .city)
self.countryCode = try container.decodeIfPresent(String.self, forKey: .countryCode)
self.region = try container.decodeIfPresent(String.self, forKey: .region)

Check warning on line 38 in Sources/Swift/Protocol/Codable/SentryGeo.swift

View check run for this annotation

Codecov / codecov/patch

Sources/Swift/Protocol/Codable/SentryGeo.swift#L32-L38

Added lines #L32 - L38 were not covered by tests
}

required public override init() {
super.init()

Check warning on line 42 in Sources/Swift/Protocol/Codable/SentryGeo.swift

View check run for this annotation

Codecov / codecov/patch

Sources/Swift/Protocol/Codable/SentryGeo.swift#L41-L42

Added lines #L41 - L42 were not covered by tests
}

public func copy(with zone: NSZone? = nil) -> Any {
let copy = Geo()
copy.city = self.city
copy.countryCode = self.countryCode
copy.region = self.region
return copy

Check warning on line 50 in Sources/Swift/Protocol/Codable/SentryGeo.swift

View check run for this annotation

Codecov / codecov/patch

Sources/Swift/Protocol/Codable/SentryGeo.swift#L45-L50

Added lines #L45 - L50 were not covered by tests
}

public func serialize() -> [String: Any] {
var serializedData = [String: Any]()

if let city = self.city {
serializedData["city"] = city

Check warning on line 57 in Sources/Swift/Protocol/Codable/SentryGeo.swift

View check run for this annotation

Codecov / codecov/patch

Sources/Swift/Protocol/Codable/SentryGeo.swift#L53-L57

Added lines #L53 - L57 were not covered by tests
}

if let countryCode = self.countryCode {
serializedData["country_code"] = countryCode

Check warning on line 61 in Sources/Swift/Protocol/Codable/SentryGeo.swift

View check run for this annotation

Codecov / codecov/patch

Sources/Swift/Protocol/Codable/SentryGeo.swift#L59-L61

Added lines #L59 - L61 were not covered by tests
}

if let region = self.region {
serializedData["region"] = region

Check warning on line 65 in Sources/Swift/Protocol/Codable/SentryGeo.swift

View check run for this annotation

Codecov / codecov/patch

Sources/Swift/Protocol/Codable/SentryGeo.swift#L63-L65

Added lines #L63 - L65 were not covered by tests
}

return serializedData

Check warning on line 68 in Sources/Swift/Protocol/Codable/SentryGeo.swift

View check run for this annotation

Codecov / codecov/patch

Sources/Swift/Protocol/Codable/SentryGeo.swift#L67-L68

Added lines #L67 - L68 were not covered by tests
}

public override func isEqual(_ object: Any?) -> Bool {
guard let other = object as? Geo else {
return false

Check warning on line 73 in Sources/Swift/Protocol/Codable/SentryGeo.swift

View check run for this annotation

Codecov / codecov/patch

Sources/Swift/Protocol/Codable/SentryGeo.swift#L71-L73

Added lines #L71 - L73 were not covered by tests
}

return isEqualToGeo(other)

Check warning on line 76 in Sources/Swift/Protocol/Codable/SentryGeo.swift

View check run for this annotation

Codecov / codecov/patch

Sources/Swift/Protocol/Codable/SentryGeo.swift#L75-L76

Added lines #L75 - L76 were not covered by tests
}

public func isEqualToGeo(_ geo: Geo) -> Bool {
if self === geo {
return true

Check warning on line 81 in Sources/Swift/Protocol/Codable/SentryGeo.swift

View check run for this annotation

Codecov / codecov/patch

Sources/Swift/Protocol/Codable/SentryGeo.swift#L79-L81

Added lines #L79 - L81 were not covered by tests
}

return self.city == geo.city &&
self.countryCode == geo.countryCode &&
self.region == geo.region

Check warning on line 86 in Sources/Swift/Protocol/Codable/SentryGeo.swift

View check run for this annotation

Codecov / codecov/patch

Sources/Swift/Protocol/Codable/SentryGeo.swift#L83-L86

Added lines #L83 - L86 were not covered by tests
}

public override var hash: Int {
var hasher = Hasher()
hasher.combine(city)
hasher.combine(countryCode)
hasher.combine(region)
return hasher.finalize()

Check warning on line 94 in Sources/Swift/Protocol/Codable/SentryGeo.swift

View check run for this annotation

Codecov / codecov/patch

Sources/Swift/Protocol/Codable/SentryGeo.swift#L89-L94

Added lines #L89 - L94 were not covered by tests
}
}

extension Geo: SentrySerializable { }
20 changes: 0 additions & 20 deletions Sources/Swift/Protocol/Codable/SentryGeoCodable.swift

This file was deleted.

Loading