internal static OSSubscriptionStateChanges ParseOSSubscriptionStateChanges(IOneSignalPlatform platform, string stateChangesJSONString) { var stateChangesJson = Json.Deserialize(stateChangesJSONString) as Dictionary <string, object>; var permissionStateChanges = new OSSubscriptionStateChanges(); permissionStateChanges.to = platform.ParseOSSubscriptionState(stateChangesJson["to"]); permissionStateChanges.from = platform.ParseOSSubscriptionState(stateChangesJson["from"]); return(permissionStateChanges); }
internal static OSPermissionSubscriptionState ParsePermissionSubscriptionState(IOneSignalPlatform platform, string jsonStr) { var stateDict = Json.Deserialize(jsonStr) as Dictionary <string, object>; var state = new OSPermissionSubscriptionState(); state.permissionStatus = platform.ParseOSPermissionState(stateDict["permissionStatus"]); state.subscriptionStatus = platform.ParseOSSubscriptionState(stateDict["subscriptionStatus"]); if (stateDict.ContainsKey("emailSubscriptionStatus")) { state.emailSubscriptionStatus = platform.ParseOSEmailSubscriptionState(stateDict["emailSubscriptionStatus"]); } return(state); }