35 lines
970 B
Objective-C
35 lines
970 B
Objective-C
//
|
|
// Copyright 2014 Signal Messenger, LLC
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
//
|
|
|
|
#import "VersionMigrations.h"
|
|
|
|
NS_ASSUME_NONNULL_BEGIN
|
|
|
|
@implementation VersionMigrations
|
|
|
|
#pragma mark - Utility methods
|
|
|
|
+ (BOOL)isVersion:(NSString *)thisVersionString
|
|
atLeast:(NSString *)openLowerBoundVersionString
|
|
andLessThan:(NSString *)closedUpperBoundVersionString
|
|
{
|
|
return [self isVersion:thisVersionString atLeast:openLowerBoundVersionString] &&
|
|
[self isVersion:thisVersionString lessThan:closedUpperBoundVersionString];
|
|
}
|
|
|
|
+ (BOOL)isVersion:(NSString *)thisVersionString atLeast:(NSString *)thatVersionString
|
|
{
|
|
return [thisVersionString compare:thatVersionString options:NSNumericSearch] != NSOrderedAscending;
|
|
}
|
|
|
|
+ (BOOL)isVersion:(NSString *)thisVersionString lessThan:(NSString *)thatVersionString
|
|
{
|
|
return [thisVersionString compare:thatVersionString options:NSNumericSearch] == NSOrderedAscending;
|
|
}
|
|
|
|
@end
|
|
|
|
NS_ASSUME_NONNULL_END
|