|
@@ -15,6 +15,8 @@ NSString *const UPLOAD_FINISH_NOTIFICATION = @"upload_finish_notification";
|
|
|
NSString *const UPLOAD_COUNT_CHANGE_NOTIFICATION = @"upload_count_change_notification";
|
|
NSString *const UPLOAD_COUNT_CHANGE_NOTIFICATION = @"upload_count_change_notification";
|
|
|
NSString *const UPLOAD_REFRESH_UI_NOTIFICATION = @"upload_refresh_ui_notification";
|
|
NSString *const UPLOAD_REFRESH_UI_NOTIFICATION = @"upload_refresh_ui_notification";
|
|
|
|
|
|
|
|
|
|
+static RAUploadManager *sharedInstance;
|
|
|
|
|
+
|
|
|
@interface RAUploadManager ()
|
|
@interface RAUploadManager ()
|
|
|
|
|
|
|
|
@property (nonatomic,strong) NSTimer *retryTimer;
|
|
@property (nonatomic,strong) NSTimer *retryTimer;
|
|
@@ -77,6 +79,16 @@ NSString *const UPLOAD_REFRESH_UI_NOTIFICATION = @"upload_refresh_ui_notificatio
|
|
|
|
|
|
|
|
[[NSUserDefaults standardUserDefaults] setObject:param forKey:kUploadSetting];
|
|
[[NSUserDefaults standardUserDefaults] setObject:param forKey:kUploadSetting];
|
|
|
[[NSUserDefaults standardUserDefaults] synchronize];
|
|
[[NSUserDefaults standardUserDefaults] synchronize];
|
|
|
|
|
+
|
|
|
|
|
+ if (sharedInstance) {
|
|
|
|
|
+ sharedInstance.autoStart = self.autoUpload;
|
|
|
|
|
+ sharedInstance.removeFinish = self.autoRemoveFinish;
|
|
|
|
|
+// sharedInstance.removeError = self.autoRemoveError;
|
|
|
|
|
+ sharedInstance.maxRetry = self.retryCount;
|
|
|
|
|
+ sharedInstance.onlyWiFi = self.onlyWIFI;
|
|
|
|
|
+ sharedInstance.monitorNetwork = self.monitorNetwork;
|
|
|
|
|
+ sharedInstance.retryTimeInterval = self.retryTimeIntetval;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@end
|
|
@end
|
|
@@ -93,6 +105,14 @@ NSString *const UPLOAD_REFRESH_UI_NOTIFICATION = @"upload_refresh_ui_notificatio
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
++ (instancetype)sharedManager {
|
|
|
|
|
+ static dispatch_once_t token;
|
|
|
|
|
+ dispatch_once(&token, ^{
|
|
|
|
|
+ sharedInstance = [[RAUploadManager alloc] init];
|
|
|
|
|
+ });
|
|
|
|
|
+ return sharedInstance;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
/*!
|
|
/*!
|
|
|
* Called by Reachability whenever status changes.
|
|
* Called by Reachability whenever status changes.
|
|
|
*/
|
|
*/
|
|
@@ -164,7 +184,7 @@ NSString *const UPLOAD_REFRESH_UI_NOTIFICATION = @"upload_refresh_ui_notificatio
|
|
|
if (param) {
|
|
if (param) {
|
|
|
BOOL autoUpload = [[param objectForKey:@"auto_upload"] boolValue];
|
|
BOOL autoUpload = [[param objectForKey:@"auto_upload"] boolValue];
|
|
|
BOOL autoRmFinish = [[param objectForKey:@"auto_rm_finish"] boolValue];
|
|
BOOL autoRmFinish = [[param objectForKey:@"auto_rm_finish"] boolValue];
|
|
|
- BOOL autoRmErr = [[param objectForKey:@"auto_rm_error"] boolValue];
|
|
|
|
|
|
|
+// BOOL autoRmErr = [[param objectForKey:@"auto_rm_error"] boolValue];
|
|
|
BOOL onlyWiFi = [[param objectForKey:@"only_wifi"] boolValue];
|
|
BOOL onlyWiFi = [[param objectForKey:@"only_wifi"] boolValue];
|
|
|
int retryCount = [[param objectForKey:@"retry_count"] intValue];
|
|
int retryCount = [[param objectForKey:@"retry_count"] intValue];
|
|
|
NSNumber *timeInterval = [param objectForKey:@"retry_time_interval"];
|
|
NSNumber *timeInterval = [param objectForKey:@"retry_time_interval"];
|