diff --git a/CHANGELOG.md b/CHANGELOG.md
index a2224398..fb95d1e6 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,13 @@
# 更新日志
+### [v1.5.0 (2018-02-24)](https://github.com/TKkk-iOSer/WeChatPlugin-MacOS/releases/tag/v1.5.0)
+
+* 优化防撤回提醒
+* 新增自动登录开关
+* 新增小助手检测更新
+* 新增通知中心快捷回复
+* 新增表情包复制 & 存储
+* 自动回复 & 远程控制设置存储到本地
### [v1.4.0 (2017-10-11)](https://github.com/TKkk-iOSer/WeChatPlugin-MacOS/releases/tag/v1.4.0)
diff --git a/Other/Products/Debug/WeChatPlugin.framework/Resources/Info.plist b/Other/Products/Debug/WeChatPlugin.framework/Resources/Info.plist
index 1953c6c7..ec02ed9c 100644
--- a/Other/Products/Debug/WeChatPlugin.framework/Resources/Info.plist
+++ b/Other/Products/Debug/WeChatPlugin.framework/Resources/Info.plist
@@ -17,7 +17,7 @@
CFBundlePackageType
FMWK
CFBundleShortVersionString
- 1.0
+ 1.5.0
CFBundleSupportedPlatforms
MacOSX
@@ -40,5 +40,7 @@
9C40b
NSHumanReadableCopyright
Copyright © 2017年 tk. All rights reserved.
+ versionInfo
+ 👉 优化防撤回提醒。 \n👉🏻 新增自动登录开关。 \n👉🏼 新增小助手检测更新。 \n👉🏽 新增通知中心快捷回复。\n👉🏾 新增表情包复制 & 存储。\n👉🏿 自动回复 & 远程控制设置存储到本地。\n\n
diff --git a/Other/Products/Debug/WeChatPlugin.framework/Versions/A/Resources/Info.plist b/Other/Products/Debug/WeChatPlugin.framework/Versions/A/Resources/Info.plist
index 1953c6c7..ec02ed9c 100644
--- a/Other/Products/Debug/WeChatPlugin.framework/Versions/A/Resources/Info.plist
+++ b/Other/Products/Debug/WeChatPlugin.framework/Versions/A/Resources/Info.plist
@@ -17,7 +17,7 @@
CFBundlePackageType
FMWK
CFBundleShortVersionString
- 1.0
+ 1.5.0
CFBundleSupportedPlatforms
MacOSX
@@ -40,5 +40,7 @@
9C40b
NSHumanReadableCopyright
Copyright © 2017年 tk. All rights reserved.
+ versionInfo
+ 👉 优化防撤回提醒。 \n👉🏻 新增自动登录开关。 \n👉🏼 新增小助手检测更新。 \n👉🏽 新增通知中心快捷回复。\n👉🏾 新增表情包复制 & 存储。\n👉🏿 自动回复 & 远程控制设置存储到本地。\n\n
diff --git a/Other/Products/Debug/WeChatPlugin.framework/Versions/A/WeChatPlugin b/Other/Products/Debug/WeChatPlugin.framework/Versions/A/WeChatPlugin
index f8fc0c46..99a50eaf 100755
Binary files a/Other/Products/Debug/WeChatPlugin.framework/Versions/A/WeChatPlugin and b/Other/Products/Debug/WeChatPlugin.framework/Versions/A/WeChatPlugin differ
diff --git a/Other/Products/Debug/WeChatPlugin.framework/Versions/Current/Resources/Info.plist b/Other/Products/Debug/WeChatPlugin.framework/Versions/Current/Resources/Info.plist
index 1953c6c7..ec02ed9c 100644
--- a/Other/Products/Debug/WeChatPlugin.framework/Versions/Current/Resources/Info.plist
+++ b/Other/Products/Debug/WeChatPlugin.framework/Versions/Current/Resources/Info.plist
@@ -17,7 +17,7 @@
CFBundlePackageType
FMWK
CFBundleShortVersionString
- 1.0
+ 1.5.0
CFBundleSupportedPlatforms
MacOSX
@@ -40,5 +40,7 @@
9C40b
NSHumanReadableCopyright
Copyright © 2017年 tk. All rights reserved.
+ versionInfo
+ 👉 优化防撤回提醒。 \n👉🏻 新增自动登录开关。 \n👉🏼 新增小助手检测更新。 \n👉🏽 新增通知中心快捷回复。\n👉🏾 新增表情包复制 & 存储。\n👉🏿 自动回复 & 远程控制设置存储到本地。\n\n
diff --git a/Other/Products/Debug/WeChatPlugin.framework/Versions/Current/WeChatPlugin b/Other/Products/Debug/WeChatPlugin.framework/Versions/Current/WeChatPlugin
index f8fc0c46..99a50eaf 100755
Binary files a/Other/Products/Debug/WeChatPlugin.framework/Versions/Current/WeChatPlugin and b/Other/Products/Debug/WeChatPlugin.framework/Versions/Current/WeChatPlugin differ
diff --git a/Other/Products/Debug/WeChatPlugin.framework/WeChatPlugin b/Other/Products/Debug/WeChatPlugin.framework/WeChatPlugin
index f8fc0c46..99a50eaf 100755
Binary files a/Other/Products/Debug/WeChatPlugin.framework/WeChatPlugin and b/Other/Products/Debug/WeChatPlugin.framework/WeChatPlugin differ
diff --git a/Other/ScreenShots/emotion_copy_export.png b/Other/ScreenShots/emotion_copy_export.png
new file mode 100644
index 00000000..21851dc9
Binary files /dev/null and b/Other/ScreenShots/emotion_copy_export.png differ
diff --git a/Other/ScreenShots/wechatplugin.png b/Other/ScreenShots/wechatplugin.png
new file mode 100644
index 00000000..8a878740
Binary files /dev/null and b/Other/ScreenShots/wechatplugin.png differ
diff --git a/README.md b/README.md
index 7ed07d79..59029b84 100644
--- a/README.md
+++ b/README.md
@@ -1,11 +1,9 @@
## WeChatPlugin-MacOS
-![](https://img.shields.io/badge/platform-osx-lightgrey.svg) ![](https://img.shields.io/badge/support-wechat%202.2.8-green.svg)
-
-微信小助手 v1.4.0
+微信小助手 v1.5.0
-![微信小助手.png](http://upload-images.jianshu.io/upload_images/965383-31708af611b55ca4.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
+![微信小助手.png](./Other/ScreenShots/wechatplugin.png)
**iOS版本请戳→_→ [WeChatPlugin-iOS](https://github.com/TKkk-iOSer/WeChatPlugin-iOS)**
@@ -15,6 +13,8 @@
### 更新日志
+[新增小助手检测更新&表情包复制存储等等 (2018-02-24)](https://github.com/TKkk-iOSer/WeChatPlugin-MacOS/releases/tag/v1.5.0)
+
[新增窗口置顶&多选删除等等 (2017-10-11)](https://github.com/TKkk-iOSer/WeChatPlugin-MacOS/releases/tag/v1.4.0)
[新增置底&免认证 (2017-09-17)](https://github.com/TKkk-iOSer/WeChatPlugin-MacOS/releases/tag/v1.3.0)
@@ -38,6 +38,8 @@
* 会话多选删除
* 自动登录开关
* 通知中心快捷回复
+* 聊天窗口表情包复制 & 存储
+* 小助手检测更新提醒
远程控制:
@@ -86,6 +88,9 @@
* 通知中心快捷回复
![快捷回复](./Other/ScreenShots/notification_quick_reply.gif)
+* 聊天窗口表情复制 & 存储
+![表情复制存储](./Other/ScreenShots/emotion_copy_export.png)
+
---
### 安装
diff --git a/WeChatPlugin.xcodeproj/project.pbxproj b/WeChatPlugin.xcodeproj/project.pbxproj
index 65e45b4e..3d2bf4bf 100644
--- a/WeChatPlugin.xcodeproj/project.pbxproj
+++ b/WeChatPlugin.xcodeproj/project.pbxproj
@@ -15,6 +15,8 @@
522547E11F4C312A00226A2A /* TKRemoteControlWindowController.h in Headers */ = {isa = PBXBuildFile; fileRef = 522547DB1F4C312A00226A2A /* TKRemoteControlWindowController.h */; };
522547E21F4C312A00226A2A /* TKRemoteControlWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 522547DC1F4C312A00226A2A /* TKRemoteControlWindowController.m */; };
522547E31F4C312A00226A2A /* TKRemoteControlWindowController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 522547DD1F4C312A00226A2A /* TKRemoteControlWindowController.xib */; };
+ 5226D5CA2040FC3E0013C048 /* TKVersionManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 5226D5C82040FC3E0013C048 /* TKVersionManager.h */; };
+ 5226D5CB2040FC3E0013C048 /* TKVersionManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 5226D5C92040FC3E0013C048 /* TKVersionManager.m */; };
5228EABA1F70B59500D808CF /* NSButton+Action.h in Headers */ = {isa = PBXBuildFile; fileRef = 5228EAB81F70B59500D808CF /* NSButton+Action.h */; };
5228EABB1F70B59500D808CF /* NSButton+Action.m in Sources */ = {isa = PBXBuildFile; fileRef = 5228EAB91F70B59500D808CF /* NSButton+Action.m */; };
523848AB1F70E73500771BA3 /* NSTextField+Action.h in Headers */ = {isa = PBXBuildFile; fileRef = 523848A91F70E73500771BA3 /* NSTextField+Action.h */; };
@@ -66,6 +68,8 @@
522547DB1F4C312A00226A2A /* TKRemoteControlWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TKRemoteControlWindowController.h; sourceTree = ""; };
522547DC1F4C312A00226A2A /* TKRemoteControlWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TKRemoteControlWindowController.m; sourceTree = ""; };
522547DD1F4C312A00226A2A /* TKRemoteControlWindowController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = TKRemoteControlWindowController.xib; sourceTree = ""; };
+ 5226D5C82040FC3E0013C048 /* TKVersionManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TKVersionManager.h; sourceTree = ""; };
+ 5226D5C92040FC3E0013C048 /* TKVersionManager.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = TKVersionManager.m; sourceTree = ""; };
5228EAB81F70B59500D808CF /* NSButton+Action.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSButton+Action.h"; sourceTree = ""; };
5228EAB91F70B59500D808CF /* NSButton+Action.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSButton+Action.m"; sourceTree = ""; };
523848A91F70E73500771BA3 /* NSTextField+Action.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSTextField+Action.h"; sourceTree = ""; };
@@ -307,6 +311,8 @@
52B5CF031F3B4631000D9DD9 /* TKHelper.m */,
52B5CF041F3B4631000D9DD9 /* XMLReader.h */,
52B5CF051F3B4631000D9DD9 /* XMLReader.m */,
+ 5226D5C82040FC3E0013C048 /* TKVersionManager.h */,
+ 5226D5C92040FC3E0013C048 /* TKVersionManager.m */,
);
path = Utils;
sourceTree = "";
@@ -352,6 +358,7 @@
52475C321F6BA43800760E3E /* TKIgnoreSessonModel.h in Headers */,
526F4D8D1F4AAC3800E46004 /* TKRemoteControlCell.h in Headers */,
52B5CF181F3B4631000D9DD9 /* TKRemoteControlModel.h in Headers */,
+ 5226D5CA2040FC3E0013C048 /* TKVersionManager.h in Headers */,
522547CF1F4AE5A700226A2A /* NSView+Action.h in Headers */,
526F4D911F4AAE6F00E46004 /* TKAutoReplyCell.h in Headers */,
52475C2E1F6B993E00760E3E /* MMChatsTableCellView+hook.h in Headers */,
@@ -466,6 +473,7 @@
526F4D841F4AAC1900E46004 /* TKAutoReplyModel.m in Sources */,
526F4D8C1F4AAC3800E46004 /* TKAutoReplyContentView.m in Sources */,
522547DF1F4C312A00226A2A /* TKAutoReplyWindowController.m in Sources */,
+ 5226D5CB2040FC3E0013C048 /* TKVersionManager.m in Sources */,
52B5CF191F3B4631000D9DD9 /* TKRemoteControlModel.m in Sources */,
5228EABB1F70B59500D808CF /* NSButton+Action.m in Sources */,
52EE9515203FE58500B76873 /* MMStickerMessageCellView+hook.m in Sources */,
diff --git a/WeChatPlugin.xcodeproj/project.xcworkspace/xcuserdata/TK.xcuserdatad/UserInterfaceState.xcuserstate b/WeChatPlugin.xcodeproj/project.xcworkspace/xcuserdata/TK.xcuserdatad/UserInterfaceState.xcuserstate
index e7926d3d..7477f8b8 100644
Binary files a/WeChatPlugin.xcodeproj/project.xcworkspace/xcuserdata/TK.xcuserdatad/UserInterfaceState.xcuserstate and b/WeChatPlugin.xcodeproj/project.xcworkspace/xcuserdata/TK.xcuserdatad/UserInterfaceState.xcuserstate differ
diff --git a/WeChatPlugin/Info.plist b/WeChatPlugin/Info.plist
index 1ff89961..bd7f2a62 100644
--- a/WeChatPlugin/Info.plist
+++ b/WeChatPlugin/Info.plist
@@ -15,12 +15,14 @@
CFBundlePackageType
FMWK
CFBundleShortVersionString
- 1.0
+ 1.5.0
CFBundleVersion
$(CURRENT_PROJECT_VERSION)
NSHumanReadableCopyright
Copyright © 2017年 tk. All rights reserved.
NSPrincipalClass
+ versionInfo
+ 👉 优化防撤回提醒。 \n👉🏻 新增自动登录开关。 \n👉🏼 新增小助手检测更新。 \n👉🏽 新增通知中心快捷回复。\n👉🏾 新增表情包复制 & 存储。\n👉🏿 自动回复 & 远程控制设置存储到本地。\n\n
diff --git a/WeChatPlugin/Sources/Category/WeChat+hook.m b/WeChatPlugin/Sources/Category/WeChat+hook.m
index 37dbd0bc..2a77264c 100644
--- a/WeChatPlugin/Sources/Category/WeChat+hook.m
+++ b/WeChatPlugin/Sources/Category/WeChat+hook.m
@@ -14,6 +14,7 @@
#import "TKRemoteControlWindowController.h"
#import "TKIgnoreSessonModel.h"
#import "fishhook.h"
+#import "TKVersionManager.h"
static char tkAutoReplyWindowControllerKey; // 自动回复窗口的关联 key
static char tkRemoteControlWindowControllerKey; // 远程控制窗口的关联 key
@@ -46,6 +47,7 @@ + (void)hookWeChat {
}, 2);
[self setup];
+ [self checkPluginVersion];
}
+ (void)setup {
@@ -58,6 +60,30 @@ + (void)setup {
});
}
++ (void)checkPluginVersion {
+ if ([[TKWeChatPluginConfig sharedConfig] forbidCheckVersion]) return;
+
+ [[TKVersionManager shareManager] checkVersionFinish:^(TKVersionStatus status, NSString *message) {
+ if (status == TKVersionStatusNew) {
+ dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
+ NSAlert *alert = [[NSAlert alloc] init];
+ [alert addButtonWithTitle:@"前往Github"];
+ [alert addButtonWithTitle:@"不再提示"];
+ [alert addButtonWithTitle:@"取消"];
+ [alert setMessageText:@"检测到新版本!主要内容:👇"];
+ [alert setInformativeText:message];
+ NSModalResponse respose = [alert runModal];
+ if (respose == NSAlertFirstButtonReturn) {
+ NSURL *url = [NSURL URLWithString:@"https://github.com/TKkk-iOSer/WeChatPlugin-MacOS"];
+ [[NSWorkspace sharedWorkspace] openURL:url];
+ } else if (respose == NSAlertSecondButtonReturn) {
+ [[TKWeChatPluginConfig sharedConfig] setForbidCheckVersion:YES];
+ }
+ });
+ }
+ }];
+}
+
/**
菜单栏添加 menuItem
*/
@@ -77,6 +103,8 @@ + (void)addAssistantMenuItem {
// 免认证登录
NSMenuItem *autoAuthItem = [[NSMenuItem alloc] initWithTitle:@"免认证登录" action:@selector(onAutoAuthControl:) keyEquivalent:@"M"];
autoAuthItem.state = [[TKWeChatPluginConfig sharedConfig] autoAuthEnable];
+ // 更新小助手
+ NSMenuItem *updatePluginItem = [[NSMenuItem alloc] initWithTitle:@"更新小助手…" action:@selector(onUpdatePluginControl:) keyEquivalent:@""];
NSMenu *subMenu = [[NSMenu alloc] initWithTitle:@"微信小助手"];
[subMenu addItem:preventRevokeItem];
@@ -85,6 +113,7 @@ + (void)addAssistantMenuItem {
[subMenu addItem:newWeChatItem];
[subMenu addItem:onTopItem];
[subMenu addItem:autoAuthItem];
+ [subMenu addItem:updatePluginItem];
NSMenuItem *menuItem = [[NSMenuItem alloc] init];
[menuItem setTitle:@"微信小助手"];
@@ -173,6 +202,34 @@ - (void)onWechatOnTopControl:(NSMenuItem *)item {
wechat.mainWindowController.window.level = item.state == NSControlStateValueOn ? NSStatusWindowLevel : NSNormalWindowLevel;
}
+/**
+ 菜单栏-微信小助手-更新小助手
+
+ @param item 更新小助手的 item
+ */
+- (void)onUpdatePluginControl:(NSMenuItem *)item {
+ [[TKWeChatPluginConfig sharedConfig] setForbidCheckVersion:NO];
+ [[TKVersionManager shareManager] checkVersionFinish:^(TKVersionStatus status, NSString *message) {
+ if (status == TKVersionStatusNew) {
+ NSAlert *alert = [[NSAlert alloc] init];
+ [alert addButtonWithTitle:@"前往Github"];
+ [alert addButtonWithTitle:@"取消"];
+ [alert setMessageText:@"检测到新版本!主要内容:👇"];
+ [alert setInformativeText:message];
+ NSModalResponse respose = [alert runModal];
+ if (respose == NSAlertFirstButtonReturn) {
+ NSURL *url = [NSURL URLWithString:@"https://github.com/TKkk-iOSer/WeChatPlugin-MacOS"];
+ [[NSWorkspace sharedWorkspace] openURL:url];
+ }
+ } else {
+ NSAlert *alert = [[NSAlert alloc] init];
+ [alert setMessageText:@"当前为最新版本!主要内容:👇"];
+ [alert setInformativeText:message];
+ [alert runModal];
+ }
+ }];
+}
+
/**
登录界面-自动登录
diff --git a/WeChatPlugin/Sources/Config/TKWeChatPluginConfig.h b/WeChatPlugin/Sources/Config/TKWeChatPluginConfig.h
index 92d3e048..26ed3358 100644
--- a/WeChatPlugin/Sources/Config/TKWeChatPluginConfig.h
+++ b/WeChatPlugin/Sources/Config/TKWeChatPluginConfig.h
@@ -13,15 +13,18 @@
@property (nonatomic, assign) BOOL preventRevokeEnable; /**< 是否开启防撤回 */
@property (nonatomic, assign) BOOL autoAuthEnable; /**< 是否免认证登录 */
-@property (nonatomic, assign) BOOL autoLoginEnable; /**< 是否自动登录 */
+@property (nonatomic, assign) BOOL autoLoginEnable; /**< 是否自动登录 */
@property (nonatomic, assign) BOOL onTop; /**< 是否要置顶微信 */
@property (nonatomic, assign) BOOL multipleSelectionEnable; /**< 是否要进行多选 */
+@property (nonatomic, assign) BOOL forbidCheckVersion; /**< 禁止检测版本 */
@property (nonatomic, copy) NSMutableArray *autoReplyModels; /**< 自动回复的数组 */
@property (nonatomic, copy) NSMutableArray *remoteControlModels; /**< 远程控制的数组 */
@property (nonatomic, copy) NSMutableArray *ignoreSessionModels; /**< 聊天置底的数组 */
@property (nonatomic, copy) NSMutableArray *selectSessions; /**< 已经选中的会话 */
@property (nonatomic, copy) NSMutableSet *revokeMsgSet; /**< 撤回的消息集合 */
@property (nonatomic, copy) NSString *currentUserName; /**< 当前用户的id */
+@property (nonatomic, copy, readonly) NSDictionary *localInfoPlist;
+@property (nonatomic, copy, readonly) NSDictionary *romoteInfoPlist;
- (void)saveAutoReplyModels;
- (void)saveRemoteControlModels;
diff --git a/WeChatPlugin/Sources/Config/TKWeChatPluginConfig.m b/WeChatPlugin/Sources/Config/TKWeChatPluginConfig.m
index 83187bf4..ecaa88bf 100644
--- a/WeChatPlugin/Sources/Config/TKWeChatPluginConfig.m
+++ b/WeChatPlugin/Sources/Config/TKWeChatPluginConfig.m
@@ -15,6 +15,7 @@
static NSString * const kTKAutoAuthEnableKey = @"kTKAutoAuthEnableKey";
static NSString * const kTKAutoLoginEnableKey = @"kTKAutoLoginEnableKey";
static NSString * const kTKOnTopKey = @"kTKOnTopKey";
+static NSString * const kTKForbidCheckVersionKey = @"kTKForbidCheckVersionKey";
static NSString * const kTKWeChatResourcesPath = @"/Applications/WeChat.app/Contents/MacOS/WeChatPlugin.framework/Resources/";
@interface TKWeChatPluginConfig ()
@@ -23,6 +24,9 @@ @interface TKWeChatPluginConfig ()
@property (nonatomic, copy) NSString *autoReplyPlistFilePath;
@property (nonatomic, copy) NSString *ignoreSessionPlistFilePath;
+@property (nonatomic, copy) NSDictionary *localInfoPlist;
+@property (nonatomic, copy) NSDictionary *romoteInfoPlist;
+
@end
@implementation TKWeChatPluginConfig
@@ -43,6 +47,7 @@ - (instancetype)init {
_autoAuthEnable = [[NSUserDefaults standardUserDefaults] boolForKey:kTKAutoAuthEnableKey];
_autoLoginEnable = [[NSUserDefaults standardUserDefaults] boolForKey:kTKAutoLoginEnableKey];
_onTop = [[NSUserDefaults standardUserDefaults] boolForKey:kTKOnTopKey];
+ _forbidCheckVersion = [[NSUserDefaults standardUserDefaults] boolForKey:kTKForbidCheckVersionKey];
}
return self;
}
@@ -71,6 +76,12 @@ - (void)setOnTop:(BOOL)onTop {
[[NSUserDefaults standardUserDefaults] synchronize];
}
+- (void)setForbidCheckVersion:(BOOL)forbidCheckVersion {
+ _forbidCheckVersion = forbidCheckVersion;
+ [[NSUserDefaults standardUserDefaults] setBool:_forbidCheckVersion forKey:kTKForbidCheckVersionKey];
+ [[NSUserDefaults standardUserDefaults] synchronize];
+}
+
#pragma mark - 自动回复
- (NSArray *)autoReplyModels {
if (!_autoReplyModels) {
@@ -151,7 +162,7 @@ - (NSMutableArray *)selectSessions {
return _selectSessions;
}
-#pragma mark - 选中的会话
+#pragma mark - 撤回的消息集合
- (NSMutableSet *)revokeMsgSet {
if (!_revokeMsgSet) {
_revokeMsgSet = [NSMutableSet set];
@@ -181,6 +192,23 @@ - (NSString *)ignoreSessionPlistFilePath {
return _ignoreSessionPlistFilePath;
}
+#pragma mark - 获取本地 & github 上的小助手 info 信息
+- (NSDictionary *)localInfoPlist {
+ if (!_localInfoPlist) {
+ NSString *localInfoPath = [kTKWeChatResourcesPath stringByAppendingString:@"info.plist"];
+ _localInfoPlist = [NSDictionary dictionaryWithContentsOfFile:localInfoPath];
+ }
+ return _localInfoPlist;
+}
+
+- (NSDictionary *)romoteInfoPlist {
+ if (!_romoteInfoPlist) {
+ NSURL *url = [NSURL URLWithString:@"https://raw.githubusercontent.com/TKkk-iOSer/WeChatPlugin-MacOS/master/Other/Products/Debug/WeChatPlugin.framework/Resources/Info.plist"];
+ _romoteInfoPlist = [NSDictionary dictionaryWithContentsOfURL:url];
+ }
+ return _romoteInfoPlist;
+}
+
#pragma mark - common
- (NSMutableArray *)getModelsWithClass:(Class)class filePath:(NSString *)filePath {
NSArray *originModels = [NSArray arrayWithContentsOfFile:filePath];
@@ -213,7 +241,6 @@ - (NSString *)getSandboxFilePathWithPlistName:(NSString *)plistName {
if (!error) {
return plistFilePath;
}
-
return resourcesFilePath;
}
diff --git a/WeChatPlugin/Sources/Utils/TKVersionManager.h b/WeChatPlugin/Sources/Utils/TKVersionManager.h
new file mode 100644
index 00000000..0840fb30
--- /dev/null
+++ b/WeChatPlugin/Sources/Utils/TKVersionManager.h
@@ -0,0 +1,21 @@
+//
+// TKVersionManager.h
+// WeChatPlugin
+//
+// Created by TK on 2018/2/24.
+// Copyright © 2018年 tk. All rights reserved.
+//
+
+#import
+
+typedef NS_ENUM(NSUInteger, TKVersionStatus) {
+ TKVersionStatusOld,
+ TKVersionStatusNew,
+};
+
+@interface TKVersionManager : NSObject
+
++ (instancetype)shareManager;
+- (void)checkVersionFinish:(void (^)(TKVersionStatus, NSString *))finish;
+
+@end
diff --git a/WeChatPlugin/Sources/Utils/TKVersionManager.m b/WeChatPlugin/Sources/Utils/TKVersionManager.m
new file mode 100644
index 00000000..eb00cade
--- /dev/null
+++ b/WeChatPlugin/Sources/Utils/TKVersionManager.m
@@ -0,0 +1,44 @@
+//
+// TKVersionManager.m
+// WeChatPlugin
+//
+// Created by TK on 2018/2/24.
+// Copyright © 2018年 tk. All rights reserved.
+//
+
+#import "TKVersionManager.h"
+#import "TKWeChatPluginConfig.h"
+
+static NSString * const kTKVersionStatusOldToast = @"当前小助手为最新版本,无需更新";
+
+@implementation TKVersionManager
+
++ (instancetype)shareManager {
+ static TKVersionManager *manager = nil;
+ static dispatch_once_t onceToken;
+ dispatch_once(&onceToken, ^{
+ manager = [[TKVersionManager alloc] init];
+ });
+ return manager;
+}
+
+- (void)checkVersionFinish:(void (^)(TKVersionStatus, NSString *))finish {
+ dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
+ NSDictionary *localInfo = [[TKWeChatPluginConfig sharedConfig] localInfoPlist];
+ NSDictionary *romoteInfo = [[TKWeChatPluginConfig sharedConfig] romoteInfoPlist];
+ NSString *localBundle = localInfo[@"CFBundleShortVersionString"];
+ NSString *romoteBundle = romoteInfo[@"CFBundleShortVersionString"];
+
+ dispatch_async(dispatch_get_main_queue(), ^{
+ if ([localBundle isEqualToString:romoteBundle]) {
+ NSString *versionMsg = [localInfo[@"versionInfo"] stringByReplacingOccurrencesOfString:@"\\n" withString:@"\n"];
+ finish(TKVersionStatusOld, versionMsg);
+ } else if (romoteInfo[@"versionInfo"]) {
+ NSString *versionMsg = [romoteInfo[@"versionInfo"] stringByReplacingOccurrencesOfString:@"\\n" withString:@"\n"];
+ finish(TKVersionStatusNew, versionMsg);
+ }
+ });
+ });
+}
+
+@end