UAScheduleTrigger
Objective-C
@interface UAScheduleTrigger : NSObject <NSSecureCoding>
Swift
class ScheduleTrigger : NSObject, NSSecureCoding
Trigger defines a condition to execute actions or cancel a delayed execution of actions.
-
The trigger type.
Declaration
Objective-C
@property (nonatomic, readonly) UAScheduleTriggerType type;
Swift
var type: UAScheduleTriggerType { get }
-
The trigger’s goal. Once the goal is reached it will cause the schedule to execute its actions.
Declaration
Objective-C
@property (nonatomic, readonly) NSNumber *_Nonnull goal;
Swift
var goal: NSNumber { get }
-
Factory method to create an app init trigger.
Declaration
Objective-C
+ (nonnull instancetype)appInitTriggerWithCount:(NSUInteger)count;
Swift
class func appInitTrigger(withCount count: UInt) -> Self
Parameters
count
Number of foregrounds before firing the trigger.
Return Value
An app init trigger.
-
Factory method to create a foreground trigger.
Declaration
Objective-C
+ (nonnull instancetype)foregroundTriggerWithCount:(NSUInteger)count;
Swift
class func foregroundTrigger(withCount count: UInt) -> Self
Parameters
count
Number of foregrounds before firing the trigger.
Return Value
A foreground trigger.
-
Factory method to create a background trigger.
Declaration
Objective-C
+ (nonnull instancetype)backgroundTriggerWithCount:(NSUInteger)count;
Swift
class func backgroundTrigger(withCount count: UInt) -> Self
Parameters
count
Number of backgrounds before firing the trigger.
Return Value
A background trigger.
-
Factory method to create an active session trigger.
Declaration
Objective-C
+ (nonnull instancetype)activeSessionTriggerWithCount:(NSUInteger)count;
Swift
class func activeSessionTrigger(withCount count: UInt) -> Self
Parameters
count
Number of active sessions before firing the trigger.
Return Value
An active session trigger.
-
Factory method to create a region enter trigger.
Declaration
Objective-C
+ (nonnull instancetype)regionEnterTriggerForRegionID: (nonnull NSString *)regionID count:(NSUInteger)count;
Swift
class func regionEnter(forRegionID regionID: String, count: UInt) -> Self
Parameters
regionID
Source ID of the region.
count
Number of region enters before firing the trigger.
Return Value
A region enter trigger.
-
Factory method to create a region exit trigger.
Declaration
Objective-C
+ (nonnull instancetype)regionExitTriggerForRegionID: (nonnull NSString *)regionID count:(NSUInteger)count;
Swift
class func regionExitTrigger(forRegionID regionID: String, count: UInt) -> Self
Parameters
regionID
Source ID of the region.
count
Number of region exits before firing the trigger.
Return Value
A region exit trigger.
-
Factory method to create a screen trigger.
Declaration
Objective-C
+ (nonnull instancetype)screenTriggerForScreenName: (nonnull NSString *)screenName count:(NSUInteger)count;
Swift
class func screenTrigger(forScreenName screenName: String, count: UInt) -> Self
Parameters
screenName
Name of the screen.
count
Number of screen enters before firing the trigger.
Return Value
A screen trigger.
-
Factory method to create a custom event count trigger.
Declaration
Objective-C
+ (nonnull instancetype)customEventTriggerWithPredicate: (nonnull UAJSONPredicate *)predicate count:(NSUInteger)count;
Swift
class func customEventTrigger(with predicate: UAJSONPredicate, count: UInt) -> Self
Parameters
predicate
Custom event predicate to filter out events that are applied to the trigger’s count.
count
Number of custom event counts before firing the trigger.
Return Value
A custom event count trigger.
-
Factory method to create a custom event value trigger.
Declaration
Objective-C
+ (nonnull instancetype) customEventTriggerWithPredicate:(nonnull UAJSONPredicate *)predicate value:(nonnull NSNumber *)value;
Swift
class func customEventTrigger(with predicate: UAJSONPredicate, value: NSNumber) -> Self
Parameters
predicate
Custom event predicate to filter out events that are applied to the trigger’s value.
value
Aggregate custom event value before firing the trigger.
Return Value
A custom event value trigger.
-
Factory method to create a version trigger.
Declaration
Objective-C
+ (nonnull instancetype)versionTriggerWithConstraint: (nonnull NSString *)versionConstraint count:(NSUInteger)count;
Swift
class func versionTrigger(withConstraint versionConstraint: String, count: UInt) -> Self
Parameters
versionConstraint
A version constraint to match against the app version.
count
The number of updates to match before firing the trigger.
Return Value
A version trigger.
-
Factory method to create a trigger from a JSON payload.
Declaration
Objective-C
+ (nullable instancetype)triggerWithJSON:(nonnull id)json error:(NSError *_Nullable *_Nullable)error;
Swift
convenience init(json: Any) throws
Parameters
json
The JSON payload.
error
An NSError pointer for storing errors, if applicable.
Return Value
A trigger or
nil
if the JSON is invalid.
-
Checks if the trigger is equal to another trigger.
Declaration
Objective-C
- (BOOL)isEqualToTrigger:(nullable UAScheduleTrigger *)trigger;
Swift
func isEqual(to trigger: ScheduleTrigger?) -> Bool
Parameters
trigger
The other trigger info to compare against.
Return Value
YES
if the triggers are equal, otherwiseNO
.