Proyectos de Subversion Iphone Microlearning

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
/*
2
 * Copyright 2019 Google
3
 *
4
 * Licensed under the Apache License, Version 2.0 (the "License");
5
 * you may not use this file except in compliance with the License.
6
 * You may obtain a copy of the License at
7
 *
8
 *      http://www.apache.org/licenses/LICENSE-2.0
9
 *
10
 * Unless required by applicable law or agreed to in writing, software
11
 * distributed under the License is distributed on an "AS IS" BASIS,
12
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * See the License for the specific language governing permissions and
14
 * limitations under the License.
15
 */
16
 
17
#import <Foundation/Foundation.h>
18
 
19
typedef NS_ENUM(NSInteger, RCNDBSource) {
20
  RCNDBSourceActive,
21
  RCNDBSourceDefault,
22
  RCNDBSourceFetched,
23
};
24
 
25
@class RCNConfigDBManager;
26
 
27
/// This class handles all the config content that is fetched from the server, cached in local
28
/// config or persisted in database.
29
@interface RCNConfigContent : NSObject
30
/// Shared Singleton Instance
31
+ (instancetype)sharedInstance;
32
 
33
/// Fetched config (aka pending config) data that is latest data from server that might or might
34
/// not be applied.
35
@property(nonatomic, readonly, copy) NSDictionary *fetchedConfig;
36
/// Active config that is available to external users;
37
@property(nonatomic, readonly, copy) NSDictionary *activeConfig;
38
/// Local default config that is provided by external users;
39
@property(nonatomic, readonly, copy) NSDictionary *defaultConfig;
40
 
41
- (instancetype)init NS_UNAVAILABLE;
42
 
43
/// Designated initializer;
44
- (instancetype)initWithDBManager:(RCNConfigDBManager *)DBManager NS_DESIGNATED_INITIALIZER;
45
 
46
/// Returns true if initialization succeeded.
47
- (BOOL)initializationSuccessful;
48
 
49
/// Update config content from fetch response in JSON format.
50
- (void)updateConfigContentWithResponse:(NSDictionary *)response
51
                           forNamespace:(NSString *)FIRNamespace;
52
 
53
/// Copy from a given dictionary to one of the data source.
54
/// @param fromDictionary The data to copy from.
55
/// @param source       The data source to copy to(pending/active/default).
56
- (void)copyFromDictionary:(NSDictionary *)fromDictionary
57
                  toSource:(RCNDBSource)source
58
              forNamespace:(NSString *)FIRNamespace;
59
 
60
/// Sets the fetched Personalization metadata to active.
61
- (void)activatePersonalization;
62
 
63
/// Gets the active config and Personalization metadata.
64
- (NSDictionary *)getConfigAndMetadataForNamespace:(NSString *)FIRNamespace;
65
 
66
@end