shinydevelopment / SimulatorStatusMagic

Clean up your status bar for taking screenshots on the iOS simulator.
MIT License
2.35k stars 140 forks source link

Enable the app to auto override by setting an environment variable #38

Closed petero-dk closed 8 years ago

petero-dk commented 8 years ago

When working with Xamarin based apps and wanting to script the screenshots it is much easier to launch the SimulatorStatusMagic as a standalone app instead of changing the compilation process of the original app.

Hence the need for SimulatorStatusMagic to auto enable and disable the overrides.

daveverwer commented 8 years ago

Apologies for the delay in getting around to looking at this.

So as I understand it this will toggle between the overrides being applied every time the app is run. Is that the intention?

I could see that an explicit setting in an environment variable might be useful:

SIMULATOR_STATUS_MAGIC_APPLY_OVERRIDES = YES

or

SIMULATOR_STATUS_MAGIC_APPLY_OVERRIDES = NO

Or something like that, but I'm not sure a toggle is that useful. If it's a toggle you need, can you explain how it's working for you please?

Thanks!

petero-dk commented 8 years ago

Hi Dave

It might work with the explicit environment variable, and how I would set them during our testing.

What we do now is compile with the "toggle enabled" and then run automated screenshot scripts based on UI tests.

Before running the UI tests we launch the statusmagic which will automatically enable the status magic, Then we run our UI tests and grab all of our screenshots Then we run status magic again to reset the status bar.

The apply overrides might actually be better if it would ensure that the magic has been applied.

Does this make any sense to any one else but me?

(I do not think I have written magic in such a serious context so many times before)

daveverwer commented 8 years ago

(I do not think I have written magic in such a serious context so many times before)

Haha yes :)

It's not something I'd use myself (I'd integrate the library and just call it from code) but I can see a case for it. I'd merge the PR if it was explicit. I think that makes much more sense.

petero-dk commented 8 years ago

Fyi: It is for this project we use it: https://github.com/ecomerc/xscreenshot

Specifically here: https://github.com/ecomerc/xscreenshot/blob/master/Source/iOS/StatusMagic.cs and here: https://github.com/ecomerc/xscreenshot/blob/master/Source/iOS/iOSHelpers.cs#L65

petero-dk commented 8 years ago

The problem is that I cannot (perhaps I am not that smart) integrate the project into my Xamarin projects.

petero-dk commented 8 years ago

Ill see if I can make it explicit, and do a PR for that

daveverwer commented 8 years ago

Sounds good. I'm going to close this one, just reference a link to this when you submit the new PR.