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

Sync with Night Shift #15

Open
rllbe opened this issue Sep 6, 2019 · 1 comment
Open

Sync with Night Shift #15

rllbe opened this issue Sep 6, 2019 · 1 comment
Labels
enhancement New feature or request

Comments

@rllbe
Copy link

rllbe commented Sep 6, 2019

It would be nice if auto enable/disable by sunrise/sunset is implemented, just like how iOS 13 does.
I've managed to make it work by respecting night shift settings(that means no more CoreLocation stuff needed):

@interface CBBlueLightClient : NSObject
typedef struct {
int hour;
int minute;
} Time;
typedef struct {
Time fromTime;
Time toTime;
} Schedule;
typedef struct {
BOOL active;
BOOL enabled;
BOOL sunSchedulePermitted;
int mode;
Schedule schedule;
unsigned long long disableFlags;
BOOL available;
} Status;
-(CBBlueLightClient *)initWithClientObj:(id)arg1 ;
@end

%hook CBBlueLightClient
-(CBBlueLightClient *)initWithClientObj:(id)arg1 {
CBBlueLightClient *client = %orig;
void (^notificationBlock)() = ^() {
Status status;
[client getBlueLightStatus:&status];
if (status.mode == 1) { //mode 1 means sunset/sunrise mode
if (status.enabled) notify_post(@"xyz.skitty.dune.enabled".UTF8String);
else notify_post(@"xyz.skitty.dune.disabled".UTF8String);
}
};
[client setStatusNotificationBlock:notificationBlock];
return %orig;
}
%end

@Skittyblock Skittyblock changed the title Request: Add sunrise/sunset support [Todo] Add automatic settings Sep 13, 2019
@Skittyblock Skittyblock added the enhancement New feature or request label Sep 13, 2019
@Skittyblock
Copy link
Owner

Yes, I will add an option to sync with Night Shift. I'm planning to also add a separate automatic mode though so users can chose a different time or if they don't use Night Shift.

@Skittyblock Skittyblock changed the title [Todo] Add automatic settings Sync with Night Shift Sep 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants