Skip to content

Commit 7dc5136

Browse files
committed
push environment fix, logging, and no app version subscripting fix
1 parent 4e7ed24 commit 7dc5136

File tree

5 files changed

+32
-17
lines changed

5 files changed

+32
-17
lines changed

iOS_SDK/Framework/OneSignal.framework/Versions/A/Headers/OneSignal.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,5 +108,7 @@ typedef NS_ENUM(NSUInteger, ONE_S_LOG_LEVEL) {
108108

109109
- (void)promptLocation;
110110

111+
+ (void) onesignal_Log:(ONE_S_LOG_LEVEL)logLevel message:(NSString*)message;
112+
111113
@end
112114

13.1 KB
Binary file not shown.

iOS_SDK/OneSignal/OneSignal.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,5 +108,7 @@ typedef NS_ENUM(NSUInteger, ONE_S_LOG_LEVEL) {
108108

109109
- (void)promptLocation;
110110

111+
+ (void) onesignal_Log:(ONE_S_LOG_LEVEL)logLevel message:(NSString*)message;
112+
111113
@end
112114

iOS_SDK/OneSignal/OneSignal.m

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ @interface OneSignal ()
6161

6262
@implementation OneSignal
6363

64-
NSString* const ONESIGNAL_VERSION = @"011302";
64+
NSString* const ONESIGNAL_VERSION = @"011303";
6565

6666
@synthesize app_id = _GT_publicKey;
6767
@synthesize httpClient = _GT_httpRequest;
@@ -235,6 +235,10 @@ + (void)setLogLevel:(ONE_S_LOG_LEVEL)nsLogLevel visualLevel:(ONE_S_LOG_LEVEL)vis
235235
_nsLogLevel = nsLogLevel; _visualLogLevel = visualLogLevel;
236236
}
237237

238+
+ (void) onesignal_Log:(ONE_S_LOG_LEVEL)logLevel message:(NSString*) message {
239+
onesignal_Log(logLevel, message);
240+
}
241+
238242
void onesignal_Log(ONE_S_LOG_LEVEL logLevel, NSString* message) {
239243
NSString* levelString;
240244
switch (logLevel) {
@@ -403,14 +407,16 @@ - (void)registerUser {
403407
self.systemVersion, @"device_os",
404408
[[NSLocale preferredLanguages] objectAtIndex:0], @"language",
405409
[NSNumber numberWithInt:(int)[[NSTimeZone localTimeZone] secondsFromGMT]], @"timezone",
406-
build, @"game_version",
407410
[NSNumber numberWithInt:0], @"device_type",
408411
[[[UIDevice currentDevice] identifierForVendor] UUIDString], @"ad_id",
409412
[self getSoundFiles], @"sounds",
410413
ONESIGNAL_VERSION, @"sdk",
411414
mDeviceToken, @"identifier", // identifier MUST be at the end as it could be nil.
412415
nil];
413416

417+
if (build)
418+
dataDic[@"game_version"] = build;
419+
414420
mNotificationTypes = getNotificationTypes();
415421

416422
if ([OneSignalJailbreakDetection isJailbroken])
@@ -1021,6 +1027,9 @@ - (void)enqueueRequest:(NSURLRequest*)request onSuccess:(OneSignalResultSuccessB
10211027
}
10221028

10231029
- (void)enqueueRequest:(NSURLRequest*)request onSuccess:(OneSignalResultSuccessBlock)successBlock onFailure:(OneSignalFailureBlock)failureBlock isSynchronous:(BOOL)isSynchronous {
1030+
1031+
onesignal_Log(ONE_S_LL_VERBOSE, [NSString stringWithFormat:@"request.body: %@", [[NSString alloc]initWithData:request.HTTPBody encoding:NSUTF8StringEncoding]]);
1032+
10241033
if (isSynchronous) {
10251034
NSURLResponse* response = nil;
10261035
NSError* error = nil;

iOS_SDK/OneSignalMobileProvision/OneSignalMobileProvision.m

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
#import "OneSignalMobileProvision.h"
1010
#import "TargetConditionals.h"
11+
#import "OneSignal.h"
1112

1213
@implementation OneSignalMobileProvision
1314

@@ -68,32 +69,33 @@ + (NSDictionary*) getMobileProvision {
6869
}
6970

7071
+ (UIApplicationReleaseMode) releaseMode {
72+
NSDictionary *entitlements = nil;
7173
NSDictionary *mobileProvision = [self getMobileProvision];
74+
if (mobileProvision) {
75+
[OneSignal onesignal_Log:ONE_S_LL_DEBUG message:[NSString stringWithFormat:@"mobileProvision: %@", mobileProvision]];
76+
entitlements = [mobileProvision objectForKey:@"Entitlements"];
77+
}
78+
else
79+
[OneSignal onesignal_Log:ONE_S_LL_DEBUG message:@"mobileProvision not found"];
80+
7281
if (!mobileProvision) {
7382
// failure to read other than it simply not existing
7483
return UIApplicationReleaseUnknown;
75-
} else if (![mobileProvision count]) {
84+
}
85+
else if (![mobileProvision count]) {
7686
#if TARGET_IPHONE_SIMULATOR
7787
return UIApplicationReleaseSim;
7888
#else
7989
return UIApplicationReleaseAppStore;
8090
#endif
81-
} else if ([[mobileProvision objectForKey:@"ProvisionsAllDevices"] boolValue]) {
91+
}
92+
else if ([[mobileProvision objectForKey:@"ProvisionsAllDevices"] boolValue]) {
8293
// enterprise distribution contains ProvisionsAllDevices - true
8394
return UIApplicationReleaseEnterprise;
84-
} else if ([mobileProvision objectForKey:@"ProvisionedDevices"] && [[mobileProvision objectForKey:@"ProvisionedDevices"] count] > 0) {
85-
// development contains UDIDs and get-task-allow is true, expect for one with a wildcard identifier. It creates a production push token.
86-
// ad hoc contains UDIDs and get-task-allow is false
87-
NSDictionary *entitlements = [mobileProvision objectForKey:@"Entitlements"];
88-
if ([[entitlements objectForKey:@"get-task-allow"] boolValue]) {
89-
if (entitlements[@"application-identifier"] && [entitlements[@"application-identifier"] hasSuffix:@"*"])
90-
return UIApplicationReleaseWildcard;
91-
else
92-
return UIApplicationReleaseDev;
93-
} else {
94-
return UIApplicationReleaseAdHoc;
95-
}
96-
} else {
95+
}
96+
else if ([@"development" isEqualToString: entitlements[@"aps-environment"]])
97+
return UIApplicationReleaseDev;
98+
else {
9799
// app store contains no UDIDs (if the file exists at all?)
98100
return UIApplicationReleaseAppStore;
99101
}

0 commit comments

Comments
 (0)