Skip to content

Commit

Permalink
Preparing release 3.3.2
Browse files Browse the repository at this point in the history
  • Loading branch information
queue-it committed Aug 24, 2022
1 parent 047edd6 commit 0e3ee4b
Show file tree
Hide file tree
Showing 8 changed files with 6 additions and 68 deletions.
2 changes: 1 addition & 1 deletion QueueITLib/QueueConsts.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@

#define QueueCloseUrl @"queueit://close"
#define QueueRestartSessionUrl @"queueit://restartSession"
#define SDKVersion @"iOS-3.3.1";
#define SDKVersion @"iOS-3.3.2";

#endif
45 changes: 1 addition & 44 deletions QueueITLib/QueueITEngine.m
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@
#import "QueueITApiClient.h"
#import "QueueStatus.h"
#import "IOSUtils.h"
#import "QueueCache.h"
#import "QueueITWaitingRoomView.h"
#import "QueueITWaitingRoomProvider.h"

@interface QueueITEngine()
@property (nonatomic, weak)UIViewController* host;
@property (nonatomic, weak)QueueCache* cache;

@property QueueITWaitingRoomProvider* waitingRoomProvider;
@property QueueITWaitingRoomView* waitingRoomView;
Expand All @@ -26,7 +24,6 @@ -(instancetype)initWithHost:(UIViewController *)host customerId:(NSString*)custo
language:language];

self.waitingRoomView = [[QueueITWaitingRoomView alloc] initWithHost: host customerId: customerId eventId: eventOrAliasId];
self.cache = [QueueCache instance:customerId eventId:eventOrAliasId];
self.host = host;
self.customerId = customerId;
self.eventId = eventOrAliasId;
Expand All @@ -50,63 +47,29 @@ -(BOOL)isRequestInProgress {
-(BOOL)runWithEnqueueKey:(NSString *)enqueueKey
error:(NSError *__autoreleasing *)error
{
if(![self tryShowQueueFromCache]) {
return [self.waitingRoomProvider TryPassWithEnqueueKey:enqueueKey error:error];
}
return YES;
}

-(BOOL)runWithEnqueueToken:(NSString *)enqueueToken
error:(NSError *__autoreleasing *)error
{
if(![self tryShowQueueFromCache]) {
return [self.waitingRoomProvider TryPassWithEnqueueToken:enqueueToken error:error];
}
return YES;
}

-(BOOL)run:(NSError **)error
{
if(![self tryShowQueueFromCache]) {
return [self.waitingRoomProvider TryPass:error];
}
return YES;
}

-(BOOL)tryShowQueueFromCache
{
if (![self.cache isEmpty])
{
NSString* urlTtlString = [self.cache getUrlTtl];
long long cachedTime = [urlTtlString longLongValue];
long currentTime = (long)(NSTimeInterval)([[NSDate date] timeIntervalSince1970]);
if (currentTime < cachedTime)
{
NSString* targetUrl = [self.cache getTargetUrl];
NSString* queueUrl = [self.cache getQueueUrl];
[self showQueue:queueUrl targetUrl:targetUrl];
return YES;
}
}
return NO;
}


-(void)showQueue:(NSString*)queueUrl targetUrl:(NSString*)targetUrl
{
[self.waitingRoomView show:queueUrl targetUrl:targetUrl];
}

-(void)updateQueuePageUrl:(NSString *)queuePageUrl
{
if (![self.cache isEmpty]) {
NSString* urlTtlString = [self.cache getUrlTtl];
NSString* targetUrl = [self.cache getTargetUrl];
[self.cache update:queuePageUrl urlTTL:urlTtlString targetUrl:targetUrl];
}
}

- (void)waitingRoomView:(nonnull QueueITWaitingRoomView *)view notifyViewPassedQueue:(QueuePassedInfo * _Nullable)queuePassedInfo {
[self.cache clear];
[self.queuePassedDelegate notifyYourTurn:queuePassedInfo];
}

Expand All @@ -123,7 +86,6 @@ - (void)waitingRoomProvider:(nonnull QueueITWaitingRoomProvider *)provider notif
}

- (void)notifyViewSessionRestart:(nonnull QueueITWaitingRoomView *)view {
[self.cache clear];
[self.queueSessionRestartDelegate notifySessionRestart];
}

Expand All @@ -136,7 +98,6 @@ - (void)notifyViewUserClosed:(nonnull QueueITWaitingRoomView *)view {
}

- (void)waitingRoomView:(nonnull QueueITWaitingRoomView *)view notifyViewUpdatePageUrl:(NSString * _Nullable)urlString {
[self updateQueuePageUrl:urlString];
[self.queueUrlChangedDelegate notifyQueueUrlChanged:urlString];
}

Expand All @@ -160,9 +121,5 @@ - (void)waitingRoomProvider:(nonnull QueueITWaitingRoomProvider *)provider notif

[self showQueue:queuePassResult.queueUrl targetUrl:queuePassResult.targetUrl];

if(queuePassResult.urlTTLInMinutes>0){
NSString* urlTtlString = [IOSUtils convertTtlMinutesToSecondsString:queuePassResult.urlTTLInMinutes];
[self.cache update:queuePassResult.queueUrl urlTTL:urlTtlString targetUrl:queuePassResult.targetUrl];
}
}
@end
9 changes: 2 additions & 7 deletions QueueITLib/QueueITWaitingRoomProvider.m
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#import "QueueITWaitingRoomProvider.h"
#import "IOSUtils.h"
#import "QueueITApiClient.h"
#import "QueueCache.h"
#import "QueueTryPassResult.h"
#import "Reachability.h"

Expand All @@ -14,7 +13,6 @@ @interface QueueITWaitingRoomProvider()
@property NSString* language;
@property BOOL requestInProgress;
@property int deltaSec;
@property QueueCache* cache;


@end
Expand All @@ -30,7 +28,6 @@ -(instancetype _Nonnull)initWithCustomerId:(NSString* _Nonnull)customerId
language:(NSString* _Nullable)language {

if(self = [super init]) {
self.cache = [QueueCache instance:customerId eventId:eventOrAliasId];
self.customerId = customerId;
self.eventOrAliasId = eventOrAliasId;
self.layoutName = layoutName;
Expand Down Expand Up @@ -102,7 +99,6 @@ -(void)tryEnqueueWithUserAgent:(NSString*)secretAgent

[self handleAppEnqueueResponse: queueStatus.queueId
queueURL:queueStatus.queueUrlString
queueURLTTLInMinutes:queueStatus.queueUrlTTL
eventTargetURL:queueStatus.eventTargetUrl
queueItToken:queueStatus.queueitToken];

Expand All @@ -123,7 +119,6 @@ -(void)tryEnqueueWithUserAgent:(NSString*)secretAgent

-(void)handleAppEnqueueResponse:(NSString*) queueId
queueURL:(NSString*) queueURL
queueURLTTLInMinutes:(int) ttl
eventTargetURL:(NSString*) targetURL
queueItToken:(NSString*) token {

Expand All @@ -132,8 +127,8 @@ -(void)handleAppEnqueueResponse:(NSString*) queueId
NSString* redirectType = [self getRedirectTypeFromToken:token];

QueueTryPassResult* queueTryPassResult = [[QueueTryPassResult alloc]
initWithQueueUrl:queueURL targetUrl:targetURL
urlTTLInMinutes:ttl
initWithQueueUrl:queueURL
targetUrl:targetURL
redirectType:redirectType
isPassedThrough:isPassedThrough
queueToken:token];
Expand Down
1 change: 0 additions & 1 deletion QueueITLib/QueueStatus.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
@property (nonatomic, strong)NSString* queueUrlString;
@property (nonatomic, strong) NSString* eventTargetUrl;
@property (nonatomic, strong) NSString* queueitToken;
@property int queueUrlTTL;

-(instancetype)initWithDictionary:(NSDictionary *)dictionary;

Expand Down
9 changes: 0 additions & 9 deletions QueueITLib/QueueStatus.m
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,19 @@
NSString * const KEY_QUEUE_ID = @"QueueId";
NSString * const KEY_QUEUE_URL = @"QueueUrl";
NSString * const KEY_EVENT_TARGET_URL = @"EventTargetUrl";
NSString * const KEY_QUEUE_URL_TTL_IN_MINUTES = @"QueueUrlTTLInMinutes";
NSString * const KEY_QUEUEIT_TOKEN = @"QueueitToken";

@implementation QueueStatus

-(instancetype)init:(NSString *)queueId
queueUrl:(NSString *)queueUrlString
eventTargetUrl:(NSString *)eventTargetUrl
queueUrlTTL:(int)queueUrlTTL
queueitToken:(NSString *)queueitToken
{
if(self = [super init]) {
self.queueId = queueId;
self.queueUrlString = queueUrlString;
self.eventTargetUrl = eventTargetUrl;
self.queueUrlTTL = queueUrlTTL;
self.queueitToken = queueitToken;
}

Expand All @@ -31,13 +28,8 @@ - (instancetype)initWithDictionary:(NSDictionary *)dictionary
NSString *queueUrlString;
NSString *eventTargetUrl;
NSString *queueitToken;
int queueUrlTTL = 0;
id value;

if(![dictionary[KEY_QUEUE_URL_TTL_IN_MINUTES] isEqual:[NSNull null]])
{
queueUrlTTL = [dictionary[KEY_QUEUE_URL_TTL_IN_MINUTES] intValue];
}

value = dictionary[KEY_QUEUE_ID];
if ([value isKindOfClass:[NSString class]]) {
Expand All @@ -62,7 +54,6 @@ - (instancetype)initWithDictionary:(NSDictionary *)dictionary
return [self init:queueId
queueUrl:queueUrlString
eventTargetUrl:eventTargetUrl
queueUrlTTL:queueUrlTTL
queueitToken:queueitToken];
}
@end
2 changes: 0 additions & 2 deletions QueueITLib/QueueTryPassResult.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

@property (nonatomic, strong) NSString* _Nullable queueUrl;
@property (nonatomic, strong) NSString* _Nullable targetUrl;
@property (nonatomic) int urlTTLInMinutes;
@property (nonatomic, strong) NSString* _Nonnull redirectType;
@property (nonatomic) BOOL isPassedThrough;
@property (nonatomic) NSString* _Nullable queueToken;
Expand All @@ -13,7 +12,6 @@
-(instancetype _Nonnull )
initWithQueueUrl: (NSString* _Nullable) queueUrl
targetUrl:(NSString* _Nullable)targetUrl
urlTTLInMinutes: (int) urlTTLInMinutes
redirectType: (NSString* _Nonnull) redirectType
isPassedThrough: (BOOL) isPassedThrough
queueToken: (NSString* _Nullable) queueToken;
Expand Down
2 changes: 0 additions & 2 deletions QueueITLib/QueueTryPassResult.m
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,13 @@ @implementation QueueTryPassResult
-(instancetype _Nonnull )
initWithQueueUrl: (NSString* _Nullable) queueUrl
targetUrl:(NSString* _Nullable)targetUrl
urlTTLInMinutes: (int) urlTTLInMinutes
redirectType: (NSString* _Nonnull) redirectType
isPassedThrough: (BOOL) isPassedThrough
queueToken: (NSString* _Nullable) queueToken
{
if(self = [super init]) {
self.queueUrl = queueUrl;
self.targetUrl = targetUrl;
self.urlTTLInMinutes = urlTTLInMinutes;
self.redirectType = redirectType;
self.isPassedThrough = isPassedThrough;
self.queueToken = queueToken;
Expand Down
4 changes: 2 additions & 2 deletions QueueITLibrary.podspec
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
Pod::Spec.new do |s|
s.name = "QueueITLibrary"
s.version = "3.3.1"
s.version = "3.3.2"
s.summary = "Library for integrating Queue-it into an iOS app using web uI"
s.homepage = "https://github.com/queueit/ios-webui-sdk"
s.license = 'MIT'
s.authors = { 'Queue-It' => 'https://queue-it.com' }
s.platform = :ios, '9.3'
s.source = { :git => 'https://github.com/queueit/ios-webui-sdk.git', :tag => '3.3.1' }
s.source = { :git => 'https://github.com/queueit/ios-webui-sdk.git', :tag => '3.3.2' }
s.requires_arc = true
s.source_files = "QueueITLib/*.{h,m}"
end

0 comments on commit 0e3ee4b

Please sign in to comment.