2 * Copyright (c) 2017 Apple Inc. All Rights Reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
21 * @APPLE_LICENSE_HEADER_END@
26 #import <Foundation/Foundation.h>
28 typedef NS_ENUM(uint32_t, SFBehaviorRamping
) {
29 SFBehaviorRampingDisabled
= 0, /* must not be enabled */
30 SFBehaviorRampingEnabled
= 1, /* unconditionally enabled */
31 SFBehaviorRampingPromoted
= 2, /* should be promoted by application */
32 SFBehaviorRampingVisible
= 3, /* allowed to enabled */
35 @interface SFBehavior
: NSObject
37 + (SFBehavior
*)behaviorFamily
:(NSString
*)family
;
38 - (instancetype
)init NS_UNAVAILABLE
;
41 * Ramping control controlled by CloudKit and configuration
43 * Return the current ramping state, can be called as often as clients want, state is cached
44 * and fetched in background (returning SFBehaviorRampingDisabled) until server changes the value.
46 * Ramping always go from Disable -> Visiable -> Promoted -> Enabled, can can skip over steps in-between.
48 * The feature can also go from { Visiable, Promoted, Enabled } -> Disabled if the feature is disabled
50 * Passing in force will for fetching the value from the server and bypass all caching, this will
51 * take its sweet time, so don't block UI on this operation, using force is not recommended.
53 - (SFBehaviorRamping
)ramping
:(NSString
*)feature force
:(bool)force
;
56 * This feature is assumed to be enabled unless disabled by configuration.
58 - (bool)featureEnabled
:(NSString
*)feature
;
60 * This feature is assumed to be disabled unless enabled by configuration.
62 - (bool)featureDisabled
:(NSString
*)feature
;
65 * Fetch configuration values that might be changed from server configuration
67 - (NSNumber
*)configurationNumber
:(NSString
*)configuration defaultValue
:(NSNumber
*)defaultValue
;
68 - (NSString
*)configurationString
:(NSString
*)configuration defaultValue
:(NSString
*)defaultValue
;