Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

[image_picker_ios] Fix FLTPHPickerSaveImageToPathOperation property attributes - #6890

Merged
auto-submit[bot] merged 3 commits into
flutter-team-archive:mainfrom
jmagman:image-picker-quality
Jan 3, 2023
Merged

auto-submit[bot] merged 3 commits into
flutter-team-archive:mainfrom
jmagman:image-picker-quality

Conversation

@jmagman

@jmagman jmagman commented Dec 28, 2022 •

Copy link
Copy Markdown
Contributor
  • Fix memory attributes of FLTPHPickerSaveImageToPathOperation NSNumber properties to strong, not assign
  • Add UI tests that exercise the quality setting, confirm it crashes without this fix.
  • Use XCUIElementQuery subscripting to find elements instead of label predicates.
  • Minor cleanup of NSNumber boxing.
  • Remove < iOS 14 dead code in one of the UI tests.

Fixes flutter/flutter#117670

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the relevant style guides and ran the auto-formatter. (Unlike the flutter/flutter repo, the flutter/plugins repo does use dart format.)
  • I signed the CLA.
  • The title of the PR starts with the name of the plugin surrounded by square brackets, e.g. [shared_preferences]
  • I listed at least one issue that this PR fixes in the description above.
  • I updated pubspec.yaml with an appropriate new version according to the pub versioning philosophy, or this PR is exempt from version changes.
  • I updated CHANGELOG.md to add a description of the change, following repository CHANGELOG style.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is test-exempt.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

BuildableIdentifier = "primary"
BlueprintIdentifier = "BE7AEE6B26403C46006181AA"
BuildableName = "RunnerUITestiOS14.xctest"
BlueprintName = "RunnerUITestiOS14"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This was removed at some point.

* Creates a mock picker result using NSItemProvider.
*
* @param itemProvider an item provider that will be used as picker result
* @param identifier local identifier of the asset

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

There is no such parameter.


XCUIElement *imageFromGalleryButton =
[self.app.otherElements elementMatchingPredicate:predicateToFindImageFromGalleryButton];
self.app.otherElements[@"image_picker_example_from_gallery"].firstMatch;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Prefer subscripting over predicates for easier reading.

@(kElementWaitingTime));
}

XCTAssertTrue(imageFromGalleryButton.exists);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Don't need to check that it exists, waitForExistenceWithTimeout right above does this already.

[self launchPickerAndCancel];
}

- (void)launchPickerAndCancel {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Remove unnecessary utility method.

}

XCUIElement *pickButton = [self.app.buttons elementMatchingPredicate:predicateToFindPickButton];
if (quality != nil) {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This tests the fix, and crashes on master without it.


- (void)testSelectingFromGallery {
// Test the `Select Photos` button which is available after iOS 14.
if (@available(iOS 14, *)) {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Use API_AVAILABLE in the method signature instead.

XCUIElement *aImage;
if (@available(iOS 14, *)) {
aImage = [self.app.scrollViews.firstMatch.images elementBoundByIndex:1];
} else {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This else was dead code, this only runs on iOS 14.

// Find an image and tap on it to have access to selected photos.
if (@available(iOS 14, *)) {
aImage = [self.app.scrollViews.firstMatch.images elementBoundByIndex:1];
} else {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Same, dead code.

Comment on lines +16 to +18
@property(strong, nonatomic) NSNumber *maxHeight;
@property(strong, nonatomic) NSNumber *maxWidth;
@property(strong, nonatomic) NSNumber *desiredImageQuality;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is the actual fix.

@vashworth vashworth left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@stuartmorgan-g stuartmorgan-g left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@jmagman jmagman added the autosubmit Merge PR when tree becomes green via auto submit App label Jan 3, 2023
@auto-submit
auto-submit Bot merged commit f9dda6a into flutter-team-archive:main Jan 3, 2023
@jmagman
jmagman deleted the image-picker-quality branch January 3, 2023 21:03
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jan 4, 2023
auto-submit Bot pushed a commit to flutter/flutter that referenced this pull request Jan 4, 2023
* 6df3ef23f [in_app_pur] Add screenshots to pubspec.yaml (flutter-team-archive/plugins#6540)

* 42f8093c2 [google_maps_flutter] Fixed minor syntax error in the README.md (flutter-team-archive/plugins#6909)

* f9dda6a27 [image_picker_ios] Fix FLTPHPickerSaveImageToPathOperation property attributes (flutter-team-archive/plugins#6890)
loic-sharma pushed a commit to fluttergithubbot/flutter that referenced this pull request Jan 6, 2023
…#117972)

* 6df3ef23f [in_app_pur] Add screenshots to pubspec.yaml (flutter-team-archive/plugins#6540)

* 42f8093c2 [google_maps_flutter] Fixed minor syntax error in the README.md (flutter-team-archive/plugins#6909)

* f9dda6a27 [image_picker_ios] Fix FLTPHPickerSaveImageToPathOperation property attributes (flutter-team-archive/plugins#6890)
esouthren pushed a commit to esouthren/flutter that referenced this pull request Jan 15, 2023
…#117972)

* 6df3ef23f [in_app_pur] Add screenshots to pubspec.yaml (flutter-team-archive/plugins#6540)

* 42f8093c2 [google_maps_flutter] Fixed minor syntax error in the README.md (flutter-team-archive/plugins#6909)

* f9dda6a27 [image_picker_ios] Fix FLTPHPickerSaveImageToPathOperation property attributes (flutter-team-archive/plugins#6890)