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
3 changes: 1 addition & 2 deletions iOS_SDK/OneSignalDevApp/OneSignalDevApp/AppDelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@
#import <UIKit/UIKit.h>
#import <OneSignalFramework/OneSignalFramework.h>

// TODO: Add subscription observer
@interface AppDelegate : UIResponder <UIApplicationDelegate, OSPermissionObserver, OSInAppMessageLifecycleHandler>
@interface AppDelegate : UIResponder <UIApplicationDelegate, OSPermissionObserver, OSInAppMessageLifecycleHandler, OSPushSubscriptionObserver>

@property (strong, nonatomic) UIWindow *window;

Expand Down
21 changes: 13 additions & 8 deletions iOS_SDK/OneSignalDevApp/OneSignalDevApp/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,15 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
// [FIRApp configure];

NSLog(@"Bundle URL: %@", [[NSBundle mainBundle] bundleURL]);
[OneSignal.Debug setLogLevel:ONE_S_LL_VERBOSE];
[OneSignal.Debug setVisualLevel:ONE_S_LL_NONE];

[OneSignal initialize:[AppDelegate getOneSignalAppId] withLaunchOptions:launchOptions];

[OneSignal.Debug setLogLevel:ONE_S_LL_VERBOSE];
[OneSignal.Debug setVisualLevel:ONE_S_LL_NONE];
_notificationDelegate = [OneSignalNotificationCenterDelegate new];

id openNotificationHandler = ^(OSNotificationOpenedResult *result) {
// TODO: opened handler Not triggered
NSLog(@"OSNotificationOpenedResult: %@", result.action);
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated"
Expand Down Expand Up @@ -94,6 +95,11 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
[OneSignal.Notifications setNotificationWillShowInForegroundHandler:notificationReceiverBlock];
[OneSignal.Notifications setNotificationOpenedHandler:openNotificationHandler];

OSPushSubscriptionState* state = [OneSignal.User.pushSubscription addObserver:self];
NSLog(@"OneSignal Demo App push subscription observer added, current state: %@", state);

[OneSignal.Notifications addPermissionObserver:self];

NSLog(@"UNUserNotificationCenter.delegate: %@", UNUserNotificationCenter.currentNotificationCenter.delegate);

return YES;
Expand All @@ -120,12 +126,11 @@ - (void) onOSPermissionChanged:(OSPermissionStateChanges*)stateChanges {
NSLog(@"onOSPermissionChanged: %@", stateChanges);
}

// TODO: Add push sub observer
//- (void) onOSSubscriptionChanged:(OSSubscriptionStateChanges*)stateChanges {
// NSLog(@"onOSSubscriptionChanged: %@", stateChanges);
// ViewController* mainController = (ViewController*) self.window.rootViewController;
// mainController.subscriptionSegmentedControl.selectedSegmentIndex = (NSInteger) stateChanges.to.isSubscribed;
//}
- (void)onOSPushSubscriptionChangedWithStateChanges:(OSPushSubscriptionStateChanges *)stateChanges {
NSLog(@"onOSPushSubscriptionChangedWithStateChanges: %@", stateChanges);
ViewController* mainController = (ViewController*) self.window.rootViewController;
mainController.subscriptionSegmentedControl.selectedSegmentIndex = (NSInteger) stateChanges.to.optedIn;
}

#pragma mark OSInAppMessageDelegate

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
<constraint firstAttribute="width" constant="68" id="com-ja-CVD"/>
</constraints>
<color key="tintColor" red="1" green="0.1367101157" blue="0.01701983743" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<state key="normal" title="Get Tags"/>
<state key="normal" title="INFO"/>
<connections>
<action selector="getTagsButton:" destination="BYZ-38-t0r" eventType="touchUpInside" id="Pp8-oA-Zrh"/>
</connections>
Expand Down Expand Up @@ -298,7 +298,7 @@
<rect key="frame" x="118" y="581" width="136" height="30"/>
<fontDescription key="fontDescription" name=".AppleSystemUIFont" family=".AppleSystemUIFont" pointSize="15"/>
<color key="tintColor" red="1" green="0.1367101157" blue="0.01701983743" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<state key="normal" title="Set External User Id"/>
<state key="normal" title="Login to External User Id"/>
<connections>
<action selector="setExternalUserId:" destination="BYZ-38-t0r" eventType="touchUpInside" id="DXf-1K-Lkc"/>
</connections>
Expand Down Expand Up @@ -374,11 +374,11 @@
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits"/>
</textField>
<button opaque="NO" contentMode="scaleToFill" ambiguous="YES" misplaced="YES" selected="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="OiG-L7-Ot2" userLabel="Remove External User Id">
<button opaque="NO" contentMode="scaleToFill" ambiguous="YES" misplaced="YES" selected="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="OiG-L7-Ot2" userLabel="Logout">
<rect key="frame" x="103" y="619" width="168" height="30"/>
<fontDescription key="fontDescription" name=".AppleSystemUIFont" family=".AppleSystemUIFont" pointSize="15"/>
<color key="tintColor" red="1" green="0.1367101157" blue="0.01701983743" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<state key="normal" title="Remove External User Id"/>
<state key="normal" title="Logout"/>
<connections>
<action selector="removeExternalUserId:" destination="BYZ-38-t0r" eventType="touchUpInside" id="F3N-HQ-tSv"/>
</connections>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</array>
<key>com.apple.security.application-groups</key>
<array>
<string>group.com.onesignal.example.onesignal</string>
<string>group.com.onesignal.example.staging.onesignal</string>
</array>
</dict>
</plist>
7 changes: 5 additions & 2 deletions iOS_SDK/OneSignalDevApp/OneSignalDevApp/ViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -164,11 +164,14 @@ - (void)handleMessageAction:(NSString *)actionId {
}

- (IBAction)setExternalUserId:(UIButton *)sender {
NSLog(@"setExternalUserId is no longer supported. Please use login or addAlias.");
NSString* externalUserId = self.externalUserIdTextField.text;
NSLog(@"Dev App: Logging in to external user ID %@", externalUserId);
[OneSignal login:externalUserId];
}

- (IBAction)removeExternalUserId:(UIButton *)sender {
NSLog(@"setExternalUserId is no longer supported. Please use logout or removeAlias.");
NSLog(@"Dev App: Logout called.");
[OneSignal logout];
}

#pragma mark UITextFieldDelegate Methods
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</array>
<key>com.apple.developer.parent-application-identifiers</key>
<array>
<string>$(AppIdentifierPrefix)com.onesignal.example</string>
<string>$(AppIdentifierPrefix)com.onesignal.example.staging</string>
</array>
</dict>
</plist>
Original file line number Diff line number Diff line change
Expand Up @@ -745,7 +745,7 @@
);
MARKETING_VERSION = 1.4.4;
OTHER_LDFLAGS = "-ObjC";
PRODUCT_BUNDLE_IDENTIFIER = com.onesignal.example;
PRODUCT_BUNDLE_IDENTIFIER = com.onesignal.example.staging;
PRODUCT_NAME = OneSignalExample;
SUPPORTS_MACCATALYST = YES;
SWIFT_OBJC_BRIDGING_HEADER = "OneSignalDevApp/OneSignalExample-Bridging-Header.h";
Expand Down Expand Up @@ -776,7 +776,7 @@
);
MARKETING_VERSION = 1.4.4;
OTHER_LDFLAGS = "-ObjC";
PRODUCT_BUNDLE_IDENTIFIER = com.onesignal.example;
PRODUCT_BUNDLE_IDENTIFIER = com.onesignal.example.staging;
PRODUCT_NAME = OneSignalExample;
SUPPORTS_MACCATALYST = YES;
SWIFT_OBJC_BRIDGING_HEADER = "OneSignalDevApp/OneSignalExample-Bridging-Header.h";
Expand Down Expand Up @@ -804,7 +804,7 @@
);
MARKETING_VERSION = 1.4.4;
OTHER_LDFLAGS = "-ObjC";
PRODUCT_BUNDLE_IDENTIFIER = com.onesignal.example.OneSignalNotificationServiceExtensionA;
PRODUCT_BUNDLE_IDENTIFIER = com.onesignal.example.staging.OneSignalNotificationServiceExtensionA;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SUPPORTS_MACCATALYST = YES;
Expand Down Expand Up @@ -832,7 +832,7 @@
);
MARKETING_VERSION = 1.4.4;
OTHER_LDFLAGS = "-ObjC";
PRODUCT_BUNDLE_IDENTIFIER = com.onesignal.example.OneSignalNotificationServiceExtensionA;
PRODUCT_BUNDLE_IDENTIFIER = com.onesignal.example.staging.OneSignalNotificationServiceExtensionA;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SUPPORTS_MACCATALYST = YES;
Expand Down Expand Up @@ -877,7 +877,7 @@
MARKETING_VERSION = 1.4.4;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = com.onesignal.example.Clip;
PRODUCT_BUNDLE_IDENTIFIER = com.onesignal.example.staging.Clip;
PRODUCT_NAME = OneSignalExampleClip;
TARGETED_DEVICE_FAMILY = "1,2";
};
Expand Down Expand Up @@ -915,7 +915,7 @@
);
MARKETING_VERSION = 1.4.4;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = com.onesignal.example.Clip;
PRODUCT_BUNDLE_IDENTIFIER = com.onesignal.example.staging.Clip;
PRODUCT_NAME = OneSignalExampleClip;
TARGETED_DEVICE_FAMILY = "1,2";
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<dict>
<key>com.apple.security.application-groups</key>
<array>
<string>group.com.onesignal.example.onesignal</string>
<string>group.com.onesignal.example.staging.onesignal</string>
</array>
</dict>
</plist>
64 changes: 0 additions & 64 deletions iOS_SDK/OneSignalSDK/OneSignalCore/Source/API/OSRequests.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,6 @@

NS_ASSUME_NONNULL_BEGIN

@interface OSRequestGetTags : OneSignalRequest
+ (instancetype)withUserId:(NSString *)userId appId:(NSString *)appId;
@end

@interface OSRequestGetIosParams : OneSignalRequest
+ (instancetype)withUserId:(NSString *)userId appId:(NSString *)appId;
@end
Expand All @@ -45,72 +41,12 @@ NS_ASSUME_NONNULL_BEGIN
+ (instancetype)withAppId:(NSString *)appId withJson:(NSMutableDictionary *)json;
@end

@interface OSRequestUpdateNotificationTypes : OneSignalRequest
+ (instancetype)withUserId:(NSString *)userId appId:(NSString *)appId notificationTypes:(NSNumber *)notificationTypes;
@end

@interface OSRequestSendPurchases : OneSignalRequest
+ (instancetype)withUserId:(NSString *)userId externalIdAuthToken:(NSString * _Nullable)externalIdAuthToken appId:(NSString *)appId withPurchases:(NSArray *)purchases;
+ (instancetype)withUserId:(NSString *)userId emailAuthToken:(NSString *)emailAuthToken appId:(NSString *)appId withPurchases:(NSArray *)purchases;
@end

@interface OSRequestSubmitNotificationOpened : OneSignalRequest
+ (instancetype)withUserId:(NSString *)userId appId:(NSString *)appId wasOpened:(BOOL)opened messageId:(NSString *)messageId withDeviceType:(NSNumber *)deviceType;
@end

@interface OSRequestSyncHashedEmail : OneSignalRequest
+ (instancetype)withUserId:(NSString *)userId appId:(NSString *)appId email:(NSString *)email networkType:(NSNumber *)netType;
@end

NS_ASSUME_NONNULL_END

@interface OSRequestRegisterUser : OneSignalRequest
+ (instancetype _Nonnull)withData:(NSDictionary * _Nonnull)registrationData userId:(NSString * _Nullable)userId;
@end

@interface OSRequestCreateDevice : OneSignalRequest
+ (instancetype _Nonnull)withAppId:(NSString * _Nonnull)appId withDeviceType:(NSNumber * _Nonnull)deviceType withEmail:(NSString * _Nullable)email withPlayerId:(NSString * _Nullable)playerId withEmailAuthHash:(NSString * _Nullable)emailAuthHash withExternalUserId:(NSString * _Nullable)externalUserId withExternalIdAuthToken:(NSString * _Nullable)externalIdAuthToken;

+ (instancetype _Nonnull)withAppId:(NSString * _Nonnull)appId withDeviceType:(NSNumber * _Nonnull)deviceType withSMSNumber:(NSString * _Nullable)smsNumber withPlayerId:(NSString * _Nullable)playerId withSMSAuthHash:(NSString * _Nullable)smsAuthHash withExternalUserId:(NSString * _Nullable)externalUserId withExternalIdAuthToken:(NSString * _Nullable)externalIdAuthToken;
@end

@interface OSRequestLogoutEmail : OneSignalRequest
+ (instancetype _Nonnull)withAppId:(NSString * _Nonnull)appId emailPlayerId:(NSString * _Nonnull)emailPlayerId devicePlayerId:(NSString * _Nonnull)devicePlayerId emailAuthHash:(NSString * _Nullable)emailAuthHash;
@end

@interface OSRequestLogoutSMS : OneSignalRequest
+ (instancetype _Nonnull)withAppId:(NSString * _Nonnull)appId smsPlayerId:(NSString * _Nonnull)smsPlayerId smsAuthHash:(NSString * _Nullable)smsAuthHash devicePlayerId:(NSString * _Nonnull)devicePlayerId;
@end

@interface OSRequestSendTagsToServer : OneSignalRequest
+ (instancetype _Nonnull)withUserId:(NSString * _Nonnull)userId appId:(NSString * _Nonnull)appId tags:(NSDictionary * _Nonnull)tags networkType:(NSNumber * _Nonnull)netType withEmailAuthHashToken:(NSString * _Nullable)emailAuthToken withExternalIdAuthHashToken:(NSString * _Nullable)externalIdAuthToken;

+ (instancetype _Nonnull)withUserId:(NSString * _Nonnull)userId appId:(NSString * _Nonnull)appId tags:(NSDictionary * _Nonnull)tags networkType:(NSNumber * _Nonnull)netType withSMSAuthHashToken:(NSString * _Nullable)smsAuthToken withExternalIdAuthHashToken:(NSString * _Nullable)externalIdAuthToken;
@end

@interface OSRequestUpdateLanguage : OneSignalRequest
+ (instancetype _Nonnull)withUserId:(NSString * _Nonnull)userId
appId:(NSString * _Nonnull)appId
language:(NSString * _Nonnull)language
emailAuthToken:(NSString * _Nullable)emailAuthHash
externalIdAuthToken:(NSString * _Nullable)externalIdAuthToken;

+ (instancetype _Nonnull)withUserId:(NSString * _Nonnull)userId
appId:(NSString * _Nonnull)appId
language:(NSString * _Nonnull)language
smsAuthToken:(NSString * _Nullable)smsAuthToken
externalIdAuthToken:(NSString * _Nullable)externalIdAuthToken;
@end

@interface OSRequestUpdateExternalUserId : OneSignalRequest
+ (instancetype _Nonnull)withUserId:(NSString * _Nullable)externalId withUserIdHashToken:(NSString * _Nullable)hashToken withOneSignalUserId:(NSString * _Nonnull)userId appId:(NSString * _Nonnull)appId;

+ (instancetype _Nonnull)withUserId:(NSString * _Nullable)externalId withUserIdHashToken:(NSString * _Nullable)hashToken withOneSignalUserId:(NSString * _Nonnull)userId withEmailHashToken:(NSString * _Nullable)emailHashToken appId:(NSString * _Nonnull)appId;

+ (instancetype _Nonnull)withUserId:(NSString * _Nullable)externalId withUserIdHashToken:(NSString * _Nullable)hashToken withOneSignalUserId:(NSString * _Nonnull)userId withSMSHashToken:(NSString * _Nullable)smsHashToken appId:(NSString * _Nonnull)appId;
@end


@interface OSRequestTrackV1 : OneSignalRequest
+ (instancetype _Nonnull)trackUsageData:(NSString * _Nonnull)osUsageData
appId:(NSString * _Nonnull)appId;
Expand Down
Loading