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

Visual issues in Landscape mode when sharing on iOS #72

Open
acgourley opened this issue Sep 8, 2021 · 5 comments
Open

Visual issues in Landscape mode when sharing on iOS #72

acgourley opened this issue Sep 8, 2021 · 5 comments

Comments

@acgourley
Copy link

All tests on Unity 2020.3f15 / Xcode 12.5

Building the example out to an iPhone 6S on iOS 14 we can see the Instagram share has no keyboard:

Screen Shot 2021-09-08 at 2 06 53 PM

Similar for building to an iPad Pro on iOS 14 (external keyboard works, but no on screen keyboard will appear)

Screen Shot 2021-09-08 at 2 08 31 PM

On these devices, sharing images to instagram from the Photos app does bring up the keyboard, so it's likely something about the unity root view controller.

Oddly, in my own unity app when embedding this plugin, things are a bit worse. This is a screenshot of trying to share from the same iPhone 6S:

Screen Shot 2021-09-08 at 1 54 27 PM

I've closely compared the build settings in both projects and I can't figure out why the share window would be smaller and off the screen in my app and not the example project in this repo, but I do wonder if they might have the same root cause.

I'd either be happy to see the landscape share view work as well as it does in Apple Photos or have a strategy for selectively turning on portrait mode when launching this sharing dialog to sidestep the issue.

@acgourley
Copy link
Author

It does appear possible to tell unity to change the auto rotation settings to portrait, wait a frame, then invoke this plugin and this will fix the issues. Of course you also need to know when you can change your view back to landscape, and as of now this plugin doesn't furnish a callback.

I tested it, and if we add this to the activity before showing the share dialog, it does invoke when the controller is dismissed.

[activity setCompletionHandler:^(NSString *activityType, BOOL completed) {
        NSLog(@"UIActivityViewController dismissed");
        //TODO: tell unity
    }];

So maybe a good fix is to have an optional delegate arg from ShareScreenshotAndText and ShareText which will be invoked on completion, see "Using Delegates" on https://docs.unity3d.com/Manual/PluginsForIOS.html

@NicholasSheehan
Copy link
Owner

activity.completionWithItemsHandler = ^(UIActivityType activityType, BOOL completed, NSArray *returnedItems, NSError *activityError)

I started looking at Unity callbacks a while ago, the issue is I need to write a wrapper that allows Actions to be passed into Obj-C in a friendly way. The link you provided touches on how I'll do it, which is to create some typedefs like typedef void(*TYPEDEF_NAME)(void)

I'd also need to write the Android version at the same time in order to make it consistent across platforms

@acgourley
Copy link
Author

I might be able to help, depending on timing as I think I need this in a little over a week. On the other hand, I don't want to get in your way and I also don't want to figure out android as that currently works fine in landscape. If you think you won't be doing it this week just give this post a thumbs up and I'll try doing at least iOS in a fork.

@NicholasSheehan
Copy link
Owner

Feel free to add and patch what you like and submit it as a pull request

@NicholasSheehan
Copy link
Owner

I'll try and get my Mac environment setup again for the weekend

Some of the calls need a refactor, I'd rather pass around 1 object with all the variables needed for sharing rather than passing through each variable as optional parameters. But I'll do that after this as it'll be a breaking API change so I'll need to bump the version to v1.1.0 when I do

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

No branches or pull requests

2 participants