Skip to content

Commit

Permalink
Merge pull request #300 from CleverTap/task/SDK-3419-remove-warnings
Browse files Browse the repository at this point in the history
SDK - Fixes build warnings
  • Loading branch information
akashvercetti authored Nov 21, 2023
2 parents 0d010aa + ac33dc3 commit 79bc797
Show file tree
Hide file tree
Showing 17 changed files with 73 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ All notable changes to this project will be documented in this file.
### [Version 5.2.2](https://github.com/CleverTap/clevertap-ios-sdk/releases/tag/5.2.2) (November 21, 2023)

#### Fixed
- Fixes build warnings.
- Mitigates a potential crash when apps would go to the background.

### [Version 5.2.1](https://github.com/CleverTap/clevertap-ios-sdk/releases/tag/5.2.1) (September 29, 2023)
Expand Down
13 changes: 13 additions & 0 deletions CleverTapSDK/CTDeviceInfo.m
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,10 @@ - (NSString *)carrier {
// CTCarrier is deprecated above iOS version 16 with no replacements so carrierName will be empty.
_carrier = @"";
} else {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
_carrier = [self getCarrier].carrierName ?: @"";
#pragma clang diagnostic pop
}
}
return _carrier;
Expand All @@ -441,7 +444,10 @@ - (NSString *)countryCode {
NSLocale *currentLocale = [NSLocale currentLocale];
_countryCode = [currentLocale objectForKey:NSLocaleCountryCode];
} else {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
_countryCode = [self getCarrier].isoCountryCode ?: @"";
#pragma clang diagnostic pop
}
}
return _countryCode;
Expand All @@ -455,14 +461,18 @@ - (NSString *)radio {
return _radio;
}

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
- (CTCarrier *)getCarrier {
if (@available(iOS 12.0, *)) {
NSString *providerKey = _networkInfo.serviceSubscriberCellularProviders.allKeys.lastObject;
return _networkInfo.serviceSubscriberCellularProviders[providerKey];
} else {

return _networkInfo.subscriberCellularProvider;
}
}
#pragma clang diagnostic pop

- (NSString *)getCurrentRadioAccessTechnology {
__block NSString *radioValue;
Expand All @@ -474,7 +484,10 @@ - (NSString *)getCurrentRadioAccessTechnology {
}
}];
} else {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
NSString *radio = _networkInfo.currentRadioAccessTechnology;
#pragma clang diagnostic pop
if (radio && [radio hasPrefix:@"CTRadioAccessTechnology"]) {
radioValue = [radio substringFromIndex:23];
}
Expand Down
9 changes: 9 additions & 0 deletions CleverTapSDK/CTPreferences.m
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,10 @@ + (id _Nullable)unarchiveFromFile:(NSString *_Nonnull)filename ofTypes:(nonnull
CleverTapLogStaticInternal(@"%@ unarchived data from %@: %@", self, filePath, data);
}
} else {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
data = [NSKeyedUnarchiver unarchiveObjectWithFile:filePath];
#pragma clang diagnostic pop
CleverTapLogStaticInternal(@"%@ unarchived data from %@: %@", self, filePath, data);
}
}
Expand Down Expand Up @@ -137,7 +140,10 @@ + (id _Nullable)unarchiveFromFile:(NSString *_Nonnull)filename ofType:(Class _No
CleverTapLogStaticInternal(@"%@ unarchived data from %@: %@", self, filePath, data);
}
} else {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
data = [NSKeyedUnarchiver unarchiveObjectWithFile:filePath];
#pragma clang diagnostic pop
CleverTapLogStaticInternal(@"%@ unarchived data from %@: %@", self, filePath, data);
}
}
Expand Down Expand Up @@ -170,7 +176,10 @@ + (BOOL)archiveObject:(id)object forFileName:(NSString *)filename config: (Cleve
CleverTapLogStaticInternal(@"%@ failed to write data at %@: %@", self, filePath, writeError);
}
} else {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
success = [NSKeyedArchiver archiveRootObject:object toFile:filePath];
#pragma clang diagnostic pop
if (!success) {
CleverTapLogStaticInternal(@"%@ failed to archive data to %@: %@", self, filePath, object);
}
Expand Down
3 changes: 3 additions & 0 deletions CleverTapSDK/CTUIUtils.m
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,10 @@ + (BOOL)isDeviceOrientationLandscape {
} else if (@available(iOS 13.0, *)) {
orientation = [CTUIUtils getSharedApplication].windows.firstObject.windowScene.interfaceOrientation;
} else {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
orientation = [[CTUIUtils getSharedApplication] statusBarOrientation];
#pragma clang diagnostic pop
}
BOOL landscape = UIInterfaceOrientationIsLandscape(orientation);
return landscape;
Expand Down
2 changes: 1 addition & 1 deletion CleverTapSDK/CleverTap+FeatureFlags.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ __attribute__((deprecated("This protocol method has been deprecated and will be

@interface CleverTap (FeatureFlags)
@property (atomic, strong, readonly, nonnull) CleverTapFeatureFlags *featureFlags
__attribute__((deprecated("This property has been deprecated and will be removed in the future versions of this SDK.")));;
__attribute__((deprecated("This property has been deprecated and will be removed in the future versions of this SDK.")));
@end

@interface CleverTapFeatureFlags : NSObject
Expand Down
3 changes: 2 additions & 1 deletion CleverTapSDK/CleverTap+ProductConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ __attribute__((deprecated("This protocol method has been deprecated and will be
@end

@interface CleverTap(ProductConfig)
@property (atomic, strong, readonly, nonnull) CleverTapProductConfig *productConfig;
@property (atomic, strong, readonly, nonnull) CleverTapProductConfig *productConfig
__attribute__((deprecated("This property has been deprecated and will be removed in the future versions of this SDK.")));
@end


Expand Down
15 changes: 13 additions & 2 deletions CleverTapSDK/CleverTap.m
Original file line number Diff line number Diff line change
Expand Up @@ -1687,9 +1687,14 @@ - (NSDictionary *)getNotificationDictionary:(id)object {
} else if ([object isKindOfClass:[NSDictionary class]]) {
notification = object;
}
} else if ([object isKindOfClass:[UILocalNotification class]]) {
}
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
else if ([object isKindOfClass:[UILocalNotification class]]) {
notification = [((UILocalNotification *) object) userInfo];
} else if ([object isKindOfClass:[NSDictionary class]]) {
}
#pragma clang diagnostic pop
else if ([object isKindOfClass:[NSDictionary class]]) {
notification = object;
}
return notification;
Expand Down Expand Up @@ -4702,6 +4707,8 @@ - (void)_resetFeatureFlags {
}
}

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
- (void)setFeatureFlagsDelegate:(id<CleverTapFeatureFlagsDelegate>)delegate {
if (delegate && [delegate conformsToProtocol:@protocol(CleverTapFeatureFlagsDelegate)]) {
_featureFlagsDelegate = delegate;
Expand All @@ -4719,6 +4726,7 @@ - (void)featureFlagsDidUpdate {
[self.featureFlagsDelegate ctFeatureFlagsUpdated];
}
}
#pragma clang diagnostic pop

- (void)fetchFeatureFlags {
[self queueEvent:@{@"evtName": CLTAP_WZRK_FETCH_EVENT, @"evtData" : @{@"t": @1}} withType:CleverTapEventTypeFetch];
Expand Down Expand Up @@ -4778,6 +4786,8 @@ - (NSDictionary *)_setProductConfig:(NSDictionary *)arp {
return nil;
}

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
- (void)setProductConfigDelegate:(id<CleverTapProductConfigDelegate>)delegate {
if (delegate && [delegate conformsToProtocol:@protocol(CleverTapProductConfigDelegate)]) {
_productConfigDelegate = delegate;
Expand Down Expand Up @@ -4807,6 +4817,7 @@ - (void)productConfigDidInitialize {
[self.productConfigDelegate ctProductConfigInitialized];
}
}
#pragma clang diagnostic pop

- (void)fetchProductConfig {
[self queueEvent:@{@"evtName": CLTAP_WZRK_FETCH_EVENT, @"evtData" : @{@"t": @0}} withType:CleverTapEventTypeFetch];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ - (void)_unarchiveDataSync:(BOOL)sync {
- (void)_archiveData:(NSArray*)data sync:(BOOL)sync {
NSString *filePath = [self dataArchiveFileName];
CTFeatureFlagsOperationBlock opBlock = ^{
[CTPreferences archiveObject:data forFileName:filePath config:_config];
[CTPreferences archiveObject:data forFileName:filePath config:self->_config];
};
if (sync) {
opBlock();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
@protocol CleverTapPrivateFeatureFlagsDelegate <NSObject>
@required

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
@property (atomic, weak) id<CleverTapFeatureFlagsDelegate> _Nullable featureFlagsDelegate;
#pragma clang diagnostic pop

- (BOOL)getFeatureFlag:(NSString* _Nonnull)key withDefaultValue:(BOOL)defaultValue;

Expand Down
3 changes: 3 additions & 0 deletions CleverTapSDK/InApps/CTCoverImageViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@ - (void)viewDidLayoutSubviews {
if (@available(iOS 11.0, *)) {
topLength = self.view.safeAreaInsets.top;
} else {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
topLength = self.topLayoutGuide.length;
#pragma clang diagnostic pop
}
[[NSLayoutConstraint constraintWithItem: self.closeButton
attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationGreaterThanOrEqual
Expand Down
3 changes: 3 additions & 0 deletions CleverTapSDK/InApps/CTCoverViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@ - (void)viewDidLayoutSubviews {
if (@available(iOS 11.0, *)) {
topLength = self.view.safeAreaInsets.top;
} else {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
topLength = self.topLayoutGuide.length;
#pragma clang diagnostic pop
}
[[NSLayoutConstraint constraintWithItem: self.closeButton
attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationGreaterThanOrEqual
Expand Down
3 changes: 3 additions & 0 deletions CleverTapSDK/InApps/CTHeaderViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ - (void)viewDidLayoutSubviews {
if (@available(iOS 11.0, *)) {
topLength = self.view.safeAreaInsets.top;
} else {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
topLength = self.topLayoutGuide.length;
#pragma clang diagnostic pop
}
[[NSLayoutConstraint constraintWithItem: self.containerView
attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationGreaterThanOrEqual
Expand Down
3 changes: 3 additions & 0 deletions CleverTapSDK/InApps/CTInAppHTMLViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,10 @@ - (void)loadWebView {
if (@available(iOS 13.0, *)) {
statusBarFrameHeight = [[CTUIUtils getKeyWindow] windowScene].statusBarManager.statusBarFrame.size.height;
} else {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
statusBarFrameHeight = [[CTUIUtils getSharedApplication] statusBarFrame].size.height;
#pragma clang diagnostic pop
}
CGFloat statusBarHeight = self.notification.heightPercent == 100.0 ? statusBarFrameHeight : 0.0;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,14 @@ - (void)setUpTableViewLayout {
self.tableView.estimatedRowHeight = 44.0;
self.tableView.tableHeaderView = [[UIView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, self.tableView.bounds.size.width, kCellSpacing)];
self.tableView.tableFooterView = [[UIView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, self.tableView.bounds.size.width, 1.0)];
self.automaticallyAdjustsScrollViewInsets = NO;
if (@available(iOS 11.0, *)) {
self.tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
} else {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
self.automaticallyAdjustsScrollViewInsets = NO;
#pragma clang diagnostic pop
}
self.edgesForExtendedLayout = UIRectEdgeNone;
self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
}
Expand Down
3 changes: 3 additions & 0 deletions CleverTapSDK/Inbox/views/UIView+CTToast.m
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,10 @@ - (void)ct_makeToastActivity:(id)position {
if (@available(iOS 13.0, *)) {
activityIndicatorView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleLarge];
} else {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
activityIndicatorView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
#pragma clang diagnostic pop
}
activityIndicatorView.center = CGPointMake(activityView.bounds.size.width / 2, activityView.bounds.size.height / 2);
[activityView addSubview:activityIndicatorView];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ - (void)_unarchiveDataSync:(BOOL)sync {
- (void)_archiveData:(NSArray*)data sync:(BOOL)sync {
NSString *filePath = [self dataArchiveFileName];
CTProductConfigOperationBlock opBlock = ^{
[CTPreferences archiveObject:data forFileName:filePath config:_config];
[CTPreferences archiveObject:data forFileName:filePath config:self->_config];
};
if (sync) {
opBlock();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
@protocol CleverTapPrivateProductConfigDelegate <NSObject>
@required

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
@property (atomic, weak) id<CleverTapProductConfigDelegate> _Nullable productConfigDelegate;
#pragma clang diagnostic pop

- (void)fetchProductConfig;

Expand Down

0 comments on commit 79bc797

Please sign in to comment.