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
4 changes: 2 additions & 2 deletions iOS_SDK/OneSignalSDK/OneSignalNotifications/OSPermission.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ typedef NS_ENUM(NSInteger, OSNotificationPermission) {
@property (readonly, nonatomic) BOOL provisional;
@property (readonly, nonatomic) BOOL providesAppNotificationSettings;
@property (readonly, nonatomic) OSNotificationPermission status;
- (NSDictionary* _Nonnull)toDictionary;
- (NSDictionary * _Nonnull)jsonRepresentation;
- (instancetype _Nonnull )initWithStatus:(OSNotificationPermission)status reachable:(BOOL)reachable hasPrompted:(BOOL)hasPrompted provisional:(BOOL)provisional providesAppNotificationSettings:(BOOL)providesAppNotificationSettings;
@end

Expand Down Expand Up @@ -96,7 +96,7 @@ typedef OSObservable<NSObject<OSPermissionStateObserver>*, OSPermissionState*> O

@property (readonly, nonnull) OSPermissionState* to;
@property (readonly, nonnull) OSPermissionState* from;
- (NSDictionary* _Nonnull)toDictionary;
- (NSDictionary * _Nonnull)jsonRepresentation;
- (instancetype _Nonnull)initAsTo:(OSPermissionState * _Nonnull)to from:(OSPermissionState * _Nonnull)from;
@end

Expand Down
6 changes: 3 additions & 3 deletions iOS_SDK/OneSignalSDK/OneSignalNotifications/OSPermission.m
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ - (NSString*)description {
return [NSString stringWithFormat:format, self.hasPrompted, self.statusAsString, self.provisional];
}

- (NSDictionary*)toDictionary {
- (NSDictionary*)jsonRepresentation {
return @{@"hasPrompted": @(self.hasPrompted),
@"status": @(self.status),
@"provisional" : @(self.provisional)};
Expand Down Expand Up @@ -250,8 +250,8 @@ - (NSString*)description {
return [NSString stringWithFormat:format, _from, _to];
}

- (NSDictionary*)toDictionary {
return @{@"from": [_from toDictionary], @"to": [_to toDictionary]};
- (NSDictionary*)jsonRepresentation {
return @{@"from": [_from jsonRepresentation], @"to": [_to jsonRepresentation]};
}

- (instancetype)initAsTo:(OSPermissionState *)to from:(OSPermissionState *)from {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ struct OSPropertiesDeltas {
let amountSpent: NSNumber?
let purchases: [[String: AnyObject]]?

func toDictionary() -> [String: Any] {
func jsonRepresentation() -> [String: Any] {
var deltas = [String: Any]()
deltas["session_count"] = sessionCount
deltas["session_time"] = sessionTime?.intValue // server expects an int
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ extension OSPropertyOperationExecutor {

let request = OSRequestUpdateProperties(
properties: [:],
deltas: propertiesDeltas.toDictionary(),
deltas: propertiesDeltas.jsonRepresentation(),
refreshDeviceMetadata: refreshDeviceMetadata,
modelToUpdate: propertiesModel,
identityModel: identityModel)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public class OSPushSubscriptionState: NSObject {
self.optedIn = optedIn
}

@objc public func toDictionary() -> NSDictionary {
@objc public func jsonRepresentation() -> NSDictionary {
let id = self.id ?? "nil"
let token = self.token ?? "nil"
return [
Expand All @@ -77,8 +77,8 @@ public class OSPushSubscriptionStateChanges: NSObject {
self.from = from
}

@objc public func toDictionary() -> NSDictionary {
return ["from": from.toDictionary(), "to": to.toDictionary()]
@objc public func jsonRepresentation() -> NSDictionary {
return ["from": from.jsonRepresentation(), "to": to.jsonRepresentation()]
}
}

Expand Down Expand Up @@ -353,7 +353,7 @@ extension OSSubscriptionModel {
let stateChanges = OSPushSubscriptionStateChanges(to: newSubscriptionState, from: prevSubscriptionState)

// TODO: Don't fire observer until server is udated
OneSignalLog.onesignalLog(.LL_VERBOSE, message: "firePushSubscriptionChanged from \(prevSubscriptionState.toDictionary()) to \(newSubscriptionState.toDictionary())")
OneSignalLog.onesignalLog(.LL_VERBOSE, message: "firePushSubscriptionChanged from \(prevSubscriptionState.jsonRepresentation()) to \(newSubscriptionState.jsonRepresentation())")
OneSignalUserManagerImpl.sharedInstance.pushSubscriptionStateChangesObserver.notifyChange(stateChanges)
}
}