Skip to content

Commit

Permalink
Remove long deprecated properties. Remove callback that confuses Swift.
Browse files Browse the repository at this point in the history
  • Loading branch information
echo-branch committed Oct 31, 2023
1 parent 0ab4c61 commit 3889876
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 107 deletions.
39 changes: 0 additions & 39 deletions Branch-TestBed/Branch-SDK-Tests/BranchUniversalObject.Test.m
Original file line number Diff line number Diff line change
Expand Up @@ -172,45 +172,6 @@ - (void) testBUODescription {
XCTAssertTrue([s bnc_isEqualToMaskedString:mask]);
}

- (void) testDeprecations {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"

BranchUniversalObject *buo = [BranchUniversalObject new];
buo.price = 10.00;
buo.currency = BNCCurrencyUSD;
buo.type = @"Purchase";
buo.contentIndexMode = BranchContentIndexModePublic;
buo.metadata = @{ @"Key1": @"Value1" };
buo.automaticallyListOnSpotlight = YES;

XCTAssertEqualObjects(buo.contentMetadata.price, [NSDecimalNumber decimalNumberWithString:@"10.00"]);
XCTAssertEqualObjects(buo.contentMetadata.currency, BNCCurrencyUSD);
XCTAssertEqualObjects(buo.contentMetadata.contentSchema, @"Purchase");
XCTAssertEqual(buo.locallyIndex, YES);
XCTAssertEqual(buo.publiclyIndex, YES);
XCTAssertEqualObjects(buo.contentMetadata.customMetadata, @{ @"Key1": @"Value1" } );

XCTAssertEqual(buo.price, 10.00);
XCTAssertEqualObjects(buo.currency, BNCCurrencyUSD);
XCTAssertEqualObjects(buo.type, @"Purchase");;
XCTAssertEqual(buo.contentIndexMode, BranchContentIndexModePublic);
XCTAssertEqualObjects(buo.metadata, @{ @"Key1": @"Value1" });
XCTAssertEqual(buo.automaticallyListOnSpotlight, YES);

buo.contentMetadata.customMetadata = (NSMutableDictionary*) @{ @"Key2": @"Value2" };
buo.contentMetadata.customMetadata[@"Key3"] = @"Value3";
[buo addMetadataKey:@"Key4" value:@"Value4"];
NSDictionary *d = @{
@"Key2": @"Value2",
@"Key3": @"Value3",
@"Key4": @"Value4",
};
XCTAssertEqualObjects(buo.metadata, d);

#pragma clang diagnostic pop
}

- (void) testDictionary {
NSDictionary *d = nil;
BranchUniversalObject *buo = [BranchUniversalObject new];
Expand Down
82 changes: 14 additions & 68 deletions BranchSDK/BranchUniversalObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,57 +112,21 @@ FOUNDATION_EXPORT BranchCondition _Nonnull BranchConditionRefurbished;
@property (nonatomic, nullable, copy) NSString *title;
@property (nonatomic, nullable, copy) NSString *contentDescription;
@property (nonatomic, nullable, copy) NSString *imageUrl;
@property (nonatomic, strong, nullable) NSArray<NSString*> *keywords;
@property (nonatomic, strong, nullable) NSDate *creationDate;
@property (nonatomic, strong, nullable) NSDate *expirationDate;
@property (nonatomic, assign) BOOL locallyIndex; //!< Index on Spotlight.
@property (nonatomic, assign) BOOL publiclyIndex; //!< Index on Google, Branch, etc.
@property (nonatomic, strong, nullable) NSArray<NSString *> *keywords;
@property (nonatomic, strong, nullable) NSDate *creationDate;
@property (nonatomic, strong, nullable) NSDate *expirationDate;
@property (nonatomic, assign) BOOL locallyIndex; //!< Index on Spotlight.
@property (nonatomic, assign) BOOL publiclyIndex; //!< Index on Google, Branch, etc.

@property (nonatomic, strong, nonnull) BranchContentMetadata *contentMetadata;

///@name Deprecated Properties

@property (nonatomic, strong, nullable)
__attribute__((deprecated(("Use `BranchUniversalObject.contentMetadata.customMetadata` instead."))))
NSDictionary *metadata;

- (void)addMetadataKey:(nonnull NSString *)key value:(nonnull NSString *)value
__attribute__((deprecated(("Use `BranchUniversalObject.contentMetadata.customMetadata` instead."))));

@property (nonatomic, strong, nullable)
__attribute__((deprecated(("Use `BranchUniversalObject.contentMetadata.contentSchema` instead."))))
NSString *type;

@property (nonatomic, assign)
__attribute__((deprecated(("Use `BranchUniversalObject.locallyIndex and BranchUniversalObject.publiclyIndex` instead."))))
BranchContentIndexMode contentIndexMode;

@property (nonatomic, strong, nullable)
__attribute__((deprecated(("Not used due to iOS 10.0 Spotlight changes."))))
NSString *spotlightIdentifier;

@property (nonatomic, assign)
__attribute__((deprecated(("Use `BranchUniversalObject.contentMetadata.price` instead."))))
CGFloat price;

@property (nonatomic, strong, nullable)
__attribute__((deprecated(("Use `BranchUniversalObject.contentMetadata.currency` instead."))))
NSString *currency;

@property (nonatomic, assign)
__attribute__((deprecated(("Use `BranchUniversalObject.locallyIndex` instead."))))
BOOL automaticallyListOnSpotlight;


/// @name Log a User Content View Event


- (void)registerView;
- (void)registerViewWithCallback:(void (^_Nullable)(NSDictionary * _Nullable params, NSError * _Nullable error))callback;

/// @name Short Links


/// Returns a Branch short URL to the content item with the passed link properties.
- (nullable NSString *)getShortUrlWithLinkProperties:(nonnull BranchLinkProperties *)linkProperties;

Expand All @@ -184,19 +148,12 @@ FOUNDATION_EXPORT BranchCondition _Nonnull BranchConditionRefurbished;
/// @name Share Sheet Handling
#if !TARGET_OS_TV

- (void)showShareSheetWithShareText:(nullable NSString *)shareText
completion:(void (^ _Nullable)(NSString * _Nullable activityType, BOOL completed))completion;
- (void)showShareSheetWithShareText:(nullable NSString *)shareText completion:(void (^ _Nullable)(NSString * _Nullable activityType, BOOL completed))completion;

- (void)showShareSheetWithLinkProperties:(nullable BranchLinkProperties *)linkProperties
andShareText:(nullable NSString *)shareText
fromViewController:(nullable UIViewController *)viewController
completion:(void (^ _Nullable)(NSString * _Nullable activityType, BOOL completed))completion;

/// Returns with activityError as well
- (void)showShareSheetWithLinkProperties:(nullable BranchLinkProperties *)linkProperties
andShareText:(nullable NSString *)shareText
fromViewController:(nullable UIViewController *)viewController
completionWithError:(void (^ _Nullable)(NSString * _Nullable activityType, BOOL completed, NSError*_Nullable error))completion;
completionWithError:(void (^ _Nullable)(NSString * _Nullable activityType, BOOL completed, NSError * _Nullable error))completion;

// iPad
- (void)showShareSheetWithLinkProperties:(nullable BranchLinkProperties *)linkProperties
Expand All @@ -205,41 +162,30 @@ FOUNDATION_EXPORT BranchCondition _Nonnull BranchConditionRefurbished;
anchor:(nullable UIBarButtonItem *)anchor
completion:(void (^ _Nullable)(NSString * _Nullable activityType, BOOL completed))completion;

// Returns with activityError as well
- (void)showShareSheetWithLinkProperties:(nullable BranchLinkProperties *)linkProperties
andShareText:(nullable NSString *)shareText
fromViewController:(nullable UIViewController *)viewController
anchor:(nullable UIBarButtonItem *)anchor
completionWithError:(void (^ _Nullable)(NSString * _Nullable activityType, BOOL completed, NSError*_Nullable error))completion;
completionWithError:(void (^ _Nullable)(NSString * _Nullable activityType, BOOL completed, NSError * _Nullable error))completion;


/// @name List items on Spotlight


- (void)listOnSpotlight;
- (void)listOnSpotlightWithCallback:(void (^_Nullable)(NSString * _Nullable url, NSError * _Nullable error))callback;

- (void)listOnSpotlightWithIdentifierCallback:(void (^_Nullable)(NSString * _Nullable url,
NSString * _Nullable spotlightIdentifier,
NSError * _Nullable error))spotlightCallback
__attribute__((deprecated((
"iOS 10 has changed how Spotlight indexing works and we’ve updated the SDK to reflect this. "
"Please see https://dev.branch.io/features/spotlight-indexing/overview/ for instructions on migration."))));

- (void)listOnSpotlightWithLinkProperties:(BranchLinkProperties*_Nullable)linkproperties
callback:(void (^_Nullable)(NSString * _Nullable url,
NSError * _Nullable error))completion;
- (void)listOnSpotlightWithLinkProperties:(BranchLinkProperties*_Nullable)linkproperties callback:(void (^_Nullable)(NSString * _Nullable url, NSError * _Nullable error))completion;

- (void)removeFromSpotlightWithCallback:(void (^_Nullable)(NSError * _Nullable error))completion;

#endif

- (NSDictionary*_Nonnull)getDictionaryWithCompleteLinkProperties:(BranchLinkProperties*_Nonnull)linkProperties;
- (NSDictionary*_Nonnull)getParamsForServerRequestWithAddedLinkProperties:(BranchLinkProperties*_Nonnull)linkProperties;
- (NSDictionary * _Nonnull)getDictionaryWithCompleteLinkProperties:(BranchLinkProperties * _Nonnull)linkProperties;
- (NSDictionary * _Nonnull)getParamsForServerRequestWithAddedLinkProperties:(BranchLinkProperties * _Nonnull)linkProperties;

/// Convenience method for initSession methods that return BranchUniversalObject, but can be used safely by anyone.
- (NSMutableDictionary*_Nonnull) dictionary;
+ (BranchUniversalObject*_Nonnull) objectWithDictionary:(NSDictionary*_Null_unspecified)dictionary;
- (NSMutableDictionary * _Nonnull) dictionary;
+ (BranchUniversalObject * _Nonnull) objectWithDictionary:(NSDictionary * _Null_unspecified)dictionary;

- (NSString*_Nonnull) description;
- (NSString * _Nonnull) description;
@end

0 comments on commit 3889876

Please sign in to comment.