Skip to content

Commit

Permalink
Write copies of queue, traits
Browse files Browse the repository at this point in the history
  • Loading branch information
travisjeffery committed Jun 1, 2015
1 parent 2d72c65 commit e10984e
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions Analytics/Integrations/Segmentio/SEGSegmentioIntegration.m
Original file line number Diff line number Diff line change
Expand Up @@ -248,14 +248,14 @@ - (NSString *)description {
- (void)saveUserId:(NSString *)userId {
[self dispatchBackground:^{
self.userId = userId;
[_userId writeToURL:self.userIDURL atomically:YES encoding:NSUTF8StringEncoding error:NULL];
[self.userId writeToURL:self.userIDURL atomically:YES encoding:NSUTF8StringEncoding error:NULL];
}];
}

- (void)addTraits:(NSDictionary *)traits {
[self dispatchBackground:^{
[_traits addEntriesFromDictionary:traits];
[_traits writeToURL:self.traitsURL atomically:YES];
[self.traits addEntriesFromDictionary:traits];
[[self.traits copy] writeToURL:self.traitsURL atomically:YES];
}];
}

Expand Down Expand Up @@ -369,7 +369,7 @@ - (void)enqueueAction:(NSString *)action dictionary:(NSDictionary *)dictionary o

- (void)queuePayload:(NSDictionary *)payload {
[self.queue addObject:payload];
[self.queue writeToURL:[self queueURL] atomically:YES];
[[self.queue copy] writeToURL:[self queueURL] atomically:YES];
[self flushQueueByLength];
}

Expand Down Expand Up @@ -465,7 +465,7 @@ - (void)sendData:(NSData *)data {
else {
SEGLog(@"%@ API request success 200", self);
[self.queue removeObjectsInArray:self.batch];
[self.queue writeToURL:[self queueURL] atomically:YES];
[[self.queue copy] writeToURL:[self queueURL] atomically:YES];
[self notifyForName:SEGSegmentioRequestDidSucceedNotification userInfo:self.batch];
}

Expand All @@ -487,7 +487,7 @@ - (void)applicationDidEnterBackground {
- (void)applicationWillTerminate {
[self dispatchBackgroundAndWait:^{
if (self.queue.count)
[self.queue writeToURL:self.queueURL atomically:YES];
[[self.queue copy] writeToURL:self.queueURL atomically:YES];
}];
}

Expand Down

0 comments on commit e10984e

Please sign in to comment.