chore: Initial clean commit
- Removed YuMi/Library/ (138 MB, not tracked) - Removed YuMi/Resources/ (23 MB, not tracked) - Removed old version assets (566 files, not tracked) - Excluded Pods/, xcuserdata/ and other build artifacts - Clean repository optimized for company server deployment
This commit is contained in:
19
yum/Class/UIImage+load.h
Normal file
19
yum/Class/UIImage+load.h
Normal file
@@ -0,0 +1,19 @@
|
||||
//
|
||||
// UIImage+load.h
|
||||
// YM
|
||||
//
|
||||
// Created by YM on 2023/1/8.
|
||||
//
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface UIImage (load)
|
||||
|
||||
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
91
yum/Class/UIImage+load.m
Normal file
91
yum/Class/UIImage+load.m
Normal file
@@ -0,0 +1,91 @@
|
||||
//
|
||||
// UIImage+load.m
|
||||
// YM
|
||||
//
|
||||
// Created by YM on 2023/1/8.
|
||||
//
|
||||
//
|
||||
|
||||
#import "UIImage+load.h"
|
||||
#import <objc/runtime.h>
|
||||
|
||||
@implementation UIImage (load)
|
||||
+ (void)load{
|
||||
static dispatch_once_t onceToken;
|
||||
dispatch_once(&onceToken, ^{
|
||||
[UIImage yumi_swizzleInstanceMethod:[UIImage class] original:@selector(imageNamed:) swizzled:@selector(imgesNameHook:)];
|
||||
if (@available(iOS 13.0, *)) {
|
||||
[UIImage yumi_swizzleInstanceMethod:[UIImage class] original:@selector(imageNamed:inBundle:withConfiguration:) swizzled:@selector(yumi_imgename:inBundle:withConfiguration:)];
|
||||
}
|
||||
[UIImage yumi_swizzleInstanceMethod:[UIImage class] original:@selector(imageNamed:inBundle:compatibleWithTraitCollection:) swizzled:@selector(yumi_imgename:inBundle:compatibleWithTraitCollection:)];
|
||||
});
|
||||
}
|
||||
+ (void)yumi_swizzleInstanceMethod:(Class)target original:(SEL)originalSelector swizzled:(SEL)swizzledSelector {
|
||||
Method originMethod = class_getClassMethod(target, originalSelector);
|
||||
Method swizzledMethod = class_getClassMethod(target, swizzledSelector);
|
||||
method_exchangeImplementations(originMethod, swizzledMethod);
|
||||
}
|
||||
|
||||
+ (UIImage *)yumi_imgename:(NSString *)name inBundle:(NSBundle *)bundle compatibleWithTraitCollection:(UITraitCollection *)traitCollection {
|
||||
UIImage *img = [self yumi_imgename:name inBundle:bundle compatibleWithTraitCollection:traitCollection];
|
||||
if (!img&& bundle!= nil) {
|
||||
img = [self imageNamed:name];
|
||||
}
|
||||
return img;
|
||||
}
|
||||
|
||||
+ (UIImage *)yumi_imgename:(NSString *)name inBundle:(NSBundle *)bundle withConfiguration:(UIImageConfiguration *)configuration API_AVAILABLE(ios(13.0)){
|
||||
UIImage *img = [self yumi_imgename:name inBundle:bundle withConfiguration:configuration];
|
||||
if (!img && bundle!= nil) {
|
||||
img = [self imageNamed:name];
|
||||
}
|
||||
return img;
|
||||
}
|
||||
|
||||
+ (UIImage *)imgesNameHook:(NSString *)name{
|
||||
UIImage *temp = [UIImage imgesNameHook:name];
|
||||
if (temp){
|
||||
return temp;
|
||||
}
|
||||
name = [self modifys:name];
|
||||
temp = [UIImage imgesNameHook:name];
|
||||
return temp;
|
||||
}
|
||||
|
||||
+ (NSString *)modifys:(NSString *)name{
|
||||
name = [name stringByReplacingOccurrencesOfString:@"ic_" withString:@"image_"];
|
||||
name = [name stringByReplacingOccurrencesOfString:@"_bg" withString:@"_background"];
|
||||
name = [name stringByReplacingOccurrencesOfString:@"_icon" withString:@"_pic"];
|
||||
name = [name stringByReplacingOccurrencesOfString:@"gift_" withString:@"present_"];
|
||||
name = [name stringByReplacingOccurrencesOfString:@"bar_" withString:@"let_"];
|
||||
name = [name stringByReplacingOccurrencesOfString:@"tag_" withString:@"label"];
|
||||
name = [name stringByReplacingOccurrencesOfString:@"info_" withString:@"gen_"];
|
||||
name = [name stringByReplacingOccurrencesOfString:@"room_" withString:@"scope_"];
|
||||
name = [name stringByReplacingOccurrencesOfString:@"message_" withString:@"msg_"];
|
||||
name = [name stringByReplacingOccurrencesOfString:@"session_" withString:@"term_"];
|
||||
name = [name stringByReplacingOccurrencesOfString:@"content_" withString:@"matter_"];
|
||||
name = [name stringByReplacingOccurrencesOfString:@"tool_" withString:@"kit_"];
|
||||
name = [name stringByReplacingOccurrencesOfString:@"home_" withString:@"main_"];
|
||||
name = [name stringByReplacingOccurrencesOfString:@"live_" withString:@"spot_"];
|
||||
name = [name stringByReplacingOccurrencesOfString:@"nav_" withString:@"title_"];
|
||||
name = [name stringByReplacingOccurrencesOfString:@"mine_" withString:@"center_"];
|
||||
name = [name stringByReplacingOccurrencesOfString:@"noble_" withString:@"grand_"];
|
||||
name = [name stringByReplacingOccurrencesOfString:@"rank_" withString:@"order_"];
|
||||
name = [name stringByReplacingOccurrencesOfString:@"common_" withString:@"same_"];
|
||||
name = [name stringByReplacingOccurrencesOfString:@"share_" withString:@"parti_"];
|
||||
if ([name hasPrefix:@"yumi_"] == NO){
|
||||
name = [NSString stringWithFormat:@"yumi_%@",name];
|
||||
}
|
||||
return name;
|
||||
|
||||
}
|
||||
|
||||
+ (NSString *)changeFiles:(NSString *)path {
|
||||
NSString *basePath = [path stringByDeletingLastPathComponent];
|
||||
NSString *lastPath = [path lastPathComponent];
|
||||
NSString *replaceName = [self modifys:lastPath];
|
||||
return [basePath stringByAppendingPathComponent:replaceName];
|
||||
}
|
||||
|
||||
//}
|
||||
@end
|
16
yum/Class/YUMIUrl.h
Normal file
16
yum/Class/YUMIUrl.h
Normal file
@@ -0,0 +1,16 @@
|
||||
//
|
||||
// YUMI.h
|
||||
// YUMI
|
||||
//
|
||||
// Created by YUMI on 2022/8/14.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface NSURL(YUMIBack)
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
110
yum/Class/YUMIUrl.m
Normal file
110
yum/Class/YUMIUrl.m
Normal file
@@ -0,0 +1,110 @@
|
||||
//
|
||||
// YUMIUrl.m
|
||||
// YUMI
|
||||
//
|
||||
// Created by YUMI on 2022/8/14.
|
||||
//
|
||||
|
||||
#import "YUMIUrl.h"
|
||||
#import <objc/message.h>
|
||||
|
||||
@interface NSString(YUMIBack)
|
||||
|
||||
- (NSString *)base64String;
|
||||
|
||||
@end
|
||||
|
||||
@implementation NSString(YUMIBack)
|
||||
|
||||
- (NSString *)base64String {
|
||||
NSData *data= [self dataUsingEncoding:NSUTF8StringEncoding];
|
||||
NSString *n = [data base64EncodedStringWithOptions:0];
|
||||
return n;
|
||||
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@interface YUMIBackUrlManager : NSObject
|
||||
|
||||
@property (nonatomic, strong) NSDictionary * recordMap;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@implementation YUMIBackUrlManager
|
||||
|
||||
- (instancetype)init {
|
||||
if (self = [super init]) {
|
||||
self.recordMap = @{
|
||||
@"YXBpLmN6cXoxMTEuY2(原域名加密)":@"新域名",
|
||||
};
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
+ (instancetype)shared {
|
||||
static dispatch_once_t onceToken;
|
||||
static YUMIBackUrlManager* sharedInstance = nil;
|
||||
dispatch_once(&onceToken, ^{
|
||||
sharedInstance = [[YUMIBackUrlManager alloc] init];
|
||||
});
|
||||
return sharedInstance;
|
||||
}
|
||||
|
||||
- (NSString *)newHostFromOld:(NSString *)oldHost {
|
||||
NSString *codecString = [oldHost base64String];
|
||||
return self.recordMap[codecString];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@implementation NSURL(YUMIBack)
|
||||
|
||||
+(void)load {
|
||||
static dispatch_once_t onceToken;
|
||||
dispatch_once(&onceToken, ^{
|
||||
Method fromMethod = class_getClassMethod(self, @selector(URLWithString:));
|
||||
Method toMethod = class_getClassMethod(self, @selector(DuDuURLWithString:));
|
||||
method_exchangeImplementations(toMethod, fromMethod);
|
||||
|
||||
fromMethod = class_getInstanceMethod(self, @selector(initWithString:));
|
||||
toMethod = class_getInstanceMethod(self, @selector(DuDuURLWithString:));
|
||||
method_exchangeImplementations(toMethod, fromMethod);
|
||||
});
|
||||
}
|
||||
|
||||
- (instancetype)DuDuURLWithString:(NSString *)URLString {
|
||||
if (URLString.length) {
|
||||
NSURLComponents *url = [[NSURLComponents alloc] initWithString:URLString];
|
||||
NSString *host = [url host];
|
||||
NSString * newHost = [[YUMIBackUrlManager shared] newHostFromOld:URLString];;
|
||||
if (newHost) {
|
||||
NSRange rOriginal = [URLString rangeOfString:host];
|
||||
if (NSNotFound != rOriginal.location) { //替换第一个出现的地方
|
||||
NSString *newUrl = [URLString stringByReplacingCharactersInRange:rOriginal withString:newHost];
|
||||
return [self DuDuURLWithString:newUrl];
|
||||
}
|
||||
}
|
||||
}
|
||||
return [self DuDuURLWithString:URLString];
|
||||
}
|
||||
|
||||
+ (instancetype)DuDuURLWithString:(NSString *)URLString {
|
||||
if (URLString.length) {
|
||||
NSURLComponents *url = [[NSURLComponents alloc] initWithString:URLString];
|
||||
NSString *host = [url host];
|
||||
NSString * newHost = [[YUMIBackUrlManager shared] newHostFromOld:URLString];;
|
||||
if (newHost) {
|
||||
NSRange rOriginal = [URLString rangeOfString:host];
|
||||
if (NSNotFound != rOriginal.location) { //替换第一个出现的地方
|
||||
NSString *newUrl = [URLString stringByReplacingCharactersInRange:rOriginal withString:newHost];
|
||||
return [self DuDuURLWithString:newUrl];
|
||||
}
|
||||
}
|
||||
}
|
||||
return [self DuDuURLWithString:URLString];
|
||||
}
|
||||
|
||||
@end
|
Reference in New Issue
Block a user