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:
edwinQQQ
2025-10-09 16:19:14 +08:00
commit a35a711be6
5582 changed files with 408913 additions and 0 deletions

View File

@@ -0,0 +1,48 @@
//
// CountDownHelper.h
// xplan-ios
//
// Created by 冯硕 on 2021/9/15.
// 倒计时
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@protocol CountDownHelperDelegate <NSObject>
@optional
///倒计时结束
- (void)onCountdownFinish;
///倒计时进行
- (void)onCountdownOpen:(int)time;
///顺计时结束
- (void)onClockwiseFinish;
///顺计时进行
- (void)onClockwiseOpen:(CGFloat)time;
@end
@interface CountDownHelper : NSObject
///倒计时是否完成
@property (nonatomic,assign) BOOL isCountdownFinish;
///顺计时的秒数
@property (nonatomic,assign) CGFloat seconds;
///代理
@property (nonatomic,weak) id<CountDownHelperDelegate> delegate;
///单例
+ (instancetype)shareHelper;
// 停止倒计时
- (void)stopCountDown;
///开始倒计时
- (void)openCountdownWithTime:(int)totalTime;
// 停止顺计时
- (void)stopClockwise;
///开始顺计时
- (void)openClockwiseWithTime:(int)totalTime;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,132 @@
//
// CountDownHelper.m
// xplan-ios
//
// Created by on 2021/9/15.
//
#import "CountDownHelper.h"
@interface CountDownHelper ()
@property (strong, nonatomic) dispatch_source_t timer;
@property (strong, nonatomic) dispatch_source_t clockwiseTimer;
@end
@implementation CountDownHelper
-(void)dealloc{
[self stopCountDown];
}
-(instancetype)init{
self = [super init];
if(self){
self.isCountdownFinish = YES;
self.seconds = 1.0;
}
return self;
}
+ (instancetype)shareHelper {
static dispatch_once_t onceToken;
static CountDownHelper * helper = nil;
dispatch_once(&onceToken, ^{
helper = [[CountDownHelper alloc] init];
});
return helper;
}
//
- (void)stopCountDown {
if (self.timer != nil) {
dispatch_source_cancel(self.timer);
self.timer = nil;
}
self.isCountdownFinish = YES;
}
- (void)stopClockwise {
if (self.clockwiseTimer != nil) {
dispatch_source_cancel(self.clockwiseTimer);
self.clockwiseTimer = nil;
}
self.isCountdownFinish = YES;
}
//
- (void)openCountdownWithTime:(int)totalTime{
if (time <= 0) {
return;
}
__block CGFloat time = (CGFloat)totalTime; //
if (self.timer != nil) {
dispatch_source_cancel(self.timer);
}
dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
self.timer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, queue);
dispatch_source_set_timer(self.timer,dispatch_walltime(NULL, 0),1*NSEC_PER_SEC, 0); //
__weak typeof(self) weakself = self;
dispatch_source_set_event_handler(self.timer, ^{
__strong typeof(weakself) self = weakself;
if(time <= 0){ //
dispatch_source_cancel(self.timer);
dispatch_async(dispatch_get_main_queue(), ^{
self.isCountdownFinish = YES;
if (self.delegate && [self.delegate respondsToSelector:@selector(onCountdownFinish)]) {
[self.delegate onCountdownFinish];
}
});
}else{
time--;
self.isCountdownFinish = NO;
dispatch_async(dispatch_get_main_queue(), ^{
//
if (self.delegate && [self.delegate respondsToSelector:@selector(onCountdownOpen:)]) {
[self.delegate onCountdownOpen:time];
}
});
}
});
dispatch_resume(self.timer);
}
- (void)openClockwiseWithTime:(int)totalTime{
if (totalTime <= 0) {
return;
}
__block CGFloat backTime = 0; //
if (self.clockwiseTimer != nil) {
dispatch_source_cancel(self.clockwiseTimer);
}
dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
self.clockwiseTimer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, queue);
dispatch_source_set_timer(self.clockwiseTimer,dispatch_walltime(NULL, 0),self.seconds*NSEC_PER_SEC, 0); //
__weak typeof(self) weakself = self;
dispatch_source_set_event_handler(self.clockwiseTimer, ^{
__strong typeof(weakself) self = weakself;
if(backTime > totalTime){ //
dispatch_source_cancel(self.clockwiseTimer);
dispatch_async(dispatch_get_main_queue(), ^{
self.isCountdownFinish = YES;
if (self.delegate && [self.delegate respondsToSelector:@selector(onClockwiseFinish)]) {
[self.delegate onClockwiseFinish];
}
});
}else{
backTime = backTime + self.seconds;
self.isCountdownFinish = NO;
dispatch_async(dispatch_get_main_queue(), ^{
//
if(self.delegate && [self.delegate respondsToSelector:@selector(onClockwiseOpen:)]){
[self.delegate onClockwiseOpen:backTime];
}
});
}
});
dispatch_resume(self.clockwiseTimer);
}
@end