liuzhenxing1118 7 месяцев назад
Родитель
Сommit
c305ee027c

+ 3 - 0
artimenring-iOS/Artimenring/Classes/ViewController/Call/SKInCallViewController+agora.h

@@ -12,6 +12,9 @@ NS_ASSUME_NONNULL_BEGIN
 
 @interface SKInCallViewController (agora)
 
+@property (nonatomic, strong) UIView* localView;
+@property (nonatomic, strong) UIView* remoteView;
+
 @end
 
 NS_ASSUME_NONNULL_END

+ 1 - 0
artimenring-iOS/Artimenring/Classes/ViewController/Call/SKInCallViewController+juphoon.m

@@ -7,6 +7,7 @@
 //
 
 #import "SKInCallViewController+juphoon.h"
+#import "SKInCallViewController+time.h"
 #import "VideoManager+ringtone.h"
 #import "VideoManager+juphoon.h"
 

+ 23 - 0
artimenring-iOS/Artimenring/Classes/ViewController/Call/SKInCallViewController+time.h

@@ -0,0 +1,23 @@
+//
+//  SKInCallViewController+time.h
+//  SikeyComm
+//
+//  Created by 刘振兴 on 2025/2/14.
+//  Copyright © 2025 BaH Cy. All rights reserved.
+//
+
+#import "SKInCallViewController.h"
+
+NS_ASSUME_NONNULL_BEGIN
+
+@interface SKInCallViewController (time)
+
+@property(nonatomic, strong, nullable) NSTimer* mTimer;
+@property(nonatomic, assign) NSInteger mTimecost;
+
+- (void)startTimer;
+- (void)stopTimer;
+
+@end
+
+NS_ASSUME_NONNULL_END

+ 39 - 0
artimenring-iOS/Artimenring/Classes/ViewController/Call/SKInCallViewController+time.m

@@ -0,0 +1,39 @@
+//
+//  SKInCallViewController+time.m
+//  SikeyComm
+//
+//  Created by 刘振兴 on 2025/2/14.
+//  Copyright © 2025 BaH Cy. All rights reserved.
+//
+
+#import "SKInCallViewController+time.h"
+
+@implementation SKInCallViewController (time)
+
+- (void)startTimer {
+    if (self.mTimer == nil) {
+        self.mTimer = [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(talkingTimeCallback) userInfo:nil repeats:YES];
+    }
+    self.mTimecost = 0;
+}
+
+- (void)stopTimer {
+    if (self.mTimer) {
+        [self.mTimer invalidate];
+        self.mTimer = nil;
+    }
+}
+
+- (void)talkingTimeCallback {
+    self.mTimecost++;
+    self.mIngHeaderView.hidden = NO;
+    JCCallItem *activeCall = [[VideoManager shared] getActiveCall];
+    self.mIngTimeLabel.text = [self formatTalkingTime:self.mTimecost];
+    self.mIngNetWorkLabel.text = @"";
+}
+
+- (NSString *)formatTalkingTime:(long)time {
+    return [NSString stringWithFormat:@"%02ld:%02ld", time/60, time%60];
+}
+
+@end

+ 0 - 5
artimenring-iOS/Artimenring/Classes/ViewController/Call/SKInCallViewController.h

@@ -11,8 +11,6 @@
 @interface SKInCallViewController : UIViewController
 
 //video view
-@property (nonatomic, strong) UIView* localView;
-@property (nonatomic, strong) UIView* remoteView;
 @property (nonatomic, strong) UIView* smallView;
 
 //base view
@@ -43,7 +41,4 @@
 @property (nonatomic, strong) IBOutlet UIButton *speakerBtn;
 @property (nonatomic, strong) IBOutlet UIButton *endCallBtn;
 
-- (void)startTimer;
-- (void)stopTimer;
-
 @end

+ 1 - 45
artimenring-iOS/Artimenring/Classes/ViewController/Call/SKInCallViewController.m

@@ -9,15 +9,10 @@
 #import "SKInCallViewController.h"
 #import "SKInCallViewController+juphoon.h"
 #import "SKInCallViewController+agora.h"
+#import "SKInCallViewController+time.h"
 #import "SKInCallViewController+touch.h"
 #import "VideoManager+ringtone.h"
 
-
-@interface SKInCallViewController() {
-    NSTimer* _timer;
-}
-@end
-
 @implementation SKInCallViewController
 
 - (void)viewDidLoad {
@@ -133,43 +128,4 @@
 - (IBAction)callStatistics:(id)sender {
 }
 
-#pragma mark - 工具函数
-- (NSString *)getCallInfo:(JCCallItem*)item {
-    switch (item.state) {
-        case JCCallStateTalking:
-            return [self formatTalkingTime:((long)[[NSDate date] timeIntervalSince1970] - item.talkingBeginTime)];
-        default:
-            return @"";
-    }
-}
-
-- (NSString *)formatTalkingTime:(long)time {
-    return [NSString stringWithFormat:@"%02ld:%02ld", time/60, time%60];
-}
-
-#pragma mark - Timer
-- (void)startTimer {
-    if (_timer == nil) {
-        _timer = [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(timerProc) userInfo:nil repeats:YES];
-    }
-}
-
-- (void)stopTimer {
-    if (_timer) {
-        if ([_timer isValid]) {
-            [_timer invalidate];
-            _timer = nil;
-        }
-    }
-}
-
-- (void)timerProc {
-    self.mIngHeaderView.hidden = NO;
-    JCCallItem *activeCall = [[VideoManager shared] getActiveCall];
-    self.mIngTimeLabel.text = [self getCallInfo:activeCall];
-    self.mIngNetWorkLabel.text = [self getNetStatus:activeCall];
-    if (activeCall.direction == JCCallDirectionOut) {
-    }
-}
-
 @end

+ 8 - 2
artimenring-iOS/SikeyComm.xcodeproj/project.pbxproj

@@ -237,6 +237,7 @@
 		E4499A922D5DD55700653B56 /* SKInCallViewController+touch.m in Sources */ = {isa = PBXBuildFile; fileRef = E4499A912D5DD55700653B56 /* SKInCallViewController+touch.m */; };
 		E4499A972D5DDFEA00653B56 /* VideoManager+juphoon.m in Sources */ = {isa = PBXBuildFile; fileRef = E4499A932D5DDFEA00653B56 /* VideoManager+juphoon.m */; };
 		E4499A982D5DDFEA00653B56 /* VideoManager+agora.m in Sources */ = {isa = PBXBuildFile; fileRef = E4499A942D5DDFEA00653B56 /* VideoManager+agora.m */; };
+		E4499A9B2D5F3B7100653B56 /* SKInCallViewController+time.m in Sources */ = {isa = PBXBuildFile; fileRef = E4499A9A2D5F3B7100653B56 /* SKInCallViewController+time.m */; };
 		E44FCB072BA1542B00C7E9CF /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = E44FCB032BA1542B00C7E9CF /* Main.storyboard */; };
 		E44FCB142BA15BB500C7E9CF /* View.xib in Resources */ = {isa = PBXBuildFile; fileRef = E44FCB122BA15BB400C7E9CF /* View.xib */; };
 		E459F07E2B6B3D16002571E3 /* WifiAddListViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E459F0352B6B3D16002571E3 /* WifiAddListViewController.m */; };
@@ -822,6 +823,8 @@
 		E4499A942D5DDFEA00653B56 /* VideoManager+agora.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "VideoManager+agora.m"; sourceTree = "<group>"; };
 		E4499A952D5DDFEA00653B56 /* VideoManager+juphoon.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "VideoManager+juphoon.h"; sourceTree = "<group>"; };
 		E4499A962D5DDFEA00653B56 /* VideoManager+agora.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "VideoManager+agora.h"; sourceTree = "<group>"; };
+		E4499A992D5F3B7100653B56 /* SKInCallViewController+time.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "SKInCallViewController+time.h"; sourceTree = "<group>"; };
+		E4499A9A2D5F3B7100653B56 /* SKInCallViewController+time.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "SKInCallViewController+time.m"; sourceTree = "<group>"; };
 		E44FCB042BA1542B00C7E9CF /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
 		E44FCB132BA15BB400C7E9CF /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/View.xib; sourceTree = "<group>"; };
 		E459F0332B6B3D16002571E3 /* WifiListCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WifiListCell.h; sourceTree = "<group>"; };
@@ -2291,10 +2294,12 @@
 			children = (
 				E49A83702B625B3A00D5B289 /* SKInCallViewController.h */,
 				E49A83712B625B3A00D5B289 /* SKInCallViewController.m */,
-				E4499A8A2D5D954200653B56 /* SKInCallViewController+juphoon.h */,
-				E4499A8B2D5D954200653B56 /* SKInCallViewController+juphoon.m */,
 				E4499A8D2D5D955200653B56 /* SKInCallViewController+agora.h */,
 				E4499A8E2D5D955200653B56 /* SKInCallViewController+agora.m */,
+				E4499A8A2D5D954200653B56 /* SKInCallViewController+juphoon.h */,
+				E4499A8B2D5D954200653B56 /* SKInCallViewController+juphoon.m */,
+				E4499A992D5F3B7100653B56 /* SKInCallViewController+time.h */,
+				E4499A9A2D5F3B7100653B56 /* SKInCallViewController+time.m */,
 				E4499A902D5DD55700653B56 /* SKInCallViewController+touch.h */,
 				E4499A912D5DD55700653B56 /* SKInCallViewController+touch.m */,
 			);
@@ -3208,6 +3213,7 @@
 				E41ECB932CF95DD700C4C36C /* SKChatMessageButton.m in Sources */,
 				E41ECB9E2CF95DD700C4C36C /* SKChatViewController+keyboard.m in Sources */,
 				E4FE9B622AD9465100DEABCA /* SSHolidayCountry.m in Sources */,
+				E4499A9B2D5F3B7100653B56 /* SKInCallViewController+time.m in Sources */,
 				E4735C472B6CE81900FCF9D9 /* UIView+Hierarchy.m in Sources */,
 				E41ECB5D2CF95C6C00C4C36C /* SKMainViewController+realpos.m in Sources */,
 				E4A44AEB2D228B8900FCB559 /* SKNavigationView.m in Sources */,