*Incoming Tags

Added incoming tags

You can set tags to Incoming then all tracks received after installing TAGS will be marked with these tags. Here the binding is done on a person (deviceToken). You can add, remove, and get a list of installed tags on IncomingTags for enriched trips these are the same tags as on Incoming but already linked to a specific track. You can also delete, add, and get Tags already linked to a specific track.

  • (void)addFutureTrackTag:(RPTag *)tag completion:(RPAPIITagCallback)callback;

  • (void)removeFutureTrackTag:(RPTag *)tag completion:(RPAPIITagCallback)callback;

  • (void)getFutureTrackTag:(NSInteger)timestamp completion:(RPAPIITagGCallback)callback;

  • (void)removeAllFutureTrackTagsWithСompletion:(RPAPIITagWCallback)callback;

addFutureTrackTag example

  1. with out completion: [[RPEntry instance].api addFutureTrackTag:tag completion:nil];

  2. with completion: [[RPEntry instance].api addFutureTrackTag:tag completion:^(RPTagStatus status, RPTag *tag, NSInteger timestamp) {}];

Usage example:

[[RPEntry instance].api addFutureTrackTag:tag completion:nil];
[[RPEntry instance].api addFutureTrackTag:tag completion:^(RPTagStatus status, RPTag *tag, NSInteger timestamp) {}];
[[RPEntry instance].api getFutureTrackTag:0 completion:^(RPTagStatus status, NSArray<RPTag *> *tags, NSInteger timestamp) {
    for (RPTag *item in tags) {
        NSLog(@"%@", item.tag);
    }
}];
[[RPEntry instance].api removeFutureTrackTag:tag completion:^(RPTagStatus status, RPTag *tag, NSInteger timestamp) {}];
[[RPEntry instance].api removeAllFutureTrackTagsWithСompletion:^(RPTagStatus status, NSInteger timestamp) {}];

Added new RPTagsServerStateDelegate for online and offline operation status logging RPTagStatus in this protocol

typedef NS_ENUM(NSUInteger, RPTagStatus) {
    SUCCESS, // success for add or delete
    OFFLINE, // app in offline and operation saved in local database
    ERROR_WRONG_TIME, // operation canceled by server with wrong time(time from future)
    ERROR_TAG_OPERATION // operation canceled by server as duplicated or incorrect
};

Usage example:

@interface MyListener () <RPTagsServerStateDelegate> {}
@end

@implementation MyListener

- (instancetype)init {
    self = [super init];
    if (self) {
        [RPEntry instance].tagStateDelegate = self;
    }
    return self;
}

- (void)addTag:(RPTagStatus)status tag:(RPTag *)tag timestamp:(NSInteger)timestamp {
    NSString *str = @"";
    switch (status) {
        case SUCCESS:
            str = @"success for add or delete";
            break;
            
        case OFFLINE:
            str = @"app in offline and operation saved in local database";
            break;
                  
        case ERROR_WRONG_TIME:
            str = @"operation canceled by server with wrong time(time from future)";
            break;
            
        case ERROR_TAG_OPERATION:
            str = @"operation canceled by server as duplicated or incorrect";
            break;
            
        default:
            break;
    }
    NSLog(@"%@ - %@ - %ld", str, tag.toJSON, timestamp);
}

- (void)deleteTag:(RPTagStatus)status tag:(RPTag *)tag timestamp:(NSInteger)timestamp {
    NSString *str = @"";
    switch (status) {
        case SUCCESS:
            str = @"success for add or delete";
            break;
            
        case OFFLINE:
            str = @"app in offline and operation saved in local database";
            break;
                  
        case ERROR_WRONG_TIME:
            str = @"operation canceled by server with wrong time(time from future)";
            break;
            
        case ERROR_TAG_OPERATION:
            str = @"operation canceled by server as duplicated or incorrect";
            break;
            
        default:
            break;
    }
    NSLog(@"%@ - %@ - %ld", str, tag.toJSON, timestamp);
}

- (void)getTags:(RPTagStatus)status tags:(id)tags timestamp:(NSInteger)timestamp {
    NSString *str = @"";
    switch (status) {
        case SUCCESS:
            str = @"success for add or delete";
            break;
            
        case OFFLINE:
            str = @"app in offline and operation saved in local database";
            break;
                  
        case ERROR_WRONG_TIME:
            str = @"operation canceled by server with wrong time(time from future)";
            break;
            
        case ERROR_TAG_OPERATION:
            str = @"operation canceled by server as duplicated or incorrect";
            break;
            
        default:
            break;
    }
    NSLog(@"%@ - %@ - %ld", str, tags, timestamp);
}

- (void)removeAll:(RPTagStatus)status timestamp:(NSInteger)timestamp {
    NSString *str = @"";
    switch (status) {
        case SUCCESS:
            str = @"success for add or delete";
            break;
            
        case OFFLINE:
            str = @"app in offline and operation saved in local database";
            break;
                  
        case ERROR_WRONG_TIME:
            str = @"operation canceled by server with wrong time(time from future)";
            break;
            
        case ERROR_TAG_OPERATION:
            str = @"operation canceled by server as duplicated or incorrect";
            break;
            
        default:
            break;
    }
    NSLog(@"%@ - %ld", str, timestamp);
}

@end

Last updated