Skip to content

Commit

Permalink
rename OneSignalCore class to not conflict with module name
Browse files Browse the repository at this point in the history
Named to OneSignalCoreImpl
  • Loading branch information
nan-li committed Mar 6, 2024
1 parent caf6dd9 commit aff4cf2
Show file tree
Hide file tree
Showing 15 changed files with 30 additions and 30 deletions.
2 changes: 1 addition & 1 deletion iOS_SDK/OneSignalSDK/OneSignalCore/Source/OneSignalCore.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
#import <OneSignalCore/OSLocation.h>

// TODO: Testing: Should this class be defined in this file?
@interface OneSignalCore : NSObject
@interface OneSignalCoreImpl : NSObject

+ (void)setSharedClient:(nonnull id<IOneSignalClient>)client;
+ (nonnull id<IOneSignalClient>)sharedClient;
Expand Down
2 changes: 1 addition & 1 deletion iOS_SDK/OneSignalSDK/OneSignalCore/Source/OneSignalCore.m
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#import <Foundation/Foundation.h>
#import "OneSignalCore.h"

@implementation OneSignalCore
@implementation OneSignalCoreImpl

static id<IOneSignalClient> _sharedClient;
+ (id<IOneSignalClient>)sharedClient {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ - (void)sendReceiveReceiptWithPlayerId:(nonnull NSString *)playerId
dispatch_time_t dispatchTime = dispatch_time(DISPATCH_TIME_NOW, delay * NSEC_PER_SEC);
dispatch_after(dispatchTime, dispatch_get_main_queue(), ^{
[OneSignalLog onesignalLog:ONE_S_LL_VERBOSE message:[NSString stringWithFormat:@"OneSignal sendReceiveReceiptWithPlayerId now sending confirmed delievery after: %i second delay", delay]];
[OneSignalCore.sharedClient executeRequest:request onSuccess:^(NSDictionary *result) {
[OneSignalCoreImpl.sharedClient executeRequest:request onSuccess:^(NSDictionary *result) {
if (success) {
success(result);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@ - (void)loadMessageHTMLContentWithResult:(OSResultSuccessBlock _Nullable)success

let request = [OSRequestLoadInAppMessageContent withAppId:[OneSignalConfigManager getAppId] withMessageId:self.messageId withVariantId:variantId];

[OneSignalCore.sharedClient executeRequest:request onSuccess:successBlock onFailure:failureBlock];
[OneSignalCoreImpl.sharedClient executeRequest:request onSuccess:successBlock onFailure:failureBlock];
}

- (void)loadPreviewMessageHTMLContentWithUUID:(NSString * _Nonnull)previewUUID success:(OSResultSuccessBlock _Nullable)successBlock failure:(OSFailureBlock _Nullable)failureBlock {
let request = [OSRequestLoadInAppMessagePreviewContent withAppId:[OneSignalConfigManager getAppId] previewUUID:previewUUID];

[OneSignalCore.sharedClient executeRequest:request onSuccess:successBlock onFailure:failureBlock];
[OneSignalCoreImpl.sharedClient executeRequest:request onSuccess:successBlock onFailure:failureBlock];
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ - (void)getInAppMessagesFromServer:(NSString *)subscriptionId {
}

OSRequestGetInAppMessages *request = [OSRequestGetInAppMessages withSubscriptionId:subscriptionId];
[OneSignalCore.sharedClient executeRequest:request onSuccess:^(NSDictionary *result) {
[OneSignalCoreImpl.sharedClient executeRequest:request onSuccess:^(NSDictionary *result) {
dispatch_async(dispatch_get_main_queue(), ^{
[OneSignalLog onesignalLog:ONE_S_LL_VERBOSE message:@"getInAppMessagesFromServer success"];
if (result[@"in_app_messages"]) { // when there are no IAMs, will this still be there?
Expand Down Expand Up @@ -510,7 +510,7 @@ - (void)messageViewPageImpressionRequest:(OSInAppMessageInternal *)message withP
withPageId:pageId
forVariantId:message.variantId];

[OneSignalCore.sharedClient executeRequest:metricsRequest
[OneSignalCoreImpl.sharedClient executeRequest:metricsRequest
onSuccess:^(NSDictionary *result) {
NSString *successMessage = [NSString stringWithFormat:@"In App Message with message id: %@ and page id: %@, successful POST page impression update with result: %@", message.messageId, pageId, result];
[OneSignalLog onesignalLog:ONE_S_LL_DEBUG message:successMessage];
Expand Down Expand Up @@ -549,7 +549,7 @@ - (void)messageViewImpressionRequest:(OSInAppMessageInternal *)message {
withMessageId:message.messageId
forVariantId:message.variantId];

[OneSignalCore.sharedClient executeRequest:metricsRequest
[OneSignalCoreImpl.sharedClient executeRequest:metricsRequest
onSuccess:^(NSDictionary *result) {
NSString *successMessage = [NSString stringWithFormat:@"In App Message with id: %@, successful POST impression update with result: %@", message.messageId, result];
[OneSignalLog onesignalLog:ONE_S_LL_DEBUG message:successMessage];
Expand Down Expand Up @@ -951,7 +951,7 @@ - (void)sendClickRESTCall:(OSInAppMessageInternal *)message withAction:(OSInAppM
forVariantId:message.variantId
withAction:action];

[OneSignalCore.sharedClient executeRequest:metricsRequest
[OneSignalCoreImpl.sharedClient executeRequest:metricsRequest
onSuccess:^(NSDictionary *result) {
NSString *successMessage = [NSString stringWithFormat:@"In App Message with id: %@, successful POST click update for click id: %@, with result: %@", message.messageId, action.clickId, result];
[OneSignalLog onesignalLog:ONE_S_LL_DEBUG message:successMessage];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -716,7 +716,7 @@ + (void)submitNotificationOpened:(NSString*)messageId {
NSString* lastMessageId = [standardUserDefaults getSavedStringForKey:OSUD_LAST_MESSAGE_OPENED defaultValue:nil];
//Only submit request if messageId not nil and: (lastMessage is nil or not equal to current one)
if(messageId && (!lastMessageId || ![lastMessageId isEqualToString:messageId])) {
[OneSignalCore.sharedClient executeRequest:[OSRequestSubmitNotificationOpened withUserId:[self pushSubscriptionId]
[OneSignalCoreImpl.sharedClient executeRequest:[OSRequestSubmitNotificationOpened withUserId:[self pushSubscriptionId]
appId:[OneSignalConfigManager getAppId]
wasOpened:YES
messageId:messageId
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ - (void)requestMeasureOutcomeEventWithAppId:(NSString *)appId
return;
}

[OneSignalCore.sharedClient executeRequest:request onSuccess:successBlock onFailure:failureBlock];
[OneSignalCoreImpl.sharedClient executeRequest:request onSuccess:successBlock onFailure:failureBlock];
}

@end
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ - (void)requestMeasureOutcomeEventWithAppId:(NSString *)appId
appId:appId
deviceType:deviceType];

[OneSignalCore.sharedClient executeRequest:request onSuccess:successBlock onFailure:failureBlock];
[OneSignalCoreImpl.sharedClient executeRequest:request onSuccess:successBlock onFailure:failureBlock];
}

@end
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ - (void)sendSessionEndOutcomes:(NSNumber * _Nonnull)timeElapsed
influenceParams:(NSArray<OSFocusInfluenceParam *> * _Nonnull)influenceParams
onSuccess:(OSResultSuccessBlock _Nonnull)successBlock
onFailure:(OSFailureBlock _Nonnull)failureBlock {
[OneSignalCore.sharedClient executeRequest:[OSRequestSendSessionEndOutcomes
[OneSignalCoreImpl.sharedClient executeRequest:[OSRequestSendSessionEndOutcomes
withActiveTime:timeElapsed
appId:appId
pushSubscriptionId:pushSubscriptionId
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ class OSIdentityOperationExecutor: OSOperationExecutor {
OSBackgroundTaskManager.beginBackgroundTask(backgroundTaskIdentifier)
}

OneSignalCore.sharedClient().execute(request) { _ in
OneSignalCoreImpl.sharedClient().execute(request) { _ in
// No hydration from response
// On success, remove request from cache
self.addRequestQueue.removeAll(where: { $0 == request})
Expand Down Expand Up @@ -234,7 +234,7 @@ class OSIdentityOperationExecutor: OSOperationExecutor {
OSBackgroundTaskManager.beginBackgroundTask(backgroundTaskIdentifier)
}

OneSignalCore.sharedClient().execute(request) { _ in
OneSignalCoreImpl.sharedClient().execute(request) { _ in
// There is nothing to hydrate
// On success, remove request from cache
self.removeRequestQueue.removeAll(where: { $0 == request})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ class OSPropertyOperationExecutor: OSOperationExecutor {
OSBackgroundTaskManager.beginBackgroundTask(backgroundTaskIdentifier)
}

OneSignalCore.sharedClient().execute(request) { _ in
OneSignalCoreImpl.sharedClient().execute(request) { _ in
// On success, remove request from cache, and we do need to hydrate
// TODO: We need to hydrate after all ? What why ?
self.dispatchQueue.async {
Expand Down Expand Up @@ -205,7 +205,7 @@ extension OSPropertyOperationExecutor {

if sendImmediately {
// Bypass the request queues
OneSignalCore.sharedClient().execute(request) { _ in
OneSignalCoreImpl.sharedClient().execute(request) { _ in
if let onSuccess = onSuccess {
onSuccess()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ class OSSubscriptionOperationExecutor: OSOperationExecutor {
}

OneSignalLog.onesignalLog(.LL_VERBOSE, message: "OSSubscriptionOperationExecutor: executeCreateSubscriptionRequest making request: \(request)")
OneSignalCore.sharedClient().execute(request) { result in
OneSignalCoreImpl.sharedClient().execute(request) { result in
// On success, remove request from cache (even if not hydrating model), and hydrate model
self.addRequestQueue.removeAll(where: { $0 == request})
OneSignalUserDefaults.initShared().saveCodeableData(forKey: OS_SUBSCRIPTION_EXECUTOR_ADD_REQUEST_QUEUE_KEY, withValue: self.addRequestQueue)
Expand Down Expand Up @@ -308,7 +308,7 @@ class OSSubscriptionOperationExecutor: OSOperationExecutor {

// This request can be executed as-is.
OneSignalLog.onesignalLog(.LL_VERBOSE, message: "OSSubscriptionOperationExecutor: executeDeleteSubscriptionRequest making request: \(request)")
OneSignalCore.sharedClient().execute(request) { _ in
OneSignalCoreImpl.sharedClient().execute(request) { _ in
// On success, remove request from cache. No model hydration occurs.
// For example, if app restarts and we read in operations between sending this off and getting the response
self.removeRequestQueue.removeAll(where: { $0 == request})
Expand Down Expand Up @@ -347,7 +347,7 @@ class OSSubscriptionOperationExecutor: OSOperationExecutor {
OSBackgroundTaskManager.beginBackgroundTask(backgroundTaskIdentifier)
}

OneSignalCore.sharedClient().execute(request) { _ in
OneSignalCoreImpl.sharedClient().execute(request) { _ in
// On success, remove request from cache. No model hydration occurs.
// For example, if app restarts and we read in operations between sending this off and getting the response
self.updateRequestQueue.removeAll(where: { $0 == request})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ class OSUserExecutor {
request.updatePushSubscriptionModel(pushSubscriptionModel)
}

OneSignalCore.sharedClient().execute(request) { response in
OneSignalCoreImpl.sharedClient().execute(request) { response in
removeFromQueue(request)

// TODO: Differentiate if we need to fetch the user based on response code of 200, 201, 202
Expand Down Expand Up @@ -263,7 +263,7 @@ class OSUserExecutor {
}
request.sentToClient = true

OneSignalCore.sharedClient().execute(request) { response in
OneSignalCoreImpl.sharedClient().execute(request) { response in
removeFromQueue(request)

if let identityObject = parseIdentityObjectResponse(response),
Expand Down Expand Up @@ -316,7 +316,7 @@ class OSUserExecutor {
}
request.sentToClient = true

OneSignalCore.sharedClient().execute(request) { _ in
OneSignalCoreImpl.sharedClient().execute(request) { _ in
removeFromQueue(request)

// the anonymous user has been identified, still need to Fetch User as we cleared local data
Expand Down Expand Up @@ -386,7 +386,7 @@ class OSUserExecutor {
return
}
request.sentToClient = true
OneSignalCore.sharedClient().execute(request) { _ in
OneSignalCoreImpl.sharedClient().execute(request) { _ in
removeFromQueue(request)

// TODO: ... hydrate with returned identity object?
Expand Down Expand Up @@ -422,7 +422,7 @@ class OSUserExecutor {
return
}
request.sentToClient = true
OneSignalCore.sharedClient().execute(request) { response in
OneSignalCoreImpl.sharedClient().execute(request) { response in
removeFromQueue(request)

if let response = response {
Expand Down
2 changes: 1 addition & 1 deletion iOS_SDK/OneSignalSDK/Source/OneSignal.m
Original file line number Diff line number Diff line change
Expand Up @@ -601,7 +601,7 @@ + (void)downloadIOSParamsWithAppId:(NSString *)appId {
// NSString *userId = OneSignalUserManagerImpl.sharedInstance.pushSubscriptionId;
NSString *userId = nil;

[OneSignalCore.sharedClient executeRequest:[OSRequestGetIosParams withUserId:userId appId:appId] onSuccess:^(NSDictionary *result) {
[OneSignalCoreImpl.sharedClient executeRequest:[OSRequestGetIosParams withUserId:userId appId:appId] onSuccess:^(NSDictionary *result) {

if (result[IOS_REQUIRES_USER_ID_AUTHENTICATION]) {
OneSignalUserManagerImpl.sharedInstance.requiresUserAuth = [result[IOS_REQUIRES_USER_ID_AUTHENTICATION] boolValue];
Expand Down
8 changes: 4 additions & 4 deletions iOS_SDK/OneSignalSDK/Source/OneSignalLiveActivityController.m
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ + (void)enterLiveActivity:(NSString * _Nonnull)activityId appId:(NSString *)appI
}

if(subscriptionId) {
[OneSignalCore.sharedClient executeRequest:[OSRequestLiveActivityEnter withSubscriptionId:subscriptionId appId:appId activityId:activityId token:token]
[OneSignalCoreImpl.sharedClient executeRequest:[OSRequestLiveActivityEnter withSubscriptionId:subscriptionId appId:appId activityId:activityId token:token]
onSuccess:^(NSDictionary *result) {
[self callSuccessBlockOnMainThread:successBlock withResult:result];
} onFailure:^(NSError *error) {
Expand Down Expand Up @@ -169,7 +169,7 @@ + (void)exitLiveActivity:(NSString * _Nonnull)activityId appId:(NSString *)appId
}

if(subscriptionId) {
[OneSignalCore.sharedClient executeRequest:[OSRequestLiveActivityExit withSubscriptionId:subscriptionId appId:appId activityId:activityId]
[OneSignalCoreImpl.sharedClient executeRequest:[OSRequestLiveActivityExit withSubscriptionId:subscriptionId appId:appId activityId:activityId]
onSuccess:^(NSDictionary *result) {
[self callSuccessBlockOnMainThread:successBlock withResult:result];
} onFailure:^(NSError *error) {
Expand Down Expand Up @@ -221,7 +221,7 @@ + (void)executePendingLiveActivityUpdates {
OSPendingLiveActivityUpdate * updateToProcess = [pendingLiveActivityUpdates objectAtIndex:0];
[pendingLiveActivityUpdates removeObjectAtIndex: 0];
if (updateToProcess.isEnter) {
[OneSignalCore.sharedClient executeRequest:[OSRequestLiveActivityEnter withSubscriptionId:subscriptionId appId:updateToProcess.appId activityId:updateToProcess.activityId token:updateToProcess.token]
[OneSignalCoreImpl.sharedClient executeRequest:[OSRequestLiveActivityEnter withSubscriptionId:subscriptionId appId:updateToProcess.appId activityId:updateToProcess.activityId token:updateToProcess.token]
onSuccess:^(NSDictionary *result) {
[self callSuccessBlockOnMainThread:updateToProcess.successBlock withResult:result];
[self executePendingLiveActivityUpdates];
Expand All @@ -230,7 +230,7 @@ + (void)executePendingLiveActivityUpdates {
[self executePendingLiveActivityUpdates];
}];
} else {
[OneSignalCore.sharedClient executeRequest:[OSRequestLiveActivityExit withSubscriptionId:subscriptionId appId:updateToProcess.appId activityId:updateToProcess.activityId]
[OneSignalCoreImpl.sharedClient executeRequest:[OSRequestLiveActivityExit withSubscriptionId:subscriptionId appId:updateToProcess.appId activityId:updateToProcess.activityId]
onSuccess:^(NSDictionary *result) {
[self callSuccessBlockOnMainThread:updateToProcess.successBlock withResult:result];
[self executePendingLiveActivityUpdates];
Expand Down

0 comments on commit aff4cf2

Please sign in to comment.