11
11
12
12
NS_ASSUME_NONNULL_BEGIN
13
13
14
- typedef NS_ENUM (NSUInteger , QBConnectionZoneType) {
15
-
16
- QBConnectionZoneTypeAutomatic = 1 , // Default. Endpoints are loaded from QuickBlox
17
- QBConnectionZoneTypeProduction = 2 ,
18
- QBConnectionZoneTypeDevelopment = 3 ,
19
- QBConnectionZoneTypeStage = 4
20
- };
21
-
22
14
/* *
23
- * QBSettings class interface.
24
- * Class for framework setup.
15
+ QBSettings class interface.
16
+ Class for framework setup.
25
17
*/
26
18
@interface QBSettings : NSObject
27
19
28
- /* *
29
- * Allows to set api endpoint and chat endpoint for service zone.
30
- *
31
- * @note QBConnectionZoneTypeAutomatic is used by default.
32
- * If you are using shared server and you are migrating to enterprise account,
33
- * then you don't need to resubmit your application, endpoints will be updated automatically.
34
-
35
- * To set custom endpoints use QBConnectionZoneTypeProduction or QBConnectionZoneTypeDevelopment service zone.
36
- * Then you should manually activate your service zone by calling setServiceZone:
37
- *
38
- * @param apiEndpoint apiEndpoint - Endpoint for service i.e. http://my_custom_endpoint.com. Possible to pass nil to return to default settings
39
- * @param chatEndpoint chat endpoint
40
- * @param zone QBConnectionZoneType - service zone
41
- */
42
- + (void )setApiEndpoint : (nullable NSString *)apiEndpoint chatEndpoint : (nullable NSString *)chatEndpoint forServiceZone : (QBConnectionZoneType)zone ;
20
+ /* * Storing Application ID */
21
+ @property (nonatomic , class ) NSUInteger applicationID;
22
+ /* * Setting API Key for Quickblox API */
23
+ @property (nonatomic , class , nullable ) NSString *authKey;
43
24
44
- // MARK: - Chat settings
25
+ /* * Setting API Secret for Quickblox API */
26
+ @property (nonatomic , class , nullable ) NSString *authSecret;
45
27
46
- /* *
47
- * Enable or disable chat auto reconnect
48
- *
49
- * @param autoReconnectEnabled The default value is NO
50
- */
51
- + (void )setAutoReconnectEnabled : (BOOL )autoReconnectEnabled ;
28
+ /* *Set account key (from admin.quickblox.com). This parameter is skipped for custom endpoints. */
29
+ @property (nonatomic , class , nullable ) NSString *accountKey;
52
30
53
- /* *
54
- * Enable or disable message carbons
55
- *
56
- * @note Call this method after chat connection has been established
57
- * @param carbonsEnabled BOOL value
58
- */
59
- + (void )setCarbonsEnabled : (BOOL )carbonsEnabled ;
31
+ /* * Setting application group identifier */
32
+ @property (nonatomic , class , nullable ) NSString *applicationGroupIdentifier;
60
33
61
- // / Set timeout value for Stream Management send a message operation
62
- + ( void ) setStreamManagementSendMessageTimeout : ( NSUInteger ) streamManagementSendMessageTimeout ;
34
+ /* * Setting Api Endpoint. Default - https://api.quickblox.com */
35
+ @property ( nonatomic , class , null_resettable) NSString *apiEndpoint ;
63
36
64
- /* * A reconnect timer may optionally be used to attempt a reconnect periodically.
65
- Default value is 5 seconds */
66
- + (void )setReconnectTimerInterval : (NSTimeInterval )reconnectTimerInterval ;
37
+ /* * Setting Chat endpoint. Default - chat.quickblox.com */
38
+ @property (nonatomic , class , null_resettable) NSString *chatEndpoint;
67
39
68
40
/* *
69
- * Many routers will teardown a socket mapping if there is no activity on the socket.
70
- * For this reason, the stream supports sending keep-alive data.
71
- * This is simply whitespace, which is ignored by the protocol.
72
- *
73
- * Keep-alive data is only sent in the absence of any other data being sent/received.
74
- *
75
- * The default value is 20s.
76
- * The minimum value for TARGET_OS_IPHONE is 10s, else 20s.
77
- *
78
- * To disable keep-alive, set the interval to zero (or any non-positive number).
79
- *
80
- * The keep-alive timer (if enabled) fires every (keepAliveInterval / 4) seconds.
81
- * Upon firing it checks when data was last sent/received,
82
- * and sends keep-alive data if the elapsed time has exceeded the keepAliveInterval.
83
- * Thus the effective resolution of the keepalive timer is based on the interval.
84
- */
85
- + (void )setKeepAliveInterval : (NSTimeInterval )keepAliveInterval ;
86
-
87
- // MARK: - Credentials
88
-
89
- // / Storing Application ID
90
- + (void )setApplicationID : (NSUInteger )applicationID ;
41
+ Load QuickBlox application settings from QBSettings-Info.plist.
42
+
43
+ @warning This method should be used only for Continuous Integration (CI), because of security reasons
44
+
45
+ @discussion Raises an exception if any configuration step fails.
46
+ @note This method should be called after the app is launched and before using Quickblox services.
47
+
48
+ @code
49
+ Required keys:
91
50
92
- /* *
93
- Set account key
51
+ applicationID : Number
52
+ authorizationKey : String
53
+ authorizationSecret : String
54
+ accountKey : String
55
+
56
+ Optional keys:
94
57
95
- @param accountKey Account key - from admin.quickblox.com
58
+ apiEndpoint : String
59
+ chatEndpoint : String
60
+ autoReconnectEnabled : BOOL
61
+ carbonsEnabled : BOOL
62
+ streamManagementSendMessageTimeout : Integer
63
+ reconnectTimerInterval : Double
64
+ keepAliveInterval : Double
65
+ chatEndpointPort : Integer
66
+ @endcode
96
67
*/
97
- + (void )setAccountKey : ( NSString *) accountKey ;
68
+ + (void )settingsFromPlist ;
98
69
99
70
/* *
100
- * Setting API Key for Quickblox API
101
- *
102
- * @param authKey - NSString value of API Key.
71
+ Load QuickBlox application settings from specific plist with name.
72
+
73
+ @param name plist file name
103
74
*/
104
- + (void )setAuthKey : (NSString *)authKey ;
75
+ + (void )settingsFromPlistWithName : (NSString *)name ;
105
76
106
- /* *
107
- * Setting API Secret for Quickblox API
108
- *
109
- * @param authSecret - NSString value of API Secret.
110
- */
111
- + (void )setAuthSecret : (NSString *)authSecret ;
77
+ @end
112
78
113
- /* *
114
- * Setting application group identifier
115
- *
116
- * @param appGroupIdentifier - NSString value of identifier.
117
- */
118
79
119
- + (void )setApplicationGroupIdentifier : (NSString *)appGroupIdentifier ;
120
80
121
- // MARK: - Endpoints
81
+ @interface QBSettings (QBChat)
122
82
123
- /* *
124
- * Allows to change Services Zone to work with Production, Development and Staging environments
125
- *
126
- * @param serviceZone - Service Zone. One from QBConnectionZoneType. Default - QBConnectionZoneTypeAutomatic.
127
- */
128
- + (void )setServiceZone : (QBConnectionZoneType)serviceZone ;
83
+ /* *Enable or disable chat auto reconnect. The default value is NO */
84
+ @property (nonatomic , class ) BOOL autoReconnectEnabled;
129
85
130
- /* *
131
- * Return current Service Zone
132
- *
133
- * @note serviceZone - Service Zone. One from QBConnectionZoneType. Default - QBConnectionZoneTypeAutomatic
134
- */
135
- + (QBConnectionZoneType)currentServiceZone ;
86
+ /* * Enable or disable message carbons */
87
+ @property (nonatomic , class ) BOOL carbonsEnabled;
88
+
89
+ /* * Set timeout value for Stream Management send a message operation */
90
+ @property (nonatomic , class ) NSUInteger streamManagementSendMessageTimeout;
136
91
137
92
/* *
138
- * Returns Api Endpoint for current zone
139
- *
140
- * @return NSString value of Api Endpoint
93
+ A reconnect timer may optionally be used to attempt a reconnect periodically.
94
+ Default value is 5 seconds
141
95
*/
142
- + (nullable NSString *)apiEndpoint ;
143
-
144
- // MARK: - Chat Endpoints
96
+ @property (nonatomic , class ) NSTimeInterval reconnectTimerInterval;
145
97
146
98
/* *
147
- Get server's Chat endpoint
148
-
149
- @note you have to prepend http or https prefix
150
- @return Current server's Chat endpoint
99
+ Many routers will teardown a socket mapping if there is no activity on the socket.
100
+ For this reason, the stream supports sending keep-alive data.
101
+ This is simply whitespace, which is ignored by the protocol.
102
+
103
+ Keep-alive data is only sent in the absence of any other data being sent/received.
104
+
105
+ The default value is 20s.
106
+ The minimum value for TARGET_OS_IPHONE is 10s, else 20s.
107
+
108
+ To disable keep-alive, set the interval to zero (or any non-positive number).
109
+
110
+ The keep-alive timer (if enabled) fires every (keepAliveInterval / 4) seconds.
111
+ Upon firing it checks when data was last sent/received,
112
+ and sends keep-alive data if the elapsed time has exceeded the keepAliveInterval.
113
+ Thus the effective resolution of the keepalive timer is based on the interval.
151
114
*/
152
- + ( NSString *) chatEndpoint ;
115
+ @property ( nonatomic , class ) NSTimeInterval keepAliveInterval ;
153
116
154
117
/* *
155
118
The port the xmpp server is running on.
@@ -158,83 +121,131 @@ typedef NS_ENUM(NSUInteger, QBConnectionZoneType) {
158
121
159
122
The default port is 5223.
160
123
**/
161
- @property (assign , nonatomic , class ) NSUInteger chatEndpointPort;
124
+ @property (nonatomic , class ) NSUInteger chatEndpointPort;
125
+
126
+ @end
127
+
162
128
163
- // MARK: - Network Indicator
129
+
130
+ @interface QBSettings (UIKit)
164
131
165
132
/* *
166
- * A Boolean value indicating whether the manager is enabled.
133
+ A Boolean value indicating whether the manager is enabled.
134
+
135
+ @note If YES, the manager will change status bar network activity indicator according to network
136
+ operation notifications it receives. The default value is NO.
167
137
168
- * If YES, the manager will change status bar network activity indicator according to network operation notifications it receives.
169
- * The default value is NO.
138
+ @param enabled
170
139
*/
171
140
#if TARGET_OS_IOS
172
- + ( void ) setNetworkIndicatorManagerEnabled : ( BOOL ) enabled ;
141
+ @property ( nonatomic , class ) BOOL networkIndicatorManagerEnabled ;
173
142
174
143
/* *
175
- A Boolean value indicating whether the network activity indicator is currently displayed in the status bar.
144
+ A Boolean value indicating whether the network activity indicator is currently displayed in the
145
+ status bar.
176
146
*/
177
147
+ (BOOL )isNetworkIndicatorVisible ;
178
148
179
149
#endif
180
150
181
- // MARK: - Logging
151
+ @end
182
152
183
- /* *
184
- Set SDK log level (by default: QBLogLevelDebug). Possible values: QBLogLevelDebug, QBLogLevelNothing.
185
-
186
- @param logLevel New log level
187
- */
188
- + (void )setLogLevel : (QBLogLevel)logLevel ;
189
153
190
- /* *
191
- * Enable full XMPP Framework logging to console. By default is disabled.
192
- */
154
+
155
+ @interface QBSettings (Logging)
156
+
157
+ /* * Set SDK log level (by default: QBLogLevelDebug). Possible values: QBLogLevelDebug, QBLogLevelNothing. */
158
+ @property (nonatomic , class ) QBLogLevel logLevel;
159
+
160
+ /* * Enable full XMPP Framework logging to console. By default is disabled. */
193
161
+ (void )enableXMPPLogging ;
194
162
163
+ /* * Disable full XMPP Framework logging to console. */
164
+ + (void )disableXMPPLogging ;
165
+
195
166
/* *
196
- * Enable log to file
197
- * The approximate maximum size to allow log files to grow.
198
- * If a log file is larger than this value after a log statement is appended,
199
- * then the log file is rolled.
200
- * @param maximumFileSize maximum file size in bytes, for example: 1024 * 1024 * 10 = 10Mb
167
+ Enable log to file
168
+
169
+ The approximate maximum size to allow log files to grow.
170
+ If a log file is larger than this value after a log statement is appended,
171
+ then the log file is rolled.
172
+
173
+ @param maximumFileSize maximum file size in bytes, for example: 1024 * 1024 * 10 = 10Mb
201
174
*/
202
175
+ (void )enableFileLoggingWithMaximumFileSize : (unsigned long long )maximumFileSize ;
203
176
204
- /* *
205
- * Disable logging to file
206
- */
177
+ /* * Disable logging to file */
207
178
+ (void )disableFileLogging ;
208
179
209
180
/* *
210
- * Returns log file paths if loggint to file is enabled
211
- * Example name of log file: /var/mobile/Containers/Data/Application/518F9FD2-BB4C-4AF4-89D8-7FF85B0518B7/Library/Caches/Logs/com.quickblox.supersample 2016-03-25 11-23.log
212
- *
213
- * @return Array of log file paths or nil if logging to file is disabled
181
+ Returns log file paths if loggint to file is enabled
182
+ Example name of log file:
183
+ /var/mobile/Containers/Data/Application/<UDID>/Library/Caches/Logs/com.quickblox.<app_name> 2016-03-25 11-23.log
184
+
185
+ @return Array of log file paths or nil if logging to file is disabled
214
186
*/
215
187
+ (nullable NSArray <NSString *> *)logFilePaths ;
216
188
189
+ @end
190
+
191
+ @interface QBSettings (NSURLSessionConfiguration )
192
+
217
193
/* *
218
- * Disable full XMPP Framework logging to console.
194
+ Set custom session configuration that will be used for REST API requests.
195
+ '[NSURLSessionConfiguration defaultSessionConfiguration]' is used if nil is passed.
219
196
*/
220
- + (void )disableXMPPLogging ;
221
197
222
- // MARK: - NSURLSessionConfiguration
198
+ @property (nonatomic , class , nullable ) NSURLSessionConfiguration *sessionConfiguration;
199
+
200
+ @end
201
+
202
+ typedef NS_ENUM (NSUInteger , QBConnectionZoneType) {
203
+
204
+ QBConnectionZoneTypeAutomatic = 1 , // Default. Endpoints are loaded from QuickBlox
205
+ QBConnectionZoneTypeProduction = 2 ,
206
+ QBConnectionZoneTypeDevelopment = 3 ,
207
+ QBConnectionZoneTypeStage = 4
208
+ } DEPRECATED_ATTRIBUTE;
209
+
210
+ @interface QBSettings (DEPRECATED)
211
+
212
+ /* *
213
+ Allows to set api endpoint and chat endpoint for service zone.
214
+
215
+ @note QBConnectionZoneTypeAutomatic is used by default.
216
+ If you are using shared server and you are migrating to enterprise account,
217
+ then you don't need to resubmit your application, endpoints will be updated automatically.
218
+
219
+ To set custom endpoints use QBConnectionZoneTypeProduction or QBConnectionZoneTypeDevelopment service zone.
220
+ Then you should manually activate your service zone by calling setServiceZone:
221
+
222
+ @param apiEndpoint apiEndpoint - Endpoint for service i.e. http://my_custom_endpoint.com. Possible to pass nil to return to default settings
223
+ @param chatEndpoint chat endpoint
224
+ @param zone QBConnectionZoneType - service zone
225
+ @warning Deprecated in 2.12. Use QBSettings.apiEndpoint and QBSettings.chatEndpoint to set custom endpoints
226
+ */
227
+ + (void )setApiEndpoint : (nullable NSString *)apiEndpoint
228
+ chatEndpoint : (nullable NSString *)chatEndpoint
229
+ forServiceZone : (QBConnectionZoneType)zone
230
+ DEPRECATED_MSG_ATTRIBUTE(" Deprecated in 2.12. Use QBSettings.apiEndpoint and QBSettings.chatEndpoint to set custom endpoints" );
223
231
224
232
/* *
225
- * Set custom session configuration that will be used for REST API requests.
226
- * '[NSURLSessionConfiguration defaultSessionConfiguration]' is used if nil is passed.
227
- *
228
- * @param configuration Your NSURLSessionConfiguration object.
233
+ Allows to change Services Zone to work with Production, Development and Staging environments
234
+
235
+ @param serviceZone - Service Zone. One from QBConnectionZoneType. Default - QBConnectionZoneTypeAutomatic.
236
+ @warning Deprecated in 2.12. Use QBSettings.apiEndpoint and QBSettings.chatEndpoint to set custom endpoints
229
237
*/
230
- + (void )setSessionConfiguration : (nullable NSURLSessionConfiguration *)configuration ;
238
+ + (void )setServiceZone : (QBConnectionZoneType)serviceZone
239
+ DEPRECATED_MSG_ATTRIBUTE(" Deprecated in 2.12. Use QBSettings.apiEndpoint and QBSettings.chatEndpoint to set custom endpoints" );
231
240
232
241
/* *
233
- * Get custom session configuration.
234
- *
235
- * @return Your NSURLSessionConfiguration object.
242
+ Return current Service Zone
243
+
244
+ @note serviceZone - Service Zone. One from QBConnectionZoneType. Default - QBConnectionZoneTypeAutomatic
245
+ @warning Deprecated in 2.12. Use QBSettings.apiEndpoint and QBSettings.chatEndpoint to set custom endpoints
236
246
*/
237
- + (nullable NSURLSessionConfiguration *)sessionConfiguration ;
247
+ + (QBConnectionZoneType)currentServiceZone
248
+ DEPRECATED_MSG_ATTRIBUTE(" Deprecated in 2.12. Use QBSettings.apiEndpoint and QBSettings.chatEndpoint to set custom endpoints" );
238
249
239
250
@end
240
251
0 commit comments