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):
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.
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