Skip to content

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

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions EDQueue.podspec
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 = '1.1'
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'
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why would we move the location of the homepage and repo?

Copy link
Author

Choose a reason for hiding this comment

The 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 => 'v1.1' }
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
45 changes: 31 additions & 14 deletions EDQueue/EDQueue.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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).
Copy link
Owner

Choose a reason for hiding this comment

The 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;
@property (nonatomic) NSUInteger retryLimit;

- (void)enqueueWithData:(id)data forTask:(NSString *)task;
+ (instancetype)defaultQueue;

- (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;
- (NSInteger)jobCount;

@end
- (BOOL)jobExistsForTag:(NSString *)tag;
- (BOOL)jobIsActiveForTag:(NSString *)tag;
- (nullable EDQueueJob *)nextJobForTag:(NSString *)tag;

@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
Loading