Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: lock app orientation to portrait mode on iOS and macOS #1225

Open
wants to merge 1 commit into
base: flutter_app
Choose a base branch
from

Conversation

samruddhi-Rahegaonkar
Copy link
Contributor

@samruddhi-Rahegaonkar samruddhi-Rahegaonkar commented Mar 6, 2025

Fixes
-This PR fixes issue #1190 by locking the app's orientation to portrait mode on both iOS and macOS platforms.

Changes

  • Updated Info.plist for iOS to restrict orientation to portrait.
  • Modified macOS project settings to ensure portrait orientation is enforced.
  • Adjusted shared schemes to reflect orientation changes.

Screenshots / Recordings

Checklist:

  • No hard coding: I have used resources from constants.dart without hard coding any value.
  • No end of file edits: No modifications done at end of resource files.
  • Code reformatting: I have reformatted code and fixed indentation in every file included in this pull request.
  • Code analyzation: My code passes analyzations run in flutter analyze and tests run in flutter test.

Fixes #1190.

Summary by Sourcery

Bug Fixes:

Copy link
Contributor

sourcery-ai bot commented Mar 6, 2025

Reviewer's Guide by Sourcery

This pull request locks the app orientation to portrait mode on both iOS and macOS. This was achieved by modifying the Info.plist file for iOS, updating macOS project settings, and adjusting shared schemes.

Class diagram for main.dart

classDiagram
    class MyApp {
        -Key? key
        +MyApp(Key? key)
        +Widget build(BuildContext context)
    }
Loading

File-Level Changes

Change Details Files
Restricted the app to portrait orientation on iOS.
  • Modified the Info.plist file to remove landscape orientations from the supported orientations.
iOS/Runner/Info.plist
Enforced portrait orientation on macOS.
  • Modified macOS project settings to ensure portrait orientation is enforced.
iOS/Runner.xcodeproj/project.pbxproj
iOS/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
macos/Runner.xcworkspace/contents.xcworkspacedata

Assessment against linked issues

Issue Objective Addressed Explanation
#1190 The app should respect the preferred orientations set in setPreferredOrientations on iPad devices.
#1190 Specifically, the Dashboard screen should not rotate to landscape, and the Draw Badge screen should not rotate to portrait on iPads.

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!
  • Generate a plan of action for an issue: Comment @sourcery-ai plan on
    an issue to generate a plan of action for it.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @samruddhi-Rahegaonkar - I've reviewed your changes - here's some feedback:

Overall Comments:

  • It might be worth investigating if there's a way to achieve this in the Flutter code itself, rather than modifying platform-specific files.
Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Copy link

github-actions bot commented Mar 6, 2025

Build Status

Build successful. APKs to test: https://github.com/fossasia/badgemagic-app/actions/runs/13706365344/artifacts/2706119782.

Screenshots (Android)

Screenshots (iPhone)

Screenshots (iPad)

Comment on lines +64 to +84
<dict>
<key>CADisableMinimumFrameDurationOnPhone</key>
<true/>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleDisplayName</key>
<string>Badge Magic</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>badgemagic</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>$(FLUTTER_BUILD_NAME)</string>
<key>CFBundleSignature</key>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wondering why this was changed?

@adityastic adityastic force-pushed the fix-ipad-orientation branch 2 times, most recently from 0a481f0 to 4c91306 Compare March 6, 2025 18:03
@AsCress
Copy link
Contributor

AsCress commented Mar 6, 2025

@adityastic Let's rebase this and test :))

@AsCress
Copy link
Contributor

AsCress commented Mar 6, 2025

Build Status

Build successful. APKs to test: https://github.com/fossasia/badgemagic-app/actions/runs/13706365344/artifacts/2706119782.

Screenshots (Android)

Screenshots (iPhone)

Screenshots (iPad)

@adityastic There we go !

@adityastic
Copy link
Collaborator

Build Status

Build successful. APKs to test: https://github.com/fossasia/badgemagic-app/actions/runs/13706365344/artifacts/2706119782.

Screenshots (Android)

Screenshots (iPhone)

Screenshots (iPad)

@adityastic There we go !

Awesome! Great job!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Layouts don't respect orientation on iPad
3 participants