feat(@capacitor/screen-orientation): Orientation 'landscape' lock should use current held landscape if any

Đang mở
#2,039 15 bình luận 1 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 29 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
48/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Ít trao đổi
Công nghệ
java, swift
Lĩnh vực
mobile-dev

Hướng nghiên cứu

Bắt đầu với phần xử lý khóa hướng trong ios/Sources/ScreenOrientationPlugin/ScreenOrientation.swift tại dòng được tham chiếu và trong android/src/main/java/com/capacitorjs/plugins/screenorientation/ScreenOrientation.java. Chạy ứng dụng tái hiện được liên kết trong khi giữ thiết bị theo từng hướng ngang, sau đó xác minh rằng việc khóa ở hướng ngang sẽ giữ nguyên hướng ngang hiện tại trên cả iOS và Android.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

platform: android platform: ios type: feature request

Bug Report

Plugin(s)

@capacitor/screen-orientation 5.0.7

Capacitor Version
💊   Capacitor Doctor  💊 

Latest Dependencies:

  @capacitor/cli: 5.7.0
  @capacitor/core: 5.7.0
  @capacitor/android: 5.7.0
  @capacitor/ios: 5.7.0

Installed Dependencies:

  @capacitor/cli: 5.6.0
  @capacitor/android: 5.7.0
  @capacitor/core: 5.7.0
  @capacitor/ios: 5.7.0

Platform(s)

Android and iOS

Current Behavior

When locking the screen orientation to 'landscape' it locks it to landscape left. Meaning that if I'm holding my phone in landscape right mode, the view rotates 180 degrees and locks there. (Same goes for android with landscape and landscape reverse).

You can see this is how its configured in the plugin code:
iOS: https://github.com/ionic-team/capacitor-plugins/blob/be3dd6889b5d147cd43ff17ae2cfdb936a146a34/screen-orientation/ios/Sources/ScreenOrientationPlugin/ScreenOrientation.swift#L87
Android: https://github.com/ionic-team/capacitor-plugins/blob/be3dd6889b5d147cd43ff17ae2cfdb936a146a34/screen-orientation/android/src/main/java/com/capacitorjs/plugins/screenorientation/ScreenOrientation.java#L62

Expected Behavior

If the phone is physically held in either landscape left or right (normal or reverse for android), when locking the orientation to 'landscape' it should lock the current orientation without rotating anything.

Code Reproduction

This simple app by WIStudent reproduces the problem: https://github.com/WIStudent/capacitor-screen-orientation-issue-reproduction-app/tree/main

Other Technical Details
Additional Context
Ngôn ngữ chính
Java
Star
688
Fork
692
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của ionic-team/capacitor-plugins

Tất cả issue của ionic-team/capacitor-plugins

Issue tương tự

Thêm issue về Java

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.