Skip to content

Commit 3f76837

Browse files
feat: Remove deprecated public APIs
1 parent d1da053 commit 3f76837

File tree

13 files changed

+1
-247
lines changed

13 files changed

+1
-247
lines changed

UnitTests/ObjCTests/MPCommerceEventTests.m

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -325,17 +325,13 @@ - (void)testCommerceEventProductDeprecated {
325325
XCTAssertNotNil(commerceEvent, @"Commerce event should not have been nil.");
326326
XCTAssertEqual(commerceEvent.products.count, 1, @"Incorrect product count.");
327327

328-
#pragma clang diagnostic push
329-
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
330328
commerceEvent.checkoutOptions = @"option 1";
331329
commerceEvent.screenName = @"Time Traveling";
332330
commerceEvent.checkoutStep = 1;
333-
commerceEvent[@"key_string"] = @"val_string";
334-
commerceEvent[@"key_number"] = @"3.14";
331+
commerceEvent.customAttributes = @{@"key_string": @"val_string", @"key_number": @"3.14"};
335332
commerceEvent.currency = @"bitcoins";
336333
commerceEvent.nonInteractive = YES;
337334
commerceEvent.screenName = @"time machine screen";
338-
#pragma clang diagnostic pop
339335

340336
product = [[MPProduct alloc] initWithName:@"Tardis" sku:@"trds" quantity:@1 price:@7.89];
341337
product.brand = @"Gallifrey Tardis";

UnitTests/ObjCTests/MPEventTests.m

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -71,20 +71,12 @@ - (void)testInstance {
7171
event.category = mock;
7272

7373
XCTAssertNil(event.category, @"Should have been nil.");
74-
75-
#pragma clang diagnostic push
76-
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
7774
XCTAssertNotNil(event.customAttributes, @"Should not have been nil.");
78-
XCTAssertNotNil(event.info, @"Should not have been nil.");
79-
8075
XCTAssertEqual(event.customAttributes.count, 3, @"Should have been three values in the customAttributes dictionary.");
81-
XCTAssertEqual(event.info.count, 3, @"Should have been three values in the info dictionary.");
8276

8377
NSDictionary *copyEventInfo = [eventInfo copy];
8478
event.customAttributes = copyEventInfo;
8579
XCTAssertEqualObjects(event.customAttributes, eventInfo, @"Should have been equal.");
86-
XCTAssertEqualObjects(event.info, eventInfo, @"Should have been equal.");
87-
#pragma clang diagnostic pop
8880

8981
event = [[MPEvent alloc] init];
9082
XCTAssertNotNil(event, @"Should not have been nil.");

UnitTests/ObjCTests/MParticleTests.m

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -795,20 +795,6 @@ - (void)testLogNilScreenEvent {
795795
XCTAssertNil(e);
796796
}
797797

798-
#pragma clang diagnostic push
799-
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
800-
- (void)testLogNilCommerceEvent {
801-
MParticle *instance = [MParticle sharedInstance];
802-
NSException *e = nil;
803-
@try {
804-
[instance logCommerceEvent:(id _Nonnull)nil];
805-
} @catch (NSException *ex) {
806-
e = ex;
807-
}
808-
XCTAssertNil(e);
809-
}
810-
#pragma clang diagnostic pop
811-
812798
- (void)testSetATTStatusNotDetermined {
813799
MParticle *instance = [MParticle sharedInstance];
814800
MParticleUser *currentUser = [[[MParticle sharedInstance] identity] currentUser];

UnitTests/SwiftTests/MPEventTests.swift

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ class MPEventTests: XCTestCase {
5050
XCTAssertNotNil(sut)
5151
XCTAssertEqual(sut.name, "<<Event With No Name>>")
5252
XCTAssertEqual(sut.duration, 0)
53-
XCTAssertNil(sut.info)
5453
XCTAssertNil(sut.category)
5554
XCTAssertNil(sut.endTime)
5655
XCTAssertNil(sut.startTime)
@@ -236,12 +235,6 @@ class MPEventTests: XCTestCase {
236235
XCTAssertEqual(ts, expected)
237236
}
238237

239-
func testInfoAndSetInfo_mapsToCustomAttributes() {
240-
sut.info = ["a": "1"]
241-
XCTAssertEqual(sut.info?["a"] as? String, "1")
242-
XCTAssertEqual(sut.customAttributes?["a"] as? String, "1")
243-
}
244-
245238
func testSetName_withEmptyName_discardsAndLogs() {
246239
let logger = MParticle.sharedInstance().getLogger()!
247240
logger.logLevel = .verbose

mParticle-Apple-SDK/Ecommerce/MPCommerceEvent.mm

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -287,43 +287,6 @@ - (void)setEventType {
287287
}
288288
}
289289

290-
- (NSMutableDictionary *)userDefinedAttributes {
291-
return [self.customAttributes copy];
292-
}
293-
294-
- (void)setUserDefinedAttributes:(NSMutableDictionary *)userDefinedAttributes {
295-
self.customAttributes = userDefinedAttributes;
296-
}
297-
298-
#pragma mark Subscripting
299-
- (id)objectForKeyedSubscript:(NSString *const)key {
300-
NSAssert(key != nil, @"'key' cannot be nil.");
301-
302-
id object = [self.customAttributes objectForKey:key];
303-
return object;
304-
}
305-
306-
- (void)setObject:(id)obj forKeyedSubscript:(NSString *)key {
307-
NSAssert(key != nil, @"'key' cannot be nil.");
308-
NSAssert(obj != nil, @"'obj' cannot be nil.");
309-
310-
if (obj == nil) {
311-
return;
312-
}
313-
314-
NSMutableDictionary *mutatingAttributes = [[NSMutableDictionary alloc] init];
315-
316-
if (self.customAttributes != nil && self.customAttributes.count > 0) {
317-
mutatingAttributes = [self.customAttributes mutableCopy];
318-
}
319-
320-
mutatingAttributes[key] = obj;
321-
self.customAttributes = [mutatingAttributes copy];
322-
}
323-
324-
- (NSArray *)allKeys {
325-
return [self.customAttributes allKeys];
326-
}
327290
#pragma mark NSObject
328291
- (BOOL)isEqual:(MPCommerceEvent *)object {
329292
BOOL isEqual = [super isEqual:object] &&

mParticle-Apple-SDK/Ecommerce/MPProduct.m

Lines changed: 0 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -325,18 +325,6 @@ - (MPProduct *)copyMatchingHashedProperties:(NSDictionary *)hashedMap {
325325
}
326326

327327
#pragma mark Public accessors
328-
- (NSString *)affiliation {
329-
return self.objectDictionary[kMPProductAffiliation];
330-
}
331-
332-
- (void)setAffiliation:(NSString *)affiliation {
333-
if (affiliation) {
334-
self.objectDictionary[kMPProductAffiliation] = affiliation;
335-
} else {
336-
[self.objectDictionary removeObjectForKey:kMPProductAffiliation];
337-
}
338-
}
339-
340328
- (NSString *)brand {
341329
return self.objectDictionary[kMPProductBrand];
342330
}
@@ -379,14 +367,6 @@ - (void)setCouponCode:(NSString *)couponCode {
379367
}
380368
}
381369

382-
- (NSString *)currency {
383-
return self.objectDictionary[kMPProductCurrency];
384-
}
385-
386-
- (void)setCurrency:(NSString *)currency {
387-
self.objectDictionary[kMPProductCurrency] = currency ? : @"USD";
388-
}
389-
390370
- (NSString *)name {
391371
return self.objectDictionary[kMPProductName];
392372
}
@@ -429,16 +409,6 @@ - (void)setSku:(NSString *)sku {
429409
}
430410
}
431411

432-
- (NSString *)transactionId {
433-
return self.objectDictionary[kMPProductTransactionId];
434-
}
435-
436-
- (void)setTransactionId:(NSString *)transactionId {
437-
if (transactionId) {
438-
self.objectDictionary[kMPProductTransactionId] = transactionId;
439-
}
440-
}
441-
442412
- (NSString *)variant {
443413
return self.objectDictionary[kMPProductVariant];
444414
}
@@ -450,38 +420,6 @@ - (void)setVariant:(NSString *)variant {
450420
}
451421
}
452422

453-
- (double)shippingAmount {
454-
return [self.objectDictionary[kMPProductShipping] doubleValue];
455-
}
456-
457-
- (void)setShippingAmount:(double)shippingAmount {
458-
self.objectDictionary[kMPProductShipping] = @(shippingAmount);
459-
}
460-
461-
- (double)taxAmount {
462-
return [self.objectDictionary[kMPProductTax] doubleValue];
463-
}
464-
465-
- (void)setTaxAmount:(double)taxAmount {
466-
self.objectDictionary[kMPProductTax] = @(taxAmount);
467-
}
468-
469-
- (double)totalAmount {
470-
return [self.objectDictionary[kMPProductRevenue] doubleValue];
471-
}
472-
473-
- (void)setTotalAmount:(double)totalAmount {
474-
self.objectDictionary[kMPProductRevenue] = @(totalAmount);
475-
}
476-
477-
- (double)unitPrice {
478-
return [self.price doubleValue];
479-
}
480-
481-
- (void)setUnitPrice:(double)unitPrice {
482-
self.price = @(unitPrice);
483-
}
484-
485423
- (NSUInteger)position {
486424
return [self.objectDictionary[kMPProductPosition] integerValue];
487425
}

mParticle-Apple-SDK/Event/MPEvent.m

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -170,14 +170,6 @@ - (void)setCategory:(NSString *)category {
170170
return eventDictionary;
171171
}
172172

173-
- (NSDictionary *)info {
174-
return [self.customAttributes copy];
175-
}
176-
177-
- (void)setInfo:(NSDictionary *)info {
178-
self.customAttributes = info;
179-
}
180-
181173
- (void)setName:(NSString *)name {
182174
MPLog *logger = MParticle.sharedInstance.getLogger;
183175
if (name.length == 0) {

mParticle-Apple-SDK/Include/MPCommerceEvent.h

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -163,24 +163,6 @@ typedef NS_ENUM(NSUInteger, MPCommerceEventAction) {
163163
*/
164164
- (void)removeProduct:(nonnull MPProduct *)product;
165165

166-
/**
167-
Returns an array with all keys in the custom attributes dictionary
168-
@returns An array with all keys in the custom attributes dictionary
169-
@deprecated use customAttributes.allKeys instead
170-
*/
171-
- (nullable NSArray *)allKeys DEPRECATED_MSG_ATTRIBUTE("use customAttributes.allKeys instead");
172-
173-
/**
174-
A dictionary containing further information about the commerce event. The number of entries is
175-
limited to 100 key value pairs. Keys must be strings (up to 255 characters) and values
176-
can be strings (up to 4096 characters), numbers, booleans, or dates
177-
@deprecated use customAttributes instead
178-
*/
179-
- (NSMutableDictionary * _Nullable)userDefinedAttributes DEPRECATED_MSG_ATTRIBUTE("use customAttributes instead");
180-
- (void)setUserDefinedAttributes:(NSMutableDictionary *_Nullable)userDefinedAttributes DEPRECATED_MSG_ATTRIBUTE("set customAttributes instead");
181-
- (nullable id)objectForKeyedSubscript:(nonnull NSString *const)key DEPRECATED_MSG_ATTRIBUTE("use customAttributes[key] instead");
182-
- (void)setObject:(nonnull id)obj forKeyedSubscript:(nonnull NSString *)key DEPRECATED_MSG_ATTRIBUTE("use customAttributes[key] = obj instead");
183-
184166
@end
185167

186168
extern NSString * _Nonnull const kMPCEInstructionsKey;

mParticle-Apple-SDK/Include/MPEvent.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,6 @@
1414
*/
1515
@property (nonatomic, strong, nullable) NSString *category;
1616

17-
/**
18-
A dictionary containing further information about the event. The number of entries is
19-
limited to 100 key value pairs. Keys must be strings (up to 255 characters) and values
20-
can be strings (up to 4096 characters), numbers, booleans, or dates
21-
@deprecated use customAttributes instead
22-
*/
23-
@property (nonatomic, strong, nullable) NSDictionary<NSString *, id> *info DEPRECATED_MSG_ATTRIBUTE("use customAttributes instead");
24-
2517
/**
2618
The name of the event to be logged (required not nil). The event name must not contain
2719
more than 255 characters.

mParticle-Apple-SDK/Include/MPProduct.h

Lines changed: 0 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -102,64 +102,6 @@
102102
- (nullable id)objectForKeyedSubscript:(nonnull NSString *const)key;
103103
- (void)setObject:(nonnull id)obj forKeyedSubscript:(nonnull NSString *)key;
104104

105-
#pragma mark Deprecated and/or Unavailable
106-
/**
107-
An entity with which the transaction should be affiliated (e.g. a particular store). If nil, mParticle will use an empty string
108-
@deprecated use MPTransactionAttributes.affiliation instead
109-
*/
110-
@property (nonatomic, strong, nullable) NSString *affiliation __attribute__((deprecated("use MPTransactionAttributes.affiliation instead")));
111-
112-
/**
113-
The currency of a transaction. If not specified, mParticle will use "USD"
114-
@deprecated use MPCommerceEvent.currency instead
115-
*/
116-
@property (nonatomic, strong, nullable) NSString *currency __attribute__((deprecated("use MPCommerceEvent.currency instead")));
117-
118-
/**
119-
A unique ID representing the transaction. This ID should not collide with other transaction IDs. If not specified, mParticle will generate a random id with 20 characters
120-
@deprecated use MPTransactionAttributes.transactionId instead
121-
*/
122-
@property (nonatomic, strong, nullable) NSString *transactionId __attribute__((deprecated("use MPTransactionAttributes.transactionId instead")));
123-
124-
/**
125-
@deprecated use MPTransactionAttributes.revenue instead
126-
*/
127-
@property (nonatomic, readwrite) double revenueAmount __attribute__((unavailable("use MPTransactionAttributes.revenue instead")));
128-
129-
/**
130-
The total cost of shipping for a transaction. If free or non-applicable use 0. Default value is zero
131-
@deprecated use MPTransactionAttributes.shipping instead
132-
*/
133-
@property (nonatomic, readwrite) double shippingAmount __attribute__((deprecated("use MPTransactionAttributes.shipping instead")));
134-
135-
/**
136-
The total tax for a transaction. If free or non-applicable use 0. Default value is zero
137-
@deprecated use MPTransactionAttributes.tax instead
138-
*/
139-
@property (nonatomic, readwrite) double taxAmount __attribute__((deprecated("use MPTransactionAttributes.tax instead")));
140-
141-
/**
142-
The total value of a transaction, including tax and shipping. If free or non-applicable use 0. Default value is zero
143-
@deprecated use MPTransactionAttributes.revenue instead
144-
*/
145-
@property (nonatomic, readwrite) double totalAmount __attribute__((deprecated("use MPTransactionAttributes.revenue instead")));
146-
147-
/**
148-
The price of a product. If product is free or price is non-applicable use 0. Default value is zero
149-
@deprecated use the price property instead
150-
*/
151-
@property (nonatomic, readwrite) double unitPrice __attribute__((deprecated("use the price property instead")));
152-
153-
/**
154-
@deprecated use initWithName:sku:quantity:price: instead
155-
*/
156-
- (nonnull instancetype)initWithName:(nonnull NSString *)name category:(nullable NSString *)category quantity:(NSInteger)quantity totalAmount:(double)totalAmount __attribute__((unavailable("use initWithName:sku:quantity:price: instead")));
157-
158-
/**
159-
@deprecated use initWithName:sku:quantity:price: instead
160-
*/
161-
- (nonnull instancetype)initWithName:(nonnull NSString *)name category:(nullable NSString *)category quantity:(NSInteger)quantity revenueAmount:(double)revenueAmount __attribute__((unavailable("use initWithName:sku:quantity:price: instead")));
162-
163105
@end
164106

165107
// Internal

0 commit comments

Comments
 (0)