Skip to content

Commit

Permalink
Merge pull request #315 from rudderlabs/release/1.15.0
Browse files Browse the repository at this point in the history
chore(release): pulling release/1.15.0 into master
  • Loading branch information
desusai7 authored May 10, 2023
2 parents b02a26f + dad2014 commit 7ab3a82
Show file tree
Hide file tree
Showing 9 changed files with 59 additions and 28 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

## [1.15.0](https://github.com/rudderlabs/rudder-sdk-ios/compare/v1.14.0...v1.15.0) (2023-05-09)


### Features

* handled retrieving carrier names as per different iOS versions ([a81e3a2](https://github.com/rudderlabs/rudder-sdk-ios/commit/a81e3a2de7a10f5d16d8632db97a301f10920631))

## [1.14.0](https://github.com/rudderlabs/rudder-sdk-ios/compare/v1.13.2...v1.14.0) (2023-04-19)


Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<p align="center">
<a href="https://cocoapods.org/pods/Rudder">
<img src="https://img.shields.io/static/v1?label=pod&message=v1.14.0&color=blue&style=flat">
<img src="https://img.shields.io/static/v1?label=pod&message=v1.15.0&color=blue&style=flat">
</a>
</p>

Expand Down Expand Up @@ -39,15 +39,15 @@ The iOS SDK is available through [**CocoaPods**](https://cocoapods.org), [**Cart
To install the SDK, simply add the following line to your Podfile:

```xcode
pod 'Rudder', '1.14.0'
pod 'Rudder', '1.15.0'
```

### Carthage

For Carthage support, add the following line to your `Cartfile`:

```xcode
github "rudderlabs/rudder-sdk-ios" "v1.14.0"
github "rudderlabs/rudder-sdk-ios" "v1.15.0"
```

> Remember to include the following code in all `.m` and `.h` files where you want to refer to or use the RudderStack SDK classes, as shown:
Expand All @@ -71,7 +71,7 @@ You can also add the RudderStack iOS SDK via Swift Package Mangaer, via one of t

* Enter the package repository (`[email protected]:rudderlabs/rudder-sdk-ios.git`) in the search bar.

* In **Dependency Rule**, select **Up to Next Major Version** and enter `1.14.0` as the value, as shown:
* In **Dependency Rule**, select **Up to Next Major Version** and enter `1.15.0` as the value, as shown:

![Setting dependency](https://user-images.githubusercontent.com/59817155/145574696-8c849749-13e0-40d5-aacb-3fccb5c8e67d.png)

Expand Down Expand Up @@ -99,7 +99,7 @@ let package = Package(
],
dependencies: [
// Dependencies declare other packages that this package depends on.
.package(url: "[email protected]:rudderlabs/rudder-sdk-ios.git", from: "1.14.0")
.package(url: "[email protected]:rudderlabs/rudder-sdk-ios.git", from: "1.15.0")
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
Expand Down
12 changes: 6 additions & 6 deletions Sources/Classes/Headers/Public/RSNetwork.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@
NS_ASSUME_NONNULL_BEGIN

@interface RSNetwork : NSObject
- (instancetype) initWithDict:(NSDictionary*) dict;
- (NSDictionary<NSString* , NSObject *>*) dict;
- (instancetype)initWithDict:(NSDictionary *)dict;
- (NSDictionary<NSString *, NSObject *> *)dict;

@property (nonatomic, readwrite) NSString* carrier;
@property (nonatomic, readwrite) bool wifi;
@property (nonatomic, readwrite) bool isNetworkReachable;
@property (nonatomic, readwrite) bool cellular;
@property(nonatomic, strong) NSMutableArray<NSString *> *carrier;
@property(nonatomic, readwrite) bool wifi;
@property(nonatomic, readwrite) bool isNetworkReachable;
@property(nonatomic, readwrite) bool cellular;

@end

Expand Down
2 changes: 1 addition & 1 deletion Sources/Classes/Headers/RSVersion.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
#ifndef RSVersion_h
#define RSVersion_h

NSString *const SDK_VERSION = @"1.14.0";
NSString *const SDK_VERSION = @"1.15.0";

#endif /* RSVersion_h */
38 changes: 32 additions & 6 deletions Sources/Classes/RSNetwork.m
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
//

#import "RSNetwork.h"

#import "RSLogger.h"
#import "RSUtils.h"
#if !TARGET_OS_TV && !TARGET_OS_WATCH
#import <CoreTelephony/CTTelephonyNetworkInfo.h>
#import <CoreTelephony/CTCarrier.h>
Expand All @@ -19,12 +20,35 @@ - (instancetype)init
{
self = [super init];
if (self) {
_carrier = [[NSMutableArray alloc] init];
#if !TARGET_OS_TV && !TARGET_OS_WATCH
NSString *carrierName = [[[[CTTelephonyNetworkInfo alloc] init] subscriberCellularProvider]carrierName];
if (carrierName == nil) {
carrierName = @"unavailable";
CTTelephonyNetworkInfo *networkInfo = [[CTTelephonyNetworkInfo alloc] init];
if(@available(iOS 16.0, *)) {
[RSLogger logWarn:@"RSNetwork: init: cannot retrieve carrier names on iOS 16 and above as CTCarrier is deprecated"];
}
else if (@available(iOS 12.0, *)) {
NSDictionary *serviceProviders = [networkInfo serviceSubscriberCellularProviders];
for (NSString *rat in serviceProviders) {
CTCarrier *carrier = [serviceProviders objectForKey:rat];
if(carrier == nil) {
continue;
}
NSString *carrierName = [carrier carrierName];
if (carrierName && ![carrierName isEqualToString:@"--"]) {
[_carrier addObject:carrierName];
}
}
} else {
CTCarrier *carrier = [networkInfo subscriberCellularProvider];
NSString *carrierName = [carrier carrierName];
if (carrierName) {
[_carrier addObject:carrierName];
}
}

if(_carrier.count == 0) {
[RSLogger logWarn:@"RSNetwork: init: unable to retrieve carrier name"];
}
_carrier = carrierName;
#endif
#if !TARGET_OS_WATCH
SCNetworkReachabilityRef reachability = SCNetworkReachabilityCreateWithName(NULL, "8.8.8.8");
Expand Down Expand Up @@ -60,7 +84,9 @@ - (instancetype) initWithDict:(NSDictionary*) dict {
NSMutableDictionary *tempDict;
@synchronized (tempDict) {
tempDict = [[NSMutableDictionary alloc] init];
[tempDict setValue:_carrier forKey:@"carrier"];
if(_carrier.count !=0) {
[tempDict setValue:[RSUtils getCSVString:_carrier] forKey:@"carrier"];
}
#if !TARGET_OS_WATCH
if(_isNetworkReachable) {
[tempDict setValue:[NSNumber numberWithBool:_wifi] forKey:@"wifi"];
Expand Down
9 changes: 1 addition & 8 deletions Sources/Classes/RSUtils.m
Original file line number Diff line number Diff line change
Expand Up @@ -128,14 +128,7 @@ + (NSArray*) serializeArray:(NSArray*) array {
}

+(NSString*) getCSVString:(NSArray*) inputStrings {
NSMutableString *CSVString = [[NSMutableString alloc] init];
for (int index = 0; index < inputStrings.count; index++) {
[CSVString appendString:inputStrings[index]];
if (index != inputStrings.count -1) {
[CSVString appendString:@","];
}
}
return [CSVString copy];
return [inputStrings componentsJoinedByString:@","];
}

+(NSString*) getJSONCSVString:(NSArray*) inputStrings {
Expand Down
5 changes: 5 additions & 0 deletions Tests/RudderUtilsTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ class RudderUtilsTest: XCTestCase {
let bioCSV = RSUtils.getCSVString(bio)
print(bioCSV)
XCTAssert(bioCSV == "Desu,Mobile Engineer,RudderStack")
let carriers:[String] = ["Airtel"]
let carriersCSV = RSUtils.getCSVString(carriers)
print(carriersCSV)
XCTAssertEqual(carriersCSV, "Airtel")

}

func testGetJSONCSVString() throws {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"version": "1.14.0",
"version": "1.15.0",
"description": "Rudder is a platform for collecting, storing and routing customer event data to dozens of tools"
}
2 changes: 1 addition & 1 deletion sonar-project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ sonar.qualitygate.wait=false
sonar.projectKey=rudderlabs_rudder-sdk-ios
sonar.organization=rudderlabs
sonar.projectName=RudderStack iOS SDK
sonar.projectVersion=1.14.0
sonar.projectVersion=1.15.0

# C/C++/Objective-C related details
# sonar.cfamily.compile-commands=compile_commands.json
Expand Down

0 comments on commit 7ab3a82

Please sign in to comment.