diff --git a/control b/control index 482977b..07b833b 100644 --- a/control +++ b/control @@ -2,13 +2,14 @@ Package: com.haoict.messengernoads-beta Name: Messenger No Ads Beta Depends: mobilesubstrate, firmware (>= 10) Conflicts: com.haoict.messengernoads -Version: 3.0.0~b1 +Version: 3.0.0~b3 Architecture: iphoneos-arm Description: The best tweak for Messenger app. The best tweak for Messenger app. + * Tap on your profile picture on top right of the screen to access settings Features: - Hide Ads on Messenger app - - Disable Read Receipt (Support Control Center to quick turn on/off) + - Disable Read Receipt - Disable Typing Indicator - Disable Story Seen Receipt - Can Save Friend's Story diff --git a/release/com.haoict.messengernoads-beta_3.0.0~b1_iphoneos-arm.deb b/release/com.haoict.messengernoads-beta_3.0.0~b1_iphoneos-arm.deb deleted file mode 100644 index 48f898e..0000000 Binary files a/release/com.haoict.messengernoads-beta_3.0.0~b1_iphoneos-arm.deb and /dev/null differ diff --git a/release/com.haoict.messengernoads-beta_3.0.0~b3_iphoneos-arm.deb b/release/com.haoict.messengernoads-beta_3.0.0~b3_iphoneos-arm.deb new file mode 100644 index 0000000..f26432a Binary files /dev/null and b/release/com.haoict.messengernoads-beta_3.0.0~b3_iphoneos-arm.deb differ diff --git a/settingsview/MNASettingsViewController.m b/settingsview/MNASettingsViewController.m index 18152f0..bc46d20 100644 --- a/settingsview/MNASettingsViewController.m +++ b/settingsview/MNASettingsViewController.m @@ -1,6 +1,7 @@ #include "MNASettingsViewController.h" #define TABLE_BACKGROUND_COLOR "#EFEFF4" +#define TABLE_BACKGROUND_COLOR_DARKMODE "#000000" @implementation MNASettingsViewController - (id)init { @@ -43,11 +44,11 @@ - (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; // set switches color UIWindow *keyWindow = [UIApplication sharedApplication].keyWindow; - self.view.tintColor = kTintColor; - keyWindow.tintColor = kTintColor; - [UISwitch appearanceWhenContainedInInstancesOfClasses:@[self.class]].onTintColor = kTintColor; + self.view.tintColor = [MNAUtil colorFromHex:[MNAUtil isDarkMode] ? @KTINT_COLOR_DARKMODE : @KTINT_COLOR]; + keyWindow.tintColor = [MNAUtil colorFromHex:[MNAUtil isDarkMode] ? @KTINT_COLOR_DARKMODE : @KTINT_COLOR]; + [UISwitch appearanceWhenContainedInInstancesOfClasses:@[self.class]].onTintColor = [MNAUtil colorFromHex:[MNAUtil isDarkMode] ? @KTINT_COLOR_DARKMODE : @KTINT_COLOR]; // set navigation bar color - self.navigationController.navigationBar.barTintColor = kTintColor; + self.navigationController.navigationBar.barTintColor = [MNAUtil colorFromHex:[MNAUtil isDarkMode] ? @KTINT_COLOR_DARKMODE : @KTINT_COLOR]; self.navigationController.navigationBar.tintColor = [UIColor whiteColor]; [self.navigationController.navigationBar setShadowImage: [UIImage new]]; self.navigationController.navigationController.navigationBar.translucent = NO; @@ -59,7 +60,7 @@ - (void)viewWillAppear:(BOOL)animated { - (void)viewWillDisappear:(BOOL)animated { [super viewWillDisappear:animated]; UIWindow *keyWindow = [UIApplication sharedApplication].keyWindow; - keyWindow.tintColor = [UIColor blackColor]; // should be nil for default, but Messenger uses black + keyWindow.tintColor = [MNAUtil isDarkMode] ? [UIColor whiteColor] : [UIColor blackColor]; // should be nil for default, but Messenger uses black/white self.navigationController.navigationBar.barTintColor = nil; self.navigationController.navigationBar.tintColor = nil; [self.navigationController.navigationBar setShadowImage:nil]; @@ -81,7 +82,7 @@ - (void)viewDidLoad { _tableView.delegate = self; _tableView.dataSource = self; _tableView.alwaysBounceVertical = NO; - _tableView.backgroundColor = [MNAUtil colorFromHex:@TABLE_BACKGROUND_COLOR]; + _tableView.backgroundColor = [MNAUtil colorFromHex:[MNAUtil isDarkMode] ? @TABLE_BACKGROUND_COLOR_DARKMODE : @TABLE_BACKGROUND_COLOR]; [_tableView setSeparatorStyle:UITableViewCellSeparatorStyleNone]; [self.view addSubview:_tableView]; diff --git a/settingsview/MNATableViewCell.m b/settingsview/MNATableViewCell.m index 1e77e75..0a6209c 100644 --- a/settingsview/MNATableViewCell.m +++ b/settingsview/MNATableViewCell.m @@ -3,6 +3,13 @@ #define LABEL_COLOR "#333333" #define SUBTITLE_COLOR "#828282" #define STATIC_BACKGROUND_COLOR "#EFEFF4" +#define CELL_BACKGROUND_COLOR "#FFFFFF" + +#define LABEL_COLOR_DARKMODE "#F2F2F2" +#define SUBTITLE_COLOR_DARKMODE "#888888" +#define STATIC_BACKGROUND_COLOR_DARKMODE "#000000" +#define CELL_BACKGROUND_COLOR_DARKMODE "#1C1C1C" + #define STATIC_FONT_SIZE 13.0 @implementation MNATableViewCell @@ -14,10 +21,10 @@ - (id)initWithData:(MNACellModel *)cellData reuseIdentifier:(NSString *)reuseIde if (self) { self.textLabel.text = cellData.label; - self.textLabel.textColor = [MNAUtil colorFromHex:@LABEL_COLOR]; + self.textLabel.textColor = [MNAUtil colorFromHex:[MNAUtil isDarkMode] ? @LABEL_COLOR_DARKMODE : @LABEL_COLOR]; self.selectionStyle = UITableViewCellSelectionStyleNone; self.detailTextLabel.text = cellData.subtitle; - self.detailTextLabel.textColor = [MNAUtil colorFromHex:@SUBTITLE_COLOR]; + self.detailTextLabel.textColor = [MNAUtil colorFromHex:[MNAUtil isDarkMode] ? @SUBTITLE_COLOR_DARKMODE : @SUBTITLE_COLOR]; if (cellData.disabled) { self.userInteractionEnabled = NO; self.textLabel.enabled = NO; @@ -38,7 +45,7 @@ - (id)initWithData:(MNACellModel *)cellData reuseIdentifier:(NSString *)reuseIde case StaticText: { self.textLabel.font=[UIFont systemFontOfSize:STATIC_FONT_SIZE]; - self.contentView.backgroundColor = [MNAUtil colorFromHex:@STATIC_BACKGROUND_COLOR]; + self.contentView.backgroundColor = [MNAUtil colorFromHex:[MNAUtil isDarkMode] ? @STATIC_BACKGROUND_COLOR_DARKMODE : @STATIC_BACKGROUND_COLOR]; break; } @@ -64,23 +71,23 @@ - (void)prepareForReuse { - (void)setHighlighted:(BOOL)highlighted animated:(BOOL)animated { [super setHighlighted:highlighted animated:animated]; - if (self.selectionStyle != UITableViewCellSelectionStyleNone) { - if (highlighted) { - self.contentView.superview.backgroundColor = [kTintColor colorWithAlphaComponent:0.3]; - } else { - self.contentView.superview.backgroundColor = [UIColor whiteColor]; + if (highlighted) { + if (self.selectionStyle != UITableViewCellSelectionStyleNone) { + self.contentView.superview.backgroundColor = [[MNAUtil colorFromHex:@KTINT_COLOR] colorWithAlphaComponent:0.3]; } + } else { + self.contentView.superview.backgroundColor = [MNAUtil colorFromHex:[MNAUtil isDarkMode] ? @CELL_BACKGROUND_COLOR_DARKMODE : @CELL_BACKGROUND_COLOR]; } } - (void)setSelected:(BOOL)selected animated:(BOOL)animated { [super setSelected:selected animated:animated]; - if (self.selectionStyle != UITableViewCellSelectionStyleNone) { - if (selected) { - self.contentView.superview.backgroundColor = [kTintColor colorWithAlphaComponent:0.3]; - } else { - self.contentView.superview.backgroundColor = [UIColor whiteColor]; + if (selected) { + if (self.selectionStyle != UITableViewCellSelectionStyleNone) { + self.contentView.superview.backgroundColor = [[MNAUtil colorFromHex:@KTINT_COLOR] colorWithAlphaComponent:0.3]; } + } else { + self.contentView.superview.backgroundColor = [MNAUtil colorFromHex:[MNAUtil isDarkMode] ? @CELL_BACKGROUND_COLOR_DARKMODE : @CELL_BACKGROUND_COLOR]; } } @@ -125,10 +132,4 @@ - (void)loadSwitcher { switchView.enabled = NO; } } - -// - (void)resetSettings:(id)sender { -// [@{} writeToFile:@PLIST_PATH atomically:YES]; -// [self reloadSpecifiers]; -// notify_post(PREF_CHANGED_NOTIF); -// } @end \ No newline at end of file diff --git a/settingsview/MNAUtil.h b/settingsview/MNAUtil.h index e9a7245..86d3a9f 100644 --- a/settingsview/MNAUtil.h +++ b/settingsview/MNAUtil.h @@ -2,7 +2,8 @@ #define PREF_BUNDLE_PATH "/Library/Application Support/MessengerNoAds.bundle" #define PLIST_FILENAME "com.haoict.messengernoadspref.plist" #define PREF_CHANGED_NOTIF "com.haoict.messengernoadspref/PrefChanged" -#define kTintColor [UIColor colorWithRed:0.72 green:0.53 blue:1.00 alpha:1.00] +#define KTINT_COLOR "#B787FF" // [UIColor colorWithRed:0.72 green:0.53 blue:1.00 alpha:1.00] +#define KTINT_COLOR_DARKMODE "#B787FF" // don't know what looks good, better let it be the same with white mode @interface NSTask : NSObject @property (copy) NSArray *arguments; @@ -29,4 +30,6 @@ + (NSString *)localizedItem:(NSString *)key; + (UIColor *)colorFromHex:(NSString *)hexString; + (void)showAlertMessage:(NSString *)message title:(NSString *)title viewController:(id)vc; ++ (BOOL)isDarkMode; ++ (BOOL)isiPad; @end \ No newline at end of file diff --git a/settingsview/MNAUtil.m b/settingsview/MNAUtil.m index 05f6cc6..19ddd93 100644 --- a/settingsview/MNAUtil.m +++ b/settingsview/MNAUtil.m @@ -39,4 +39,19 @@ + (void)showAlertMessage:(NSString *)message title:(NSString *)title viewControl [vc presentViewController:alert animated:YES completion:nil]; } } + ++ (BOOL)isDarkMode { + if (@available(iOS 12.0, *)) { + if(UIScreen.mainScreen.traitCollection.userInterfaceStyle == UIUserInterfaceStyleDark){ + return TRUE; + }else{ + return FALSE; + } + } + return FALSE; +} + ++ (BOOL)isiPad { + return UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad; +} @end \ No newline at end of file