This commit is contained in:
DDIsFriend
2023-09-19 11:04:22 +08:00
parent 4b5e345397
commit 004df124ed
7 changed files with 33 additions and 77 deletions

View File

@@ -3841,8 +3841,8 @@
filePath = "OrderScheduling/Global/Tool/Tool.swift"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "169"
endingLineNumber = "169"
startingLineNumber = "119"
endingLineNumber = "119"
landmarkName = "playVoiceWith(userInfo:)"
landmarkType = "7">
<Locations>
@@ -3889,8 +3889,8 @@
filePath = "OrderScheduling/Global/Tool/Tool.swift"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "160"
endingLineNumber = "160"
startingLineNumber = "110"
endingLineNumber = "110"
landmarkName = "Tool"
landmarkType = "3">
</BreakpointContent>
@@ -4097,8 +4097,8 @@
filePath = "OrderScheduling/Global/Tool/Tool.swift"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "181"
endingLineNumber = "181"
startingLineNumber = "131"
endingLineNumber = "131"
landmarkName = "playVoiceWith(userInfo:)"
landmarkType = "7">
</BreakpointContent>

View File

@@ -56,7 +56,7 @@ open class SystemCall {
self?.isConnected = false
self?.isDisconnected = false
self?.callTime = Date().dd_toString(format: "yyyy-MM-dd HH:mm:ss")
self?.callTime = Date().dd_toString(format: .yyyyMMddHHmmssDefault)
self?.dialingTimeInterval = Date().timeIntervalSince1970
break
case "CTCallStateIncoming":

View File

@@ -71,56 +71,6 @@ open class Tool {
return dateString
}
public func getVersion() -> String {
return (Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String) ?? "1.0.0"
}
public func getIPhoneCode() -> String {
var systemInfo = utsname()
uname(&systemInfo)
let versionCode: String = String(validatingUTF8: NSString(bytes: &systemInfo.machine, length: Int(_SYS_NAMELEN), encoding: String.Encoding.ascii.rawValue)!.utf8String!)!
switch versionCode {
/*** iPhone ***/
case "iPhone5,1", "iPhone5,2": return "iPhone5"
case "iPhone5,3", "iPhone5,4": return "iPhone5C"
case "iPhone6,1", "iPhone6,2": return "iPhone5S"
case "iPhone7,2": return "iPhone6"
case "iPhone7,1": return "iPhone6Plus"
case "iPhone8,1": return "iPhone6S"
case "iPhone8,2": return "iPhone6SPlus"
case "iPhone8,3", "iPhone8,4": return "iPhoneSE"
case "iPhone9,1", "iPhone9,3": return "iPhone7"
case "iPhone9,2", "iPhone9,4": return "iPhone7Plus"
case "iPhone10,1", "iPhone10,4": return "iPhone8"
case "iPhone10,2", "iPhone10,5": return "iPhone8Plus"
case "iPhone10,3", "iPhone10,6": return "iPhoneX"
case "iPhone11,2": return "iPhoneXS"
case "iPhone11,4", "iPhone11,6": return "iPhoneXS_Max"
case "iPhone11,8": return "iPhoneXR"
case "iPhone12,1": return "iPhone11"
case "iPhone12,3": return "iPhone11Pro"
case "iPhone12,5": return "iPhone11Pro_Max"
case "iPhone12,8": return "iPhoneSE2"
case "iPhone13,1": return "iPhone12Mini"
case "iPhone13,2": return "iPhone12"
case "iPhone13,3": return "iPhone12Pro"
case "iPhone13,4": return "iPhone12Pro_Max"
case "iPhone14,4": return "iPhone13Mini"
case "iPhone14,5": return "iPhone13"
case "iPhone14,2": return "iPhone13Pro"
case "iPhone14,3": return "iPhone13Pro_Max"
case "iPhone14,7": return "iPhone14"
case "iPhone14,8": return "iPhone14Plus"
case "iPhone15,2": return "iPhone14Pro"
case "iPhone15,3": return "iPhone14Pro_Max"
default:
break
}
return "未知"
}
// MARK:
func getOrderString(userInfo:[AnyHashable:Any]?) -> String{
var string : String = ""

View File

@@ -179,7 +179,7 @@ PODS:
- DDBasicControlsKit_Private/DDBaseView
- DDControlsKit_Private/DDViewController (0.1.2):
- DDBasicControlsKit_Private/DDBaseViewController
- DDDateKit_Private (0.1.0)
- DDDateKit_Private (0.1.1)
- DDFontKit_Private (0.1.0)
- DDLogKit_Private (0.1.4):
- DDLogKit_Private/OCLog (= 0.1.4)
@@ -391,7 +391,7 @@ SPEC CHECKSUMS:
DDCategoryKit_Private: 19d515c43d5e9c4ee80b8ccf3fb8ab40368b8668
DDColorKit_Private: 77fddb62410a2d5e6fb003083d233c0d7ea0a08f
DDControlsKit_Private: c3ac79b391cec6ecb26262a0d3b02718f696ab19
DDDateKit_Private: d77cfb4eb068446a17fc6e7688b050ae2ca11d72
DDDateKit_Private: f8348d10cec77ccacd2f5ec27d587ea2898ae90a
DDFontKit_Private: 7b8f4ebf0f60622874036202734d8460dc7b3806
DDLogKit_Private: 1ed442cc7be004bd05f27bfda9b525e113df54e0
DDMAMapKit_Private: fda2942ba7a3b7da4d440e59a89db9fd6708d842

View File

@@ -8,6 +8,12 @@ import Foundation
public let DDDATE = DDDate.default
public enum DateFormatEnum : String {
case yyyyMMddHHmmssDefault = "yyyy-MM-dd HH:mm:ss"
case yyyyMMddDefault = "yyyy-MM-dd"
case HHmmssDefault = "HH:mm:ss"
}
open class DDDate {
public static let `default` = DDDate()
// 使
@@ -55,8 +61,8 @@ extension Date {
/// - locale:
/// - timeZoneIdentifier:
/// - Returns:
public func dd_toString(format:String,locale:String? = nil,timeZoneIdentifier:String? = nil) -> String {
return DDDATE.getDateFormatter(format: format,locale: locale,timeZoneIdentifier: timeZoneIdentifier).string(from: self)
public func dd_toString(format:DateFormatEnum,locale:String? = nil,timeZoneIdentifier:String? = nil) -> String {
return DDDATE.getDateFormatter(format: format.rawValue,locale: locale,timeZoneIdentifier: timeZoneIdentifier).string(from: self)
}
/// date
@@ -103,14 +109,14 @@ extension Date {
return "\(min)分钟前"
}
return "今天\(dd_toString(format: "HH:mm:ss"))"
return "今天\(dd_toString(format: .HHmmssDefault))"
}
if isYesterday() == true {
return "昨天\(dd_toString(format: "HH:mm:ss"))"
return "昨天\(dd_toString(format: .HHmmssDefault))"
}
return dd_toString(format: "yyyy-MM-dd HH:mm:ss")
return dd_toString(format: .yyyyMMddHHmmssDefault)
}
}
@@ -120,9 +126,9 @@ extension String {
/// - dateString:
/// - format: ,
/// - Returns: true
public func dd_compare(dateString:String,format:String) -> ComparisonResult? {
let date = dd_toDate(format: self)
let compareDate = dd_toDate(format: self)
public func dd_compare(dateString:String,format:DateFormatEnum) -> ComparisonResult? {
let date = dd_toDate(format: format)
let compareDate = dateString.dd_toDate(format: format)
guard date != nil,compareDate != nil else {
return nil
}
@@ -135,15 +141,15 @@ extension String {
/// - locale:
/// - timeZoneIdentifier:
/// - Returns: date
public func dd_toDate(format:String,locale:String? = nil,timeZoneIdentifier:String? = nil) -> Date? {
return DDDATE.getDateFormatter(format: format,locale: locale,timeZoneIdentifier: timeZoneIdentifier).date(from: self)
public func dd_toDate(format:DateFormatEnum,locale:String? = nil,timeZoneIdentifier:String? = nil) -> Date? {
return DDDATE.getDateFormatter(format: format.rawValue,locale: locale,timeZoneIdentifier: timeZoneIdentifier).date(from: self)
}
///
/// - Parameter format:
/// - Returns:
public func dd_timeIntervalSince1970(format:String) -> TimeInterval? {
public func dd_timeIntervalSince1970(format:DateFormatEnum) -> TimeInterval? {
let date = dd_toDate(format: format)
guard date != nil else {
return nil
@@ -154,7 +160,7 @@ extension String {
///
/// - Parameter format:
/// - Returns:
public func dd_timeIntervalSssSince1970(format:String) -> TimeInterval? {
public func dd_timeIntervalSssSince1970(format:DateFormatEnum) -> TimeInterval? {
let timeInterval = dd_timeIntervalSince1970(format: format)
guard timeInterval != nil else {
return nil
@@ -166,7 +172,7 @@ extension String {
///
/// - Parameter format:
/// - Returns:
public func isYesterday(format:String) -> Bool {
public func isYesterday(format:DateFormatEnum) -> Bool {
let date = dd_toDate(format: format)
guard date != nil else {
return false
@@ -177,7 +183,7 @@ extension String {
///
/// - Parameter format:
/// - Returns:
public func isToday(format:String) -> Bool {
public func isToday(format:DateFormatEnum) -> Bool {
let date = dd_toDate(format: format)
guard date != nil else {
return false
@@ -188,7 +194,7 @@ extension String {
///
/// - Parameter format:
/// - Returns:
public func isTomorrow(format:String) -> Bool {
public func isTomorrow(format:DateFormatEnum) -> Bool {
let date = dd_toDate(format: format)
guard date != nil else {
return false
@@ -200,7 +206,7 @@ extension String {
/// - Parameters:
/// - format:
/// - Returns:
public func dd_pushNotificationDateFormatString(format:String) -> String? {
public func dd_pushNotificationDateFormatString(format:DateFormatEnum) -> String? {
let date = dd_toDate(format: format)
return date?.dd_pushNotificationDateFormatString()
}

4
Pods/Manifest.lock generated
View File

@@ -179,7 +179,7 @@ PODS:
- DDBasicControlsKit_Private/DDBaseView
- DDControlsKit_Private/DDViewController (0.1.2):
- DDBasicControlsKit_Private/DDBaseViewController
- DDDateKit_Private (0.1.0)
- DDDateKit_Private (0.1.1)
- DDFontKit_Private (0.1.0)
- DDLogKit_Private (0.1.4):
- DDLogKit_Private/OCLog (= 0.1.4)
@@ -391,7 +391,7 @@ SPEC CHECKSUMS:
DDCategoryKit_Private: 19d515c43d5e9c4ee80b8ccf3fb8ab40368b8668
DDColorKit_Private: 77fddb62410a2d5e6fb003083d233c0d7ea0a08f
DDControlsKit_Private: c3ac79b391cec6ecb26262a0d3b02718f696ab19
DDDateKit_Private: d77cfb4eb068446a17fc6e7688b050ae2ca11d72
DDDateKit_Private: f8348d10cec77ccacd2f5ec27d587ea2898ae90a
DDFontKit_Private: 7b8f4ebf0f60622874036202734d8460dc7b3806
DDLogKit_Private: 1ed442cc7be004bd05f27bfda9b525e113df54e0
DDMAMapKit_Private: fda2942ba7a3b7da4d440e59a89db9fd6708d842