Skip to content

Commit f80cbe2

Browse files
committed
Address linter issues
1 parent ab85eef commit f80cbe2

File tree

2 files changed

+21
-26
lines changed

2 files changed

+21
-26
lines changed

mParticle-Apple-SDK-Swift/Sources/Utils/MPDevice.swift

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public class MPDevice: NSObject, NSCopying {
7171
self.userDefaults = userDefaults
7272
self.identity = identity
7373
self.logger = logger
74-
74+
7575
super.init()
7676
}
7777

@@ -89,9 +89,6 @@ public class MPDevice: NSObject, NSCopying {
8989

9090
private var _advertiserId: String?
9191
@objc public private(set) var advertiserId: String? {
92-
set {
93-
_advertiserId = newValue
94-
}
9592
get {
9693
if let adID = _advertiserId {
9794
return adID
@@ -103,13 +100,13 @@ public class MPDevice: NSObject, NSCopying {
103100
}
104101
}
105102
}
103+
set {
104+
_advertiserId = newValue
105+
}
106106
}
107107

108108
private var _architecture: String?
109109
@objc public private(set) var architecture: String {
110-
set {
111-
_architecture = newValue
112-
}
113110
get {
114111
if let arch = _architecture {
115112
return arch
@@ -120,6 +117,9 @@ public class MPDevice: NSObject, NSCopying {
120117
return String(cString: archRaw)
121118
}
122119
}
120+
set {
121+
_architecture = newValue
122+
}
123123
}
124124

125125
@objc public var brand: String {
@@ -158,9 +158,6 @@ public class MPDevice: NSObject, NSCopying {
158158

159159
private var _model: String?
160160
@objc public private(set) var model: String {
161-
set {
162-
_model = newValue
163-
}
164161
get {
165162
if _model == nil {
166163
var size = 0
@@ -176,6 +173,9 @@ public class MPDevice: NSObject, NSCopying {
176173
return "Not available."
177174
}
178175
}
176+
set {
177+
_model = newValue
178+
}
179179
}
180180

181181
@objc open var name: String {
@@ -214,9 +214,6 @@ public class MPDevice: NSObject, NSCopying {
214214

215215
private var _vendorId: String?
216216
@objc public private(set) var vendorId: String? {
217-
set {
218-
_vendorId = newValue
219-
}
220217
get {
221218
if _vendorId == nil {
222219
if let vendor = userDefaults[Device.kMPDeviceAppVendorIdKey] as? String,
@@ -229,6 +226,9 @@ public class MPDevice: NSObject, NSCopying {
229226
}
230227
return _vendorId
231228
}
229+
set {
230+
_vendorId = newValue
231+
}
232232
}
233233

234234
@objc public var buildId: String? {
@@ -241,11 +241,8 @@ public class MPDevice: NSObject, NSCopying {
241241

242242
private var _screenSize: CGSize?
243243
@objc public private(set) var screenSize: CGSize {
244-
set {
245-
_screenSize = newValue
246-
}
247244
get {
248-
if let screenSize = _screenSize, !CGSizeEqualToSize(screenSize, CGSizeZero) {
245+
if let screenSize = _screenSize, !CGSizeEqualToSize(screenSize, .zero) {
249246
return screenSize
250247
} else {
251248
let bounds = UIScreen.main.bounds
@@ -255,6 +252,9 @@ public class MPDevice: NSObject, NSCopying {
255252
return screenSize
256253
}
257254
}
255+
set {
256+
_screenSize = newValue
257+
}
258258
}
259259

260260
@objc public var isDaylightSavingTime: Bool {

mParticle-Apple-SDK-Swift/Test/Utils/MPDeviceTests.swift

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,43 +3,38 @@ import XCTest
33

44
class MPStateMachineMPDeviceMock: MPStateMachineMPDeviceProtocol {
55
var deviceTokenType: String?
6-
76
var attAuthorizationStatus: NSNumber?
8-
97
var attAuthorizationTimestamp: NSNumber?
10-
118
}
129

1310
class MPIdentityApiMPUserDefaultsMock: MPIdentityApiMPUserDefaultsProtocol {
1411
var map: [String: Any] = [:]
15-
12+
1613
subscript(key: String) -> Any? {
1714
get {
1815
return map[key]
1916
}
2017
set(newValue) {
21-
map[key] = newValue;
18+
map[key] = newValue
2219
}
2320
}
24-
2521
}
2622

2723
class MPIdentityApiMPDeviceMock: MPIdentityApiMPDeviceProtocol {
2824
func currentUserIdentities() -> [NSNumber: String]? {
2925
return nil
3026
}
31-
27+
3228
func userIdentities(mpId: NSNumber) -> [NSNumber: String]? {
3329
return nil
3430
}
35-
3631
}
3732

3833
final class MPDeviceTests: XCTestCase {
3934

4035
func testDictionaryDescription() {
4136
let kMPDeviceTokenKey = "to"
42-
let testDeviceToken = "<000000000000000000000000000000>".data(using: .utf8)!
37+
let testDeviceToken = Data("<000000000000000000000000000000>".utf8)
4338
let userDefaults = MPIdentityApiMPUserDefaultsMock()
4439
userDefaults[kMPDeviceTokenKey] = testDeviceToken
4540

0 commit comments

Comments
 (0)