diff --git a/ACSimpleKeychain.h b/ACSimpleKeychain.h deleted file mode 100644 index 343ded4..0000000 --- a/ACSimpleKeychain.h +++ /dev/null @@ -1,70 +0,0 @@ -// -// ACSimpleKeychain.h -// ACSimpleKeychain -// -// Created by Alex Chugunov on 2/3/11. -// Copyright 2011 Alex Chugunov. All rights reserved. -// - -#import -#import - -extern NSString *const ACKeychainPassword; -extern NSString *const ACKeychainUsername; -extern NSString *const ACKeychainIdentifier; -extern NSString *const ACKeychainService; -extern NSString *const ACKeychainExpirationDate; -extern NSString *const ACKeychainInfo; - -#define KeyChainService @"DisplayTen" - -@interface ACSimpleKeychain : NSObject { - -} - -+ (id)defaultKeychain; - -// Creates new item with the provided values and deletes the old ones if those existed. -// Returns YES on success and NO on failure. -- (BOOL)storeUsername:(NSString *)username password:(NSString *)password identifier:(NSString *)identifier forService:(NSString *)service; -- (BOOL)storeUsername:(NSString *)username password:(NSString *)password identifier:(NSString *)identifier info:(NSDictionary *)info forService:(NSString *)service; - -- (BOOL)storeUsername:(NSString *)username password:(NSString *)password identifier:(NSString *)identifier expirationDate:(NSDate *)expirationDate forService:(NSString *)service; - - -// On success returns a dictionary with the following keys: -// ACKeychainUsername -// ACKeychainPassword -// ACKeychainIdentifier -// ACKeychainService -// ACKeychainExpirationDate -- (NSDictionary *)credentialsForIdentifier:(NSString *)identifier service:(NSString *)service; - -// On success returns a dictionary with the following keys: -// ACKeychainUsername -// ACKeychainPassword -// ACKeychainIdentifier -// ACKeychainService -// ACKeychainExpirationDate -- (NSDictionary *)credentialsForUsername:(NSString *)username service:(NSString *)service; - -// On success returns an array of dictionaries with the following keys: -// ACKeychainUsername -// ACKeychainPassword -// ACKeychainIdentifier -// ACKeychainService -// ACKeychainExpirationDate -// -// limit - the amount of entries to return. Should be > 0 -- (NSArray *)allCredentialsForService:(NSString *)service limit:(NSUInteger)limit; - -// Deletes credentials matching the provided identifier and service, returns YES on sucess -- (BOOL)deleteCredentialsForIdentifier:(NSString *)identifier service:(NSString *)service; - -// Deletes credentials matching the provided username and service, returns YES on sucess -- (BOOL)deleteCredentialsForUsername:(NSString *)username service:(NSString *)service; - -// Deletes all entries for the given service -- (BOOL)deleteAllCredentialsForService:(NSString *)service; - -@end diff --git a/ACSimpleKeychain.m b/ACSimpleKeychain.m deleted file mode 100644 index 0771163..0000000 --- a/ACSimpleKeychain.m +++ /dev/null @@ -1,204 +0,0 @@ -// -// ACSimpleKeychain.m -// ACSimpleKeychain -// -// Created by Alex Chugunov on 2/3/11. -// Copyright 2011 Alex Chugunov. All rights reserved. -// - -#import "ACSimpleKeychain.h" - -NSString *const ACKeychainPassword = @"password"; -NSString *const ACKeychainUsername = @"username"; -NSString *const ACKeychainIdentifier = @"identifier"; -NSString *const ACKeychainExpirationDate = @"expirationDate"; -NSString *const ACKeychainService = @"service"; -NSString *const ACKeychainInfo = @"info"; - -@interface ACSimpleKeychain (Private) - -- (NSDictionary *)credentialsFromKeychainItem:(NSDictionary *)item; - -@end - -@implementation ACSimpleKeychain - -+ (id)defaultKeychain -{ - static ACSimpleKeychain *_sharedInstance = nil; - static dispatch_once_t oncePredicate; - - dispatch_once(&oncePredicate, ^{ - _sharedInstance = [[self alloc] init]; - }); - - return _sharedInstance; -} - -- (NSDictionary *)credentialsForQuery:(NSDictionary *)query -{ - CFDictionaryRef result = NULL; - OSStatus status = SecItemCopyMatching((__bridge CFDictionaryRef)query, (CFTypeRef *) &result); - if (status == errSecSuccess && result != NULL) { - NSDictionary *credentials = [self credentialsFromKeychainItem:(__bridge_transfer NSDictionary *) result]; - return credentials; - } - return nil; -} - -- (NSDictionary *)credentialsFromKeychainItem:(NSDictionary *)item -{ - NSString *username = [[NSString alloc] initWithData:[item valueForKey:(__bridge id)kSecAttrAccount] - encoding:NSUTF8StringEncoding]; - NSString *identifier = [[NSString alloc] initWithData:[item valueForKey:(__bridge id)kSecAttrGeneric] - encoding:NSUTF8StringEncoding]; - NSString *service = [[NSString alloc] initWithData:[item valueForKey:(__bridge id)kSecAttrService] - encoding:NSUTF8StringEncoding]; - NSData *passwordData = [item valueForKey:(__bridge id)kSecValueData]; - - NSString *password = nil; - if (passwordData) { - password = [[NSString alloc] initWithData:passwordData - encoding:NSUTF8StringEncoding]; - } - - NSData *miscData = [item valueForKey:(__bridge id)kSecAttrComment]; - NSDictionary *misc = nil; - - if (miscData) { - NSKeyedUnarchiver *unarchiver = [[NSKeyedUnarchiver alloc] initForReadingWithData:miscData]; - misc = [unarchiver decodeObjectForKey:ACKeychainInfo]; - [unarchiver finishDecoding]; - } - - NSMutableDictionary *credentials = [NSMutableDictionary dictionaryWithObjectsAndKeys: - username, ACKeychainUsername, - identifier, ACKeychainIdentifier, - service, ACKeychainService, nil]; - [credentials setValue:password forKey:ACKeychainPassword]; - [credentials setValue:misc forKey:ACKeychainInfo]; - [credentials setValue:[misc valueForKey:ACKeychainExpirationDate] forKey:ACKeychainExpirationDate]; - - return credentials; -} - -- (BOOL)storeUsername:(NSString *)username password:(NSString *)password identifier:(NSString *)identifier forService:(NSString *)service -{ - return [self storeUsername:username password:password identifier:identifier expirationDate:nil forService:service]; -} - -- (BOOL)storeUsername:(NSString *)username password:(NSString *)password identifier:(NSString *)identifier info:(NSDictionary *)info forService:(NSString *)service -{ - if ([self deleteCredentialsForUsername:username service:service] && - [self deleteCredentialsForIdentifier:identifier service:service]) - { - NSMutableDictionary *dictionary = [NSMutableDictionary dictionaryWithObjectsAndKeys: - (__bridge id)kSecClassGenericPassword, (__bridge id)kSecClass, - [username dataUsingEncoding:NSUTF8StringEncoding], (__bridge id)kSecAttrAccount, - [identifier dataUsingEncoding:NSUTF8StringEncoding], (__bridge id)kSecAttrGeneric, - [service dataUsingEncoding:NSUTF8StringEncoding], (__bridge id)kSecAttrService, nil]; - [dictionary setValue:[password dataUsingEncoding:NSUTF8StringEncoding] forKey:(__bridge id)kSecValueData]; - NSMutableData *miscData = [NSMutableData data]; - NSKeyedArchiver *archiver = [[NSKeyedArchiver alloc] initForWritingWithMutableData:miscData]; - [archiver encodeObject:info forKey:ACKeychainInfo]; - [archiver finishEncoding]; - [dictionary setValue:miscData forKey:(__bridge id)kSecAttrComment]; - OSStatus status = SecItemAdd((__bridge CFDictionaryRef)dictionary, NULL); - return (status == errSecSuccess); - } - return NO; -} - -- (BOOL)storeUsername:(NSString *)username password:(NSString *)password identifier:(NSString *)identifier expirationDate:(NSDate *)expirationDate forService:(NSString *)service -{ - NSDictionary *info = nil; - if (expirationDate) { - info = [NSDictionary dictionaryWithObject:expirationDate - forKey:ACKeychainExpirationDate]; - } - - return [self storeUsername:username password:password identifier:identifier info:info forService:service]; -} - -- (NSDictionary *)credentialsForIdentifier:(NSString *)identifier service:(NSString *)service -{ - NSDictionary *query = [NSDictionary dictionaryWithObjectsAndKeys: - (__bridge id)kSecClassGenericPassword, (__bridge id)kSecClass, - [service dataUsingEncoding:NSUTF8StringEncoding], (__bridge id)kSecAttrService, - [identifier dataUsingEncoding:NSUTF8StringEncoding], (__bridge id)kSecAttrGeneric, - (__bridge id)kCFBooleanTrue, (__bridge id)kSecReturnAttributes, - (__bridge id)kCFBooleanTrue, (__bridge id)kSecReturnData, - nil]; - return [self credentialsForQuery:query]; -} - -- (NSDictionary *)credentialsForUsername:(NSString *)username service:(NSString *)service -{ - NSDictionary *query = [NSDictionary dictionaryWithObjectsAndKeys: - (__bridge id)kSecClassGenericPassword, (__bridge id)kSecClass, - [service dataUsingEncoding:NSUTF8StringEncoding], (__bridge id)kSecAttrService, - [username dataUsingEncoding:NSUTF8StringEncoding], (__bridge id)kSecAttrAccount, - (__bridge id)kCFBooleanTrue, (__bridge id)kSecReturnAttributes, - (__bridge id)kCFBooleanTrue, (__bridge id)kSecReturnData, - nil]; - return [self credentialsForQuery:query]; -} - - -- (NSArray *)allCredentialsForService:(NSString *)service limit:(NSUInteger)limit -{ - NSDictionary *query = [NSDictionary dictionaryWithObjectsAndKeys: - (__bridge id)kSecClassGenericPassword, (__bridge id)kSecClass, - [service dataUsingEncoding:NSUTF8StringEncoding], (__bridge id)kSecAttrService, - (__bridge id)kCFBooleanTrue, (__bridge id)kSecReturnAttributes, - [NSNumber numberWithUnsignedInteger:limit], (__bridge id)kSecMatchLimit, - (__bridge id)kCFBooleanTrue, (__bridge id)kSecReturnData, - nil]; - - CFArrayRef list = NULL; - OSStatus status = SecItemCopyMatching((__bridge CFDictionaryRef)query, (CFTypeRef *) &list); - if (status == errSecSuccess && list != NULL) { - NSMutableArray *result = [NSMutableArray array]; - for (NSDictionary *item in (__bridge_transfer NSArray *)list) { - NSDictionary *credentials = [self credentialsFromKeychainItem:item]; - [result addObject:credentials]; - } - return result; - } - return nil; -} - -- (BOOL)deleteCredentialsForIdentifier:(NSString *)identifier service:(NSString *)service -{ - NSDictionary *query = [NSDictionary dictionaryWithObjectsAndKeys: - (__bridge id)kSecClassGenericPassword, (__bridge id)kSecClass, - [service dataUsingEncoding:NSUTF8StringEncoding], (__bridge id)kSecAttrService, - [identifier dataUsingEncoding:NSUTF8StringEncoding], (__bridge id)kSecAttrGeneric, - nil]; - OSStatus status = SecItemDelete((__bridge CFDictionaryRef)query); - return (status == errSecSuccess || status == errSecItemNotFound); -} - -- (BOOL)deleteCredentialsForUsername:(NSString *)username service:(NSString *)service -{ - NSDictionary *query = [NSDictionary dictionaryWithObjectsAndKeys: - (__bridge id)kSecClassGenericPassword, (__bridge id)kSecClass, - [service dataUsingEncoding:NSUTF8StringEncoding], (__bridge id)kSecAttrService, - [username dataUsingEncoding:NSUTF8StringEncoding], (__bridge id)kSecAttrAccount, - nil]; - OSStatus status = SecItemDelete((__bridge CFDictionaryRef)query); - return (status == errSecSuccess || status == errSecItemNotFound); -} - -- (BOOL)deleteAllCredentialsForService:(NSString *)service -{ - NSDictionary *query = [NSDictionary dictionaryWithObjectsAndKeys: - (__bridge id)kSecClassGenericPassword, (__bridge id)kSecClass, - [service dataUsingEncoding:NSUTF8StringEncoding], (__bridge id)kSecAttrService, - (__bridge id)kCFBooleanTrue, (__bridge id)kSecReturnAttributes, - nil]; - OSStatus status = SecItemDelete((__bridge CFDictionaryRef)query); - return (status == errSecSuccess || status == errSecItemNotFound); -} - -@end diff --git a/LGGetWifiInfo.h b/LGGetWifiInfo.h deleted file mode 100644 index 26ee39d..0000000 --- a/LGGetWifiInfo.h +++ /dev/null @@ -1,16 +0,0 @@ -// -// LGGetWifiInfo.h -// textObject -// -// Created by 东途 on 16/5/9. -// Copyright © 2016年 东途. All rights reserved. -// - -#import - -@interface LGGetWifiInfo : NSObject - -//获取Wi-Fi信息,有BSSID,SSID,SSIDDATA三项,只能真机测试时候正常使用 -+ (NSString *)getWifiName; - -@end diff --git a/LGGetWifiInfo.m b/LGGetWifiInfo.m deleted file mode 100644 index a8a220a..0000000 --- a/LGGetWifiInfo.m +++ /dev/null @@ -1,51 +0,0 @@ -// -// LGGetWifiInfo.m -// textObject -// -// Created by 东途 on 16/5/9. -// Copyright © 2016年 东途. All rights reserved. -// - -#import "LGGetWifiInfo.h" - -#import - -@implementation LGGetWifiInfo - - -//获取Wi-Fi信息,有BSSID,SSID,SSIDDATA三项,只能真机测试时候正常使用 -+ (NSString *)getWifiName { - - NSString *wifiName = nil; - - CFArrayRef wifiInterfaces = CNCopySupportedInterfaces(); - - if (!wifiInterfaces) { - return nil; - } - - NSArray *interfaces = (__bridge NSArray *)wifiInterfaces; - - for (NSString *interfaceName in interfaces) { - - CFDictionaryRef dictRef = CNCopyCurrentNetworkInfo((__bridge CFStringRef)(interfaceName)); - - if (dictRef) { - - // Wi-Fi的详细信息 - NSDictionary *networkInfo = (__bridge NSDictionary *)dictRef; - -// NSLog(@"network info -> %@", networkInfo); - - wifiName = [networkInfo objectForKey:(__bridge NSString *)kCNNetworkInfoKeySSID]; - - CFRelease(dictRef); - } - } - - CFRelease(wifiInterfaces); - - return wifiName; -} - -@end diff --git a/NSDate+MJ.h b/NSDate+MJ.h deleted file mode 100644 index ce2d195..0000000 --- a/NSDate+MJ.h +++ /dev/null @@ -1,38 +0,0 @@ -// -// NSDate+MJ.h -// ItcastWeibo -// -// Created by apple on 14-5-9. -// Copyright (c) 2014年 itcast. All rights reserved. -// - -#import - -@interface NSDate (MJ) -/** - * 是否为今天 - */ -- (BOOL)isToday; -/** - * 是否为昨天 - */ -- (BOOL)isYesterday; -/** - * 是否为今年 - */ -- (BOOL)isThisYear; -/** - * 是否为本周 - */ -- (BOOL)isThisWeak; - -/** - * 返回一个只有年月日的时间 - */ -- (NSDate *)dateWithYMD; - -/** - * 获得与当前时间的差距 - */ -- (NSDateComponents *)deltaWithNow; -@end diff --git a/NSDate+MJ.m b/NSDate+MJ.m deleted file mode 100644 index e7bae8a..0000000 --- a/NSDate+MJ.m +++ /dev/null @@ -1,96 +0,0 @@ -// -// NSDate+MJ.m -// ItcastWeibo -// -// Created by apple on 14-5-9. -// Copyright (c) 2014年 itcast. All rights reserved. -// - -#import "NSDate+MJ.h" - -@implementation NSDate (MJ) -/** - * 是否为今天 - */ -- (BOOL)isToday -{ - NSCalendar *calendar = [NSCalendar currentCalendar]; - int unit = NSCalendarUnitDay | NSCalendarUnitMonth | NSCalendarUnitYear; - - // 1.获得当前时间的年月日 - NSDateComponents *nowCmps = [calendar components:unit fromDate:[NSDate date]]; - - // 2.获得self的年月日 - NSDateComponents *selfCmps = [calendar components:unit fromDate:self]; - return - (selfCmps.year == nowCmps.year) && - (selfCmps.month == nowCmps.month) && - (selfCmps.day == nowCmps.day); -} - -/** - * 是否为昨天 - */ -- (BOOL)isYesterday -{ - // 2014-05-01 - NSDate *nowDate = [[NSDate date] dateWithYMD]; - - // 2014-04-30 - NSDate *selfDate = [self dateWithYMD]; - - // 获得nowDate和selfDate的差距 - NSCalendar *calendar = [NSCalendar currentCalendar]; - NSDateComponents *cmps = [calendar components:NSCalendarUnitDay fromDate:selfDate toDate:nowDate options:0]; - return cmps.day == 1; -} - -// 是否为本周 -- (BOOL)isThisWeak { - - NSCalendar *calendar = [NSCalendar currentCalendar]; - int unit = NSCalendarUnitDay | NSCalendarUnitMonth | NSCalendarUnitYear; - - // 1.获得当前时间的年月日 - NSDateComponents *nowCmps = [calendar components:unit fromDate:[NSDate date]]; - - // 2.获得self的年月日 - NSDateComponents *selfCmps = [calendar components:unit fromDate:self]; - return - (selfCmps.year == nowCmps.year) && - (selfCmps.month == nowCmps.month) && (nowCmps.day - selfCmps.day < 7); - -} - -- (NSDate *)dateWithYMD -{ - NSDateFormatter *fmt = [[NSDateFormatter alloc] init]; - fmt.dateFormat = @"yyyy-MM-dd"; - NSString *selfStr = [fmt stringFromDate:self]; - return [fmt dateFromString:selfStr]; -} - -/** - * 是否为今年 - */ -- (BOOL)isThisYear -{ - NSCalendar *calendar = [NSCalendar currentCalendar]; - int unit = NSCalendarUnitYear; - - // 1.获得当前时间的年月日 - NSDateComponents *nowCmps = [calendar components:unit fromDate:[NSDate date]]; - - // 2.获得self的年月日 - NSDateComponents *selfCmps = [calendar components:unit fromDate:self]; - - return nowCmps.year == selfCmps.year; -} - -- (NSDateComponents *)deltaWithNow -{ - NSCalendar *calendar = [NSCalendar currentCalendar]; - int unit = NSCalendarUnitHour | NSCalendarUnitMinute | NSCalendarUnitSecond; - return [calendar components:unit fromDate:self toDate:[NSDate date] options:0]; -} -@end diff --git a/NSString+AttributedString.h b/NSString+AttributedString.h deleted file mode 100644 index faf5c1e..0000000 --- a/NSString+AttributedString.h +++ /dev/null @@ -1,17 +0,0 @@ -// -// NSString+AttributedString.h -// DTEN -// -// Created by 东途 on 16/6/13. -// Copyright © 2016年 displayten. All rights reserved. -// - -#import - -#import - -@interface NSString (AttributedString) - -+ (NSMutableAttributedString *)attributedString:(NSString *)str fontSize:(int)fontSize color:(UIColor *)color underLine:(NSNumber *)underline; - -@end diff --git a/NSString+AttributedString.m b/NSString+AttributedString.m deleted file mode 100644 index da8fa46..0000000 --- a/NSString+AttributedString.m +++ /dev/null @@ -1,41 +0,0 @@ -// -// NSString+AttributedString.m -// DTEN -// -// Created by 东途 on 16/6/13. -// Copyright © 2016年 displayten. All rights reserved. -// - -#import "NSString+AttributedString.h" - -#import - -@implementation NSString (AttributedString) - -+ (NSMutableAttributedString *)attributedString:(NSString *)str fontSize:(int)fontSize color:(UIColor *)color underLine:(NSNumber *)underline { - - NSRange range = NSMakeRange(0, str.length); - - NSMutableAttributedString *AttributedStr = [[NSMutableAttributedString alloc]initWithString:str]; - - [AttributedStr addAttribute:NSFontAttributeName - - value:[UIFont systemFontOfSize:fontSize] - - range:range]; - - [AttributedStr addAttribute:NSForegroundColorAttributeName - - value:color - - range:range]; - if (underline > 0) { - - // NSUnderlineStyleSingle - [AttributedStr addAttribute:NSUnderlineStyleAttributeName value:underline range:range]; - } - - return AttributedStr; -} - -@end diff --git a/UIBarButtonItem+Extention.h b/UIBarButtonItem+Extention.h deleted file mode 100644 index 09d1db9..0000000 --- a/UIBarButtonItem+Extention.h +++ /dev/null @@ -1,15 +0,0 @@ -// -// UIBarButtonItem+Extention.h -// 微博二期 -// -// Created by MS on 15-12-23. -// Copyright (c) 2015年 LG. All rights reserved. -// - -#import - -@interface UIBarButtonItem (Extention) - -+ (UIBarButtonItem *)itemWithTarget:(id)target Action:(SEL)action image:(NSString *)image highlightImage:(NSString *)highlightImage; - -@end diff --git a/UIBarButtonItem+Extention.m b/UIBarButtonItem+Extention.m deleted file mode 100644 index 7be36cf..0000000 --- a/UIBarButtonItem+Extention.m +++ /dev/null @@ -1,29 +0,0 @@ -// -// UIBarButtonItem+Extention.m -// 微博二期 -// -// Created by MS on 15-12-23. -// Copyright (c) 2015年 LG. All rights reserved. -// - -#import "UIBarButtonItem+Extention.h" -#import "UIView+Extention.h" - -@implementation UIBarButtonItem (Extention) - -/**创建自定义按钮样式*/ -+ (UIBarButtonItem *)itemWithTarget:(id)target Action:(SEL)action image:(NSString *)image highlightImage:(NSString *)highlightImage -{ - UIButton * btn = [UIButton buttonWithType:UIButtonTypeCustom]; - [btn addTarget:target action:action forControlEvents:UIControlEventTouchUpInside]; - //设置图片 - [btn setBackgroundImage:[UIImage imageNamed:image] forState:UIControlStateNormal]; -// [btn setBackgroundImage:[UIImage imageNamed:highlightImage] forState:UIControlStateHighlighted]; - //设置尺寸 -// btn.size = btn.currentBackgroundImage.size; - btn.size = CGSizeMake(25, 22); - btn.imageEdgeInsets = UIEdgeInsetsMake(-5, 0, 0, 0); - return [[UIBarButtonItem alloc]initWithCustomView:btn]; -} - -@end diff --git a/UIImage+Image.h b/UIImage+Image.h deleted file mode 100644 index c42d58f..0000000 --- a/UIImage+Image.h +++ /dev/null @@ -1,20 +0,0 @@ -// -// UIImage+Image.h -// 传智微博 -// -// Created by apple on 15-3-4. -// Copyright (c) 2015年 apple. All rights reserved. -// - -#import - -@interface UIImage (Image) -// instancetype默认会识别当前是哪个类或者对象调用,就会转换成对应的类的对象 -// UIImage * - -// 加载最原始的图片,没有渲染 -+ (instancetype)imageWithOriginalName:(NSString *)imageName; - -+ (instancetype)imageWithStretchableName:(NSString *)imageName; - -@end diff --git a/UIImage+Image.m b/UIImage+Image.m deleted file mode 100644 index b247892..0000000 --- a/UIImage+Image.m +++ /dev/null @@ -1,28 +0,0 @@ -// -// UIImage+Image.m -// 传智微博 -// -// Created by apple on 15-3-4. -// Copyright (c) 2012年 itcast. All rights reserved. -// - -#import "UIImage+Image.h" - -@implementation UIImage (Image) - -+ (instancetype)imageWithOriginalName:(NSString *)imageName -{ - UIImage *image = [UIImage imageNamed:imageName]; - - return [image imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]; -} - -+ (instancetype)imageWithStretchableName:(NSString *)imageName -{ - UIImage *image = [UIImage imageNamed:imageName]; - return [image stretchableImageWithLeftCapWidth:image.size.width * 0.5 topCapHeight:image.size.height * 0.5]; -} - - - -@end