@legendapp/spark 0.0.1 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (141) hide show
  1. package/native.d.cts +6 -3
  2. package/package.json +36 -28
  3. package/patches/dependencies.json +252 -0
  4. package/patches/expo-application@55.0.19.patch +54 -0
  5. package/patches/expo-blur@55.0.18.patch +130 -0
  6. package/patches/expo-device@55.0.21.patch +149 -0
  7. package/patches/expo-font@55.0.8.patch +55 -0
  8. package/patches/expo-glass-effect@55.0.11.patch +304 -0
  9. package/patches/expo-haptics@55.0.18.patch +54 -0
  10. package/patches/expo-image-manipulator@55.0.21.patch +312 -0
  11. package/patches/expo-image-picker@55.0.24.patch +327 -0
  12. package/patches/expo-image@55.0.11.patch +158 -0
  13. package/patches/expo-keep-awake@55.0.8.patch +41 -0
  14. package/patches/expo-localization@55.0.19.patch +32 -0
  15. package/patches/expo-location@55.1.15.patch +190 -0
  16. package/patches/expo-symbols@55.0.9.patch +286 -0
  17. package/patches/expo-system-ui@55.0.22.patch +61 -0
  18. package/patches/expo-web-browser@55.0.20.patch +13 -0
  19. package/patches/react-native-app-logs@0.3.1.patch +20 -0
  20. package/patches/react-native-blurhash@2.1.3.patch +318 -0
  21. package/patches/react-native-community-blur@4.4.1.patch +415 -0
  22. package/patches/react-native-community-datetimepicker@9.2.2.patch +320 -0
  23. package/patches/react-native-enriched-markdown@1.1.1.patch +141 -10
  24. package/patches/react-native-fast-image@10.9.9.patch +131 -0
  25. package/patches/react-native-graph@1.4.0.patch +157 -0
  26. package/patches/react-native-keyboard-controller@1.22.9.patch +16 -0
  27. package/patches/react-native-masked-view-masked-view@0.3.2.patch +140 -0
  28. package/patches/react-native-mmkv@4.3.2.patch +40 -0
  29. package/patches/react-native-nitro-fetch@1.9.0.patch +130 -0
  30. package/patches/react-native-nitro-zxing@0.3.0.patch +13 -0
  31. package/patches/react-native-quick-base64@3.0.1.patch +13 -0
  32. package/patches/react-native-quick-crypto@1.1.9.patch +31 -0
  33. package/patches/react-native-release-profiler@0.4.5.patch +37 -0
  34. package/patches/react-native-screen-corner-radius@0.2.3.patch +13 -0
  35. package/patches/react-native-screens@4.23.0.patch +160 -0
  36. package/patches/react-native-svg@15.15.3.patch +31 -0
  37. package/patches/react-native-unistyles@3.6.0.patch +203 -0
  38. package/patches/react-native-worklets-core@1.6.3.patch +13 -0
  39. package/patches/react-navigation-native-stack@7.21.0.patch +16 -0
  40. package/patches/sentry-react-native@8.32.0.patch +76 -0
  41. package/skills/spark/UPGRADING.md +122 -3
  42. package/vendor/node_modules/@legendapp/spark-ai/package.json +5 -5
  43. package/vendor/node_modules/@legendapp/spark-audio/package.json +5 -5
  44. package/vendor/node_modules/@legendapp/spark-audio/src/index.macos.ts +1 -0
  45. package/vendor/node_modules/@legendapp/spark-auth-session/package.json +6 -6
  46. package/vendor/node_modules/@legendapp/spark-auth-session/src/index.macos.ts +1 -0
  47. package/vendor/node_modules/@legendapp/spark-cli/dist/add-desktop.js +2 -2
  48. package/vendor/node_modules/@legendapp/spark-cli/dist/build.js +17 -5
  49. package/vendor/node_modules/@legendapp/spark-cli/dist/cli-arguments.js +4 -2
  50. package/vendor/node_modules/@legendapp/spark-cli/dist/create.js +8 -4
  51. package/vendor/node_modules/@legendapp/spark-cli/dist/dependency-pins.js +45 -1
  52. package/vendor/node_modules/@legendapp/spark-cli/dist/dev.js +15 -3
  53. package/vendor/node_modules/@legendapp/spark-cli/dist/examples.js +2 -2
  54. package/vendor/node_modules/@legendapp/spark-cli/dist/expo-dev-patch.cjs +3 -3
  55. package/vendor/node_modules/@legendapp/spark-cli/dist/expo-dev-preload.cjs +3 -0
  56. package/vendor/node_modules/@legendapp/spark-cli/dist/index.js +26 -7
  57. package/vendor/node_modules/@legendapp/spark-cli/dist/metro.cjs +3 -1
  58. package/vendor/node_modules/@legendapp/spark-cli/dist/migration-helpers.cjs +20 -5
  59. package/vendor/node_modules/@legendapp/spark-cli/dist/migration-helpers.d.cts +1 -0
  60. package/vendor/node_modules/@legendapp/spark-cli/dist/migrations.cjs +10 -2
  61. package/vendor/node_modules/@legendapp/spark-cli/dist/native-patch-preflight.js +3 -3
  62. package/vendor/node_modules/@legendapp/spark-cli/dist/project.js +28 -10
  63. package/vendor/node_modules/@legendapp/spark-cli/dist/release-runner-root.js +108 -0
  64. package/vendor/node_modules/@legendapp/spark-cli/dist/release.json +13 -13
  65. package/vendor/node_modules/@legendapp/spark-cli/dist/runtime-input-cache.js +140 -0
  66. package/vendor/node_modules/@legendapp/spark-cli/dist/watchman.js +12 -0
  67. package/vendor/node_modules/@legendapp/spark-cli/dist/windows-geometry.js +2 -2
  68. package/vendor/node_modules/@legendapp/spark-cli/dist/windows.js +1 -1
  69. package/vendor/node_modules/@legendapp/spark-cli/package.json +3 -3
  70. package/vendor/node_modules/@legendapp/spark-cli/templates/blank-typescript/desktop.config.json +1 -1
  71. package/vendor/node_modules/@legendapp/spark-cli/templates/blank-typescript/package.json +27 -25
  72. package/vendor/node_modules/@legendapp/spark-cli/templates/universal/desktop.config.json +1 -1
  73. package/vendor/node_modules/@legendapp/spark-cli/templates/universal/package.json +35 -33
  74. package/vendor/node_modules/@legendapp/spark-cli/templates/windows/package.json +29 -27
  75. package/vendor/node_modules/@legendapp/spark-clipboard/package.json +5 -5
  76. package/vendor/node_modules/@legendapp/spark-clipboard/src/index.macos.ts +1 -0
  77. package/vendor/node_modules/@legendapp/spark-codex/package.json +4 -4
  78. package/vendor/node_modules/@legendapp/spark-commands/package.json +7 -7
  79. package/vendor/node_modules/@legendapp/spark-context-menu/package.json +4 -4
  80. package/vendor/node_modules/@legendapp/spark-desktop-app/macos/SparkDesktop.mm +7 -2
  81. package/vendor/node_modules/@legendapp/spark-desktop-app/macos/SparkTestDriver.mm +64 -2
  82. package/vendor/node_modules/@legendapp/spark-desktop-app/package.json +3 -3
  83. package/vendor/node_modules/@legendapp/spark-desktop-config/accessibility-state.cjs +2 -2
  84. package/vendor/node_modules/@legendapp/spark-desktop-config/app.plugin.cjs +12 -0
  85. package/vendor/node_modules/@legendapp/spark-desktop-config/autolinking.cjs +7 -6
  86. package/vendor/node_modules/@legendapp/spark-desktop-config/config.d.cts +1 -1
  87. package/vendor/node_modules/@legendapp/spark-desktop-config/fabric-lifecycle.cjs +1 -1
  88. package/vendor/node_modules/@legendapp/spark-desktop-config/keyboard-events.cjs +2 -2
  89. package/vendor/node_modules/@legendapp/spark-desktop-config/macos-host.cjs +39 -0
  90. package/vendor/node_modules/@legendapp/spark-desktop-config/native-patches.cjs +73 -20
  91. package/vendor/node_modules/@legendapp/spark-desktop-config/native-patches.d.cts +2 -1
  92. package/vendor/node_modules/@legendapp/spark-desktop-config/package.json +8 -6
  93. package/vendor/node_modules/@legendapp/spark-desktop-config/rtl-scroll-view.cjs +2 -2
  94. package/vendor/node_modules/@legendapp/spark-desktop-config/rtl-text-alignment.cjs +2 -2
  95. package/vendor/node_modules/@legendapp/spark-desktop-config/rtl-text-input-alignment.cjs +2 -2
  96. package/vendor/node_modules/@legendapp/spark-desktop-config/text-input-accessibility.cjs +2 -2
  97. package/vendor/node_modules/@legendapp/spark-desktop-host/macos/AppDelegate.h +6 -0
  98. package/vendor/node_modules/@legendapp/spark-desktop-host/macos/Main.storyboard +684 -0
  99. package/vendor/node_modules/@legendapp/spark-desktop-host/macos/main.m +5 -0
  100. package/vendor/node_modules/@legendapp/spark-desktop-host/package.json +3 -2
  101. package/vendor/node_modules/@legendapp/spark-desktop-links/package.json +5 -5
  102. package/vendor/node_modules/@legendapp/spark-desktop-links/src/index.macos.ts +1 -0
  103. package/vendor/node_modules/@legendapp/spark-desktop-shortcuts/package.json +4 -4
  104. package/vendor/node_modules/@legendapp/spark-desktop-windows/macos/window-manager/RNWindowManager.mm +68 -17
  105. package/vendor/node_modules/@legendapp/spark-desktop-windows/package.json +5 -5
  106. package/vendor/node_modules/@legendapp/spark-desktop-windows/src/macos-adapter.ts +2 -1
  107. package/vendor/node_modules/@legendapp/spark-documents/package.json +9 -9
  108. package/vendor/node_modules/@legendapp/spark-drag-drop/package.json +4 -4
  109. package/vendor/node_modules/@legendapp/spark-file-dialog/package.json +4 -4
  110. package/vendor/node_modules/@legendapp/spark-file-system/macos/RNDesktopFileSystem.mm +14 -5
  111. package/vendor/node_modules/@legendapp/spark-file-system/package.json +4 -4
  112. package/vendor/node_modules/@legendapp/spark-file-system/src/index.ts +1 -1
  113. package/vendor/node_modules/@legendapp/spark-global-shortcuts/package.json +4 -4
  114. package/vendor/node_modules/@legendapp/spark-html/package.json +4 -4
  115. package/vendor/node_modules/@legendapp/spark-markdown/package.json +4 -4
  116. package/vendor/node_modules/@legendapp/spark-message-dialog/package.json +4 -4
  117. package/vendor/node_modules/@legendapp/spark-native-menu/package.json +4 -4
  118. package/vendor/node_modules/@legendapp/spark-notifications/package.json +4 -4
  119. package/vendor/node_modules/@legendapp/spark-processes/macos/RNDesktopProcesses.mm +110 -19
  120. package/vendor/node_modules/@legendapp/spark-processes/package.json +4 -4
  121. package/vendor/node_modules/@legendapp/spark-processes/src/index.ts +17 -3
  122. package/vendor/node_modules/@legendapp/spark-processes/src/types.ts +6 -0
  123. package/vendor/node_modules/@legendapp/spark-rich-text/package.json +4 -4
  124. package/vendor/node_modules/@legendapp/spark-secure-storage/package.json +5 -5
  125. package/vendor/node_modules/@legendapp/spark-secure-storage/src/index.macos.ts +1 -0
  126. package/vendor/node_modules/@legendapp/spark-settings/package.json +3 -3
  127. package/vendor/node_modules/@legendapp/spark-settings-ui/package.json +6 -6
  128. package/vendor/node_modules/@legendapp/spark-sqlite/package.json +12 -5
  129. package/vendor/node_modules/@legendapp/spark-system/package.json +4 -4
  130. package/vendor/node_modules/@legendapp/spark-tray/package.json +4 -4
  131. package/vendor/node_modules/@legendapp/spark-ui/macos/appkit-split-view/RNSidebarSplitViewComponent.mm +82 -18
  132. package/vendor/node_modules/@legendapp/spark-ui/package.json +6 -6
  133. package/vendor/node_modules/@legendapp/spark-ui/src/appkit-split-view/SidebarSplitViewNativeComponent.ts +4 -0
  134. package/vendor/node_modules/@legendapp/spark-ui/src/appkit-split-view/index.tsx +11 -9
  135. package/vendor/node_modules/@legendapp/spark-ui/src/index.android.tsx +20 -10
  136. package/vendor/node_modules/@legendapp/spark-ui/src/index.ios.tsx +15 -10
  137. package/vendor/node_modules/@legendapp/spark-ui/src/index.macos.tsx +1 -0
  138. package/vendor/node_modules/@legendapp/spark-updates/package.json +4 -4
  139. package/vendor/node_modules/@legendapp/spark-webview/package.json +11 -4
  140. package/vendor/node_modules/@legendapp/spark-window-options/package.json +1 -1
  141. package/camera.ts +0 -13
@@ -0,0 +1,158 @@
1
+ diff --git a/src/ExpoImage.macos.tsx b/src/ExpoImage.macos.tsx
2
+ new file mode 100644
3
+ index 0000000..cd859ac
4
+ --- /dev/null
5
+ +++ b/src/ExpoImage.macos.tsx
6
+ @@ -0,0 +1,128 @@
7
+ +// expo-image on macOS: React Native's Image stands in for the native view, which is UIKit
8
+ +// only. Sources (uri, headers, require(); the largest of several sizes), placeholders while
9
+ +// loading, contentFit, tintColor, the load events and reloadAsync work. Its SDWebImage
10
+ +// caches, blurhash/thumbhash and SF Symbol sources, contentPosition, transitions and
11
+ +// ImageRef sources are not supported; such a source reports onError.
12
+ +import React from 'react';
13
+ +import { Image, StyleSheet, View, type ImageProps, type ImageResizeMode } from 'react-native';
14
+ +
15
+ +import type { ImageContentFit, ImageNativeProps, ImageSource } from './Image.types';
16
+ +
17
+ +const fits: Record<ImageContentFit, ImageResizeMode> = {
18
+ + cover: 'cover',
19
+ + contain: 'contain',
20
+ + fill: 'stretch',
21
+ + none: 'center',
22
+ + 'scale-down': 'center',
23
+ +};
24
+ +
25
+ +function largest(sources: ImageNativeProps['source']): ImageSource | undefined {
26
+ + if (!Array.isArray(sources)) return undefined;
27
+ + const area = (source: ImageSource) => (source.width ?? 0) * (source.height ?? 0);
28
+ + const drawable = sources.filter(source => source.uri && !/^(blurhash|thumbhash|sf):\//.test(source.uri));
29
+ + return drawable.reduce<ImageSource | undefined>((best, next) => (best && area(best) >= area(next) ? best : next), undefined);
30
+ +}
31
+ +
32
+ +// RN Image copies source dimensions into its layout; let contentFit control the size.
33
+ +function ImageWithFit({ source, contentFit, style, ...props }: Omit<ImageProps, 'source'> & {
34
+ + source: ImageSource & { scale?: number }; contentFit: ImageContentFit;
35
+ +}) {
36
+ + const { uri, headers, scale = 1 } = source;
37
+ + const [size, setSize] = React.useState<{ uri: string; width: number; height: number }>();
38
+ + React.useEffect(() => {
39
+ + if (contentFit !== 'none' || !uri) return;
40
+ + let active = true;
41
+ + Image.getSizeWithHeaders(uri, headers ?? {}).then(({ width, height }) => {
42
+ + if (active) setSize({ uri, width, height });
43
+ + }, () => {}); // The Image's onError reports load failures.
44
+ + return () => { active = false; };
45
+ + }, [uri, headers, contentFit]);
46
+ + const width = size && size.uri === uri ? size.width / scale : (source.width ?? 0);
47
+ + const height = size && size.uri === uri ? size.height / scale : (source.height ?? 0);
48
+ + return <Image {...props} source={{ uri, headers, scale }} resizeMode={fits[contentFit]} style={[
49
+ + StyleSheet.absoluteFill, style,
50
+ + contentFit === 'none' && {
51
+ + width, height, left: '50%', top: '50%', right: undefined, bottom: undefined,
52
+ + transform: [{ translateX: -width / 2 }, { translateY: -height / 2 }],
53
+ + },
54
+ + ]} />;
55
+ +}
56
+ +
57
+ +class ExpoImage extends React.PureComponent<ImageNativeProps, { attempt: number; loaded: boolean }> {
58
+ + state = { attempt: 0, loaded: false };
59
+ +
60
+ + startAnimating = () => {};
61
+ + stopAnimating = () => {};
62
+ + lockResourceAsync = async () => {};
63
+ + unlockResourceAsync = async () => {};
64
+ + reloadAsync = async () => this.setState(({ attempt }) => ({ attempt: attempt + 1, loaded: false }));
65
+ +
66
+ + unsupported?: string;
67
+ +
68
+ + componentDidMount() {
69
+ + // Image calls startAnimating and reloadAsync through this ref, which holds the native view on iOS.
70
+ + const ref = this.props.nativeViewRef as React.MutableRefObject<unknown> | undefined;
71
+ + if (ref) ref.current = this;
72
+ + this.reportUnsupported();
73
+ + }
74
+ +
75
+ + componentDidUpdate() {
76
+ + this.reportUnsupported();
77
+ + }
78
+ +
79
+ + // A source with nothing to draw still settles, once per source, so load and error handlers run.
80
+ + reportUnsupported() {
81
+ + const { source } = this.props;
82
+ + const key = largest(source) || source == null || (Array.isArray(source) && !source.length) ? undefined : JSON.stringify(source);
83
+ + if (key === this.unsupported) return;
84
+ + this.unsupported = key;
85
+ + if (key === undefined) return;
86
+ + this.props.onLoadStart?.();
87
+ + this.props.onError?.({ error: 'expo-image cannot draw blurhash, thumbhash, SF Symbol or ImageRef sources on macOS' });
88
+ + this.props.onLoadEnd?.();
89
+ + }
90
+ +
91
+ + render() {
92
+ + const { source, placeholder, contentFit = 'cover', placeholderContentFit = 'scale-down', tintColor, style, accessibilityLabel, alt,
93
+ + onLoadStart, onProgress, onLoad, onError, onLoadEnd, onDisplay, containerViewRef, nativeViewRef, ...props } = this.props;
94
+ + const image = largest(source);
95
+ + const fallback = largest(placeholder);
96
+ + const tint = tintColor == null ? null : { tintColor: tintColor as string };
97
+ + return (
98
+ + <View ref={containerViewRef as never} {...(props as object)} accessibilityLabel={accessibilityLabel ?? alt} style={[styles.container, style]}>
99
+ + {!this.state.loaded && fallback && (
100
+ + <ImageWithFit source={fallback} contentFit={placeholderContentFit} style={tint} />
101
+ + )}
102
+ + {image && (
103
+ + <ImageWithFit
104
+ + key={this.state.attempt}
105
+ + source={image}
106
+ + contentFit={contentFit}
107
+ + style={tint}
108
+ + onLoadStart={() => onLoadStart?.()}
109
+ + onProgress={event => onProgress?.({ loaded: event.nativeEvent.loaded, total: event.nativeEvent.total })}
110
+ + onLoad={event => {
111
+ + const loaded = (width: number, height: number) => {
112
+ + this.setState({ loaded: true });
113
+ + onLoad?.({ cacheType: 'none', source: { url: image.uri!, width, height, mediaType: null } });
114
+ + onLoadEnd?.();
115
+ + onDisplay?.();
116
+ + };
117
+ + // React Native macOS scales a 1x image's size by the screen's; getSize reads its pixels.
118
+ + const { width, height } = event.nativeEvent.source;
119
+ + Image.getSize(image.uri!).then(size => loaded(size.width, size.height), () => loaded(width, height));
120
+ + }}
121
+ + onError={event => {
122
+ + onError?.({ error: String(event.nativeEvent.error) });
123
+ + onLoadEnd?.();
124
+ + }}
125
+ + />
126
+ + )}
127
+ + </View>
128
+ + );
129
+ + }
130
+ +}
131
+ +
132
+ +const styles = StyleSheet.create({ container: { overflow: 'hidden' } });
133
+ +
134
+ +export default ExpoImage;
135
+ diff --git a/src/ImageModule.macos.ts b/src/ImageModule.macos.ts
136
+ new file mode 100644
137
+ index 0000000..1ffc9e3
138
+ --- /dev/null
139
+ +++ b/src/ImageModule.macos.ts
140
+ @@ -0,0 +1,18 @@
141
+ +// expo-image on macOS has no native module; see ExpoImage.macos.tsx.
142
+ +import { Image } from 'react-native';
143
+ +
144
+ +import type { ImageNativeModule } from './Image.types';
145
+ +
146
+ +const unsupported = (name: string) => () => Promise.reject(new Error(`Image.${name} is not supported on macOS`));
147
+ +
148
+ +export default {
149
+ + Image: class {},
150
+ + prefetch: (urls: string[]) => Promise.all(urls.map(url => Image.prefetch(url))).then(() => true, () => false),
151
+ + clearMemoryCache: async () => false,
152
+ + clearDiskCache: async () => false,
153
+ + configureCache: () => {},
154
+ + getCachePathAsync: async () => null,
155
+ + loadAsync: unsupported('loadAsync'),
156
+ + generateBlurhashAsync: unsupported('generateBlurhashAsync'),
157
+ + generateThumbhashAsync: unsupported('generateThumbhashAsync'),
158
+ +} as unknown as ImageNativeModule;
@@ -0,0 +1,41 @@
1
+ diff --git a/ios/KeepAwakeModule.swift b/ios/KeepAwakeModule.swift
2
+ index 835b4f1..22aac25 100644
3
+ --- a/ios/KeepAwakeModule.swift
4
+ +++ b/ios/KeepAwakeModule.swift
5
+ @@ -30,7 +30,9 @@ public final class KeepAwakeModule: Module {
6
+ return UIApplication.shared.isIdleTimerDisabled
7
+ }
8
+ #elseif os(macOS)
9
+ - return false
10
+ + return DispatchQueue.main.sync {
11
+ + return displaySleepActivity != nil
12
+ + }
13
+ #endif
14
+ }
15
+
16
+ @@ -48,10 +50,25 @@ public final class KeepAwakeModule: Module {
17
+ }
18
+ }
19
+
20
+ +#if os(macOS)
21
+ +// macOS has no idle timer to disable; a process activity holds the display and system awake instead.
22
+ +private var displaySleepActivity: NSObjectProtocol?
23
+ +#endif
24
+ +
25
+ private func setActivated(_ activated: Bool) {
26
+ #if os(iOS) || os(tvOS)
27
+ DispatchQueue.main.async {
28
+ UIApplication.shared.isIdleTimerDisabled = activated
29
+ }
30
+ + #elseif os(macOS)
31
+ + DispatchQueue.main.async {
32
+ + if activated, displaySleepActivity == nil {
33
+ + displaySleepActivity = ProcessInfo.processInfo.beginActivity(
34
+ + options: [.idleDisplaySleepDisabled, .idleSystemSleepDisabled], reason: "expo-keep-awake")
35
+ + } else if !activated, let activity = displaySleepActivity {
36
+ + ProcessInfo.processInfo.endActivity(activity)
37
+ + displaySleepActivity = nil
38
+ + }
39
+ + }
40
+ #endif
41
+ }
@@ -0,0 +1,32 @@
1
+ diff --git a/ios/ExpoLocalization.podspec b/ios/ExpoLocalization.podspec
2
+ index 29b720d..117b6a0 100644
3
+ --- a/ios/ExpoLocalization.podspec
4
+ +++ b/ios/ExpoLocalization.podspec
5
+ @@ -12,6 +12,7 @@ Pod::Spec.new do |s|
6
+ s.homepage = package['homepage']
7
+ s.platforms = {
8
+ :ios => '15.1',
9
+ + :osx => '14.0',
10
+ :tvos => '15.1'
11
+ }
12
+ s.swift_version = '5.9'
13
+ diff --git a/ios/LocalizationModule.swift b/ios/LocalizationModule.swift
14
+ index ffc4593..df54b76 100644
15
+ --- a/ios/LocalizationModule.swift
16
+ +++ b/ios/LocalizationModule.swift
17
+ @@ -8,7 +8,14 @@ let CALENDAR_SETTINGS_CHANGED = "onCalendarSettingsChanged"
18
+
19
+ let OBSERVED_EVENTS: Set<Notification.Name> = [
20
+ // swiftlint:disable legacy_objc_type
21
+ - UIApplication.significantTimeChangeNotification,
22
+ + // macOS has no significant-time-change notification; a time zone change is the closest.
23
+ + {
24
+ + #if os(macOS)
25
+ + return Notification.Name.NSSystemTimeZoneDidChange
26
+ + #else
27
+ + return UIApplication.significantTimeChangeNotification
28
+ + #endif
29
+ + }(),
30
+ NSLocale.currentLocaleDidChangeNotification
31
+ // swiftlint:enable legacy_objc_type
32
+ ]
@@ -0,0 +1,190 @@
1
+ diff --git a/ios/EXLocation.h b/ios/EXLocation.h
2
+ index 6e6c661..4954506 100644
3
+ --- a/ios/EXLocation.h
4
+ +++ b/ios/EXLocation.h
5
+ @@ -17,6 +17,8 @@ typedef NS_ENUM(NSUInteger, EXLocationAccuracy) {
6
+
7
+ + (NSDictionary *)exportLocation:(CLLocation *)location;
8
+ + (CLLocationAccuracy)CLLocationAccuracyFromOption:(EXLocationAccuracy)accuracy;
9
+ +#if !TARGET_OS_OSX
10
+ + (CLActivityType)CLActivityTypeFromOption:(NSInteger)activityType;
11
+ +#endif
12
+
13
+ @end
14
+ diff --git a/ios/EXLocation.m b/ios/EXLocation.m
15
+ index 0442c37..ac375c6 100644
16
+ --- a/ios/EXLocation.m
17
+ +++ b/ios/EXLocation.m
18
+ @@ -42,6 +42,7 @@ + (CLLocationAccuracy)CLLocationAccuracyFromOption:(EXLocationAccuracy)accuracy
19
+ }
20
+ }
21
+
22
+ +#if !TARGET_OS_OSX
23
+ + (CLActivityType)CLActivityTypeFromOption:(NSInteger)activityType
24
+ {
25
+ if (activityType >= CLActivityTypeOther && activityType <= CLActivityTypeOtherNavigation) {
26
+ @@ -52,6 +53,7 @@ + (CLActivityType)CLActivityTypeFromOption:(NSInteger)activityType
27
+ }
28
+ return CLActivityTypeOther;
29
+ }
30
+ +#endif
31
+
32
+ @end
33
+
34
+ diff --git a/ios/ExpoLocation.podspec b/ios/ExpoLocation.podspec
35
+ index df166fe..2214d91 100644
36
+ --- a/ios/ExpoLocation.podspec
37
+ +++ b/ios/ExpoLocation.podspec
38
+ @@ -11,7 +11,8 @@ Pod::Spec.new do |s|
39
+ s.author = package['author']
40
+ s.homepage = package['homepage']
41
+ s.platforms = {
42
+ - :ios => '15.1'
43
+ + :ios => '15.1',
44
+ + :osx => '14.0'
45
+ }
46
+ s.source = { git: 'https://github.com/expo/expo.git' }
47
+ s.static_framework = true
48
+ diff --git a/ios/Providers/BaseLocationProvider.swift b/ios/Providers/BaseLocationProvider.swift
49
+ index ae9135a..98dcce1 100644
50
+ --- a/ios/Providers/BaseLocationProvider.swift
51
+ +++ b/ios/Providers/BaseLocationProvider.swift
52
+ @@ -9,7 +9,9 @@ internal class BaseLocationProvider: NSObject, CLLocationManagerDelegate {
53
+ @MainActor
54
+ init(options: LocationOptions) {
55
+ super.init()
56
+ + #if !os(macOS)
57
+ manager.allowsBackgroundLocationUpdates = false
58
+ + #endif
59
+ manager.distanceFilter = options.distanceInterval
60
+ manager.desiredAccuracy = options.accuracy.toCLLocationAccuracy()
61
+ manager.delegate = self
62
+ diff --git a/ios/Providers/DeviceHeadingStreamer.swift b/ios/Providers/DeviceHeadingStreamer.swift
63
+ index 802bf57..47d89a3 100644
64
+ --- a/ios/Providers/DeviceHeadingStreamer.swift
65
+ +++ b/ios/Providers/DeviceHeadingStreamer.swift
66
+ @@ -25,14 +25,19 @@ internal class DeviceHeadingStreamer: BaseStreamer {
67
+ }
68
+ let stream = DeviceHeadingStream { continuation in
69
+ self.continuation = continuation
70
+ + // Macs have no compass; headingAvailable() is false there, so this is never reached.
71
+ + #if !os(macOS)
72
+ manager.startUpdatingHeading()
73
+ + #endif
74
+ }
75
+ headingStream = stream
76
+ return stream
77
+ }
78
+
79
+ override func stopStreaming() {
80
+ + #if !os(macOS)
81
+ manager.stopUpdatingHeading()
82
+ + #endif
83
+ continuation?.finish()
84
+
85
+ headingStream = nil
86
+ diff --git a/ios/Requesters/EXBackgroundLocationPermissionRequester.m b/ios/Requesters/EXBackgroundLocationPermissionRequester.m
87
+ index aa54f8c..a2e4918 100644
88
+ --- a/ios/Requesters/EXBackgroundLocationPermissionRequester.m
89
+ +++ b/ios/Requesters/EXBackgroundLocationPermissionRequester.m
90
+ @@ -14,6 +14,12 @@ @interface EXBackgroundLocationPermissionRequester ()
91
+
92
+ @end
93
+
94
+ +#if TARGET_OS_OSX
95
+ +#import <AppKit/AppKit.h>
96
+ +#define UIApplicationWillResignActiveNotification NSApplicationWillResignActiveNotification
97
+ +#define UIApplicationDidBecomeActiveNotification NSApplicationDidBecomeActiveNotification
98
+ +#endif
99
+ +
100
+ @implementation EXBackgroundLocationPermissionRequester
101
+
102
+ - (instancetype)init
103
+ diff --git a/ios/Requesters/EXBaseLocationRequester.h b/ios/Requesters/EXBaseLocationRequester.h
104
+ index ae63560..d29a8be 100644
105
+ --- a/ios/Requesters/EXBaseLocationRequester.h
106
+ +++ b/ios/Requesters/EXBaseLocationRequester.h
107
+ @@ -5,6 +5,11 @@
108
+ #import <ExpoModulesCore/EXPermissionsInterface.h>
109
+ #import <CoreLocation/CLLocationManagerDelegate.h>
110
+
111
+ +#if TARGET_OS_OSX
112
+ +// macOS has no when-in-use authorization and never reports it; keep the shared status switches compiling.
113
+ +#define kCLAuthorizationStatusAuthorizedWhenInUse ((CLAuthorizationStatus)4)
114
+ +#endif
115
+ +
116
+ @interface EXBaseLocationRequester : NSObject<EXPermissionsRequester, CLLocationManagerDelegate>
117
+
118
+ @property (nonatomic, strong) CLLocationManager *locationManager;
119
+ diff --git a/ios/Requesters/EXBaseLocationRequester.m b/ios/Requesters/EXBaseLocationRequester.m
120
+ index 350eb5f..c8f6d82 100644
121
+ --- a/ios/Requesters/EXBaseLocationRequester.m
122
+ +++ b/ios/Requesters/EXBaseLocationRequester.m
123
+ @@ -37,7 +37,12 @@ - (NSDictionary *)getPermissions {
124
+
125
+ CLAuthorizationStatus systemStatus;
126
+ if (![EXBaseLocationRequester isConfiguredForAlwaysAuthorization] && ![EXBaseLocationRequester isConfiguredForWhenInUseAuthorization]) {
127
+ +#if TARGET_OS_OSX
128
+ + // RCTFatal throws in Release; on macOS the missing key reports denied, as it does in Debug.
129
+ + RCTLogError(@"This app is missing NSLocationWhenInUseUsageDescription in its macOS Info.plist, so location services will fail.");
130
+ +#else
131
+ RCTFatal(RCTErrorWithMessage(@"This app is missing usage descriptions, so location services will fail. Add one of the `NSLocation*UsageDescription` keys to your bundle's Info.plist. See https://bit.ly/3iLqy6S (https://docs.expo.dev/distribution/app-stores/#system-permissions-dialogs-on-ios) for more information."));
132
+ +#endif
133
+ systemStatus = kCLAuthorizationStatusDenied;
134
+ } else {
135
+ systemStatus = [CLLocationManager authorizationStatus];
136
+ diff --git a/ios/TaskConsumers/EXGeofencingTaskConsumer.m b/ios/TaskConsumers/EXGeofencingTaskConsumer.m
137
+ index 7e6482e..c94f09e 100644
138
+ --- a/ios/TaskConsumers/EXGeofencingTaskConsumer.m
139
+ +++ b/ios/TaskConsumers/EXGeofencingTaskConsumer.m
140
+ @@ -71,8 +71,10 @@ - (void)startMonitoringRegionsForTask:(id<EXTaskInterface>)task
141
+ self->_regionStates = regionStates;
142
+
143
+ locationManager.delegate = self;
144
+ +#if !TARGET_OS_OSX
145
+ locationManager.allowsBackgroundLocationUpdates = YES;
146
+ locationManager.pausesLocationUpdatesAutomatically = NO;
147
+ +#endif
148
+
149
+ for (NSDictionary *regionDict in regions) {
150
+ NSString *identifier = regionDict[@"identifier"] ?: [[NSUUID UUID] UUIDString];
151
+ diff --git a/ios/TaskConsumers/EXLocationTaskConsumer.m b/ios/TaskConsumers/EXLocationTaskConsumer.m
152
+ index fe1d9dd..75df305 100644
153
+ --- a/ios/TaskConsumers/EXLocationTaskConsumer.m
154
+ +++ b/ios/TaskConsumers/EXLocationTaskConsumer.m
155
+ @@ -49,7 +49,9 @@ - (void)didRegisterTask:(id<EXTaskInterface>)task
156
+ self->_locationManager = locationManager;
157
+
158
+ locationManager.delegate = self;
159
+ +#if !TARGET_OS_OSX
160
+ locationManager.allowsBackgroundLocationUpdates = YES;
161
+ +#endif
162
+
163
+ // Set options-specific things in location manager.
164
+ [self setOptions:task.options];
165
+ @@ -69,9 +71,11 @@ - (void)setOptions:(NSDictionary *)options
166
+
167
+ locationManager.desiredAccuracy = [EXLocation CLLocationAccuracyFromOption:accuracy];
168
+ locationManager.distanceFilter = [self numberToDouble:options[@"distanceInterval"] defaultValue:kCLDistanceFilterNone];
169
+ +#if !TARGET_OS_OSX
170
+ locationManager.activityType = [EXLocation CLActivityTypeFromOption:[self numberToInteger:options[@"activityType"] defaultValue:CLActivityTypeOther]];
171
+ locationManager.pausesLocationUpdatesAutomatically = [self numberToBool:options[@"pausesUpdatesAutomatically"] defaultValue:true];
172
+ locationManager.showsBackgroundLocationIndicator = [self numberToBool:options[@"showsBackgroundLocationIndicator"] defaultValue:false];
173
+ +#endif
174
+
175
+ [locationManager startUpdatingLocation];
176
+ [locationManager startMonitoringSignificantLocationChanges];
177
+ @@ -145,9 +149,13 @@ - (BOOL)shouldReportDeferredLocations
178
+ if (_deferredLocations.count <= 0) {
179
+ return NO;
180
+ }
181
+ +#if TARGET_OS_OSX
182
+ + if (NSApp.isActive) {
183
+ +#else
184
+ UIApplicationState appState = [[UIApplication sharedApplication] applicationState];
185
+
186
+ if (appState == UIApplicationStateActive) {
187
+ +#endif
188
+ // Don't defer location updates when app is in foreground state.
189
+ return YES;
190
+ }