Custom message recalled background color

This commit is contained in:
Jeason Lee 2019-11-01 15:31:01 +08:00
parent 382aea6c7d
commit c2c2876bd4
17 changed files with 242 additions and 57 deletions

View File

@ -31,3 +31,6 @@
/* Class = "NSTextFieldCell"; title = "Alfred JSON compressing:"; ObjectID = "jHw-2a-B2t"; */
"jHw-2a-B2t.title" = "Alfred JSON compressing:";
/* Class = "NSTextFieldCell"; title = "Message recalled background color:"; ObjectID = "8uI-sB-Jzm"; */
"8uI-sB-Jzm.title" = "Message recalled background color:";

View File

@ -31,3 +31,6 @@
/* Class = "NSTextFieldCell"; title = "Alfred JSON compressing:"; ObjectID = "jHw-2a-B2t"; */
"jHw-2a-B2t.title" = "Alfred JSON 压缩:";
/* Class = "NSTextFieldCell"; title = "Message recalled background color:"; ObjectID = "8uI-sB-Jzm"; */
"8uI-sB-Jzm.title" = "消息撤回背景颜色:";

View File

@ -31,3 +31,6 @@
/* Class = "NSTextFieldCell"; title = "Alfred JSON compressing:"; ObjectID = "jHw-2a-B2t"; */
"jHw-2a-B2t.title" = "Alfred JSON 壓縮:";
/* Class = "NSTextFieldCell"; title = "Message recalled background color:"; ObjectID = "8uI-sB-Jzm"; */
"8uI-sB-Jzm.title" = "消息撤回背景顏色:";

View File

@ -27,6 +27,10 @@
7DF8425C1F4058DD00D42D79 /* NSBundle+WeChatTweak.m in Sources */ = {isa = PBXBuildFile; fileRef = 7DF842581F4058DD00D42D79 /* NSBundle+WeChatTweak.m */; };
7DF842601F40590500D42D79 /* WeChatTweakHeaders.h in Headers */ = {isa = PBXBuildFile; fileRef = 7DF8425F1F40590500D42D79 /* WeChatTweakHeaders.h */; };
7DF842651F40594400D42D79 /* Prefs-Tweak.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 7DF842641F40594400D42D79 /* Prefs-Tweak.tiff */; };
9CB3C3CB236BFE38002F060C /* TweakColorView.h in Headers */ = {isa = PBXBuildFile; fileRef = 9CB3C3C9236BFE38002F060C /* TweakColorView.h */; };
9CB3C3CC236BFE38002F060C /* TweakColorView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9CB3C3CA236BFE38002F060C /* TweakColorView.m */; };
9CB3C3CF236C131D002F060C /* NSColor+WeChatTweak.h in Headers */ = {isa = PBXBuildFile; fileRef = 9CB3C3CD236C131D002F060C /* NSColor+WeChatTweak.h */; };
9CB3C3D0236C131D002F060C /* NSColor+WeChatTweak.m in Sources */ = {isa = PBXBuildFile; fileRef = 9CB3C3CE236C131D002F060C /* NSColor+WeChatTweak.m */; };
D84599A16A2504BCF95DB436 /* libPods-WeChatTweak.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 153504EC5C9196C0D85213CF /* libPods-WeChatTweak.a */; };
/* End PBXBuildFile section */
@ -59,6 +63,10 @@
7DF842581F4058DD00D42D79 /* NSBundle+WeChatTweak.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSBundle+WeChatTweak.m"; sourceTree = "<group>"; };
7DF8425F1F40590500D42D79 /* WeChatTweakHeaders.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WeChatTweakHeaders.h; sourceTree = "<group>"; };
7DF842641F40594400D42D79 /* Prefs-Tweak.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = "Prefs-Tweak.tiff"; sourceTree = "<group>"; };
9CB3C3C9236BFE38002F060C /* TweakColorView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TweakColorView.h; sourceTree = "<group>"; };
9CB3C3CA236BFE38002F060C /* TweakColorView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = TweakColorView.m; sourceTree = "<group>"; };
9CB3C3CD236C131D002F060C /* NSColor+WeChatTweak.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "NSColor+WeChatTweak.h"; sourceTree = "<group>"; };
9CB3C3CE236C131D002F060C /* NSColor+WeChatTweak.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "NSColor+WeChatTweak.m"; sourceTree = "<group>"; };
A82E6F61C63DBD47219BB308 /* Pods-WeChatTweak.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-WeChatTweak.debug.xcconfig"; path = "Pods/Target Support Files/Pods-WeChatTweak/Pods-WeChatTweak.debug.xcconfig"; sourceTree = "<group>"; };
B418F83DA5D4A992F73514A9 /* Pods-WeChatTweak.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-WeChatTweak.release.xcconfig"; path = "Pods/Target Support Files/Pods-WeChatTweak/Pods-WeChatTweak.release.xcconfig"; sourceTree = "<group>"; };
/* End PBXFileReference section */
@ -113,6 +121,8 @@
7DF842581F4058DD00D42D79 /* NSBundle+WeChatTweak.m */,
7D9049F71F82B6FB004E6370 /* NSString+WeChatTweak.h */,
7D9049F81F82B6FB004E6370 /* NSString+WeChatTweak.m */,
9CB3C3CD236C131D002F060C /* NSColor+WeChatTweak.h */,
9CB3C3CE236C131D002F060C /* NSColor+WeChatTweak.m */,
);
path = Category;
sourceTree = "<group>";
@ -157,14 +167,15 @@
7DF842291F40583F00D42D79 /* WeChatTweak */ = {
isa = PBXGroup;
children = (
7DF8422A1F40583F00D42D79 /* WeChatTweak.h */,
7DF842331F4058AB00D42D79 /* WeChatTweak.m */,
7D5AAF3720DF4BB300860EEE /* Vendor */,
7D5AAF3620DF4BA400860EEE /* Category */,
7D5AAF3520DF4B9700860EEE /* Controller */,
7D5AAF3320DF4B7B00860EEE /* Manager */,
7DF842631F40594400D42D79 /* Resources */,
7D5AAF3820DF4BC400860EEE /* Supporting Files */,
7D5AAF3720DF4BB300860EEE /* Vendor */,
9CB3C3C8236BFE06002F060C /* View */,
7DF8422A1F40583F00D42D79 /* WeChatTweak.h */,
7DF842331F4058AB00D42D79 /* WeChatTweak.m */,
);
path = WeChatTweak;
sourceTree = "<group>";
@ -177,6 +188,15 @@
path = Resources;
sourceTree = "<group>";
};
9CB3C3C8236BFE06002F060C /* View */ = {
isa = PBXGroup;
children = (
9CB3C3C9236BFE38002F060C /* TweakColorView.h */,
9CB3C3CA236BFE38002F060C /* TweakColorView.m */,
);
path = View;
sourceTree = "<group>";
};
FEFA9C3F34481028661EEC5A /* Pods */ = {
isa = PBXGroup;
children = (
@ -197,10 +217,12 @@
7D9049FA1F82B708004E6370 /* NSString+WeChatTweak.h in Headers */,
7DF8422C1F40583F00D42D79 /* WeChatTweak.h in Headers */,
7DF8425B1F4058DD00D42D79 /* NSBundle+WeChatTweak.h in Headers */,
9CB3C3CB236BFE38002F060C /* TweakColorView.h in Headers */,
7DB8AFBE206211D900E683AE /* WTConfigManager.h in Headers */,
7D9049F61F82A41A004E6370 /* fishhook.h in Headers */,
7D14E5A41F6447DB00D75132 /* AlfredManager.h in Headers */,
7DF842601F40590500D42D79 /* WeChatTweakHeaders.h in Headers */,
9CB3C3CF236C131D002F060C /* NSColor+WeChatTweak.h in Headers */,
7DF842521F4058C600D42D79 /* TweakPreferencesController.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
@ -321,12 +343,14 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
9CB3C3CC236BFE38002F060C /* TweakColorView.m in Sources */,
7D14E5A51F6447DB00D75132 /* AlfredManager.m in Sources */,
7DF842531F4058C600D42D79 /* TweakPreferencesController.m in Sources */,
7D9049F91F82B6FB004E6370 /* NSString+WeChatTweak.m in Sources */,
7DBA4468231812AB004CE2DB /* RecallCacheManager.m in Sources */,
7DF842341F4058AB00D42D79 /* WeChatTweak.m in Sources */,
7DB8AFBF206211D900E683AE /* WTConfigManager.m in Sources */,
9CB3C3D0236C131D002F060C /* NSColor+WeChatTweak.m in Sources */,
7D9049F51F82A41A004E6370 /* fishhook.c in Sources */,
7DF8425C1F4058DD00D42D79 /* NSBundle+WeChatTweak.m in Sources */,
);

View File

@ -0,0 +1,21 @@
//
// NSColor+WeChatTweak.h
// WeChatTweak
//
// Created by Jeason Lee on 2019/11/1.
// Copyright © 2019 Sunnyyoung. All rights reserved.
//
#import <Cocoa/Cocoa.h>
NS_ASSUME_NONNULL_BEGIN
static NSString * const WeChatTweakPreferenceRevokeBackgroundColorKey = @"WeChatTweakPreferenceRevokeBackgroundColorKey";
@interface NSColor (WeChatTweak)
+ (NSColor *)tweak_revokeBackgroundColor;
@end
NS_ASSUME_NONNULL_END

View File

@ -0,0 +1,26 @@
//
// NSColor+WeChatTweak.m
// WeChatTweak
//
// Created by Jeason Lee on 2019/11/1.
// Copyright © 2019 Sunnyyoung. All rights reserved.
//
#import "NSColor+WeChatTweak.h"
@implementation NSColor (WeChatTweak)
+ (NSColor *)tweak_revokeBackgroundColor {
NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
NSData *colorData = [userDefaults objectForKey:WeChatTweakPreferenceRevokeBackgroundColorKey];
NSColor *color = [NSKeyedUnarchiver unarchiveObjectWithData:colorData];
if(![color isKindOfClass:[NSColor class]]){
color = [NSColor colorWithRed:250/255.0 green:250/255.0 blue:205/255.0 alpha:1];
NSData *colorData = [NSKeyedArchiver archivedDataWithRootObject:color];
[userDefaults setObject:colorData forKey:WeChatTweakPreferenceRevokeBackgroundColorKey];
[userDefaults synchronize];
}
return color;
}
@end

View File

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="14490.70" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="14868" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14490.70"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14868"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
@ -11,33 +11,18 @@
<outlet property="autoAuthButton" destination="5by-EJ-3f2" id="VIV-sZ-ybx"/>
<outlet property="compressedJSONEnabledButton" destination="ylY-lF-oFq" id="yqW-Bl-hNf"/>
<outlet property="notificationTypeButton" destination="6x2-KV-p8w" id="Kfn-2a-Yup"/>
<outlet property="recallColorView" destination="dkE-Ks-I5o" id="HIe-Sz-AOd"/>
<outlet property="view" destination="Hz6-mo-xeY" id="0bl-1N-x8E"/>
</connections>
</customObject>
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<customView id="Hz6-mo-xeY">
<rect key="frame" x="0.0" y="0.0" width="430" height="123"/>
<rect key="frame" x="0.0" y="0.0" width="480" height="140"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<subviews>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="RFE-oR-GRm">
<rect key="frame" x="58" y="86" width="138" height="17"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" refusesFirstResponder="YES" sendsActionOnEndEditing="YES" alignment="right" title="Auto login:" usesSingleLineMode="YES" id="UiV-zj-l6I">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="B87-eD-uhI">
<rect key="frame" x="10" y="53" width="186" height="17"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" refusesFirstResponder="YES" sendsActionOnEndEditing="YES" alignment="right" title="Message recalled notification:" usesSingleLineMode="YES" id="UKv-CM-nGt">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<popUpButton verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="5by-EJ-3f2">
<rect key="frame" x="200" y="81" width="91" height="25"/>
<rect key="frame" x="278" y="99" width="91" height="25"/>
<popUpButtonCell key="cell" type="push" title="Disabled" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" state="on" borderStyle="borderAndBezel" imageScaling="axesIndependently" inset="2" selectedItem="Vcv-eD-OM9" id="8qB-Jj-tlv">
<behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="menu"/>
@ -57,7 +42,7 @@
</connections>
</popUpButton>
<popUpButton verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="6x2-KV-p8w">
<rect key="frame" x="200" y="48" width="92" height="25"/>
<rect key="frame" x="278" y="71" width="92" height="25"/>
<popUpButtonCell key="cell" type="push" title="Inherited" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" state="on" borderStyle="borderAndBezel" imageScaling="axesIndependently" inset="2" selectedItem="gec-CY-E1x" id="wek-GT-N5V">
<behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="menu"/>
@ -79,16 +64,65 @@
<action selector="switchNotificationTypeAction:" target="-2" id="xjO-Ck-wem"/>
</connections>
</popUpButton>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="zsd-Bb-6l4">
<rect key="frame" x="32" y="20" width="164" height="17"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" refusesFirstResponder="YES" sendsActionOnEndEditing="YES" alignment="right" title="Alfred JSON compressing:" usesSingleLineMode="YES" id="jHw-2a-B2t">
<stackView distribution="fillEqually" orientation="vertical" alignment="trailing" spacing="12" horizontalStackHuggingPriority="249.99998474121094" verticalStackHuggingPriority="249.99998474121094" detachesHiddenViews="YES" translatesAutoresizingMaskIntoConstraints="NO" id="ChT-5e-8lm">
<rect key="frame" x="50" y="20" width="220" height="100"/>
<subviews>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="RFE-oR-GRm">
<rect key="frame" x="153" y="84" width="69" height="16"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" refusesFirstResponder="YES" sendsActionOnEndEditing="YES" alignment="right" title="Auto login:" usesSingleLineMode="YES" id="UiV-zj-l6I">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="B87-eD-uhI">
<rect key="frame" x="36" y="56" width="186" height="16"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" refusesFirstResponder="YES" sendsActionOnEndEditing="YES" alignment="right" title="Message recalled notification:" usesSingleLineMode="YES" id="UKv-CM-nGt">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="eOf-Ts-pZk">
<rect key="frame" x="-2" y="28" width="224" height="16"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" refusesFirstResponder="YES" sendsActionOnEndEditing="YES" alignment="right" title="Message recalled background color:" usesSingleLineMode="YES" id="8uI-sB-Jzm">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="zsd-Bb-6l4">
<rect key="frame" x="58" y="0.0" width="164" height="16"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" refusesFirstResponder="YES" sendsActionOnEndEditing="YES" alignment="right" title="Alfred JSON compressing:" usesSingleLineMode="YES" id="jHw-2a-B2t">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
</subviews>
<visibilityPriorities>
<integer value="1000"/>
<integer value="1000"/>
<integer value="1000"/>
<integer value="1000"/>
</visibilityPriorities>
<customSpacing>
<real value="3.4028234663852886e+38"/>
<real value="3.4028234663852886e+38"/>
<real value="3.4028234663852886e+38"/>
<real value="3.4028234663852886e+38"/>
</customSpacing>
</stackView>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="kNm-y0-HmG">
<rect key="frame" x="374" y="20" width="96" height="16"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" refusesFirstResponder="YES" sendsActionOnEndEditing="YES" title="Need to restart" usesSingleLineMode="YES" id="2vl-mc-m3L">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="textColor" name="disabledControlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<popUpButton verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="ylY-lF-oFq">
<rect key="frame" x="200" y="15" width="91" height="25"/>
<rect key="frame" x="278" y="15" width="91" height="25"/>
<popUpButtonCell key="cell" type="push" title="Disabled" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" state="on" borderStyle="borderAndBezel" imageScaling="axesIndependently" inset="2" selectedItem="MEN-Kg-wfj" id="taL-8q-Quu">
<behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="menu"/>
@ -107,35 +141,29 @@
<action selector="switchCompressedJSONEnabledAction:" target="-2" id="HLt-oc-7An"/>
</connections>
</popUpButton>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="kNm-y0-HmG">
<rect key="frame" x="296" y="20" width="96" height="17"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" refusesFirstResponder="YES" sendsActionOnEndEditing="YES" title="Need to restart" usesSingleLineMode="YES" id="2vl-mc-m3L">
<font key="font" metaFont="system"/>
<color key="textColor" name="disabledControlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<customView translatesAutoresizingMaskIntoConstraints="NO" id="dkE-Ks-I5o" customClass="TweakColorView">
<rect key="frame" x="280" y="46" width="50" height="20"/>
<constraints>
<constraint firstAttribute="height" constant="20" id="3qv-Ln-g0w"/>
<constraint firstAttribute="width" constant="50" id="Mh6-Tw-cUb"/>
</constraints>
</customView>
</subviews>
<constraints>
<constraint firstItem="B87-eD-uhI" firstAttribute="trailing" secondItem="RFE-oR-GRm" secondAttribute="trailing" id="3p1-WF-TYr"/>
<constraint firstItem="zsd-Bb-6l4" firstAttribute="top" secondItem="B87-eD-uhI" secondAttribute="bottom" constant="16" id="62W-9V-E2u"/>
<constraint firstItem="RFE-oR-GRm" firstAttribute="top" secondItem="Hz6-mo-xeY" secondAttribute="top" constant="20" id="CWK-cO-DBz"/>
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="5by-EJ-3f2" secondAttribute="trailing" constant="12" id="KRA-o3-Ab4"/>
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="kNm-y0-HmG" secondAttribute="trailing" constant="12" id="Le8-Ns-wyj"/>
<constraint firstItem="5by-EJ-3f2" firstAttribute="centerY" secondItem="RFE-oR-GRm" secondAttribute="centerY" id="QLN-KI-HUD"/>
<constraint firstItem="RFE-oR-GRm" firstAttribute="leading" secondItem="Hz6-mo-xeY" secondAttribute="leading" constant="60" id="R8y-0p-4Sk"/>
<constraint firstItem="B87-eD-uhI" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="Hz6-mo-xeY" secondAttribute="leading" constant="12" id="TgK-yZ-mK1"/>
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="6x2-KV-p8w" secondAttribute="trailing" constant="12" id="VbQ-1W-cmx"/>
<constraint firstItem="6x2-KV-p8w" firstAttribute="leading" secondItem="5by-EJ-3f2" secondAttribute="leading" id="WSG-53-r8r"/>
<constraint firstItem="zsd-Bb-6l4" firstAttribute="trailing" secondItem="RFE-oR-GRm" secondAttribute="trailing" id="Wlh-6X-UJN"/>
<constraint firstItem="kNm-y0-HmG" firstAttribute="centerY" secondItem="ylY-lF-oFq" secondAttribute="centerY" id="eMk-RJ-Mbw"/>
<constraint firstItem="6x2-KV-p8w" firstAttribute="centerY" secondItem="B87-eD-uhI" secondAttribute="centerY" id="gqp-om-e0O"/>
<constraint firstItem="ylY-lF-oFq" firstAttribute="centerY" secondItem="zsd-Bb-6l4" secondAttribute="centerY" id="h7g-u6-ZwV"/>
<constraint firstItem="zsd-Bb-6l4" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="Hz6-mo-xeY" secondAttribute="leading" constant="12" id="icK-YZ-ZLo"/>
<constraint firstItem="B87-eD-uhI" firstAttribute="top" secondItem="RFE-oR-GRm" secondAttribute="bottom" constant="16" id="lG1-vw-epo"/>
<constraint firstItem="kNm-y0-HmG" firstAttribute="leading" secondItem="ylY-lF-oFq" secondAttribute="trailing" constant="10" id="urr-9v-Okd"/>
<constraint firstItem="5by-EJ-3f2" firstAttribute="leading" secondItem="RFE-oR-GRm" secondAttribute="trailing" constant="8" id="v9V-TW-Voc"/>
<constraint firstItem="ylY-lF-oFq" firstAttribute="leading" secondItem="5by-EJ-3f2" secondAttribute="leading" id="wQB-cU-fmf"/>
<constraint firstItem="dkE-Ks-I5o" firstAttribute="leading" secondItem="6x2-KV-p8w" secondAttribute="leading" id="0D5-BC-meJ"/>
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="kNm-y0-HmG" secondAttribute="trailing" constant="12" id="1wx-JF-wqN"/>
<constraint firstAttribute="bottom" secondItem="ChT-5e-8lm" secondAttribute="bottom" constant="20" id="HaO-CB-AZT"/>
<constraint firstItem="5by-EJ-3f2" firstAttribute="centerY" secondItem="RFE-oR-GRm" secondAttribute="centerY" id="J0G-jo-ZDH"/>
<constraint firstItem="5by-EJ-3f2" firstAttribute="leading" secondItem="ChT-5e-8lm" secondAttribute="trailing" constant="10" id="LRm-RB-MSA"/>
<constraint firstItem="kNm-y0-HmG" firstAttribute="leading" secondItem="ylY-lF-oFq" secondAttribute="trailing" constant="10" id="Wb3-NG-vyn"/>
<constraint firstItem="ylY-lF-oFq" firstAttribute="centerY" secondItem="zsd-Bb-6l4" secondAttribute="centerY" id="dN4-ow-sAV"/>
<constraint firstItem="ylY-lF-oFq" firstAttribute="leading" secondItem="dkE-Ks-I5o" secondAttribute="leading" id="i6R-3k-JnB"/>
<constraint firstItem="ChT-5e-8lm" firstAttribute="top" secondItem="Hz6-mo-xeY" secondAttribute="top" constant="20" id="m4w-Ya-3LB"/>
<constraint firstItem="6x2-KV-p8w" firstAttribute="centerY" secondItem="B87-eD-uhI" secondAttribute="centerY" id="nYC-u6-mfD"/>
<constraint firstItem="6x2-KV-p8w" firstAttribute="leading" secondItem="5by-EJ-3f2" secondAttribute="leading" id="r01-5M-8C4"/>
<constraint firstItem="dkE-Ks-I5o" firstAttribute="centerY" secondItem="eOf-Ts-pZk" secondAttribute="centerY" id="s5x-XK-Hg2"/>
<constraint firstItem="ChT-5e-8lm" firstAttribute="leading" secondItem="Hz6-mo-xeY" secondAttribute="leading" constant="50" id="uaZ-h8-DHG"/>
<constraint firstItem="kNm-y0-HmG" firstAttribute="centerY" secondItem="ylY-lF-oFq" secondAttribute="centerY" id="wm4-bT-e48"/>
</constraints>
<point key="canvasLocation" x="139" y="179.5"/>
</customView>

View File

@ -7,6 +7,7 @@
//
#import "WeChatTweakHeaders.h"
#import "NSColor+WeChatTweak.h"
typedef NS_ENUM(NSUInteger, RevokeNotificationType) {
RevokeNotificationTypeFollow = 0,

View File

@ -9,12 +9,14 @@
#import "TweakPreferencesController.h"
#import "NSBundle+WeChatTweak.h"
#import "WTConfigManager.h"
#import "TweakColorView.h"
@interface TweakPreferencesController () <MASPreferencesViewController>
@property (weak) IBOutlet NSPopUpButton *autoAuthButton;
@property (weak) IBOutlet NSPopUpButton *notificationTypeButton;
@property (weak) IBOutlet NSPopUpButton *compressedJSONEnabledButton;
@property (weak) IBOutlet TweakColorView *recallColorView;
@end
@ -22,6 +24,9 @@
- (void)viewDidLoad {
[super viewDidLoad];
NSClickGestureRecognizer *click = [[NSClickGestureRecognizer alloc] initWithTarget:self action:@selector(recallColorAction:)];
[self.recallColorView addGestureRecognizer:click];
self.recallColorView.backgroundColor = [NSColor tweak_revokeBackgroundColor];
}
- (void)viewWillAppear {
@ -57,6 +62,24 @@
WTConfigManager.sharedInstance.compressedJSONEnabled = enabled;
}
- (void)recallColorAction:(id)sender {
NSColorPanel *colorPanel = [NSColorPanel sharedColorPanel];
colorPanel.mode = NSColorPanelModeRGB;
[colorPanel setAction:@selector(changeColorAction:)];
[colorPanel setTarget:self];
[colorPanel orderFront:nil];
colorPanel.color = self.recallColorView.backgroundColor;
}
- (void)changeColorAction:(NSColorPanel *)sender {
NSColor *color = sender.color;
self.recallColorView.backgroundColor = color;
NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
NSData *colorData = [NSKeyedArchiver archivedDataWithRootObject:color];
[userDefaults setObject:colorData forKey:WeChatTweakPreferenceRevokeBackgroundColorKey];
[userDefaults synchronize];
}
#pragma mark - MASPreferencesViewController
- (NSString *)identifier {

View File

@ -31,3 +31,6 @@
/* Class = "NSTextFieldCell"; title = "Alfred JSON compressing:"; ObjectID = "jHw-2a-B2t"; */
"jHw-2a-B2t.title" = "Alfred JSON compressing:";
/* Class = "NSTextFieldCell"; title = "Message recalled background color:"; ObjectID = "8uI-sB-Jzm"; */
"8uI-sB-Jzm.title" = "Message recalled background color:";

View File

@ -31,3 +31,6 @@
/* Class = "NSTextFieldCell"; title = "Alfred JSON compressing:"; ObjectID = "jHw-2a-B2t"; */
"jHw-2a-B2t.title" = "Alfred JSON 压缩:";
/* Class = "NSTextFieldCell"; title = "Message recalled background color:"; ObjectID = "8uI-sB-Jzm"; */
"8uI-sB-Jzm.title" = "消息撤回背景颜色:";

View File

@ -31,3 +31,6 @@
/* Class = "NSTextFieldCell"; title = "Alfred JSON compressing:"; ObjectID = "jHw-2a-B2t"; */
"jHw-2a-B2t.title" = "Alfred JSON 壓縮:";
/* Class = "NSTextFieldCell"; title = "Message recalled background color:"; ObjectID = "8uI-sB-Jzm"; */
"8uI-sB-Jzm.title" = "消息撤回背景顏色:";

View File

@ -0,0 +1,19 @@
//
// TweakColorView.h
// WeChatTweak
//
// Created by Jeason Lee on 2019/11/1.
// Copyright © 2019 Sunnyyoung. All rights reserved.
//
#import <Cocoa/Cocoa.h>
NS_ASSUME_NONNULL_BEGIN
@interface TweakColorView : NSView
@property (nonatomic, strong) NSColor *backgroundColor;
@end
NS_ASSUME_NONNULL_END

View File

@ -0,0 +1,24 @@
//
// TweakColorView.m
// WeChatTweak
//
// Created by Jeason Lee on 2019/11/1.
// Copyright © 2019 Sunnyyoung. All rights reserved.
//
#import "TweakColorView.h"
@implementation TweakColorView
- (void)mouseDown:(NSEvent *)event {
[NSColorPanel dragColor:self.backgroundColor withEvent:event fromView:self];
}
- (void)setBackgroundColor:(NSColor *)backgroundColor {
_backgroundColor = backgroundColor;
dispatch_async(dispatch_get_main_queue(), ^{
self.layer.backgroundColor = backgroundColor.CGColor;
});
}
@end

View File

@ -108,7 +108,8 @@ static void __attribute__((constructor)) tweak(void) {
*stop = YES;
view.hidden = !style;
}];
((MMMessageCellView *)self).layer.backgroundColor = style ? [NSColor.yellowColor colorWithAlphaComponent:0.3].CGColor : ((MMMessageCellView *)self).layer.backgroundColor;
NSColor *color = [NSColor tweak_revokeBackgroundColor];
((MMMessageCellView *)self).layer.backgroundColor = style ? color.CGColor : ((MMMessageCellView *)self).layer.backgroundColor;
}
- (void)tweak_layout {