Skip to content

Commit

Permalink
Updates README with new methods for both Android and iOS
Browse files Browse the repository at this point in the history
Updates Android SDK to 3.15.1
Adds "setExternalUserId" and "removeExternalUserId" methods on Android as well
Removes deprecated "idsAvailable" method from Android module
Uses iOS One Signal SDK from GitHub Release instead of Carthage
  • Loading branch information
chmiiller committed Jul 1, 2020
1 parent 03f7714 commit 55be73b
Show file tree
Hide file tree
Showing 13 changed files with 52 additions and 92 deletions.
22 changes: 18 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Binary file modified android/lib/OneSignalSDK.jar
100755 → 100644
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand All @@ -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)
{
Expand Down
8 changes: 4 additions & 4 deletions ios/com.williamrijksen.onesignal.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand All @@ -49,7 +49,7 @@
4ACB5A1A218C674B00DB9BB6 /* OneSignalModuleHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OneSignalModuleHelper.h; path = Classes/OneSignalModuleHelper.h; sourceTree = "<group>"; };
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 = "<group>"; };
B3937AC324ACF29B0050FD11 /* OneSignal.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OneSignal.framework; path = platform/OneSignal.framework; sourceTree = "<group>"; };
D2AAC07E0554694100DB518D /* libComWilliamrijksenOnesignal.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libComWilliamrijksenOnesignal.a; sourceTree = BUILT_PRODUCTS_DIR; };
/* End PBXFileReference section */

Expand All @@ -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;
Expand Down Expand Up @@ -88,7 +88,7 @@
0867D69AFE84028FC02AAC07 /* Frameworks */ = {
isa = PBXGroup;
children = (
B31E849F24AB914B0062A08D /* OneSignal.framework */,
B3937AC324ACF29B0050FD11 /* OneSignal.framework */,
AACBBE490F95108600F1A2B1 /* Foundation.framework */,
);
name = Frameworks;
Expand Down
1 change: 1 addition & 0 deletions ios/platform/OneSignal.framework/Headers
Binary file removed ios/platform/OneSignal.framework/Info.plist
Binary file not shown.
1 change: 1 addition & 0 deletions ios/platform/OneSignal.framework/Modules
1 change: 1 addition & 0 deletions ios/platform/OneSignal.framework/Resources
Original file line number Diff line number Diff line change
Expand Up @@ -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<OSInAppMessageOutcome *> *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 <NSObject>
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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<OSPermissionObserver>*)observer;
+ (void)removePermissionObserver:(NSObject<OSPermissionObserver>*)observer;
Expand Down
Binary file not shown.
Binary file not shown.
1 change: 1 addition & 0 deletions ios/platform/OneSignal.framework/Versions/Current

0 comments on commit 55be73b

Please sign in to comment.