Skip to content

Commit fbf91f6

Browse files
mikehaney24paulb777
authored andcommitted
Cherry pick GDT changes for 6.8.0 and increment versions (#3770)
1 parent 5dc46ad commit fbf91f6

21 files changed

+206
-97
lines changed

GoogleDataTransport.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = 'GoogleDataTransport'
3-
s.version = '1.1.3'
3+
s.version = '1.2.0'
44
s.summary = 'Google iOS SDK data transport.'
55

66
s.description = <<-DESC

GoogleDataTransport/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# v1.2.0
2+
- Removes all NSAsserts in favor of custom asserts. (#3747)
3+
14
# v1.1.3
25
- Wrap decoding in GDTUploadCoordinator in a try catch. (#3676)
36

GoogleDataTransport/GDTLibrary/GDTAssert.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414
* limitations under the License.
1515
*/
1616

17-
#import "GDTLibrary/Private/GDTAssert.h"
17+
#import "GDTLibrary/Public/GDTAssert.h"
1818

19-
GDTAssertionBlock GDTAssertionBlockToRunInsteadOfNSAssert(void) {
19+
GDTAssertionBlock GDTAssertionBlockToRunInstead(void) {
2020
// This class is only compiled in by unit tests, and this should fail quickly in optimized builds.
2121
Class GDTAssertClass = NSClassFromString(@"GDTAssertHelper");
2222
if (__builtin_expect(!!GDTAssertClass, 0)) {

GoogleDataTransport/GDTLibrary/GDTEvent.m

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,19 @@
1616

1717
#import <GoogleDataTransport/GDTEvent.h>
1818

19+
#import <GoogleDataTransport/GDTAssert.h>
1920
#import <GoogleDataTransport/GDTStoredEvent.h>
2021

21-
#import "GDTLibrary/Private/GDTAssert.h"
2222
#import "GDTLibrary/Private/GDTEvent_Private.h"
2323

2424
@implementation GDTEvent
2525

2626
- (instancetype)initWithMappingID:(NSString *)mappingID target:(NSInteger)target {
2727
GDTAssert(mappingID.length > 0, @"Please give a valid mapping ID");
2828
GDTAssert(target > 0, @"A target cannot be negative or 0");
29+
if (mappingID == nil || mappingID.length == 0 || target <= 0) {
30+
return nil;
31+
}
2932
self = [super init];
3033
if (self) {
3134
_mappingID = mappingID;

GoogleDataTransport/GDTLibrary/GDTPlatform.m

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616

1717
#import <GoogleDataTransport/GDTPlatform.h>
1818

19+
#import <GoogleDataTransport/GDTAssert.h>
20+
1921
const GDTBackgroundIdentifier GDTBackgroundIdentifierInvalid = 0;
2022

2123
NSString *const kGDTApplicationDidEnterBackgroundNotification =
@@ -40,8 +42,8 @@ @implementation GDTApplication
4042
+ (void)load {
4143
#if TARGET_OS_IOS || TARGET_OS_TV
4244
// If this asserts, please file a bug at https://github.com/firebase/firebase-ios-sdk/issues.
43-
NSAssert(GDTBackgroundIdentifierInvalid == UIBackgroundTaskInvalid,
44-
@"GDTBackgroundIdentifierInvalid and UIBackgroundTaskInvalid should be the same.");
45+
GDTFatalAssert(GDTBackgroundIdentifierInvalid == UIBackgroundTaskInvalid,
46+
@"GDTBackgroundIdentifierInvalid and UIBackgroundTaskInvalid should be the same.");
4547
#endif
4648
[self sharedApplication];
4749
}

GoogleDataTransport/GDTLibrary/GDTStorage.m

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@
1717
#import "GDTLibrary/Private/GDTStorage.h"
1818
#import "GDTLibrary/Private/GDTStorage_Private.h"
1919

20+
#import <GoogleDataTransport/GDTAssert.h>
2021
#import <GoogleDataTransport/GDTConsoleLogger.h>
2122
#import <GoogleDataTransport/GDTLifecycle.h>
2223
#import <GoogleDataTransport/GDTPrioritizer.h>
2324
#import <GoogleDataTransport/GDTStoredEvent.h>
2425

25-
#import "GDTLibrary/Private/GDTAssert.h"
2626
#import "GDTLibrary/Private/GDTEvent_Private.h"
2727
#import "GDTLibrary/Private/GDTRegistrar_Private.h"
2828
#import "GDTLibrary/Private/GDTUploadCoordinator.h"
@@ -74,6 +74,10 @@ - (instancetype)init {
7474
}
7575

7676
- (void)storeEvent:(GDTEvent *)event {
77+
if (event == nil) {
78+
return;
79+
}
80+
7781
[self createEventDirectoryIfNotExists];
7882

7983
__block GDTBackgroundIdentifier bgID = GDTBackgroundIdentifierInvalid;

GoogleDataTransport/GDTLibrary/GDTTransformer.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@
1717
#import "GDTLibrary/Private/GDTTransformer.h"
1818
#import "GDTLibrary/Private/GDTTransformer_Private.h"
1919

20+
#import <GoogleDataTransport/GDTAssert.h>
2021
#import <GoogleDataTransport/GDTConsoleLogger.h>
2122
#import <GoogleDataTransport/GDTEventTransformer.h>
2223
#import <GoogleDataTransport/GDTLifecycle.h>
2324

24-
#import "GDTLibrary/Private/GDTAssert.h"
2525
#import "GDTLibrary/Private/GDTStorage.h"
2626

2727
@implementation GDTTransformer

GoogleDataTransport/GDTLibrary/GDTTransport.m

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,24 @@
1717
#import <GoogleDataTransport/GDTTransport.h>
1818
#import "GDTLibrary/Private/GDTTransport_Private.h"
1919

20+
#import <GoogleDataTransport/GDTAssert.h>
2021
#import <GoogleDataTransport/GDTClock.h>
2122
#import <GoogleDataTransport/GDTEvent.h>
2223

23-
#import "GDTLibrary/Private/GDTAssert.h"
2424
#import "GDTLibrary/Private/GDTTransformer.h"
2525

2626
@implementation GDTTransport
2727

2828
- (instancetype)initWithMappingID:(NSString *)mappingID
2929
transformers:(nullable NSArray<id<GDTEventTransformer>> *)transformers
3030
target:(NSInteger)target {
31+
GDTAssert(mappingID.length > 0, @"A mapping ID cannot be nil or empty");
32+
GDTAssert(target > 0, @"A target cannot be negative or 0");
33+
if (mappingID == nil || mappingID.length == 0 || target <= 0) {
34+
return nil;
35+
}
3136
self = [super init];
3237
if (self) {
33-
GDTAssert(mappingID.length > 0, @"A mapping ID cannot be nil or empty");
34-
GDTAssert(target > 0, @"A target cannot be negative or 0");
3538
_mappingID = mappingID;
3639
_transformers = transformers;
3740
_target = target;

GoogleDataTransport/GDTLibrary/GDTUploadCoordinator.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@
1616

1717
#import "GDTLibrary/Private/GDTUploadCoordinator.h"
1818

19+
#import <GoogleDataTransport/GDTAssert.h>
1920
#import <GoogleDataTransport/GDTClock.h>
2021
#import <GoogleDataTransport/GDTConsoleLogger.h>
2122

22-
#import "GDTLibrary/Private/GDTAssert.h"
2323
#import "GDTLibrary/Private/GDTReachability.h"
2424
#import "GDTLibrary/Private/GDTRegistrar_Private.h"
2525
#import "GDTLibrary/Private/GDTStorage.h"

GoogleDataTransport/GDTLibrary/Private/GDTAssert.h

Lines changed: 0 additions & 54 deletions
This file was deleted.

0 commit comments

Comments
 (0)