-
Notifications
You must be signed in to change notification settings - Fork 43
Bump target to iOS7, introduce nullability, always async, and separate storage from queue #22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 3 commits
6f779a5
9d08d34
9adb89e
63a2f12
9673f1a
1f2c92a
bd34c48
068d114
474a202
82a64aa
12e0b86
22aac2c
29f231c
7e25335
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
Pod::Spec.new do |s| | ||
s.name = 'EDQueue' | ||
s.version = '0.7.1' | ||
s.version = '0.7.3' | ||
s.license = 'MIT' | ||
s.summary = 'A persistent background job queue for iOS.' | ||
s.homepage = 'https://github.com/thisandagain/queue' | ||
s.authors = {'Andrew Sliwinski' => '[email protected]', 'Francois Lambert' => '[email protected]'} | ||
s.source = { :git => 'https://github.com/thisandagain/queue.git', :tag => 'v0.7.1' } | ||
s.platform = :ios, '5.0' | ||
s.homepage = 'https://github.com/gelosi/queue' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why would we move the location of the homepage and repo? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've set it to mine now to use it already, but if you will accept the changes in the end (I'm still on it) I'd be happy to keep original link to repo. |
||
s.authors = {'Andrew Sliwinski' => '[email protected]', 'Francois Lambert' => '[email protected]', 'Oleg Shanyuk' => '[email protected]'} | ||
s.source = { :git => 'https://github.com/gelosi/queue.git', :tag => 'v0.7.3' } | ||
s.platform = :ios, '7.0' | ||
s.source_files = 'EDQueue' | ||
s.library = 'sqlite3.0' | ||
s.requires_arc = true | ||
s.dependency 'FMDB', '~> 2.0' | ||
s.dependency 'FMDB', '~> 2.1' | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,12 @@ | |
// Copyright (c) 2012 Andrew Sliwinski. All rights reserved. | ||
// | ||
|
||
#import <UIKit/UIKit.h> | ||
@import Foundation; | ||
|
||
#import "EDQueueJob.h" | ||
#import "EDQueuePersistentStorageProtocol.h" | ||
|
||
NS_ASSUME_NONNULL_BEGIN | ||
|
||
typedef NS_ENUM(NSInteger, EDQueueResult) { | ||
EDQueueResultSuccess = 0, | ||
|
@@ -22,30 +27,42 @@ extern NSString *const EDQueueJobDidSucceed; | |
extern NSString *const EDQueueJobDidFail; | ||
extern NSString *const EDQueueDidDrain; | ||
|
||
@protocol EDQueueDelegate; | ||
@interface EDQueue : NSObject | ||
@class EDQueue; | ||
|
||
+ (EDQueue *)sharedInstance; | ||
@protocol EDQueueDelegate <NSObject> | ||
- (void)queue:(EDQueue *)queue processJob:(EDQueueJob *)job completion:(EDQueueCompletionBlock)block; | ||
@end | ||
|
||
@interface EDQueue : NSObject | ||
|
||
@property (nonatomic, weak) id<EDQueueDelegate> delegate; | ||
@property (nonatomic, strong, readonly) id<EDQueuePersistentStorage> storage; | ||
|
||
/** | ||
* Returns true if Queue is running (e.g. not stopped). | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 Thanks |
||
*/ | ||
@property (nonatomic, readonly) BOOL isRunning; | ||
/** | ||
* Returns true if Queue is performing Job right now | ||
*/ | ||
@property (nonatomic, readonly) BOOL isActive; | ||
/** | ||
* Retry limit for failing tasks (will be elimitated and moved to Job later) | ||
*/ | ||
@property (nonatomic) NSUInteger retryLimit; | ||
|
||
- (void)enqueueWithData:(id)data forTask:(NSString *)task; | ||
- (instancetype)initWithPersistentStore:(id<EDQueuePersistentStorage>)persistentStore; | ||
|
||
- (void)enqueueJob:(EDQueueJob *)job; | ||
- (void)start; | ||
- (void)stop; | ||
- (void)empty; | ||
|
||
- (BOOL)jobExistsForTask:(NSString *)task; | ||
- (BOOL)jobIsActiveForTask:(NSString *)task; | ||
- (NSDictionary *)nextJobForTask:(NSString *)task; | ||
- (nullable EDQueueJob *)nextJobForTask:(NSString *)task; | ||
|
||
@end | ||
|
||
@protocol EDQueueDelegate <NSObject> | ||
@optional | ||
- (EDQueueResult)queue:(EDQueue *)queue processJob:(NSDictionary *)job; | ||
- (void)queue:(EDQueue *)queue processJob:(NSDictionary *)job completion:(EDQueueCompletionBlock)block; | ||
@end | ||
|
||
NS_ASSUME_NONNULL_END |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// | ||
// EDQueueJob.h | ||
// queue | ||
// | ||
// Created by Oleg Shanyuk on 18/02/16. | ||
// Copyright © 2016 DIY, Co. All rights reserved. | ||
// | ||
|
||
@import Foundation; | ||
|
||
NS_ASSUME_NONNULL_BEGIN | ||
|
||
@interface EDQueueJob : NSObject | ||
|
||
@property(nonatomic, readonly) NSString *task; | ||
@property(nonatomic, readonly) NSDictionary *userInfo; | ||
|
||
@property(nonatomic, readonly, nullable) NSNumber *jobID; | ||
@property(nonatomic, readonly, nullable) NSNumber *attempts; | ||
@property(nonatomic, readonly, nullable) NSString *timeStamp; | ||
|
||
- (instancetype)initWithTask:(NSString *)task | ||
userInfo:(nullable NSDictionary *)userInfo | ||
jobID:(nullable NSNumber *)jobID | ||
atempts:(nullable NSNumber *)attemps | ||
timeStamp:(nullable NSString *)timeStamp; | ||
|
||
- (instancetype)initWithTask:(NSString *)task | ||
userInfo:(nullable NSDictionary *)userInfo; | ||
|
||
- (instancetype)init NS_UNAVAILABLE; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It makes sense to mark There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👌🏻 |
||
|
||
@end | ||
|
||
NS_ASSUME_NONNULL_END | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. New line missing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we are going to break backwards compatibility (min platform to iOS 7) we should bump the major version number as per semver. That would make this
1.0.0
. 😄There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1!