yeet
This commit is contained in:
15
node_modules/expo-updates/ios/EXUpdates/Update/EXUpdatesBareUpdate.h
generated
vendored
Normal file
15
node_modules/expo-updates/ios/EXUpdates/Update/EXUpdatesBareUpdate.h
generated
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
// Copyright © 2019 650 Industries. All rights reserved.
|
||||
|
||||
#import <EXUpdates/EXUpdatesUpdate.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface EXUpdatesBareUpdate : NSObject
|
||||
|
||||
+ (EXUpdatesUpdate *)updateWithBareManifest:(NSDictionary *)manifest
|
||||
config:(EXUpdatesConfig *)config
|
||||
database:(EXUpdatesDatabase *)database;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
84
node_modules/expo-updates/ios/EXUpdates/Update/EXUpdatesBareUpdate.m
generated
vendored
Normal file
84
node_modules/expo-updates/ios/EXUpdates/Update/EXUpdatesBareUpdate.m
generated
vendored
Normal file
@ -0,0 +1,84 @@
|
||||
// Copyright © 2019 650 Industries. All rights reserved.
|
||||
|
||||
#import <EXUpdates/EXUpdatesBareUpdate.h>
|
||||
#import <EXUpdates/EXUpdatesEmbeddedAppLoader.h>
|
||||
#import <EXUpdates/EXUpdatesUpdate+Private.h>
|
||||
#import <EXUpdates/EXUpdatesUtils.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@implementation EXUpdatesBareUpdate
|
||||
|
||||
+ (EXUpdatesUpdate *)updateWithBareManifest:(NSDictionary *)manifest
|
||||
config:(EXUpdatesConfig *)config
|
||||
database:(EXUpdatesDatabase *)database
|
||||
{
|
||||
EXUpdatesUpdate *update = [[EXUpdatesUpdate alloc] initWithRawManifest:manifest
|
||||
config:config
|
||||
database:database];
|
||||
|
||||
id updateId = manifest[@"id"];
|
||||
id commitTime = manifest[@"commitTime"];
|
||||
id metadata = manifest[@"metadata"];
|
||||
id assets = manifest[@"assets"];
|
||||
|
||||
NSAssert([updateId isKindOfClass:[NSString class]], @"update ID should be a string");
|
||||
NSAssert([commitTime isKindOfClass:[NSNumber class]], @"commitTime should be a number");
|
||||
NSAssert(!metadata || [metadata isKindOfClass:[NSDictionary class]], @"metadata should be null or an object");
|
||||
NSAssert(assets && [assets isKindOfClass:[NSArray class]], @"assets should be a nonnull array");
|
||||
|
||||
NSUUID *uuid = [[NSUUID alloc] initWithUUIDString:(NSString *)updateId];
|
||||
NSAssert(uuid, @"update ID should be a valid UUID");
|
||||
|
||||
NSMutableArray<EXUpdatesAsset *> *processedAssets = [NSMutableArray new];
|
||||
|
||||
NSString *bundleKey = [NSString stringWithFormat:@"bundle-%@", commitTime];
|
||||
EXUpdatesAsset *jsBundleAsset = [[EXUpdatesAsset alloc] initWithKey:bundleKey type:EXUpdatesBareEmbeddedBundleFileType];
|
||||
jsBundleAsset.isLaunchAsset = YES;
|
||||
jsBundleAsset.mainBundleFilename = EXUpdatesBareEmbeddedBundleFilename;
|
||||
[processedAssets addObject:jsBundleAsset];
|
||||
|
||||
for (NSDictionary *assetDict in (NSArray *)assets) {
|
||||
NSAssert([assetDict isKindOfClass:[NSDictionary class]], @"assets must be objects");
|
||||
id packagerHash = assetDict[@"packagerHash"];
|
||||
id type = assetDict[@"type"];
|
||||
id mainBundleDir = assetDict[@"nsBundleDir"];
|
||||
id mainBundleFilename = assetDict[@"nsBundleFilename"];
|
||||
NSAssert(packagerHash && [packagerHash isKindOfClass:[NSString class]], @"asset key should be a nonnull string");
|
||||
NSAssert(type && [type isKindOfClass:[NSString class]], @"asset type should be a nonnull string");
|
||||
NSAssert(mainBundleFilename && [mainBundleFilename isKindOfClass:[NSString class]], @"asset nsBundleFilename should be a nonnull string");
|
||||
if (mainBundleDir) {
|
||||
NSAssert([mainBundleDir isKindOfClass:[NSString class]], @"asset nsBundleDir should be a string");
|
||||
}
|
||||
|
||||
NSString *key = [NSString stringWithFormat:@"%@.%@", packagerHash, type];
|
||||
EXUpdatesAsset *asset = [[EXUpdatesAsset alloc] initWithKey:key type:(NSString *)type];
|
||||
asset.mainBundleDir = mainBundleDir;
|
||||
asset.mainBundleFilename = mainBundleFilename;
|
||||
|
||||
[processedAssets addObject:asset];
|
||||
}
|
||||
|
||||
update.updateId = uuid;
|
||||
update.commitTime = [NSDate dateWithTimeIntervalSince1970:[(NSNumber *)commitTime doubleValue] / 1000];
|
||||
update.runtimeVersion = [EXUpdatesUtils getRuntimeVersionWithConfig:config];
|
||||
if (metadata) {
|
||||
update.metadata = (NSDictionary *)metadata;
|
||||
}
|
||||
update.status = EXUpdatesUpdateStatusEmbedded;
|
||||
update.keep = YES;
|
||||
update.assets = processedAssets;
|
||||
|
||||
if ([update.runtimeVersion containsString:@","]) {
|
||||
@throw [NSException exceptionWithName:NSInternalInconsistencyException
|
||||
reason:@"Should not be initializing EXUpdatesBareUpdate in an environment with multiple runtime versions."
|
||||
userInfo:@{}];
|
||||
}
|
||||
|
||||
return update;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
17
node_modules/expo-updates/ios/EXUpdates/Update/EXUpdatesLegacyUpdate.h
generated
vendored
Normal file
17
node_modules/expo-updates/ios/EXUpdates/Update/EXUpdatesLegacyUpdate.h
generated
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
// Copyright © 2019 650 Industries. All rights reserved.
|
||||
|
||||
#import <EXUpdates/EXUpdatesUpdate.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface EXUpdatesLegacyUpdate : NSObject
|
||||
|
||||
+ (EXUpdatesUpdate *)updateWithLegacyManifest:(NSDictionary *)manifest
|
||||
config:(EXUpdatesConfig *)config
|
||||
database:(EXUpdatesDatabase *)database;
|
||||
|
||||
+ (NSURL *)bundledAssetBaseUrlWithManifest:(NSDictionary *)manifest config:(EXUpdatesConfig *)config;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
158
node_modules/expo-updates/ios/EXUpdates/Update/EXUpdatesLegacyUpdate.m
generated
vendored
Normal file
158
node_modules/expo-updates/ios/EXUpdates/Update/EXUpdatesLegacyUpdate.m
generated
vendored
Normal file
@ -0,0 +1,158 @@
|
||||
// Copyright © 2019 650 Industries. All rights reserved.
|
||||
|
||||
#import <EXUpdates/EXUpdatesEmbeddedAppLoader.h>
|
||||
#import <EXUpdates/EXUpdatesLegacyUpdate.h>
|
||||
#import <EXUpdates/EXUpdatesUpdate+Private.h>
|
||||
#import <EXUpdates/EXUpdatesUtils.h>
|
||||
#import <React/RCTConvert.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
static NSString * const EXUpdatesExpoAssetBaseUrl = @"https://d1wp6m56sqw74a.cloudfront.net/~assets/";
|
||||
static NSString * const EXUpdatesExpoIoDomain = @"expo.io";
|
||||
static NSString * const EXUpdatesExpHostDomain = @"exp.host";
|
||||
static NSString * const EXUpdatesExpoTestDomain = @"expo.test";
|
||||
|
||||
@implementation EXUpdatesLegacyUpdate
|
||||
|
||||
+ (EXUpdatesUpdate *)updateWithLegacyManifest:(NSDictionary *)manifest
|
||||
config:(EXUpdatesConfig *)config
|
||||
database:(EXUpdatesDatabase *)database
|
||||
{
|
||||
EXUpdatesUpdate *update = [[EXUpdatesUpdate alloc] initWithRawManifest:manifest
|
||||
config:config
|
||||
database:database];
|
||||
|
||||
if ([[self class] areDevToolsEnabledWithManifest:manifest]) {
|
||||
// XDL does not set a releaseId or commitTime for development manifests.
|
||||
// we do not need these so we just stub them out
|
||||
update.updateId = [NSUUID UUID];
|
||||
update.commitTime = [NSDate date];
|
||||
} else {
|
||||
id updateId = manifest[@"releaseId"];
|
||||
NSAssert([updateId isKindOfClass:[NSString class]], @"update ID should be a string");
|
||||
update.updateId = [[NSUUID alloc] initWithUUIDString:(NSString *)updateId];
|
||||
NSAssert(update.updateId, @"update ID should be a valid UUID");
|
||||
|
||||
id commitTimeString = manifest[@"commitTime"];
|
||||
NSAssert([commitTimeString isKindOfClass:[NSString class]], @"commitTime should be a string");
|
||||
update.commitTime = [RCTConvert NSDate:commitTimeString];
|
||||
}
|
||||
|
||||
if ([[self class] isDevelopmentModeManifest:manifest]) {
|
||||
update.isDevelopmentMode = YES;
|
||||
update.status = EXUpdatesUpdateStatusDevelopment;
|
||||
} else {
|
||||
update.status = EXUpdatesUpdateStatusPending;
|
||||
}
|
||||
|
||||
id bundleUrlString = manifest[@"bundleUrl"];
|
||||
id assets = manifest[@"bundledAssets"] ?: @[];
|
||||
|
||||
id sdkVersion = manifest[@"sdkVersion"];
|
||||
id runtimeVersion = manifest[@"runtimeVersion"];
|
||||
if (runtimeVersion && [runtimeVersion isKindOfClass:[NSDictionary class]]) {
|
||||
id runtimeVersionIos = ((NSDictionary *)runtimeVersion)[@"ios"];
|
||||
NSAssert([runtimeVersionIos isKindOfClass:[NSString class]], @"runtimeVersion['ios'] should be a string");
|
||||
update.runtimeVersion = (NSString *)runtimeVersionIos;
|
||||
} else if (runtimeVersion && [runtimeVersion isKindOfClass:[NSString class]]) {
|
||||
update.runtimeVersion = (NSString *)runtimeVersion;
|
||||
} else {
|
||||
NSAssert([sdkVersion isKindOfClass:[NSString class]], @"sdkVersion should be a string");
|
||||
update.runtimeVersion = (NSString *)sdkVersion;
|
||||
}
|
||||
|
||||
NSAssert([bundleUrlString isKindOfClass:[NSString class]], @"bundleUrl should be a string");
|
||||
NSAssert([assets isKindOfClass:[NSArray class]], @"assets should be a nonnull array");
|
||||
|
||||
NSURL *bundleUrl = [NSURL URLWithString:bundleUrlString];
|
||||
NSAssert(bundleUrl, @"bundleUrl should be a valid URL");
|
||||
|
||||
NSMutableArray<EXUpdatesAsset *> *processedAssets = [NSMutableArray new];
|
||||
|
||||
NSString *bundleKey = [NSString stringWithFormat:@"bundle-%@", [EXUpdatesUtils sha256WithData:[(NSString *)bundleUrlString dataUsingEncoding:NSUTF8StringEncoding]]];
|
||||
EXUpdatesAsset *jsBundleAsset = [[EXUpdatesAsset alloc] initWithKey:bundleKey type:EXUpdatesEmbeddedBundleFileType];
|
||||
jsBundleAsset.url = bundleUrl;
|
||||
jsBundleAsset.isLaunchAsset = YES;
|
||||
jsBundleAsset.mainBundleFilename = EXUpdatesEmbeddedBundleFilename;
|
||||
[processedAssets addObject:jsBundleAsset];
|
||||
|
||||
NSURL *bundledAssetBaseUrl = [[self class] bundledAssetBaseUrlWithManifest:manifest config:config];
|
||||
|
||||
for (NSString *bundledAsset in (NSArray *)assets) {
|
||||
NSAssert([bundledAsset isKindOfClass:[NSString class]], @"bundledAssets must be an array of strings");
|
||||
|
||||
NSRange extensionStartRange = [bundledAsset rangeOfString:@"." options:NSBackwardsSearch];
|
||||
NSUInteger prefixLength = [@"asset_" length];
|
||||
NSString *filename;
|
||||
NSString *hash;
|
||||
NSString *type;
|
||||
if (extensionStartRange.location == NSNotFound) {
|
||||
filename = bundledAsset;
|
||||
hash = [bundledAsset substringFromIndex:prefixLength];
|
||||
type = @"";
|
||||
} else {
|
||||
filename = [bundledAsset substringToIndex:extensionStartRange.location];
|
||||
NSRange hashRange = NSMakeRange(prefixLength, extensionStartRange.location - prefixLength);
|
||||
hash = [bundledAsset substringWithRange:hashRange];
|
||||
type = [bundledAsset substringFromIndex:extensionStartRange.location + 1];
|
||||
}
|
||||
|
||||
NSURL *url = [bundledAssetBaseUrl URLByAppendingPathComponent:hash];
|
||||
|
||||
NSString *key = [NSString stringWithFormat:@"%@.%@", hash, type];
|
||||
EXUpdatesAsset *asset = [[EXUpdatesAsset alloc] initWithKey:key type:(NSString *)type];
|
||||
asset.url = url;
|
||||
asset.mainBundleFilename = filename;
|
||||
|
||||
[processedAssets addObject:asset];
|
||||
}
|
||||
|
||||
update.metadata = manifest;
|
||||
update.keep = YES;
|
||||
update.bundleUrl = bundleUrl;
|
||||
update.assets = processedAssets;
|
||||
|
||||
return update;
|
||||
}
|
||||
|
||||
+ (NSURL *)bundledAssetBaseUrlWithManifest:(NSDictionary *)manifest config:(EXUpdatesConfig *)config
|
||||
{
|
||||
NSURL *manifestUrl = config.updateUrl;
|
||||
NSString *host = manifestUrl.host;
|
||||
if (!host ||
|
||||
[host containsString:EXUpdatesExpoIoDomain] ||
|
||||
[host containsString:EXUpdatesExpHostDomain] ||
|
||||
[host containsString:EXUpdatesExpoTestDomain]) {
|
||||
return [NSURL URLWithString:EXUpdatesExpoAssetBaseUrl];
|
||||
} else {
|
||||
NSString *assetsPathOrUrl = manifest[@"assetUrlOverride"] ?: @"assets";
|
||||
// assetUrlOverride may be an absolute or relative URL
|
||||
// if relative, we should resolve with respect to the manifest URL
|
||||
NSURL *maybeAssetsUrl = [NSURL URLWithString:assetsPathOrUrl];
|
||||
if (maybeAssetsUrl && maybeAssetsUrl.scheme) {
|
||||
return maybeAssetsUrl;
|
||||
} else if (maybeAssetsUrl && maybeAssetsUrl.standardizedURL) {
|
||||
return [manifestUrl.URLByDeletingLastPathComponent URLByAppendingPathComponent:maybeAssetsUrl.standardizedURL.relativeString];
|
||||
} else {
|
||||
return [manifestUrl.URLByDeletingLastPathComponent URLByAppendingPathComponent:assetsPathOrUrl];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+ (BOOL)isDevelopmentModeManifest:(NSDictionary *)manifest
|
||||
{
|
||||
NSDictionary *manifestPackagerOptsConfig = manifest[@"packagerOpts"];
|
||||
return (manifest[@"developer"] != nil && manifestPackagerOptsConfig != nil && [@(YES) isEqualToNumber:manifestPackagerOptsConfig[@"dev"]]);
|
||||
}
|
||||
|
||||
+ (BOOL)areDevToolsEnabledWithManifest:(NSDictionary *)manifest
|
||||
{
|
||||
NSDictionary *manifestDeveloperConfig = manifest[@"developer"];
|
||||
BOOL isDeployedFromTool = (manifestDeveloperConfig && manifestDeveloperConfig[@"tool"] != nil);
|
||||
return (isDeployedFromTool);
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
15
node_modules/expo-updates/ios/EXUpdates/Update/EXUpdatesNewUpdate.h
generated
vendored
Normal file
15
node_modules/expo-updates/ios/EXUpdates/Update/EXUpdatesNewUpdate.h
generated
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
// Copyright © 2019 650 Industries. All rights reserved.
|
||||
|
||||
#import <EXUpdates/EXUpdatesUpdate.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface EXUpdatesNewUpdate : NSObject
|
||||
|
||||
+ (EXUpdatesUpdate *)updateWithNewManifest:(NSDictionary *)manifest
|
||||
config:(EXUpdatesConfig *)config
|
||||
database:(EXUpdatesDatabase *)database;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
93
node_modules/expo-updates/ios/EXUpdates/Update/EXUpdatesNewUpdate.m
generated
vendored
Normal file
93
node_modules/expo-updates/ios/EXUpdates/Update/EXUpdatesNewUpdate.m
generated
vendored
Normal file
@ -0,0 +1,93 @@
|
||||
// Copyright © 2019 650 Industries. All rights reserved.
|
||||
|
||||
#import <EXUpdates/EXUpdatesEmbeddedAppLoader.h>
|
||||
#import <EXUpdates/EXUpdatesNewUpdate.h>
|
||||
#import <EXUpdates/EXUpdatesUpdate+Private.h>
|
||||
#import <EXUpdates/EXUpdatesUtils.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@implementation EXUpdatesNewUpdate
|
||||
|
||||
+ (EXUpdatesUpdate *)updateWithNewManifest:(NSDictionary *)manifest
|
||||
config:(EXUpdatesConfig *)config
|
||||
database:(EXUpdatesDatabase *)database
|
||||
{
|
||||
EXUpdatesUpdate *update = [[EXUpdatesUpdate alloc] initWithRawManifest:manifest
|
||||
config:config
|
||||
database:database];
|
||||
|
||||
id updateId = manifest[@"id"];
|
||||
id commitTime = manifest[@"commitTime"];
|
||||
id runtimeVersion = manifest[@"runtimeVersion"];
|
||||
id metadata = manifest[@"metadata"];
|
||||
id bundleUrlString = manifest[@"bundleUrl"];
|
||||
id assets = manifest[@"assets"];
|
||||
|
||||
NSAssert([updateId isKindOfClass:[NSString class]], @"update ID should be a string");
|
||||
NSAssert([commitTime isKindOfClass:[NSNumber class]], @"commitTime should be a number");
|
||||
NSAssert([runtimeVersion isKindOfClass:[NSString class]], @"runtimeVersion should be a string");
|
||||
NSAssert(!metadata || [metadata isKindOfClass:[NSDictionary class]], @"metadata should be null or an object");
|
||||
NSAssert([bundleUrlString isKindOfClass:[NSString class]], @"bundleUrl should be a string");
|
||||
NSAssert(assets && [assets isKindOfClass:[NSArray class]], @"assets should be a nonnull array");
|
||||
|
||||
NSUUID *uuid = [[NSUUID alloc] initWithUUIDString:(NSString *)updateId];
|
||||
NSAssert(uuid, @"update ID should be a valid UUID");
|
||||
NSURL *bundleUrl = [NSURL URLWithString:bundleUrlString];
|
||||
NSAssert(bundleUrl, @"bundleUrl should be a valid URL");
|
||||
|
||||
NSMutableArray<EXUpdatesAsset *> *processedAssets = [NSMutableArray new];
|
||||
|
||||
NSString *bundleKey = [NSString stringWithFormat:@"bundle-%@", commitTime];
|
||||
EXUpdatesAsset *jsBundleAsset = [[EXUpdatesAsset alloc] initWithKey:bundleKey type:EXUpdatesEmbeddedBundleFileType];
|
||||
jsBundleAsset.url = bundleUrl;
|
||||
jsBundleAsset.isLaunchAsset = YES;
|
||||
jsBundleAsset.mainBundleFilename = EXUpdatesEmbeddedBundleFilename;
|
||||
[processedAssets addObject:jsBundleAsset];
|
||||
|
||||
for (NSDictionary *assetDict in (NSArray *)assets) {
|
||||
NSAssert([assetDict isKindOfClass:[NSDictionary class]], @"assets must be objects");
|
||||
id key = assetDict[@"key"];
|
||||
id urlString = assetDict[@"url"];
|
||||
id type = assetDict[@"type"];
|
||||
id metadata = assetDict[@"metadata"];
|
||||
id mainBundleFilename = assetDict[@"mainBundleFilename"];
|
||||
NSAssert(key && [key isKindOfClass:[NSString class]], @"asset key should be a nonnull string");
|
||||
NSAssert(urlString && [urlString isKindOfClass:[NSString class]], @"asset url should be a nonnull string");
|
||||
NSAssert(type && [type isKindOfClass:[NSString class]], @"asset type should be a nonnull string");
|
||||
NSURL *url = [NSURL URLWithString:(NSString *)urlString];
|
||||
NSAssert(url, @"asset url should be a valid URL");
|
||||
|
||||
EXUpdatesAsset *asset = [[EXUpdatesAsset alloc] initWithKey:key type:(NSString *)type];
|
||||
asset.url = url;
|
||||
|
||||
if (metadata) {
|
||||
NSAssert([metadata isKindOfClass:[NSDictionary class]], @"asset metadata should be an object");
|
||||
asset.metadata = (NSDictionary *)metadata;
|
||||
}
|
||||
|
||||
if (mainBundleFilename) {
|
||||
NSAssert([mainBundleFilename isKindOfClass:[NSString class]], @"asset localPath should be a string");
|
||||
asset.mainBundleFilename = (NSString *)mainBundleFilename;
|
||||
}
|
||||
|
||||
[processedAssets addObject:asset];
|
||||
}
|
||||
|
||||
update.updateId = uuid;
|
||||
update.commitTime = [NSDate dateWithTimeIntervalSince1970:[(NSNumber *)commitTime doubleValue] / 1000];
|
||||
update.runtimeVersion = (NSString *)runtimeVersion;
|
||||
if (metadata) {
|
||||
update.metadata = (NSDictionary *)metadata;
|
||||
}
|
||||
update.status = EXUpdatesUpdateStatusPending;
|
||||
update.keep = YES;
|
||||
update.bundleUrl = bundleUrl;
|
||||
update.assets = processedAssets;
|
||||
|
||||
return update;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
29
node_modules/expo-updates/ios/EXUpdates/Update/EXUpdatesUpdate+Private.h
generated
vendored
Normal file
29
node_modules/expo-updates/ios/EXUpdates/Update/EXUpdatesUpdate+Private.h
generated
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
// Copyright © 2019 650 Industries. All rights reserved.
|
||||
|
||||
#import <EXUpdates/EXUpdatesAsset.h>
|
||||
#import <EXUpdates/EXUpdatesUpdate.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface EXUpdatesUpdate ()
|
||||
|
||||
@property (nonatomic, strong, readwrite) NSUUID *updateId;
|
||||
@property (nonatomic, strong, readwrite) NSString *scopeKey;
|
||||
@property (nonatomic, strong, readwrite) NSDate *commitTime;
|
||||
@property (nonatomic, strong, readwrite) NSString *runtimeVersion;
|
||||
@property (nonatomic, strong, readwrite, nullable) NSDictionary *metadata;
|
||||
@property (nonatomic, assign, readwrite) BOOL keep;
|
||||
@property (nonatomic, strong, readwrite) NSURL *bundleUrl;
|
||||
@property (nonatomic, strong, readwrite) NSArray<EXUpdatesAsset *> *assets;
|
||||
@property (nonatomic, assign, readwrite) BOOL isDevelopmentMode;
|
||||
|
||||
@property (nonatomic, strong) EXUpdatesConfig *config;
|
||||
@property (nonatomic, strong, nullable) EXUpdatesDatabase *database;
|
||||
|
||||
- (instancetype)initWithRawManifest:(NSDictionary *)manifest
|
||||
config:(EXUpdatesConfig *)config
|
||||
database:(nullable EXUpdatesDatabase *)database;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
55
node_modules/expo-updates/ios/EXUpdates/Update/EXUpdatesUpdate.h
generated
vendored
Normal file
55
node_modules/expo-updates/ios/EXUpdates/Update/EXUpdatesUpdate.h
generated
vendored
Normal file
@ -0,0 +1,55 @@
|
||||
// Copyright © 2019 650 Industries. All rights reserved.
|
||||
|
||||
#import <EXUpdates/EXUpdatesAsset.h>
|
||||
#import <EXUpdates/EXUpdatesConfig.h>
|
||||
|
||||
@class EXUpdatesDatabase;
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
typedef NS_ENUM(NSInteger, EXUpdatesUpdateStatus) {
|
||||
EXUpdatesUpdateStatusFailed = 0,
|
||||
EXUpdatesUpdateStatusReady = 1,
|
||||
EXUpdatesUpdateStatusLaunchable = 2,
|
||||
EXUpdatesUpdateStatusPending = 3,
|
||||
EXUpdatesUpdateStatusUnused = 4,
|
||||
EXUpdatesUpdateStatusEmbedded = 5,
|
||||
EXUpdatesUpdateStatusDevelopment = 6
|
||||
};
|
||||
|
||||
@interface EXUpdatesUpdate : NSObject
|
||||
|
||||
@property (nonatomic, strong, readonly) NSUUID *updateId;
|
||||
@property (nonatomic, strong, readonly) NSString *scopeKey;
|
||||
@property (nonatomic, strong, readonly) NSDate *commitTime;
|
||||
@property (nonatomic, strong, readonly) NSString *runtimeVersion;
|
||||
@property (nonatomic, strong, readonly, nullable) NSDictionary * metadata;
|
||||
@property (nonatomic, assign, readonly) BOOL keep;
|
||||
@property (nonatomic, strong, readonly) NSArray<EXUpdatesAsset *> *assets;
|
||||
@property (nonatomic, assign, readonly) BOOL isDevelopmentMode;
|
||||
|
||||
@property (nonatomic, strong, readonly) NSDictionary *rawManifest;
|
||||
|
||||
@property (nonatomic, assign) EXUpdatesUpdateStatus status;
|
||||
|
||||
+ (instancetype)updateWithId:(NSUUID *)updateId
|
||||
scopeKey:(NSString *)scopeKey
|
||||
commitTime:(NSDate *)commitTime
|
||||
runtimeVersion:(NSString *)runtimeVersion
|
||||
metadata:(nullable NSDictionary *)metadata
|
||||
status:(EXUpdatesUpdateStatus)status
|
||||
keep:(BOOL)keep
|
||||
config:(EXUpdatesConfig *)config
|
||||
database:(EXUpdatesDatabase *)database;
|
||||
|
||||
+ (instancetype)updateWithManifest:(NSDictionary *)manifest
|
||||
config:(EXUpdatesConfig *)config
|
||||
database:(EXUpdatesDatabase *)database;
|
||||
|
||||
+ (instancetype)updateWithEmbeddedManifest:(NSDictionary *)manifest
|
||||
config:(EXUpdatesConfig *)config
|
||||
database:(nullable EXUpdatesDatabase *)database;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
113
node_modules/expo-updates/ios/EXUpdates/Update/EXUpdatesUpdate.m
generated
vendored
Normal file
113
node_modules/expo-updates/ios/EXUpdates/Update/EXUpdatesUpdate.m
generated
vendored
Normal file
@ -0,0 +1,113 @@
|
||||
// Copyright © 2019 650 Industries. All rights reserved.
|
||||
|
||||
#import <EXUpdates/EXUpdatesBareUpdate.h>
|
||||
#import <EXUpdates/EXUpdatesDatabase.h>
|
||||
#import <EXUpdates/EXUpdatesLegacyUpdate.h>
|
||||
#import <EXUpdates/EXUpdatesNewUpdate.h>
|
||||
#import <EXUpdates/EXUpdatesUpdate+Private.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface EXUpdatesUpdate ()
|
||||
|
||||
@property (nonatomic, strong, readwrite) NSDictionary *rawManifest;
|
||||
|
||||
@end
|
||||
|
||||
@implementation EXUpdatesUpdate
|
||||
|
||||
- (instancetype)initWithRawManifest:(NSDictionary *)manifest
|
||||
config:(EXUpdatesConfig *)config
|
||||
database:(nullable EXUpdatesDatabase *)database
|
||||
{
|
||||
if (self = [super init]) {
|
||||
_rawManifest = manifest;
|
||||
_config = config;
|
||||
_database = database;
|
||||
_scopeKey = config.scopeKey;
|
||||
_isDevelopmentMode = NO;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
+ (instancetype)updateWithId:(NSUUID *)updateId
|
||||
scopeKey:(NSString *)scopeKey
|
||||
commitTime:(NSDate *)commitTime
|
||||
runtimeVersion:(NSString *)runtimeVersion
|
||||
metadata:(nullable NSDictionary *)metadata
|
||||
status:(EXUpdatesUpdateStatus)status
|
||||
keep:(BOOL)keep
|
||||
config:(EXUpdatesConfig *)config
|
||||
database:(EXUpdatesDatabase *)database
|
||||
{
|
||||
// for now, we store the entire managed manifest in the metadata field
|
||||
EXUpdatesUpdate *update = [[self alloc] initWithRawManifest:metadata ?: @{}
|
||||
config:config
|
||||
database:database];
|
||||
update.updateId = updateId;
|
||||
update.scopeKey = scopeKey;
|
||||
update.commitTime = commitTime;
|
||||
update.runtimeVersion = runtimeVersion;
|
||||
update.metadata = metadata;
|
||||
update.status = status;
|
||||
update.keep = keep;
|
||||
return update;
|
||||
}
|
||||
|
||||
+ (instancetype)updateWithManifest:(NSDictionary *)manifest
|
||||
config:(EXUpdatesConfig *)config
|
||||
database:(EXUpdatesDatabase *)database
|
||||
{
|
||||
if (config.usesLegacyManifest) {
|
||||
return [EXUpdatesLegacyUpdate updateWithLegacyManifest:manifest
|
||||
config:config
|
||||
database:database];
|
||||
} else {
|
||||
return [EXUpdatesNewUpdate updateWithNewManifest:manifest
|
||||
config:config
|
||||
database:database];
|
||||
}
|
||||
}
|
||||
|
||||
+ (instancetype)updateWithEmbeddedManifest:(NSDictionary *)manifest
|
||||
config:(EXUpdatesConfig *)config
|
||||
database:(nullable EXUpdatesDatabase *)database
|
||||
{
|
||||
if (config.usesLegacyManifest) {
|
||||
if (manifest[@"releaseId"]) {
|
||||
return [EXUpdatesLegacyUpdate updateWithLegacyManifest:manifest
|
||||
config:config
|
||||
database:database];
|
||||
} else {
|
||||
return [EXUpdatesBareUpdate updateWithBareManifest:manifest
|
||||
config:config
|
||||
database:database];
|
||||
}
|
||||
} else {
|
||||
if (manifest[@"runtimeVersion"]) {
|
||||
return [EXUpdatesNewUpdate updateWithNewManifest:manifest
|
||||
config:config
|
||||
database:database];
|
||||
} else {
|
||||
return [EXUpdatesBareUpdate updateWithBareManifest:manifest
|
||||
config:config
|
||||
database:database];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (NSArray<EXUpdatesAsset *> *)assets
|
||||
{
|
||||
if (!_assets && _database) {
|
||||
dispatch_sync(_database.databaseQueue, ^{
|
||||
NSError *error;
|
||||
self->_assets = [self->_database assetsWithUpdateId:self->_updateId error:&error];
|
||||
NSAssert(self->_assets, @"Assets should be nonnull when selected from DB: %@", error.localizedDescription);
|
||||
});
|
||||
}
|
||||
return _assets;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
Reference in New Issue
Block a user