Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix ios compile
  • Loading branch information
dkwingsmt committed Dec 11, 2023
commit 8d20227946142f2f7626443660a8d8336ecdb324
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@
// change. Unfortunately unless you have Werror turned on, incompatible pointers as arguments are
// just a warning.
@interface FlutterViewController () <FlutterBinaryMessenger, UIScrollViewDelegate>
// TODO(dkwingsmt): Make the view ID property public once the iOS shell
// supports multiple views.
// https://github.com/flutter/flutter/issues/138168
@property(nonatomic, assign) int64_t viewId;

@property(nonatomic, readwrite, getter=isDisplayingFlutterUI) BOOL displayingFlutterUI;
@property(nonatomic, assign) BOOL isHomeIndicatorHidden;
@property(nonatomic, assign) BOOL isPresentingViewControllerAnimating;
Expand Down Expand Up @@ -214,6 +219,12 @@ - (instancetype)initWithCoder:(NSCoder*)aDecoder {
return self;
}

- (int64_t)viewId {
// TODO(dkwingsmt): Fill the view ID property with the correct value once the
// iOS shell supports multiple views.
return flutter::kFlutterImplicitViewId;
}

- (void)awakeFromNib {
[super awakeFromNib];
if (!_engine) {
Expand Down Expand Up @@ -929,7 +940,7 @@ - (void)flushOngoingTouches {
pointer_data.change = flutter::PointerData::Change::kCancel;
pointer_data.device = device.longLongValue;
pointer_data.pointer_identifier = 0;
pointer_data.view_id = _viewIdForPointerEvent();
pointer_data.view_id = self.viewId;

// Anything we put here will be arbitrary since there are no touches.
pointer_data.physical_x = 0;
Expand Down Expand Up @@ -1178,7 +1189,7 @@ - (void)dispatchTouches:(NSSet*)touches

pointer_data.device = reinterpret_cast<int64_t>(touch);

pointer_data.view_id = _viewIdForPointerEvent();
pointer_data.view_id = self.viewId;

// Pointer will be generated in pointer_data_packet_converter.cc.
pointer_data.pointer_identifier = 0;
Expand Down Expand Up @@ -2397,7 +2408,7 @@ - (BOOL)gestureRecognizer:(UIGestureRecognizer*)gestureRecognizer
pointer_data.device = reinterpret_cast<int64_t>(_continuousScrollingPanGestureRecognizer);
pointer_data.kind = flutter::PointerData::DeviceKind::kTrackpad;
pointer_data.signal_kind = flutter::PointerData::SignalKind::kScrollInertiaCancel;
pointer_data.view_id = _viewIdForPointerEvent();
pointer_data.view_id = self.viewId;

if (event.timestamp < _scrollInertiaEventAppKitDeadline) {
// Only send the event if it occured before the expected natural end of gesture momentum.
Expand All @@ -2421,7 +2432,7 @@ - (void)hoverEvent:(UIPanGestureRecognizer*)recognizer API_AVAILABLE(ios(13.4))
flutter::PointerData pointer_data = [self generatePointerDataAtLastMouseLocation];
pointer_data.device = reinterpret_cast<int64_t>(recognizer);
pointer_data.kind = flutter::PointerData::DeviceKind::kMouse;
pointer_data.view_id = _viewIdForPointerEvent();
pointer_data.view_id = self.viewId;

switch (_hoverGestureRecognizer.state) {
case UIGestureRecognizerStateBegan:
Expand Down Expand Up @@ -2460,7 +2471,7 @@ - (void)hoverEvent:(UIPanGestureRecognizer*)recognizer API_AVAILABLE(ios(13.4))
inertia_cancel.device = reinterpret_cast<int64_t>(_continuousScrollingPanGestureRecognizer);
inertia_cancel.kind = flutter::PointerData::DeviceKind::kTrackpad;
inertia_cancel.signal_kind = flutter::PointerData::SignalKind::kScrollInertiaCancel;
inertia_cancel.view_id = _viewIdForPointerEvent();
inertia_cancel.view_id = self.viewId;
packet->SetPointerData(/*i=*/1, inertia_cancel);
[_engine.get() dispatchPointerDataPacket:std::move(packet)];
_scrollInertiaEventStartline = DBL_MAX;
Expand All @@ -2484,7 +2495,7 @@ - (void)discreteScrollEvent:(UIPanGestureRecognizer*)recognizer API_AVAILABLE(io
pointer_data.signal_kind = flutter::PointerData::SignalKind::kScroll;
pointer_data.scroll_delta_x = (translation.x - _mouseState.last_translation.x);
pointer_data.scroll_delta_y = -(translation.y - _mouseState.last_translation.y);
pointer_data.view_id = _viewIdForPointerEvent();
pointer_data.view_id = self.viewId;

// The translation reported by UIPanGestureRecognizer is the total translation
// generated by the pan gesture since the gesture began. We need to be able
Expand All @@ -2508,7 +2519,7 @@ - (void)continuousScrollEvent:(UIPanGestureRecognizer*)recognizer API_AVAILABLE(
flutter::PointerData pointer_data = [self generatePointerDataAtLastMouseLocation];
pointer_data.device = reinterpret_cast<int64_t>(recognizer);
pointer_data.kind = flutter::PointerData::DeviceKind::kTrackpad;
pointer_data.view_id = _viewIdForPointerEvent();
pointer_data.view_id = self.viewId;
switch (recognizer.state) {
case UIGestureRecognizerStateBegan:
pointer_data.change = flutter::PointerData::Change::kPanZoomStart;
Expand Down Expand Up @@ -2557,7 +2568,7 @@ - (void)pinchEvent:(UIPinchGestureRecognizer*)recognizer API_AVAILABLE(ios(13.4)
flutter::PointerData pointer_data = [self generatePointerDataAtLastMouseLocation];
pointer_data.device = reinterpret_cast<int64_t>(recognizer);
pointer_data.kind = flutter::PointerData::DeviceKind::kTrackpad;
pointer_data.view_id = _viewIdForPointerEvent();
pointer_data.view_id = self.viewId;
switch (recognizer.state) {
case UIGestureRecognizerStateBegan:
pointer_data.change = flutter::PointerData::Change::kPanZoomStart;
Expand Down