Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion iOS_SDK/OneSignalSDK/OneSignalCore/Source/OneSignalCore.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
#import <OneSignalCore/OneSignalClient.h>
#import <OneSignalCore/OneSignalCoreHelper.h>
#import <OneSignalCore/OneSignalTrackFirebaseAnalytics.h>
#import <OneSignalCore/OSMacros.h>
#import <OneSignalCore/OSJSONHandling.h>
#import <OneSignalCore/OSPrivacyConsentController.h>
#import <OneSignalCore/OSDeviceUtils.h>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@
+ (void)dispatch_async_on_main_queue:(void(^)())block;
+ (void)performSelector:(SEL)aSelector onMainThreadOnObject:(id)targetObj withObject:(id)anArgument afterDelay:(NSTimeInterval)delay;

+ (NSString*)hashUsingSha1:(NSString*)string;
+ (NSString*)hashUsingMD5:(NSString*)string;
+ (NSString*)trimURLSpacing:(NSString*)url;
+ (NSString*)parseNSErrorAsJsonString:(NSError*)error;
+ (BOOL)isOneSignalPayload:(NSDictionary *)payload;
Expand Down
140 changes: 0 additions & 140 deletions iOS_SDK/OneSignalSDK/OneSignalCore/Source/OneSignalCoreHelper.m
Original file line number Diff line number Diff line change
Expand Up @@ -32,129 +32,9 @@
extern "C" {
#endif

#define CC_DIGEST_DEPRECATION_WARNING \
"This function is cryptographically broken and should not be used in security contexts. Clients should migrate to SHA256 (or stronger)."

/*
* For compatibility with legacy implementations, the *Init(), *Update(),
* and *Final() functions declared here *always* return a value of 1 (one).
* This corresponds to "success" in the similar openssl implementations.
* There are no errors of any kind which can be, or are, reported here,
* so you can safely ignore the return values of all of these functions
* if you are implementing new code.
*
* The one-shot functions (CC_MD2(), CC_SHA1(), etc.) perform digest
* calculation and place the result in the caller-supplied buffer
* indicated by the md parameter. They return the md parameter.
* Unlike the opensssl counterparts, these one-shot functions require
* a non-NULL md pointer. Passing in NULL for the md parameter
* results in a NULL return and no digest calculation.
*/

typedef uint32_t CC_LONG; /* 32 bit unsigned integer */
typedef uint64_t CC_LONG64; /* 64 bit unsigned integer */

/*** MD2 ***/

#define CC_MD2_DIGEST_LENGTH 16 /* digest length in bytes */
#define CC_MD2_BLOCK_BYTES 64 /* block size in bytes */
#define CC_MD2_BLOCK_LONG (CC_MD2_BLOCK_BYTES / sizeof(CC_LONG))

typedef struct CC_MD2state_st
{
int num;
unsigned char data[CC_MD2_DIGEST_LENGTH];
CC_LONG cksm[CC_MD2_BLOCK_LONG];
CC_LONG state[CC_MD2_BLOCK_LONG];
} CC_MD2_CTX;

extern int CC_MD2_Init(CC_MD2_CTX *c)
API_DEPRECATED(CC_DIGEST_DEPRECATION_WARNING, macos(10.4, 10.15), ios(2.0, 13.0));

extern int CC_MD2_Update(CC_MD2_CTX *c, const void *data, CC_LONG len)
API_DEPRECATED(CC_DIGEST_DEPRECATION_WARNING, macos(10.4, 10.15), ios(2.0, 13.0));

extern int CC_MD2_Final(unsigned char *md, CC_MD2_CTX *c)
API_DEPRECATED(CC_DIGEST_DEPRECATION_WARNING, macos(10.4, 10.15), ios(2.0, 13.0));

extern unsigned char *CC_MD2(const void *data, CC_LONG len, unsigned char *md)
API_DEPRECATED(CC_DIGEST_DEPRECATION_WARNING, macos(10.4, 10.15), ios(2.0, 13.0));

/*** MD4 ***/

#define CC_MD4_DIGEST_LENGTH 16 /* digest length in bytes */
#define CC_MD4_BLOCK_BYTES 64 /* block size in bytes */
#define CC_MD4_BLOCK_LONG (CC_MD4_BLOCK_BYTES / sizeof(CC_LONG))

typedef struct CC_MD4state_st
{
CC_LONG A,B,C,D;
CC_LONG Nl,Nh;
CC_LONG data[CC_MD4_BLOCK_LONG];
uint32_t num;
} CC_MD4_CTX;

extern int CC_MD4_Init(CC_MD4_CTX *c)
API_DEPRECATED(CC_DIGEST_DEPRECATION_WARNING, macos(10.4, 10.15), ios(2.0, 13.0));

extern int CC_MD4_Update(CC_MD4_CTX *c, const void *data, CC_LONG len)
API_DEPRECATED(CC_DIGEST_DEPRECATION_WARNING, macos(10.4, 10.15), ios(2.0, 13.0));

extern int CC_MD4_Final(unsigned char *md, CC_MD4_CTX *c)
API_DEPRECATED(CC_DIGEST_DEPRECATION_WARNING, macos(10.4, 10.15), ios(2.0, 13.0));

extern unsigned char *CC_MD4(const void *data, CC_LONG len, unsigned char *md)
API_DEPRECATED(CC_DIGEST_DEPRECATION_WARNING, macos(10.4, 10.15), ios(2.0, 13.0));


/*** MD5 ***/

#define CC_MD5_DIGEST_LENGTH 16 /* digest length in bytes */
#define CC_MD5_BLOCK_BYTES 64 /* block size in bytes */
#define CC_MD5_BLOCK_LONG (CC_MD5_BLOCK_BYTES / sizeof(CC_LONG))

typedef struct CC_MD5state_st
{
CC_LONG A,B,C,D;
CC_LONG Nl,Nh;
CC_LONG data[CC_MD5_BLOCK_LONG];
int num;
} CC_MD5_CTX;

extern int CC_MD5_Init(CC_MD5_CTX *c)
API_DEPRECATED(CC_DIGEST_DEPRECATION_WARNING, macos(10.4, 10.15), ios(2.0, 13.0));

extern int CC_MD5_Update(CC_MD5_CTX *c, const void *data, CC_LONG len)
API_DEPRECATED(CC_DIGEST_DEPRECATION_WARNING, macos(10.4, 10.15), ios(2.0, 13.0));

extern int CC_MD5_Final(unsigned char *md, CC_MD5_CTX *c)
API_DEPRECATED(CC_DIGEST_DEPRECATION_WARNING, macos(10.4, 10.15), ios(2.0, 13.0));

extern unsigned char *CC_MD5(const void *data, CC_LONG len, unsigned char *md)
API_DEPRECATED(CC_DIGEST_DEPRECATION_WARNING, macos(10.4, 10.15), ios(2.0, 13.0));

/*** SHA1 ***/

#define CC_SHA1_DIGEST_LENGTH 20 /* digest length in bytes */
#define CC_SHA1_BLOCK_BYTES 64 /* block size in bytes */
#define CC_SHA1_BLOCK_LONG (CC_SHA1_BLOCK_BYTES / sizeof(CC_LONG))

typedef struct CC_SHA1state_st
{
CC_LONG h0,h1,h2,h3,h4;
CC_LONG Nl,Nh;
CC_LONG data[CC_SHA1_BLOCK_LONG];
int num;
} CC_SHA1_CTX;

extern int CC_SHA1_Init(CC_SHA1_CTX *c);

extern int CC_SHA1_Update(CC_SHA1_CTX *c, const void *data, CC_LONG len);

extern int CC_SHA1_Final(unsigned char *md, CC_SHA1_CTX *c);

extern unsigned char *CC_SHA1(const void *data, CC_LONG len, unsigned char *md);

/*** SHA224 ***/
#define CC_SHA224_DIGEST_LENGTH 28 /* digest length in bytes */
#define CC_SHA224_BLOCK_BYTES 64 /* block size in bytes */
Expand Down Expand Up @@ -258,26 +138,6 @@ + (void)performSelector:(SEL)aSelector onMainThreadOnObject:(nullable id)targetO
}];
}

+ (NSString*)hashUsingSha1:(NSString*)string {
const char *cstr = [string UTF8String];
uint8_t digest[CC_SHA1_DIGEST_LENGTH];
CC_SHA1(cstr, (CC_LONG)strlen(cstr), digest);
NSMutableString *output = [NSMutableString stringWithCapacity:CC_SHA1_DIGEST_LENGTH * 2];
for (int i = 0; i < CC_SHA1_DIGEST_LENGTH; i++)
[output appendFormat:@"%02x", digest[i]];
return output;
}

+ (NSString*)hashUsingMD5:(NSString*)string {
const char *cstr = [string UTF8String];
uint8_t digest[CC_MD5_DIGEST_LENGTH];
CC_MD5(cstr, (CC_LONG)strlen(cstr), digest);
NSMutableString *output = [NSMutableString stringWithCapacity:CC_MD5_DIGEST_LENGTH * 2];
for (int i = 0; i < CC_MD5_DIGEST_LENGTH; i++)
[output appendFormat:@"%02x", digest[i]];
return output;
}

+ (NSString*)trimURLSpacing:(NSString*)url {
if (!url || [url isEqual:[NSNull null]]) {
return nil;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ of this software and associated documentation files (the "Software"), to deal
#import <Foundation/Foundation.h>
#import "OneSignalAttachmentHandler.h"
#import "OneSignalNotificationCategoryController.h"
#import <OneSignalCore/OSMacros.h>

@interface DirectDownloadDelegate : NSObject <NSURLSessionDataDelegate> {
NSError* error;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ of this software and associated documentation files (the "Software"), to deal

#import <Foundation/Foundation.h>
#import "OneSignalExtensionRequests.h"
#import <OneSignalCore/OSMacros.h>

@implementation OSRequestReceiveReceipts

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
*/

#import <OneSignalCore/OneSignalCore.h>
#import <OneSignalCore/OSMacros.h>
#import <OneSignalOutcomes/OneSignalOutcomes.h>
#import "OneSignalNotificationServiceExtensionHandler.h"
#import "OneSignalExtensionBadgeHandler.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#import <Foundation/Foundation.h>
#import "OneSignalReceiveReceiptsController.h"
#import <OneSignalCore/OneSignalCore.h>
#import <OneSignalCore/OSMacros.h>
#import "OneSignalExtensionRequests.h"

@implementation OneSignalReceiveReceiptsController
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#import "OneSignalCommonDefines.h"
#import "OSMessagingController.h"
#import <OneSignalOutcomes/OneSignalOutcomes.h>
#import <OneSignalCore/OSMacros.h>
#import "OSSessionManager.h"

@interface OSDynamicTriggerController ()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

#import "OSInAppMessageController.h"
#import <OneSignalCore/OneSignalCore.h>
#import <OneSignalCore/OSMacros.h>
#import <OneSignalUser/OneSignalUser.h>
#import "OSInAppMessagingDefines.h"
#import "OSInAppMessagingRequests.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ of this software and associated documentation files (the "Software"), to deal
#import "OSInAppMessageMigrationController.h"
#import "OSInAppMessagingDefines.h"
#import "OSInAppMessageInternal.h"
#import <OneSignalCore/OSMacros.h>

@implementation OSInAppMessageMigrationController

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#import "UIApplication+OneSignal.h"
#import "NSDateFormatter+OneSignal.h"
#import <OneSignalCore/OneSignalCore.h>
#import <OneSignalCore/OSMacros.h>
#import "OSInAppMessageClickResult.h"
#import "OSInAppMessageClickEvent.h"
#import "OSInAppMessageController.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

#import "OSTriggerController.h"
#import "OSInAppMessagingDefines.h"
#import <OneSignalCore/OSMacros.h>

@interface OSTriggerController ()
@property (strong, nonatomic, nonnull) NSMutableDictionary<NSString *, id> *triggers;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

#import "OSInAppMessageBridgeEvent.h"
#import "OSInAppMessageClickResult.h"
#import <OneSignalCore/OSMacros.h>

@implementation OSInAppMessageBridgeEvent

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@


#import "OSInAppMessageClickEvent.h"
#import <OneSignalCore/OSMacros.h>

@implementation OSInAppMessageClickEvent

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#import "OSInAppMessageClickResult.h"
#import "OSInAppMessagePushPrompt.h"
#import "OSInAppMessageLocationPrompt.h"
#import <OneSignalCore/OSMacros.h>

@implementation OSInAppMessageClickResult

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
*/

#import "OSInAppMessageDisplayStats.h"
#import <OneSignalCore/OSMacros.h>

@interface OSInAppMessageDisplayStats ()
@property (nonatomic, readwrite) BOOL redisplayEnabled;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#import "OSInAppMessageInternal.h"
#import "NSDateFormatter+OneSignal.h"
#import "OneSignalCommonDefines.h"
#import <OneSignalCore/OSMacros.h>

@implementation OSInAppMessage

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#import "OSInAppMessageLocationPrompt.h"
#import <OneSignalLocation/OneSignalLocationManager.h>
#import <OneSignalCore/OneSignalLog.h>
#import <OneSignalCore/OSMacros.h>

//@interface OneSignalLocation ()
//
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#import "OSInAppMessagePushPrompt.h"
#import "OneSignalInAppMessages.h"
#import <OneSignalNotifications/OneSignalNotifications.h>
#import <OneSignalCore/OSMacros.h>

@implementation OSInAppMessagePushPrompt

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
*/

#import "OSInAppMessageTag.h"
#import <OneSignalCore/OSMacros.h>

@implementation OSInAppMessageTag

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
*/

#import "OSTrigger.h"
#import <OneSignalCore/OSMacros.h>

@implementation OSTrigger

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ of this software and associated documentation files (the "Software"), to deal
*/
#import <Foundation/Foundation.h>
#import "OSInAppMessagingRequests.h"
#import <OneSignalCore/OSMacros.h>

@implementation OSRequestGetInAppMessages
- (NSString *)description {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#import <WebKit/WebKit.h>
#import "OSInAppMessageClickResult.h"
#import <OneSignalUser/OneSignalUser.h>
#import <OneSignalCore/OSMacros.h>

@interface OSInAppMessageView () <UIScrollViewDelegate, WKUIDelegate, WKNavigationDelegate>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#import "OSInAppMessageController.h"
#import "OSInAppMessageBridgeEvent.h"
#import <OneSignalOutcomes/OneSignalOutcomes.h>
#import <OneSignalCore/OSMacros.h>
#import "OSSessionManager.h"

#define HIGHEST_CONSTRAINT_PRIORITY 999.0f
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#import <UIKit/UIKit.h>
#import "OneSignalWebView.h"
#import <OneSignalCore/OneSignalCore.h>

#import <OneSignalCore/OSMacros.h>

@implementation OneSignalWebView

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#import <CoreLocation/CoreLocation.h>
#import "OneSignalLocationManager.h"
#import <OneSignalCore/OneSignalCore.h>
#import <OneSignalCore/OSMacros.h>
#import <OneSignalUser/OneSignalUser-Swift.h>

@implementation OneSignalLocationManager
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
#import "SwizzlingForwarder.h"
#import "OSNotificationsManager.h"
#import <objc/runtime.h>
#import <OneSignalCore/OSMacros.h>

// This class hooks into the UIApplicationDelegate selectors to receive iOS 9 and older events.
// - UNUserNotificationCenter is used for iOS 10
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#import "UIApplicationDelegate+OneSignalNotifications.h"
#import "OSNotificationsManager.h"
#import <OneSignalCore/OneSignalCore.h>
#import <OneSignalCore/OSMacros.h>
#import <objc/runtime.h>
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wundeclared-selector"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ of this software and associated documentation files (the "Software"), to deal

#import "OSNotificationsManager.h"
#import <OneSignalCore/OneSignalCore.h>
#import <OneSignalCore/OSMacros.h>
#import <UIKit/UIKit.h>
#import <UserNotifications/UserNotifications.h>
#import "OSNotification+OneSignal.h"
Expand Down
1 change: 1 addition & 0 deletions iOS_SDK/OneSignalSDK/OneSignalNotifications/OSPermission.m
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

#import "OSPermission.h"
#import <OneSignalCore/OneSignalCore.h>
#import <OneSignalCore/OSMacros.h>
#import "OSNotificationsManager.h"

@implementation OSPermissionStateInternal
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
*/

#import "OSInAppMessageOutcome.h"
#import <OneSignalCore/OSMacros.h>

@implementation OSInAppMessageOutcome

Expand Down
Loading
Loading