@geastack/apple 0.2.18 → 0.2.19
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.
- package/README.md +81 -0
- package/dist/desktop-api.js +295 -0
- package/generated/EventKit.d.ts +16 -0
- package/package.json +8 -4
- package/runtime/EventKit.js +35 -0
- package/targets/ios/Info-tvOS.plist.in +39 -0
- package/targets/ios/Info.plist.in +14 -0
- package/targets/ios/README.md +21 -0
- package/targets/ios/build-ios.sh +98 -52
- package/targets/ios/generate-xcode-project.mjs +28 -11
- package/targets/ios/main/canvas_view.mm +4 -13
- package/targets/ios/main/font_registry.mm +6 -0
- package/targets/ios/main/ios_camera.mm +10 -0
- package/targets/ios/main/ios_display.mm +25 -6
- package/targets/ios/main/ios_main.mm +259 -6
- package/targets/ios/main/ios_sensors.mm +22 -0
- package/targets/ios/main/renderer/native_scroll_container.mm +3 -0
- package/targets/macos/build-macos.sh +17 -10
- package/targets/macos/merge-info-plist.mjs +35 -0
|
@@ -1,10 +1,19 @@
|
|
|
1
1
|
#import <UIKit/UIKit.h>
|
|
2
2
|
#import <QuartzCore/QuartzCore.h>
|
|
3
3
|
|
|
4
|
+
#include <TargetConditionals.h>
|
|
5
|
+
|
|
6
|
+
#if TARGET_OS_TV
|
|
7
|
+
#import <GameController/GameController.h>
|
|
8
|
+
#endif
|
|
9
|
+
|
|
4
10
|
#include "app.h"
|
|
5
11
|
#include "apps.h"
|
|
6
12
|
#include "canvas.h"
|
|
13
|
+
#include "css/animation.h"
|
|
14
|
+
#include "css/declarative.h"
|
|
7
15
|
#include "display.h"
|
|
16
|
+
#include "display_underlay.h"
|
|
8
17
|
#include "event.h"
|
|
9
18
|
#include "events.h"
|
|
10
19
|
#include "font_registry.h"
|
|
@@ -198,6 +207,113 @@ bool attributedStringHasTextDecoration(NSAttributedString *value)
|
|
|
198
207
|
|
|
199
208
|
@end
|
|
200
209
|
|
|
210
|
+
#if TARGET_OS_TV
|
|
211
|
+
static void dispatchRemoteKey(int keyCode)
|
|
212
|
+
{
|
|
213
|
+
auto &tree = gea::embedded::ui::Tree::instance();
|
|
214
|
+
const int root = tree.mountedRoot();
|
|
215
|
+
if (root < 0) return;
|
|
216
|
+
|
|
217
|
+
gea::framework::events::PointerEvent event;
|
|
218
|
+
event.targetId = tree.firstChildOf(root);
|
|
219
|
+
if (event.targetId < 0) event.targetId = root;
|
|
220
|
+
event.type = gea::framework::events::PointerEventType::KeyDown;
|
|
221
|
+
event.keyCode = keyCode;
|
|
222
|
+
const bool delivered = gea::embedded::ui::dispatchRootKeyEvent(event, true);
|
|
223
|
+
if (std::getenv("GEA_TV_INPUT_DIAGNOSTICS"))
|
|
224
|
+
NSLog(@"[Gea TV] key=%d root=%d target=%d delivered=%d", keyCode, root, event.targetId, delivered);
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
@interface GeaTVController : GCEventViewController
|
|
228
|
+
@property(nonatomic, weak) GCMotion *remoteMotion;
|
|
229
|
+
@property(nonatomic, assign) BOOL tiltReady;
|
|
230
|
+
@property(nonatomic, strong) NSHashTable<GCController *> *configuredControllers;
|
|
231
|
+
- (void)pollRemoteMotion;
|
|
232
|
+
@end
|
|
233
|
+
|
|
234
|
+
@implementation GeaTVController
|
|
235
|
+
- (BOOL)canBecomeFirstResponder { return YES; }
|
|
236
|
+
|
|
237
|
+
- (void)viewDidAppear:(BOOL)animated
|
|
238
|
+
{
|
|
239
|
+
[super viewDidAppear:animated];
|
|
240
|
+
[self becomeFirstResponder];
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
- (void)pollRemoteMotion
|
|
244
|
+
{
|
|
245
|
+
if (!self.configuredControllers) self.configuredControllers = [NSHashTable weakObjectsHashTable];
|
|
246
|
+
for (GCController *controller in GCController.controllers) {
|
|
247
|
+
if ([self.configuredControllers containsObject:controller]) continue;
|
|
248
|
+
[self.configuredControllers addObject:controller];
|
|
249
|
+
controller.handlerQueue = dispatch_get_main_queue();
|
|
250
|
+
GCMicroGamepad *remote = controller.microGamepad;
|
|
251
|
+
if (remote) remote.reportsAbsoluteDpadValues = YES;
|
|
252
|
+
GCExtendedGamepad *pad = controller.extendedGamepad;
|
|
253
|
+
const bool directionalRemote = [remote isKindOfClass:GCDirectionalGamepad.class];
|
|
254
|
+
// The silver remote's generic dpad is its touch surface and buttonA
|
|
255
|
+
// means a click anywhere, including the direction ring. Use the
|
|
256
|
+
// dedicated physical ring and center elements to keep actions separate.
|
|
257
|
+
GCControllerDirectionPad *directions = directionalRemote
|
|
258
|
+
? remote.dpads[GCInputDirectionalCardinalDpad]
|
|
259
|
+
: (remote ? remote.dpad : pad.dpad);
|
|
260
|
+
directions.left.pressedChangedHandler = ^(GCControllerButtonInput *, float, BOOL pressed) {
|
|
261
|
+
if (pressed) dispatchRemoteKey(37);
|
|
262
|
+
};
|
|
263
|
+
directions.right.pressedChangedHandler = ^(GCControllerButtonInput *, float, BOOL pressed) {
|
|
264
|
+
if (pressed) dispatchRemoteKey(39);
|
|
265
|
+
};
|
|
266
|
+
directions.up.pressedChangedHandler = ^(GCControllerButtonInput *, float, BOOL pressed) {
|
|
267
|
+
if (pressed) dispatchRemoteKey(38);
|
|
268
|
+
};
|
|
269
|
+
directions.down.pressedChangedHandler = ^(GCControllerButtonInput *, float, BOOL pressed) {
|
|
270
|
+
if (pressed) dispatchRemoteKey(40);
|
|
271
|
+
};
|
|
272
|
+
GCControllerButtonInput *select = directionalRemote
|
|
273
|
+
? remote.buttons[GCInputDirectionalCenterButton]
|
|
274
|
+
: (remote ? remote.buttonA : pad.buttonA);
|
|
275
|
+
select.pressedChangedHandler = ^(GCControllerButtonInput *, float, BOOL pressed) {
|
|
276
|
+
if (pressed) dispatchRemoteKey(13);
|
|
277
|
+
};
|
|
278
|
+
GCControllerButtonInput *back = remote ? remote.buttonMenu : pad.buttonMenu;
|
|
279
|
+
back.pressedChangedHandler = ^(GCControllerButtonInput *, float, BOOL pressed) {
|
|
280
|
+
if (pressed) dispatchRemoteKey(27);
|
|
281
|
+
};
|
|
282
|
+
GCControllerButtonInput *dive = remote ? remote.buttonX : pad.buttonX;
|
|
283
|
+
dive.pressedChangedHandler = ^(GCControllerButtonInput *, float, BOOL pressed) {
|
|
284
|
+
if (pressed) dispatchRemoteKey(40);
|
|
285
|
+
};
|
|
286
|
+
if (std::getenv("GEA_TV_INPUT_DIAGNOSTICS"))
|
|
287
|
+
NSLog(@"[Gea TV] controller=%@ profile=%@ motion=%d", controller.vendorName,
|
|
288
|
+
NSStringFromClass(remote ? remote.class : pad.class), controller.motion != nil);
|
|
289
|
+
}
|
|
290
|
+
GCMotion *motion = nil;
|
|
291
|
+
for (GCController *controller in GCController.controllers) {
|
|
292
|
+
if (!controller.motion) continue;
|
|
293
|
+
motion = controller.motion;
|
|
294
|
+
if (controller.microGamepad) break;
|
|
295
|
+
}
|
|
296
|
+
if (motion != self.remoteMotion) {
|
|
297
|
+
GCMotion *previous = self.remoteMotion;
|
|
298
|
+
if (previous.sensorsRequireManualActivation) previous.sensorsActive = NO;
|
|
299
|
+
self.remoteMotion = motion;
|
|
300
|
+
self.tiltReady = NO;
|
|
301
|
+
if (motion.sensorsRequireManualActivation) motion.sensorsActive = YES;
|
|
302
|
+
}
|
|
303
|
+
if (!motion) return;
|
|
304
|
+
if (motion.sensorsRequireManualActivation && !motion.sensorsActive) motion.sensorsActive = YES;
|
|
305
|
+
|
|
306
|
+
// Hold the remote upright with its buttons facing you. Re-center before
|
|
307
|
+
// the next lane change so a held tilt only generates one input.
|
|
308
|
+
const double sideways = motion.hasGravityAndUserAcceleration ? motion.gravity.x : motion.acceleration.x;
|
|
309
|
+
if (std::abs(sideways) < 0.16) self.tiltReady = YES;
|
|
310
|
+
if (!self.tiltReady || std::abs(sideways) < 0.34) return;
|
|
311
|
+
self.tiltReady = NO;
|
|
312
|
+
dispatchRemoteKey(sideways < 0 ? 37 : 39);
|
|
313
|
+
}
|
|
314
|
+
@end
|
|
315
|
+
#endif
|
|
316
|
+
|
|
201
317
|
@interface GeaDisplayView : UIView
|
|
202
318
|
@property(nonatomic, strong) NSMapTable<UITouch *, NSNumber *> *touchPointerIds;
|
|
203
319
|
- (void)syncNativeTextInputs;
|
|
@@ -216,7 +332,9 @@ bool attributedStringHasTextDecoration(NSAttributedString *value)
|
|
|
216
332
|
// Track multiple simultaneous fingers so one button can be held while
|
|
217
333
|
// another is tapped (e.g. move + jump). Keyed by touch identity; the
|
|
218
334
|
// value is the pointer index (0 = primary).
|
|
335
|
+
#if !TARGET_OS_TV
|
|
219
336
|
self.multipleTouchEnabled = YES;
|
|
337
|
+
#endif
|
|
220
338
|
self.touchPointerIds = [NSMapTable mapTableWithKeyOptions:NSMapTableWeakMemory | NSMapTableObjectPointerPersonality
|
|
221
339
|
valueOptions:NSMapTableStrongMemory];
|
|
222
340
|
}
|
|
@@ -452,6 +570,12 @@ bool attributedStringHasTextDecoration(NSAttributedString *value)
|
|
|
452
570
|
touching:(bool)touching
|
|
453
571
|
{
|
|
454
572
|
if (!touch) return;
|
|
573
|
+
#if TARGET_OS_TV
|
|
574
|
+
// Remote touch coordinates describe the clickpad, not positions on the TV.
|
|
575
|
+
// GameController owns that input; forwarding it as pointer gestures sends
|
|
576
|
+
// a second, unrelated action whenever a thumb touches or moves on the pad.
|
|
577
|
+
if (touch.type == UITouchTypeIndirect) return;
|
|
578
|
+
#endif
|
|
455
579
|
const BOOL isDown = phase == gea::framework::events::TouchPhase::Down;
|
|
456
580
|
const int pointerId = [self pointerIdForTouch:touch assignIfAbsent:isDown];
|
|
457
581
|
if (pointerId < 0) return;
|
|
@@ -562,11 +686,15 @@ bool attributedStringHasTextDecoration(NSAttributedString *value)
|
|
|
562
686
|
- (void)layoutDisplayViewInSafeArea
|
|
563
687
|
{
|
|
564
688
|
if (!self.rootView || !self.displayView) return;
|
|
689
|
+
#if TARGET_OS_TV
|
|
690
|
+
CGRect frame = self.rootView.bounds;
|
|
691
|
+
#else
|
|
565
692
|
CGRect frame = self.rootView.safeAreaLayoutGuide.layoutFrame;
|
|
566
693
|
if (frame.size.width <= 0 || frame.size.height <= 0) {
|
|
567
694
|
frame = UIEdgeInsetsInsetRect(self.rootView.bounds, self.rootView.safeAreaInsets);
|
|
568
695
|
}
|
|
569
696
|
if (frame.size.width <= 0 || frame.size.height <= 0) frame = self.rootView.bounds;
|
|
697
|
+
#endif
|
|
570
698
|
self.displayView.frame = frame;
|
|
571
699
|
if (self.nativeRootView) self.nativeRootView.frame = self.rootView.bounds;
|
|
572
700
|
}
|
|
@@ -590,6 +718,9 @@ bool attributedStringHasTextDecoration(NSAttributedString *value)
|
|
|
590
718
|
|
|
591
719
|
- (CGSize)viewportSize
|
|
592
720
|
{
|
|
721
|
+
#if defined(GEA_UIKIT_VIEWPORT_WIDTH) && defined(GEA_UIKIT_VIEWPORT_HEIGHT)
|
|
722
|
+
return CGSizeMake(GEA_UIKIT_VIEWPORT_WIDTH, GEA_UIKIT_VIEWPORT_HEIGHT);
|
|
723
|
+
#endif
|
|
593
724
|
CGSize size = self.displayView.bounds.size;
|
|
594
725
|
if (size.width <= 0 || size.height <= 0) size = self.rootView.safeAreaLayoutGuide.layoutFrame.size;
|
|
595
726
|
if (size.width <= 0 || size.height <= 0) size = self.rootView.bounds.size;
|
|
@@ -616,12 +747,42 @@ bool attributedStringHasTextDecoration(NSAttributedString *value)
|
|
|
616
747
|
self.displayView.backgroundColor = color;
|
|
617
748
|
}
|
|
618
749
|
|
|
750
|
+
// Apps linked against the iOS/tvOS 27 SDKs must adopt the scene lifecycle:
|
|
751
|
+
// UIKit traps at launch otherwise. The window and everything that hangs off it
|
|
752
|
+
// is built when the scene connects (GeaSceneDelegate), not at launch.
|
|
619
753
|
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
|
|
620
754
|
{
|
|
621
755
|
(void)application;
|
|
622
756
|
(void)launchOptions;
|
|
623
|
-
|
|
757
|
+
gGeaAppDelegate = self;
|
|
758
|
+
return YES;
|
|
759
|
+
}
|
|
760
|
+
|
|
761
|
+
- (UISceneConfiguration *)application:(UIApplication *)application
|
|
762
|
+
configurationForConnectingSceneSession:(UISceneSession *)connectingSceneSession
|
|
763
|
+
options:(UISceneConnectionOptions *)options
|
|
764
|
+
{
|
|
765
|
+
(void)application;
|
|
766
|
+
(void)options;
|
|
767
|
+
UISceneConfiguration *configuration = [[UISceneConfiguration alloc] initWithName:@"Default"
|
|
768
|
+
sessionRole:connectingSceneSession.role];
|
|
769
|
+
configuration.delegateClass = NSClassFromString(@"GeaSceneDelegate");
|
|
770
|
+
return configuration;
|
|
771
|
+
}
|
|
772
|
+
|
|
773
|
+
- (void)startInWindowScene:(UIWindowScene *)scene
|
|
774
|
+
{
|
|
775
|
+
if (self.window) return;
|
|
776
|
+
UIApplication *application = UIApplication.sharedApplication;
|
|
777
|
+
self.window = [[UIWindow alloc] initWithWindowScene:scene];
|
|
778
|
+
#if TARGET_OS_TV
|
|
779
|
+
GeaTVController *controller = [[GeaTVController alloc] init];
|
|
780
|
+
controller.controllerUserInteractionEnabled = NO;
|
|
781
|
+
application.idleTimerDisabled = YES;
|
|
782
|
+
#else
|
|
783
|
+
(void)application;
|
|
624
784
|
UIViewController *controller = [[UIViewController alloc] init];
|
|
785
|
+
#endif
|
|
625
786
|
self.rootView = [[UIView alloc] initWithFrame:self.window.bounds];
|
|
626
787
|
self.rootView.opaque = YES;
|
|
627
788
|
self.rootView.backgroundColor = UIColor.blackColor;
|
|
@@ -632,6 +793,9 @@ bool attributedStringHasTextDecoration(NSAttributedString *value)
|
|
|
632
793
|
controller.view = self.rootView;
|
|
633
794
|
self.window.rootViewController = controller;
|
|
634
795
|
[self.window makeKeyAndVisible];
|
|
796
|
+
#if TARGET_OS_TV
|
|
797
|
+
[controller becomeFirstResponder];
|
|
798
|
+
#endif
|
|
635
799
|
[self.rootView layoutIfNeeded];
|
|
636
800
|
[self layoutDisplayViewInSafeArea];
|
|
637
801
|
gGeaAppDelegate = self;
|
|
@@ -667,25 +831,114 @@ bool attributedStringHasTextDecoration(NSAttributedString *value)
|
|
|
667
831
|
self.displayLink.preferredFramesPerSecond = 60;
|
|
668
832
|
}
|
|
669
833
|
[self.displayLink addToRunLoop:NSRunLoop.mainRunLoop forMode:NSRunLoopCommonModes];
|
|
670
|
-
|
|
834
|
+
}
|
|
835
|
+
|
|
836
|
+
- (void)applicationWillResignActive:(UIApplication *)application
|
|
837
|
+
{
|
|
838
|
+
(void)application;
|
|
839
|
+
self.displayLink.paused = YES;
|
|
840
|
+
#if TARGET_OS_TV
|
|
841
|
+
GCMotion *motion = ((GeaTVController *)self.window.rootViewController).remoteMotion;
|
|
842
|
+
if (motion.sensorsRequireManualActivation) motion.sensorsActive = NO;
|
|
843
|
+
#endif
|
|
844
|
+
}
|
|
845
|
+
|
|
846
|
+
- (void)applicationDidEnterBackground:(UIApplication *)application
|
|
847
|
+
{
|
|
848
|
+
#if TARGET_OS_TV
|
|
849
|
+
application.idleTimerDisabled = NO;
|
|
850
|
+
#else
|
|
851
|
+
(void)application;
|
|
852
|
+
#endif
|
|
853
|
+
}
|
|
854
|
+
|
|
855
|
+
- (void)applicationDidBecomeActive:(UIApplication *)application
|
|
856
|
+
{
|
|
857
|
+
#if TARGET_OS_TV
|
|
858
|
+
application.idleTimerDisabled = YES;
|
|
859
|
+
[self.window.rootViewController becomeFirstResponder];
|
|
860
|
+
#else
|
|
861
|
+
(void)application;
|
|
862
|
+
#endif
|
|
863
|
+
self.displayLink.paused = NO;
|
|
671
864
|
}
|
|
672
865
|
|
|
673
866
|
- (void)tick:(CADisplayLink *)link
|
|
674
867
|
{
|
|
868
|
+
#if TARGET_OS_TV
|
|
869
|
+
[(GeaTVController *)self.window.rootViewController pollRemoteMotion];
|
|
870
|
+
#endif
|
|
675
871
|
(void)link;
|
|
676
|
-
|
|
872
|
+
const int nowMs = gea_embedded_now_ms();
|
|
873
|
+
// This host replaces runtime.cpp's frame loop, including its animation
|
|
874
|
+
// clock. Prime newly mounted CSS tracks and advance them before rendering.
|
|
875
|
+
static bool declarativeAnimationsScanned = false;
|
|
876
|
+
if (!declarativeAnimationsScanned) {
|
|
877
|
+
declarativeAnimationsScanned = true;
|
|
878
|
+
gea::css::DeclarativeAnimations::scanAndStart(nowMs);
|
|
879
|
+
}
|
|
880
|
+
gea::embedded::ui::StyleSheet::instance().startCssAnimations(static_cast<std::uint32_t>(nowMs));
|
|
881
|
+
gea::css::AnimationEngine::instance().tick(static_cast<std::uint32_t>(nowMs));
|
|
882
|
+
gea::framework::app::Application::frame(nowMs);
|
|
677
883
|
[self syncAppBackgroundColor];
|
|
678
884
|
auto &tree = gea::embedded::ui::Tree::instance();
|
|
679
885
|
const int root = tree.mountedRoot();
|
|
680
|
-
if (!self.nativeRootView
|
|
681
|
-
gea::ios::IosRenderer::instance()
|
|
682
|
-
|
|
886
|
+
if (!self.nativeRootView) {
|
|
887
|
+
auto &renderer = gea::ios::IosRenderer::instance();
|
|
888
|
+
if (root < 0 || gea::framework::display::Underlay::active()) {
|
|
889
|
+
// Direct-canvas apps and composited underlays present the framework
|
|
890
|
+
// framebuffer. Remove native views that would cover that image.
|
|
891
|
+
if (renderer.hasNativeTree()) renderer.teardown();
|
|
892
|
+
} else {
|
|
893
|
+
renderer.sync(self.displayView, root);
|
|
894
|
+
[self.displayView syncNativeTextInputs];
|
|
895
|
+
}
|
|
683
896
|
[self.displayView setNeedsDisplay];
|
|
684
897
|
}
|
|
685
898
|
}
|
|
686
899
|
|
|
687
900
|
@end
|
|
688
901
|
|
|
902
|
+
// The one window scene: builds the host on connect and forwards the scene's
|
|
903
|
+
// activity to the app delegate, which keeps the per-app state (display link,
|
|
904
|
+
// idle timer, remote motion). UIKit no longer sends the application-level
|
|
905
|
+
// active/background callbacks once a scene manifest is declared.
|
|
906
|
+
@interface GeaSceneDelegate : UIResponder <UIWindowSceneDelegate>
|
|
907
|
+
@property(nonatomic, strong) UIWindow *window;
|
|
908
|
+
@end
|
|
909
|
+
|
|
910
|
+
@implementation GeaSceneDelegate
|
|
911
|
+
|
|
912
|
+
- (void)scene:(UIScene *)scene willConnectToSession:(UISceneSession *)session options:(UISceneConnectionOptions *)options
|
|
913
|
+
{
|
|
914
|
+
(void)session;
|
|
915
|
+
(void)options;
|
|
916
|
+
if (![scene isKindOfClass:UIWindowScene.class]) return;
|
|
917
|
+
GeaAppDelegate *app = gGeaAppDelegate ?: (GeaAppDelegate *)UIApplication.sharedApplication.delegate;
|
|
918
|
+
[app startInWindowScene:(UIWindowScene *)scene];
|
|
919
|
+
self.window = app.window;
|
|
920
|
+
}
|
|
921
|
+
|
|
922
|
+
- (void)sceneWillResignActive:(UIScene *)scene
|
|
923
|
+
{
|
|
924
|
+
(void)scene;
|
|
925
|
+
[gGeaAppDelegate applicationWillResignActive:UIApplication.sharedApplication];
|
|
926
|
+
}
|
|
927
|
+
|
|
928
|
+
- (void)sceneDidEnterBackground:(UIScene *)scene
|
|
929
|
+
{
|
|
930
|
+
(void)scene;
|
|
931
|
+
[gGeaAppDelegate applicationDidEnterBackground:UIApplication.sharedApplication];
|
|
932
|
+
}
|
|
933
|
+
|
|
934
|
+
- (void)sceneDidBecomeActive:(UIScene *)scene
|
|
935
|
+
{
|
|
936
|
+
(void)scene;
|
|
937
|
+
[gGeaAppDelegate applicationDidBecomeActive:UIApplication.sharedApplication];
|
|
938
|
+
}
|
|
939
|
+
|
|
940
|
+
@end
|
|
941
|
+
|
|
689
942
|
#if GEA_IOS_HAS_APPLE_NATIVE_BRIDGE
|
|
690
943
|
void gea::apple::UIKit::installRootView(gea::apple::UIKit::UIView view)
|
|
691
944
|
{
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
#include "imu.h"
|
|
2
2
|
#include "touch.h"
|
|
3
3
|
|
|
4
|
+
#include <TargetConditionals.h>
|
|
5
|
+
|
|
6
|
+
#if !TARGET_OS_TV
|
|
4
7
|
#import <CoreMotion/CoreMotion.h>
|
|
5
8
|
#import <Foundation/Foundation.h>
|
|
6
9
|
|
|
@@ -204,6 +207,25 @@ void Accelerometer::setWebTilt(int, int) {}
|
|
|
204
207
|
|
|
205
208
|
} // namespace gea::platform::sensors
|
|
206
209
|
|
|
210
|
+
#else
|
|
211
|
+
namespace gea::platform::sensors {
|
|
212
|
+
|
|
213
|
+
void Accelerometer::init() {}
|
|
214
|
+
void Accelerometer::close() {}
|
|
215
|
+
void Accelerometer::calibrateBias() {}
|
|
216
|
+
int Accelerometer::tiltX() { return 0; }
|
|
217
|
+
int Accelerometer::tiltY() { return 0; }
|
|
218
|
+
double Accelerometer::accelerationX() { return 0.0; }
|
|
219
|
+
double Accelerometer::accelerationY() { return 0.0; }
|
|
220
|
+
double Accelerometer::accelerationZ() { return 9.80665; } // gravity, plate flat
|
|
221
|
+
double Accelerometer::gyroscopeX() { return 0.0; }
|
|
222
|
+
double Accelerometer::gyroscopeY() { return 0.0; }
|
|
223
|
+
double Accelerometer::gyroscopeZ() { return 0.0; }
|
|
224
|
+
void Accelerometer::setWebTilt(int, int) {}
|
|
225
|
+
|
|
226
|
+
} // namespace gea::platform::sensors
|
|
227
|
+
#endif
|
|
228
|
+
|
|
207
229
|
namespace gea::platform::touch {
|
|
208
230
|
|
|
209
231
|
namespace {
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
#include "ui/tree_internal.h"
|
|
4
4
|
|
|
5
|
+
#include <TargetConditionals.h>
|
|
5
6
|
#include <algorithm>
|
|
6
7
|
#include <cmath>
|
|
7
8
|
#include <cstdlib>
|
|
@@ -84,7 +85,9 @@ bool rectNearlyEqual(CGRect a, CGRect b)
|
|
|
84
85
|
self.showsHorizontalScrollIndicator = NO;
|
|
85
86
|
self.delaysContentTouches = NO;
|
|
86
87
|
self.canCancelContentTouches = YES;
|
|
88
|
+
#if !TARGET_OS_TV
|
|
87
89
|
self.scrollsToTop = NO;
|
|
90
|
+
#endif
|
|
88
91
|
if (@available(iOS 11.0, *)) self.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
|
|
89
92
|
_contentView = [[UIView alloc] initWithFrame:CGRectZero];
|
|
90
93
|
_contentView.userInteractionEnabled = NO;
|
|
@@ -365,16 +365,6 @@ if [[ "$MACOS_PIPELINE_CACHE" == "0" ]]; then rm -rf "$RES_DIR"; fi
|
|
|
365
365
|
mkdir -p "$MACOS_DIR" "$RES_DIR" "$BUILD_DIR"
|
|
366
366
|
BUNDLE_CONTENT_CHANGED=0
|
|
367
367
|
|
|
368
|
-
INFO_PLIST_TMP="$BUILD_DIR/Info.plist.tmp.$$"
|
|
369
|
-
sed -e "s/@APP_EXEC@/$APP_EXEC/g" \
|
|
370
|
-
-e "s/@APP_ID@/$APP_ID/g" \
|
|
371
|
-
-e "s/@APP_NAME@/$APP_NAME/g" \
|
|
372
|
-
"$ROOT_DIR/targets/macos/Info.plist.in" > "$INFO_PLIST_TMP"
|
|
373
|
-
if replace_content_stable "$APP_BUNDLE/Contents/Info.plist" "$INFO_PLIST_TMP"; then
|
|
374
|
-
BUNDLE_CONTENT_CHANGED=1
|
|
375
|
-
fi
|
|
376
|
-
timing_mark bootstrap
|
|
377
|
-
|
|
378
368
|
# Resolve package metadata once per app. Bash 3.2 has no associative arrays, so
|
|
379
369
|
# keep parallel indexed arrays and publish the result through a global instead
|
|
380
370
|
# of command substitution (which would update the cache in a subshell).
|
|
@@ -405,6 +395,22 @@ resolve_app_dir() {
|
|
|
405
395
|
echo "$root"
|
|
406
396
|
}
|
|
407
397
|
|
|
398
|
+
# Info.plist comes from the shared template plus the optional `infoPlist`
|
|
399
|
+
# object of apps/<id>/macos.json (usage descriptions and other per-app keys).
|
|
400
|
+
INFO_PLIST_TMP="$BUILD_DIR/Info.plist.tmp.$$"
|
|
401
|
+
sed -e "s/@APP_EXEC@/$APP_EXEC/g" \
|
|
402
|
+
-e "s/@APP_ID@/$APP_ID/g" \
|
|
403
|
+
-e "s/@APP_NAME@/$APP_NAME/g" \
|
|
404
|
+
"$ROOT_DIR/targets/macos/Info.plist.in" > "$INFO_PLIST_TMP"
|
|
405
|
+
INFO_PLIST_APP_DIR="$(resolve_app_dir "$APP_ID")"
|
|
406
|
+
if [[ -n "$INFO_PLIST_APP_DIR" && -f "$INFO_PLIST_APP_DIR/macos.json" ]]; then
|
|
407
|
+
node "$ROOT_DIR/targets/macos/merge-info-plist.mjs" "$INFO_PLIST_TMP" "$INFO_PLIST_APP_DIR/macos.json"
|
|
408
|
+
fi
|
|
409
|
+
if replace_content_stable "$APP_BUNDLE/Contents/Info.plist" "$INFO_PLIST_TMP"; then
|
|
410
|
+
BUNDLE_CONTENT_CHANGED=1
|
|
411
|
+
fi
|
|
412
|
+
timing_mark bootstrap
|
|
413
|
+
|
|
408
414
|
# Cheap read-only equivalent of the post-generation finalizer for no-op cache
|
|
409
415
|
# validation. Avoiding a Node process per resident saves meaningful traversal
|
|
410
416
|
# time while preserving the same ownership invariants.
|
|
@@ -1962,6 +1968,7 @@ if [[ "$APPLE_NATIVE" == "1" ]]; then
|
|
|
1962
1968
|
-framework Metal -framework MetalKit -framework MapKit
|
|
1963
1969
|
-framework CoreLocation -framework AVFoundation -framework CoreMedia
|
|
1964
1970
|
-framework Photos -framework Security -framework UserNotifications
|
|
1971
|
+
-framework EventKit
|
|
1965
1972
|
)
|
|
1966
1973
|
fi
|
|
1967
1974
|
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Merge the optional `infoPlist` object of an app's macos.json into the
|
|
3
|
+
// generated Info.plist, so an app can declare its own keys (for example
|
|
4
|
+
// NSCalendarsFullAccessUsageDescription) without a per-app template. Each key
|
|
5
|
+
// is written with `plutil -replace`, so values may be any JSON plutil accepts:
|
|
6
|
+
// strings, numbers, booleans, arrays and objects.
|
|
7
|
+
//
|
|
8
|
+
// node merge-info-plist.mjs <Info.plist> <macos.json>
|
|
9
|
+
import { execFileSync } from 'node:child_process'
|
|
10
|
+
import { readFileSync } from 'node:fs'
|
|
11
|
+
|
|
12
|
+
const [plist, config] = process.argv.slice(2)
|
|
13
|
+
if (!plist || !config) {
|
|
14
|
+
console.error('usage: merge-info-plist.mjs <Info.plist> <macos.json>')
|
|
15
|
+
process.exit(2)
|
|
16
|
+
}
|
|
17
|
+
const fail = (message) => {
|
|
18
|
+
console.error(`${config}: ${message}`)
|
|
19
|
+
process.exit(1)
|
|
20
|
+
}
|
|
21
|
+
let parsed
|
|
22
|
+
try {
|
|
23
|
+
parsed = JSON.parse(readFileSync(config, 'utf8'))
|
|
24
|
+
} catch (error) {
|
|
25
|
+
fail(`cannot read JSON (${error.message})`)
|
|
26
|
+
}
|
|
27
|
+
const entries = parsed?.infoPlist
|
|
28
|
+
if (entries === undefined) process.exit(0)
|
|
29
|
+
if (entries === null || typeof entries !== 'object' || Array.isArray(entries)) fail('infoPlist must be an object')
|
|
30
|
+
for (const [key, value] of Object.entries(entries)) {
|
|
31
|
+
// plutil reads a dot as a key-path separator.
|
|
32
|
+
if (!key || key.includes('.')) fail(`infoPlist key ${JSON.stringify(key)} must be a non-empty name without dots`)
|
|
33
|
+
if (value === null) fail(`infoPlist.${key} must not be null`)
|
|
34
|
+
execFileSync('plutil', ['-replace', key, '-json', JSON.stringify(value), plist], { stdio: ['ignore', 'ignore', 'inherit'] })
|
|
35
|
+
}
|