+-(void)setFlashlightOn:(BOOL)arg
+{
+ if ([self.flashlightButton.bundleID isEqualToString:@"com.apple.flashlight"])
+ [self.flashlightButton setSelected:arg];
+ if ([self.cameraButton.bundleID isEqualToString:@"com.apple.flashlight"])
+ [self.cameraButton setSelected:arg];
+ for (CSQuickActionsButton *button in [self leftButtons])
+ if ([button.bundleID isEqualToString:@"com.apple.flashlight"])
+ [button setSelected:arg];
+ for (CSQuickActionsButton *button in [self rightButtons])
+ if ([button.bundleID isEqualToString:@"com.apple.flashlight"])
+ [button setSelected:arg];
+}
+
+%new
+-(void)setDoNotDisturb:(BOOL)state
+{
+ DNDModeAssertionService *assertionService = (DNDModeAssertionService *)[objc_getClass("DNDModeAssertionService") serviceForClientIdentifier:@"com.apple.donotdisturb.control-center.module"];
+
+ if (state) {
+ DNDModeAssertionDetails *newAssertion = [objc_getClass("DNDModeAssertionDetails") userRequestedAssertionDetailsWithIdentifier:@"com.apple.control-center.manual-toggle" modeIdentifier:@"com.apple.donotdisturb.mode.default" lifetime:nil];
+ [assertionService takeModeAssertionWithDetails:newAssertion error:NULL];
+ } else {
+ [assertionService invalidateAllActiveModeAssertionsWithError:NULL];
+ }
+
+ [[NSNotificationCenter defaultCenter] postNotificationName:@"SBQuietModeStatusChangedNotification" object:nil];
+}
+
+%new
+-(BOOL)isDNDActive
+{
+
+ // DNDStateService *stateService = (DNDStateService *)[objc_getClass("DNDStateService") serviceForClientIdentifier:@"com.apple.donotdisturb.control-center.module"];
+ return [[self.stateService queryCurrentStateWithError:nil] isActive];
+}
+
+%new
+-(void)updateDND:(NSNotification *)notif
+{
+ BOOL active = [self isDNDActive];
+
+ if ([self.flashlightButton.bundleID isEqualToString:@"com.apple.donotdisturb"])
+ [self.flashlightButton setSelected:active];
+ if ([self.cameraButton.bundleID isEqualToString:@"com.apple.donotdisturb"])
+ [self.cameraButton setSelected:active];
+ for (CSQuickActionsButton *button in [self leftButtons])
+ if ([button.bundleID isEqualToString:@"com.apple.donotdisturb"])
+ [button setSelected:active];
+ for (CSQuickActionsButton *button in [self rightButtons])
+ if ([button.bundleID isEqualToString:@"com.apple.donotdisturb"])
+ [button setSelected:active];
+}
+
+%new
+-(void)stateService:(id)arg1 didReceiveDoNotDisturbStateUpdate:(id)arg2
+{
+ dispatch_async(dispatch_get_main_queue(), ^{
+ [self updateDND:nil];
+ });
+}
+