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

Add (Apple Intelligence) image playground to the Quick Editor #565

Merged
merged 11 commits into from
Nov 22, 2024

Conversation

pinarol
Copy link
Contributor

@pinarol pinarol commented Nov 20, 2024

Closes #568 (comment)

Description

Adds the image playground of Apple to the QuickEditor.

ScreenRecording_11-20-2024.11-41-45_1.MP4

Testing Steps

Upgrade to iOS 18.2 beta
Turn on Apple Intelligence
Go to the demo app > Quick Editor flow
Choose "Playground"

  • Finish the flow
  • Cancel the flow

Test other image sources as well

  • Camera
  • Image picker.

Turn off Apple Intelligence via device settings

  • "Playground" option shouldn't be there anymore

@pinarol pinarol added enhance New feature or request [Feature] Gravatar-QuickEditor Gravatar Quick Editor [Priority] High labels Nov 20, 2024
@pinarol pinarol self-assigned this Nov 20, 2024
@wpmobilebot
Copy link

wpmobilebot commented Nov 20, 2024

Gravatar Prototype Build📲 You can test the changes from this Pull Request in Gravatar Prototype Build by scanning the QR code below to install the corresponding build.
App NameGravatar Prototype Build Gravatar Prototype Build
Build Number1762
Version1.0
Bundle IDcom.automattic.gravatar-sdk-demo-uikit.prototype-build
Commit5bfff19
App Center BuildGravatar SDK Demo - UIKit #405
Automatticians: You can use our internal self-serve MC tool to give yourself access to App Center if needed.

@@ -498,6 +501,7 @@
ENABLE_USER_SCRIPT_SANDBOXING = NO;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = "Demo/Gravatar-Demo/Info.plist";
INFOPLIST_KEY_NSCameraUsageDescription = "Accessing camera to create an avatar.";
Copy link
Contributor Author

@pinarol pinarol Nov 20, 2024

Choose a reason for hiding this comment

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

I guess NSCameraUsageDescription was removed during the merge of two demo apps. So I am adding it back.


var id: Int {
self.hashValue
}
}

@State var isPresented = false
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This isn't used from anywhere so I am removing it.

isPresented: Binding(
get: { sourceType == .playground },
set: { if !$0 { sourceType = nil } }
),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Doing this to be able to add the new case playground to SourceType and still have these be managed by a single sourceType variable.

(The system offers a modifier for the playground not a View. But our existing image sources are Views. So they are displayed with different methods.)

@pinarol pinarol marked this pull request as ready for review November 20, 2024 09:50
static var allCases: [SourceType] {
var cases: [SourceType] = [.camera, .photoLibrary]
if #available(iOS 18.2, *) {
if EnvironmentValues().supportsImagePlayground {
Copy link
Contributor

Choose a reason for hiding this comment

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

Works flawlessly

Copy link
Contributor

@andrewdmontgomery andrewdmontgomery left a comment

Choose a reason for hiding this comment

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

Worked great! A few notes:

Images generated in this Playground sheet are available in my Playground app. That's a nice and unexpected feature of the service.

I had something unexpected happen. It's probably an issue with the beta. but I'll mention it anyway:

  1. Performed testing steps, as instructed
  2. After disabling Apple Intelligence, and testing in that state, I re-enabled Apple Intelligence
  3. I put the phone down and started looking at the PR diff
  4. When I wasn't looking, the phone restarted (crash?)... I had to re-enter my pin in order to unlock the iphone
  5. I went back to the Demo app, and immediately tried to use the playground again.
  6. When the Playground sheet opened, I saw the message below
  7. I launched the Playground app to see if it gave the same message, but was fully functional
  8. Returned to the Demo app, and the Playground worked

Did I just have remarkable timing, and the image playground models finished downloading in the second it took me to launch the Playground app?

The crash is very suspicious, of course. So I'm attributing this to "beta".

IMG_4559

@pinarol
Copy link
Contributor Author

pinarol commented Nov 22, 2024

Yeah that sounds like a system issue...

@pinarol pinarol merged commit 79e1e6e into trunk Nov 22, 2024
9 checks passed
@pinarol pinarol deleted the wppinar/add-image-playground branch November 22, 2024 07:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhance New feature or request [Feature] Gravatar-QuickEditor Gravatar Quick Editor [Priority] Medium
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create and upload an image through Playground AI
3 participants