Skip to content

Commit

Permalink
修复 bug,优化
Browse files Browse the repository at this point in the history
  • Loading branch information
shang1219178163 committed Jul 31, 2020
1 parent b679c47 commit a342cf8
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 18 deletions.
4 changes: 2 additions & 2 deletions MacTemplet.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1190,7 +1190,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.12;
MARKETING_VERSION = 1.4.0;
MARKETING_VERSION = 2.2.0;
OTHER_SWIFT_FLAGS = "$(inherited) -DDEBUG";
PRODUCT_BUNDLE_IDENTIFIER = bin.MacTemplet.codeHelper;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand Down Expand Up @@ -1219,7 +1219,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.12;
MARKETING_VERSION = 1.4.0;
MARKETING_VERSION = 2.2.0;
OTHER_SWIFT_FLAGS = "$(inherited)";
PRODUCT_BUNDLE_IDENTIFIER = bin.MacTemplet.codeHelper;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,9 @@ import UIKit
lazy var noticeLabel: UILabel = {
let rect = CGRectMake(0, 0, kScreenWidth, 30)
let view = UILabel.create(rect, textColor: UIColorHexValue(0xE9852C), type: 2)
let view = UILabel.create(rect, textColor: UIColor.hexValue(0xE9852C), type: 2)
view.font = UIFont.systemFont(ofSize: 12);
view.backgroundColor = UIColorHexValue(0xFFEBBB)
view.backgroundColor = UIColor.hexValue(0xFFEBBB)
view.text = " 未通过的进件,可通过“创建进件”再次申请"
return view
}()
Expand Down
2 changes: 1 addition & 1 deletion MacTemplet/BatchCreateFiles/NNViewCreater.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import SnapKit
import SwiftExpand
@objc protocol \(name)Delegate{
@objc func \(name.lowercased())(_ rangeView: \(name))
@objc func \(name.lowercased())(_ view: \(name))
}
Expand Down
2 changes: 1 addition & 1 deletion MacTemplet/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<key>CFBundleShortVersionString</key>
<string>$(MARKETING_VERSION)</string>
<key>CFBundleVersion</key>
<string>202007202029</string>
<string>202007311322</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.developer-tools</string>
<key>LSMinimumSystemVersion</key>
Expand Down
24 changes: 14 additions & 10 deletions MacTemplet/JsonToModelController.m
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ - (void)viewDidLoad {
- (void)viewWillAppear{
[super viewWillAppear];

NSString * titleOfSelectedItem = [NSUserDefaults.standardUserDefaults objectForKey:kDisplayName];
NSString *titleOfSelectedItem = [NSUserDefaults.standardUserDefaults objectForKey:kDisplayName];
// DDLog(@"titleOfSelectedItem_%@", titleOfSelectedItem);
[self.popBtn selectItemWithTitle:titleOfSelectedItem];
}
Expand All @@ -107,7 +107,7 @@ -(void)viewDidAppear{

}

- (void)viewDidLayout{
-(void)viewDidLayout{
[super viewDidLayout];

[self.textView.enclosingScrollView makeConstraints:^(MASConstraintMaker *make) {
Expand Down Expand Up @@ -410,19 +410,24 @@ - (void)clearFileOutputPath {
- (void)hanldeJson{
// DDLog(@"titleOfSelectedItem_%@", self.popBtn.titleOfSelectedItem);

[self setupDefaultWithSender:self.popBtn];
if (self.textFieldThree.stringValue.length > 0) {
[NSUserDefaults.standardUserDefaults setObject:self.textFieldThree.stringValue forKey:kSuperClass];
[NSUserDefaults.standardUserDefaults synchronize];
if (self.textField.stringValue.length <= 0 || self.textFieldTwo.stringValue.length <= 0 || self.textFieldThree.stringValue.length <= 0) {
NSWindow *window = NSApplication.sharedApplication.mainWindow;
[NSAlert show:@"提示" msg:@"前缀,类名,父类均不能为空" btnTitles:@[kTitleKnow] window:window];
return;
}

[self setupDefaultWithSender:self.popBtn];

[NSUserDefaults.standardUserDefaults setObject:self.textField.stringValue forKey:kClassPrefix];
[NSUserDefaults.standardUserDefaults setObject:self.textFieldTwo.stringValue forKey:kRootClass];
[NSUserDefaults.standardUserDefaults setObject:self.textFieldThree.stringValue forKey:kSuperClass];
[NSUserDefaults.standardUserDefaults synchronize];

// self.hTextView.string = @"";
// self.mTextView.string = @"";

id result = [NSJSONSerialization jsonObjectFromString:self.textView.string options:kNilOptions];
self.textLabel.stringValue = result ? @"Valid JSON Structure" : @"JSON isn't valid";
self.textLabel.textColor = result ? NSColor.systemGreenColor : NSColor.redColor;

if (!result) {
NSAlert *alert = [NSAlert create:@"警告" msg:@"Error:Json is invalid" btnTitles:@[kTitleKnow]];
[alert beginSheetModalForWindow:NSApplication.windowDefault completionHandler:^(NSModalResponse returnCode) {
Expand Down Expand Up @@ -533,7 +538,7 @@ - (void)setupDefaultWithSender:(NSPopUpButton *)sender{

[NSUserDefaults setArcObject:self.langModel forkey:@"langModel"];
[NSUserDefaults synchronize];
id langModel = [NSUserDefaults arcObjectForKey:@"langModel"];
// id langModel = [NSUserDefaults arcObjectForKey:@"langModel"];
}

#pragma mark - lazy
Expand Down Expand Up @@ -738,7 +743,6 @@ -(NSButton *)btn{
[view addActionHandler:^(NSControl * _Nonnull control) {
DDLog(@"%@", control);
[NSApp.mainWindow makeFirstResponder:nil];

[self creatFile];

}];
Expand Down
4 changes: 2 additions & 2 deletions MacTemplet/zh-Hans.lproj/InfoPlist.strings
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
Created by Bin Shang on 2020/4/20.
Copyright © 2020 Bin Shang. All rights reserved.
*/
"CFBundleName" = "App代码助手";
"CFBundleDisplayName" = "App代码助手";
"CFBundleName" = "CodeHelper";
"CFBundleDisplayName" = "CodeHelper";

0 comments on commit a342cf8

Please sign in to comment.