thomasfinch / GammaThingy

Changes screen gamma on iOS, no jailbreak required
777 stars 94 forks source link

Reboot persistence (fetch only) #28

Closed ANGOmarcello closed 9 years ago

ANGOmarcello commented 9 years ago

Added changes so that on launch Gamma Thingy checks wether it should reapply the gammatable

thomasfinch commented 9 years ago

Ah thanks, I misunderstood and thought you meant setting the switch status depending on what the current color is, but I see you meant the other way around. Thanks!

luuuke commented 9 years ago

Are those 3 lines left over from testing?

ANGOmarcello commented 9 years ago

No that is necessary after reboot to reinstate the gamma if enabled is set to 1. Because you would it expect to be actually on if it is set to on.

ANGOmarcello commented 9 years ago

But I oversaw something.

It should be more something like this:

if ([defaults boolForKey:@"enabled"] && firstExecution){
    [self enableOrangeness];
    firstExecution = false;
}

Where firstExecution should be a boolean indicating that the Application is running for the first time so that the screen is not lit every time a fetch request happens and enabled is 1.

luuuke commented 9 years ago

Yep, that's what I was worried about. Maybe it's also possible to put this into one of the application delegate methods?

ANGOmarcello commented 9 years ago

If we put the code in the didFinishLaunchingWithOptions method it only works without user interaction if you use the VOIP Backgrounding, with the fetching backgrounding it will only be applied if you start the application manually.

So if we want to use it with the fetching it should be in a place where we can call from the didFinishLaunchingWithOptions method and from the fetching method.

So it seems that handling this in the autoChangeOrangenessIfNeeded method works best for now but it could be implemented in a more beautiful way.

I'm unsure what to do now. I changed my GammaController class with the suggestion I gave above and that works.