// Copyright 2018-present 650 Industries. All rights reserved. #import #import #import #import @implementation EXApplication UM_EXPORT_MODULE(ExpoApplication); - (dispatch_queue_t)methodQueue { return dispatch_get_main_queue(); } UM_EXPORT_METHOD_AS(getIosIdForVendorAsync, getIosIdForVendorAsyncWithResolver:(UMPromiseResolveBlock)resolve rejecter:(UMPromiseRejectBlock)reject) { resolve([[UIDevice currentDevice].identifierForVendor UUIDString]); } UM_EXPORT_METHOD_AS(getInstallationTimeAsync, getInstallationTimeAsyncWithResolver:(UMPromiseResolveBlock)resolve rejecter:(UMPromiseRejectBlock)reject) { NSURL *urlToDocumentsFolder = [[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] lastObject]; NSError *error = nil; NSDate *installDate = [[[NSFileManager defaultManager] attributesOfItemAtPath:urlToDocumentsFolder.path error:&error] objectForKey:NSFileCreationDate]; if (error) { reject(@"ERR_APPLICATION", @"Unable to get installation time of this application.", error); } else { NSTimeInterval timeInMilliseconds = [installDate timeIntervalSince1970] * 1000; NSNumber *timeNumber = @(timeInMilliseconds); resolve(timeNumber); } } UM_EXPORT_METHOD_AS(getApplicationReleaseTypeAsync, getApplicationReleaseTypeAsyncWithResolver:(UMPromiseResolveBlock)resolve rejecter:(UMPromiseRejectBlock)reject) { EXProvisioningProfile *mainProvisioningProfile = [EXProvisioningProfile mainProvisioningProfile]; resolve(@([mainProvisioningProfile appReleaseType])); } UM_EXPORT_METHOD_AS(getPushNotificationServiceEnvironmentAsync, getPushNotificationServiceEnvironmentAsyncWithResolver:(UMPromiseResolveBlock)resolve rejecter:(UMPromiseRejectBlock)reject) { EXProvisioningProfile *mainProvisioningProfile = [EXProvisioningProfile mainProvisioningProfile]; resolve([mainProvisioningProfile notificationServiceEnvironment]); } - (NSDictionary *)constantsToExport { return @{ @"applicationName": [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleDisplayName"] ?: [NSNull null], @"applicationId": [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleIdentifier"] ?: [NSNull null], @"nativeApplicationVersion": [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"] ?: [NSNull null], @"nativeBuildVersion": [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"]?: [NSNull null], }; } @end