first commit

This commit is contained in:
2026-03-10 16:18:05 +00:00
commit 11f9c069b5
31635 changed files with 3187747 additions and 0 deletions

25
node_modules/expo-constants/ios/ConstantsModule.swift generated vendored Normal file
View File

@@ -0,0 +1,25 @@
import ExpoModulesCore
#if !os(tvOS)
import WebKit
#endif
public class ConstantsModule: Module {
private lazy var constants = appContext?.constants?.constants() as? [String: Any] ?? [:]
public func definition() -> ModuleDefinition {
Name("ExponentConstants")
Constants {
return constants
}
AsyncFunction("getWebViewUserAgentAsync") { () -> String? in
#if os(tvOS)
return nil
#else
let webView = WKWebView()
return webView.value(forKey: "userAgent") as? String
#endif
}.runOnQueue(.main)
}
}

57
node_modules/expo-constants/ios/EXConstants.podspec generated vendored Normal file
View File

@@ -0,0 +1,57 @@
require 'json'
package = JSON.parse(File.read(File.join(__dir__, '..', 'package.json')))
Pod::Spec.new do |s|
s.name = 'EXConstants'
s.version = package['version']
s.summary = package['description']
s.description = package['description']
s.license = package['license']
s.author = package['author']
s.homepage = package['homepage']
s.platforms = {
:ios => '15.1',
:osx => '11.0',
:tvos => '15.1'
}
s.swift_version = '5.9'
s.source = { git: 'https://github.com/expo/expo.git' }
s.static_framework = true
s.dependency 'ExpoModulesCore'
# Swift/Objective-C compatibility
s.pod_target_xcconfig = {
'DEFINES_MODULE' => 'YES',
'SWIFT_COMPILATION_MODE' => 'wholemodule'
}
if !$ExpoUseSources&.include?(package['name']) && ENV['EXPO_USE_SOURCE'].to_i == 0 && File.exist?("#{s.name}.xcframework") && Gem::Version.new(Pod::VERSION) >= Gem::Version.new('1.10.0')
s.source_files = "**/*.h"
s.vendored_frameworks = "#{s.name}.xcframework"
else
s.source_files = "**/*.{h,m,swift}"
end
env_vars = ENV['PROJECT_ROOT'] ? "PROJECT_ROOT=#{ENV['PROJECT_ROOT']} " : ""
script_phase = {
:name => 'Generate app.config for prebuilt Constants.manifest',
:script => "bash -l -c \"#{env_vars}$PODS_TARGET_SRCROOT/../scripts/get-app-config-ios.sh\"",
:execution_position => :before_compile
}
# :always_out_of_date is only available in CocoaPods 1.13.0 and later
if Gem::Version.new(Pod::VERSION) >= Gem::Version.new('1.13.0')
# always run the script without warning
script_phase[:always_out_of_date] = "1"
end
s.script_phase = script_phase
# Generate EXConstants.bundle without existing resources
# `get-app-config-ios.sh` will generate app.config in EXConstants.bundle
s.resource_bundles = {
'EXConstants' => [],
'ExpoConstants_privacy' => ['PrivacyInfo.xcprivacy']
}
end

View File

@@ -0,0 +1,14 @@
// Copyright 2015-present 650 Industries. All rights reserved.
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface EXConstantsInstallationIdProvider : NSObject
- (nullable NSString *)getInstallationId;
- (NSString *)getOrCreateInstallationId;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,108 @@
// Copyright 2015-present 650 Industries. All rights reserved.
#import <EXConstants/EXConstantsInstallationIdProvider.h>
static NSString * const kEXDeviceInstallationUUIDKey = @"EXDeviceInstallationUUIDKey";
static NSString * const kEXDeviceInstallationUUIDLegacyKey = @"EXDeviceInstallUUIDKey";
@implementation EXConstantsInstallationIdProvider
- (NSString *)getOrCreateInstallationId
{
#if TARGET_OS_IOS || TARGET_OS_TV
NSString *installationId = [self getInstallationId];
if (installationId) {
return installationId;
}
installationId = [[NSUUID UUID] UUIDString];
[self setInstallationId:installationId error:NULL];
return installationId;
#elif TARGET_OS_OSX
return nil;
#endif
}
- (nullable NSString *)getInstallationId
{
NSString *installationId;
CFTypeRef keychainResult = NULL;
if (SecItemCopyMatching((__bridge CFDictionaryRef)[self installationIdGetQuery], &keychainResult) == noErr) {
NSData *result = (__bridge_transfer NSData *)keychainResult;
NSString *value = [[NSString alloc] initWithData:result
encoding:NSUTF8StringEncoding];
// `initWithUUIDString` returns nil if string is not a valid UUID
if ([[NSUUID alloc] initWithUUIDString:value]) {
installationId = value;
}
}
if (installationId) {
return installationId;
}
// Uses required reason API based on the following reason: CA92.1
NSString *legacyUUID = [[NSUserDefaults standardUserDefaults] stringForKey:kEXDeviceInstallationUUIDLegacyKey];
if (legacyUUID) {
installationId = legacyUUID;
NSError *error = nil;
if ([self setInstallationId:installationId error:&error]) {
// We only remove the value from old storage once it's set and saved in the new storage.
[[NSUserDefaults standardUserDefaults] removeObjectForKey:kEXDeviceInstallationUUIDLegacyKey];
} else {
NSLog(@"Could not migrate device installation UUID from legacy storage: %@", error.description);
}
}
return installationId;
}
- (BOOL)setInstallationId:(NSString *)installationId error:(NSError **)error
{
// Delete existing UUID so we don't need to handle "duplicate item" error
SecItemDelete((__bridge CFDictionaryRef)[self installationIdSearchQuery]);
OSStatus status = SecItemAdd((__bridge CFDictionaryRef)[self installationIdSetQuery:installationId], NULL);
if (status != errSecSuccess && error) {
*error = [NSError errorWithDomain:NSOSStatusErrorDomain code:status userInfo:nil];
}
return status == errSecSuccess;
}
# pragma mark - Keychain dictionaries
- (NSDictionary *)installationIdSearchQueryMerging:(NSDictionary *)dictionaryToMerge
{
NSData *encodedKey = [kEXDeviceInstallationUUIDKey dataUsingEncoding:NSUTF8StringEncoding];
NSMutableDictionary *query = [NSMutableDictionary dictionaryWithDictionary:@{
(__bridge id)kSecClass:(__bridge id)kSecClassGenericPassword,
(__bridge id)kSecAttrService:[NSBundle mainBundle].bundleIdentifier,
(__bridge id)kSecAttrGeneric:encodedKey,
(__bridge id)kSecAttrAccount:encodedKey
}];
[query addEntriesFromDictionary:dictionaryToMerge];
return query;
}
- (NSDictionary *)installationIdSearchQuery
{
return [self installationIdSearchQueryMerging:@{}];
}
- (NSDictionary *)installationIdGetQuery
{
return [self installationIdSearchQueryMerging:@{
(__bridge id)kSecMatchLimit:(__bridge id)kSecMatchLimitOne,
(__bridge id)kSecReturnData:(__bridge id)kCFBooleanTrue
}];
}
- (NSDictionary *)installationIdSetQuery:(NSString *)deviceInstallationUUID
{
return [self installationIdSearchQueryMerging:@{
(__bridge id)kSecValueData:[deviceInstallationUUID dataUsingEncoding:NSUTF8StringEncoding],
(__bridge id)kSecAttrAccessible:(__bridge id)kSecAttrAccessibleAfterFirstUnlockThisDeviceOnly
}];
}
@end

23
node_modules/expo-constants/ios/EXConstantsService.h generated vendored Normal file
View File

@@ -0,0 +1,23 @@
// Copyright 2015-present 650 Industries. All rights reserved.
#import <Foundation/Foundation.h>
#import <ExpoModulesCore/EXInternalModule.h>
#import <ExpoModulesCore/EXConstantsInterface.h>
NS_ASSUME_NONNULL_BEGIN
FOUNDATION_EXPORT NSString * const EXConstantsExecutionEnvironmentBare;
FOUNDATION_EXPORT NSString * const EXConstantsExecutionEnvironmentStoreClient;
@interface EXConstantsService : NSObject <EXInternalModule, EXConstantsInterface>
- (NSString *)buildVersion;
- (CGFloat)statusBarHeight;
- (NSArray<NSString *> *)systemFontNames;
+ (NSNumber *)deviceYear;
+ (NSString *)deviceName;
@end
NS_ASSUME_NONNULL_END

132
node_modules/expo-constants/ios/EXConstantsService.m generated vendored Normal file
View File

@@ -0,0 +1,132 @@
// Copyright 2015-present 650 Industries. All rights reserved.
#include <sys/types.h>
#include <sys/sysctl.h>
#include <sys/utsname.h>
#import <ExpoModulesCore/EXUtilities.h>
#import <EXConstants/EXConstantsService.h>
#import <EXConstants/EXConstantsInstallationIdProvider.h>
NSString * const EXConstantsExecutionEnvironmentBare = @"bare";
NSString * const EXConstantsExecutionEnvironmentStoreClient = @"storeClient";
@interface EXConstantsService ()
@property (nonatomic, strong) NSString *sessionId;
@end
@implementation EXConstantsService
EX_REGISTER_MODULE();
+ (const NSArray<Protocol *> *)exportedInterfaces
{
return @[@protocol(EXConstantsInterface)];
}
- (NSDictionary *)constants
{
if (!_sessionId) {
_sessionId = [[NSUUID UUID] UUIDString];
}
BOOL isDebugXCodeScheme = NO;
#if DEBUG
isDebugXCodeScheme = YES;
#endif
return @{
@"sessionId": _sessionId,
@"executionEnvironment": EXConstantsExecutionEnvironmentBare,
@"statusBarHeight": @([self statusBarHeight]),
@"deviceName": [[self class] deviceName],
@"systemFonts": [self systemFontNames],
@"debugMode": @(isDebugXCodeScheme),
@"isHeadless": @(NO),
@"manifest": EXNullIfNil([[self class] appConfig]), // Deprecated, but still used internally.
@"platform": @{
@"ios": @{
@"buildNumber": EXNullIfNil([self buildVersion]),
},
},
};
}
- (NSString *)buildVersion
{
return [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"];
}
- (CGFloat)statusBarHeight
{
#if TARGET_OS_IOS
__block CGSize statusBarSize;
[EXUtilities performSynchronouslyOnMainThread:^{
statusBarSize = [UIApplication sharedApplication].statusBarFrame.size;
}];
return MIN(statusBarSize.width, statusBarSize.height);
#elif TARGET_OS_OSX || TARGET_OS_TV
return 0;
#endif
}
- (NSArray<NSString *> *)systemFontNames
{
#if TARGET_OS_IOS || TARGET_OS_TV
NSArray<NSString *> *familyNames = [UIFont familyNames];
NSMutableArray<NSString *> *fontNames = [NSMutableArray array];
for (NSString *familyName in familyNames) {
// "System Font" is added to [UIFont familyNames] in iOS 15, and the font names that
// correspond with it are dot prefixed .SFUI-* fonts which log the following warning
// when passed in to [UIFont fontNamesForFamilyName:name]:
// CoreText note: Client requested name .SFUI-HeavyItalic, it will get TimesNewRomanPSMT rather than the intended font.
// All system UI font access should be through proper APIs such as CTFontCreateUIFontForLanguage() or +[UIFont systemFontOfSize:]
//
if (![familyName isEqualToString:@"System Font"]) {
[fontNames addObject:familyName];
[fontNames addObjectsFromArray:[UIFont fontNamesForFamilyName:familyName]];
}
}
// Remove duplicates and sort alphabetically
return [[[NSSet setWithArray:fontNames] allObjects] sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)];
#elif TARGET_OS_OSX
return [[NSFontManager sharedFontManager] availableFontFamilies];
#endif
}
# pragma mark - device info
+ (NSString *)deviceName
{
#if TARGET_OS_IOS || TARGET_OS_TV
return [UIDevice currentDevice].name;
#elif TARGET_OS_OSX
return [NSHost currentHost].localizedName;
#endif
}
+ (NSDictionary *)appConfig
{
NSBundle *frameworkBundle = [NSBundle bundleForClass:[EXConstantsService class]];
NSURL *bundleUrl = [frameworkBundle.resourceURL URLByAppendingPathComponent:@"EXConstants.bundle"];
NSBundle *bundle = [NSBundle bundleWithURL:bundleUrl];
NSString *path = [bundle pathForResource:@"app" ofType:@"config"];
if (path) {
NSData *configData = [NSData dataWithContentsOfFile:path];
if (configData) {
NSError *error;
NSDictionary *configObject = [NSJSONSerialization JSONObjectWithData:configData options:kNilOptions error:&error];
if (!configObject || ![configObject isKindOfClass:[NSDictionary class]]) {
NSLog(@"Error reading embedded app config: %@", error.localizedDescription ?: @"config is not an object");
return nil;
}
return configObject;
}
}
return nil;
}
@end

24
node_modules/expo-constants/ios/PrivacyInfo.xcprivacy generated vendored Normal file
View File

@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSPrivacyCollectedDataTypes</key>
<array>
</array>
<key>NSPrivacyTracking</key>
<false/>
<key>NSPrivacyTrackingDomains</key>
<array/>
<key>NSPrivacyAccessedAPITypes</key>
<array>
<dict>
<key>NSPrivacyAccessedAPIType</key>
<string>NSPrivacyAccessedAPICategoryUserDefaults</string>
<key>NSPrivacyAccessedAPITypeReasons</key>
<array>
<string>CA92.1</string>
</array>
</dict>
</array>
</dict>
</plist>