// Copyright 2015-present 650 Industries. All rights reserved. #import "EXConstantsBinding.h" #import "EXUnversioned.h" @interface EXConstantsBinding () @property (nonatomic, strong) NSDictionary *unversionedConstants; @end @implementation EXConstantsBinding : EXConstantsService @synthesize appOwnership = _appOwnership; - (instancetype)initWithExperienceId:(NSString *)experienceId andParams:(NSDictionary *)params { if (self = [super initWithExperienceId:experienceId]) { _unversionedConstants = params[@"constants"]; if (_unversionedConstants && _unversionedConstants[@"appOwnership"]) { _appOwnership = _unversionedConstants[@"appOwnership"]; } } return self; } - (NSDictionary *)constants { NSMutableDictionary *constants = [[super constants] mutableCopy]; [constants setValue:[self expoClientVersion] forKey:@"expoVersion"]; if (_unversionedConstants) { [constants addEntriesFromDictionary:_unversionedConstants]; } return constants; } - (NSString *)expoClientVersion { NSString *expoClientVersion = _unversionedConstants[EX_UNVERSIONED(@"expoRuntimeVersion")]; if (expoClientVersion) { return expoClientVersion; } else { // not correct in standalone apps return [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"]; } } @end