diff --git a/README.md b/README.md index 4da55ff..d081075 100644 --- a/README.md +++ b/README.md @@ -76,18 +76,32 @@ Before setting up the Titanium SDK, you must generate the appropriate credential Ti.API.info(Ti.Platform.osname === "iphone"? e.results : JSON.parse(e.results)); }); ``` -1. Set External User ID (iOS-only for now): +1. Set External User ID: ```js onesignal.setExternalUserId('your_db_user_id'); ``` -1. Remove External User ID (iOS-only for now): +1. Remove External User ID: ```js onesignal.removeExternalUserId(); ``` -1. Get Permission Subscription State (iOS-only for now): - Useful to get user's playerId +1. Get if user is subscribed (Boolean): + + ```js + var subscribed = onesignal.retrieveSubscribed(); + ``` +1. Get One Signal Player ID (String): + + ```js + var res = onesignal.retrievePlayerId(); + ``` +1. Get One Signal Token (String): + + ```js + var token = onesignal.retrieveToken(); + ``` +1. Get Permission Subscription State (iOS-only for now): ```js var res = onesignal.getPermissionSubscriptionState(); diff --git a/android/lib/OneSignalSDK.jar b/android/lib/OneSignalSDK.jar old mode 100755 new mode 100644 index e309cda..6bfaea2 Binary files a/android/lib/OneSignalSDK.jar and b/android/lib/OneSignalSDK.jar differ diff --git a/android/src/com/williamrijksen/onesignal/ComWilliamrijksenOnesignalModule.java b/android/src/com/williamrijksen/onesignal/ComWilliamrijksenOnesignalModule.java index ff6e2d8..d7c6865 100644 --- a/android/src/com/williamrijksen/onesignal/ComWilliamrijksenOnesignalModule.java +++ b/android/src/com/williamrijksen/onesignal/ComWilliamrijksenOnesignalModule.java @@ -115,6 +115,28 @@ public String retrieveToken(){ return OneSignal.getPermissionSubscriptionState().getSubscriptionStatus().getPushToken(); } + @Kroll.method + public void setExternalUserId(String id) + { + OneSignal.setExternalUserId(id, new OneSignal.OSExternalUserIdUpdateCompletionHandler() { + @Override + public void onComplete(JSONObject results) { + Log.d(LCAT, "com.williamrijksen.onesignal Set external user id done with results: " + results.toString()); + } + }); + } + + @Kroll.method + public void removeExternalUserId() + { + OneSignal.removeExternalUserId(new OneSignal.OSExternalUserIdUpdateCompletionHandler() { + @Override + public void onComplete(JSONObject results) { + Log.d(LCAT, "com.williamrijksen.onesignal Remove external user id done with results: " + results.toString()); + } + }); + } + @Kroll.method public void setSubscription(boolean enable) { @@ -128,13 +150,6 @@ public void getTags(KrollFunction handler) OneSignal.getTags(new GetTagsHandler()); } - @Kroll.method - public void idsAvailable(KrollFunction handler) - { - idsAvailableCallback = handler; - OneSignal.idsAvailable(new IdsAvailableHandler()); - } - @Kroll.method public void setLogLevel(HashMap args) { diff --git a/ios/com.williamrijksen.onesignal.xcodeproj/project.pbxproj b/ios/com.williamrijksen.onesignal.xcodeproj/project.pbxproj index a250a2f..17791f3 100644 --- a/ios/com.williamrijksen.onesignal.xcodeproj/project.pbxproj +++ b/ios/com.williamrijksen.onesignal.xcodeproj/project.pbxproj @@ -28,7 +28,7 @@ 4ACB5A1C218C674B00DB9BB6 /* OneSignalModuleHelper.h in Headers */ = {isa = PBXBuildFile; fileRef = 4ACB5A1A218C674B00DB9BB6 /* OneSignalModuleHelper.h */; }; AA747D9F0F9514B9006C5449 /* ComWilliamrijksenOnesignal_Prefix.pch in Headers */ = {isa = PBXBuildFile; fileRef = AA747D9E0F9514B9006C5449 /* ComWilliamrijksenOnesignal_Prefix.pch */; }; AACBBE4A0F95108600F1A2B1 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AACBBE490F95108600F1A2B1 /* Foundation.framework */; }; - B31E84A024AB914B0062A08D /* OneSignal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B31E849F24AB914B0062A08D /* OneSignal.framework */; }; + B3937AC424ACF29B0050FD11 /* OneSignal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B3937AC324ACF29B0050FD11 /* OneSignal.framework */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -49,7 +49,7 @@ 4ACB5A1A218C674B00DB9BB6 /* OneSignalModuleHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OneSignalModuleHelper.h; path = Classes/OneSignalModuleHelper.h; sourceTree = ""; }; AA747D9E0F9514B9006C5449 /* ComWilliamrijksenOnesignal_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ComWilliamrijksenOnesignal_Prefix.pch; sourceTree = SOURCE_ROOT; }; AACBBE490F95108600F1A2B1 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; - B31E849F24AB914B0062A08D /* OneSignal.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OneSignal.framework; path = platform/OneSignal.framework; sourceTree = ""; }; + B3937AC324ACF29B0050FD11 /* OneSignal.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OneSignal.framework; path = platform/OneSignal.framework; sourceTree = ""; }; D2AAC07E0554694100DB518D /* libComWilliamrijksenOnesignal.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libComWilliamrijksenOnesignal.a; sourceTree = BUILT_PRODUCTS_DIR; }; /* End PBXFileReference section */ @@ -58,7 +58,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - B31E84A024AB914B0062A08D /* OneSignal.framework in Frameworks */, + B3937AC424ACF29B0050FD11 /* OneSignal.framework in Frameworks */, AACBBE4A0F95108600F1A2B1 /* Foundation.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; @@ -88,7 +88,7 @@ 0867D69AFE84028FC02AAC07 /* Frameworks */ = { isa = PBXGroup; children = ( - B31E849F24AB914B0062A08D /* OneSignal.framework */, + B3937AC324ACF29B0050FD11 /* OneSignal.framework */, AACBBE490F95108600F1A2B1 /* Foundation.framework */, ); name = Frameworks; diff --git a/ios/platform/OneSignal.framework/Headers b/ios/platform/OneSignal.framework/Headers new file mode 120000 index 0000000..d5ab97c --- /dev/null +++ b/ios/platform/OneSignal.framework/Headers @@ -0,0 +1 @@ +Versions/A/Headers \ No newline at end of file diff --git a/ios/platform/OneSignal.framework/Info.plist b/ios/platform/OneSignal.framework/Info.plist deleted file mode 100644 index 80fbb28..0000000 Binary files a/ios/platform/OneSignal.framework/Info.plist and /dev/null differ diff --git a/ios/platform/OneSignal.framework/Modules b/ios/platform/OneSignal.framework/Modules new file mode 120000 index 0000000..751d64f --- /dev/null +++ b/ios/platform/OneSignal.framework/Modules @@ -0,0 +1 @@ +Versions/A/Modules \ No newline at end of file diff --git a/ios/platform/OneSignal.framework/Resources b/ios/platform/OneSignal.framework/Resources new file mode 120000 index 0000000..186f014 --- /dev/null +++ b/ios/platform/OneSignal.framework/Resources @@ -0,0 +1 @@ +Versions/A/Resources \ No newline at end of file diff --git a/ios/platform/OneSignal.framework/Headers/OneSignal.h b/ios/platform/OneSignal.framework/Versions/A/Headers/OneSignal.h similarity index 90% rename from ios/platform/OneSignal.framework/Headers/OneSignal.h rename to ios/platform/OneSignal.framework/Versions/A/Headers/OneSignal.h index 8bed5da..af2001e 100755 --- a/ios/platform/OneSignal.framework/Headers/OneSignal.h +++ b/ios/platform/OneSignal.framework/Versions/A/Headers/OneSignal.h @@ -189,50 +189,20 @@ typedef NS_ENUM(NSUInteger, OSNotificationDisplayType) { @end; -@interface OSInAppMessageOutcome : NSObject - -@property (strong, nonatomic, nonnull) NSString *name; -@property (strong, nonatomic, nonnull) NSNumber *weight; -@property (nonatomic) BOOL unique; - -// Convert the class into a NSDictionary -- (NSDictionary *_Nonnull)jsonRepresentation; - -@end - -@interface OSInAppMessageTag : NSObject - -@property (strong, nonatomic, nullable) NSDictionary *tagsToAdd; -@property (strong, nonatomic, nullable) NSArray *tagsToRemove; - -// Convert the class into a NSDictionary -- (NSDictionary *_Nonnull)jsonRepresentation; - -@end - @interface OSInAppMessageAction : NSObject -// The action name attached to the IAM action +/* The action name attached to the IAM action */ @property (strong, nonatomic, nullable) NSString *clickName; -// The URL (if any) that should be opened when the action occurs +/* The URL (if any) that should be opened when the action occurs */ @property (strong, nonatomic, nullable) NSURL *clickUrl; -// Whether or not the click action is first click on the IAM +/* Whether or not the click action is first click on the IAM */ @property (nonatomic) BOOL firstClick; -// Whether or not the click action dismisses the message +/* Whether or not the click action dismisses the message */ @property (nonatomic) BOOL closesMessage; -// The outcome to send for this action -@property (strong, nonatomic, nullable) NSArray *outcomes; - -// The tags to send for this action -@property (strong, nonatomic, nullable) OSInAppMessageTag *tags; - -// Convert the class into a NSDictionary -- (NSDictionary *_Nonnull)jsonRepresentation; - @end @protocol OSInAppMessageDelegate @@ -365,48 +335,6 @@ typedef NS_ENUM(NSInteger, OSNotificationPermission) { @end -@interface OSDevice : NSObject -/** - * Get the app's notification permission - * @return false if the user disabled notifications for the app, otherwise true - */ -- (BOOL)isNotificationEnabled; -/** - * Get whether the user is subscribed to OneSignal notifications or not - * @return false if the user is not subscribed to OneSignal notifications, otherwise true - */ -- (BOOL)isUserSubscribed; -/** - * Get whether the user is subscribed - * @return true if isNotificationEnabled, isUserSubscribed, getUserId and getPushToken are true, otherwise false - */ -- (BOOL)isSubscribed; -/** - * Get the user notification permision status - * @return OSNotificationPermission -*/ -- (OSNotificationPermission)getNotificationPermissionStatus; -/** - * Get user id from registration (player id) - * @return user id if user is registered, otherwise false - */ -- (NSString*)getUserId; -/** - * Get apple deice push token - * @return push token if available, otherwise null - */ -- (NSString*)getPushToken; -/** - * Get the user email id - * @return email id if user address was registered, otherwise null - */ -- (NSString*)getEmailUserId; -/** - * Get the user email - * @return email address if set, otherwise null - */ -- (NSString*)getEmailAddress; -@end typedef void (^OSWebOpenURLResultBlock)(BOOL shouldOpen); @@ -523,7 +451,6 @@ typedef NS_ENUM(NSUInteger, ONE_S_LOG_LEVEL) { + (void)IdsAvailable:(OSIdsAvailableBlock)idsAvailableBlock __deprecated_msg("Please use getPermissionSubscriptionState or addSubscriptionObserver and addPermissionObserver instead."); + (OSPermissionSubscriptionState*)getPermissionSubscriptionState; -+ (OSDevice*)getUserDevice; + (void)addPermissionObserver:(NSObject*)observer; + (void)removePermissionObserver:(NSObject*)observer; diff --git a/ios/platform/OneSignal.framework/Modules/module.modulemap b/ios/platform/OneSignal.framework/Versions/A/Modules/module.modulemap similarity index 100% rename from ios/platform/OneSignal.framework/Modules/module.modulemap rename to ios/platform/OneSignal.framework/Versions/A/Modules/module.modulemap diff --git a/ios/platform/OneSignal.framework/Versions/A/OneSignal b/ios/platform/OneSignal.framework/Versions/A/OneSignal new file mode 100644 index 0000000..cad9639 Binary files /dev/null and b/ios/platform/OneSignal.framework/Versions/A/OneSignal differ diff --git a/ios/platform/OneSignal.framework/Versions/A/Resources/Info.plist b/ios/platform/OneSignal.framework/Versions/A/Resources/Info.plist new file mode 100644 index 0000000..3f4182e Binary files /dev/null and b/ios/platform/OneSignal.framework/Versions/A/Resources/Info.plist differ diff --git a/ios/platform/OneSignal.framework/Versions/Current b/ios/platform/OneSignal.framework/Versions/Current new file mode 120000 index 0000000..8c7e5a6 --- /dev/null +++ b/ios/platform/OneSignal.framework/Versions/Current @@ -0,0 +1 @@ +A \ No newline at end of file