Skip to content

Commit

Permalink
删除辣鸡代码
Browse files Browse the repository at this point in the history
  • Loading branch information
crazypoo committed Dec 6, 2022
1 parent aeabf6b commit 3d044d2
Show file tree
Hide file tree
Showing 13 changed files with 5,252 additions and 5,521 deletions.
10,148 changes: 5,076 additions & 5,072 deletions Pods/Pods.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions PooTools.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@
5599AE9E28FCEE250035A364 /* PTCountingLabel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5599AE9D28FCEE250035A364 /* PTCountingLabel.swift */; };
559C1C93293AF138002874BA /* NSURLResponse+PTEX.swift in Sources */ = {isa = PBXBuildFile; fileRef = 559C1C92293AF138002874BA /* NSURLResponse+PTEX.swift */; };
559C1C95293CB789002874BA /* PTRotationManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 559C1C94293CB789002874BA /* PTRotationManager.swift */; };
559C1C97293F7ED8002874BA /* NSData+PTEX.swift in Sources */ = {isa = PBXBuildFile; fileRef = 559C1C96293F7ED8002874BA /* NSData+PTEX.swift */; };
55C7A2B02926995900220926 /* PTPhoneNetWorkInfo.swift in Sources */ = {isa = PBXBuildFile; fileRef = 55C7A2AF2926995900220926 /* PTPhoneNetWorkInfo.swift */; };
55C9CBA128E8505E00DB6200 /* PTBaseModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 55C9CBA028E8505E00DB6200 /* PTBaseModel.swift */; };
55C9CBA328E851DA00DB6200 /* Network.swift in Sources */ = {isa = PBXBuildFile; fileRef = 55C9CBA228E851DA00DB6200 /* Network.swift */; };
Expand Down Expand Up @@ -339,6 +340,7 @@
5599AE9D28FCEE250035A364 /* PTCountingLabel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PTCountingLabel.swift; sourceTree = "<group>"; };
559C1C92293AF138002874BA /* NSURLResponse+PTEX.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NSURLResponse+PTEX.swift"; sourceTree = "<group>"; };
559C1C94293CB789002874BA /* PTRotationManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PTRotationManager.swift; sourceTree = "<group>"; };
559C1C96293F7ED8002874BA /* NSData+PTEX.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NSData+PTEX.swift"; sourceTree = "<group>"; };
55C7A2AF2926995900220926 /* PTPhoneNetWorkInfo.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PTPhoneNetWorkInfo.swift; sourceTree = "<group>"; };
55C9CBA028E8505E00DB6200 /* PTBaseModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PTBaseModel.swift; sourceTree = "<group>"; };
55C9CBA228E851DA00DB6200 /* Network.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Network.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -601,6 +603,7 @@
9AE4469C28597B1F007DC2B5 /* FileManager+PTEX.swift */,
9A14E99A2861BB3100D7E8EF /* Float+PTEX.swift */,
9A14E9982861B9D700D7E8EF /* Int+PTEX.swift */,
559C1C96293F7ED8002874BA /* NSData+PTEX.swift */,
231D15B7272CDEE9003D6F62 /* NSDictionary+PTEX.swift */,
231D15BB272CDEE9003D6F62 /* NSMutableArray+PTEX.swift */,
231D1501272CDEE9003D6F62 /* NSMutableString+TagReplace.h */,
Expand Down Expand Up @@ -1584,6 +1587,7 @@
554929EF28F9089D00C82ABF /* PTPermissionHeader.swift in Sources */,
231D1699272CDEEA003D6F62 /* JYBDBankCardSearch.m in Sources */,
9A14E98A28616B4100D7E8EF /* LLFilledPageControl.swift in Sources */,
559C1C97293F7ED8002874BA /* NSData+PTEX.swift in Sources */,
9AE4469428586A59007DC2B5 /* UIFont+PTEX.swift in Sources */,
9A14E98728616B4000D7E8EF /* LLImagePageControl.swift in Sources */,
231D1626272CDEE9003D6F62 /* UITextField+ModifyPlaceholder.m in Sources */,
Expand Down
3 changes: 1 addition & 2 deletions PooTools/PTSwiftViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ class PTSwiftViewController: UIViewController {
#if canImport(LifetimeTracker)
LifetimeTracker.setup(onUpdate: LifetimeTrackerDashboardIntegration(visibility: .alwaysVisible, style: .bar).refreshUI)
#endif

let card1 = "621226200000000000"
let card2 = "123456789098765"
let idcard = "111111111111111111"
Expand All @@ -50,7 +49,7 @@ class PTSwiftViewController: UIViewController {

print((idcard as NSString).getIdentityCardAge())

print(("1234" as NSString).getuperDigit())
print(("123456789" as NSString).getuperDigit())

PTBankSimpleInfoNetwork.getBankSimpleInfo(cardNum: card1 as NSString) { model in
print(model.logoUrl)
Expand Down
2 changes: 1 addition & 1 deletion PooToolsSource/ApplicationFunction/PTLaunchAdMonitor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ public class PTLaunchAdMonitor: NSObject {
func loadImageAtPath(path:NSArray)
{
let imageStr = path.firstObject
if PTUtils.contentTypeForUrl(url: imageStr as! String) == PTUrlStringVideoType.MP4
if (imageStr as! NSString).contentTypeForUrl() == PTUrlStringVideoType.MP4
{
playMovie = true
imgLoaded = true
Expand Down
40 changes: 40 additions & 0 deletions PooToolsSource/Category/Application+PTEX.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,44 @@ public extension PTProtocol where Base: UIApplication
let country = usLocale.displayName(forKey: NSLocale.Key.countryCode, value: countryCode!)
return country!
}

/*! @brief iOS更换App图标
* @attention 此方法必须在info.plist中添加Icon files (iOS 5)字段,k&vCFBundleAlternateIcons ={IconName={CFBundleIconFiles =(IconName);UIPrerenderedIcon = 0;};};CFBundlePrimaryIcon={CFBundleIconFiles=(AppIcon20x20,AppIcon29x29,AppIcon40x40,AppIcon60x60);};
*/
static func changeAppIcon()
{
if UIApplication.shared.supportsAlternateIcons
{
PTNSLog("you can change this app's icon")
}
else
{
PTNSLog("you can not change this app's icon")
return
}

let iconName = UIApplication.shared.alternateIconName
if !(iconName ?? "").stringIsEmpty()
{
UIApplication.shared.setAlternateIconName(nil) { error in
if error != nil
{
PTUtils.gobal_drop(title: error.debugDescription)

}
PTNSLog("The alternate icon's name is \(String(describing: iconName))")
}
}
else
{
UIApplication.shared.setAlternateIconName(iconName) { error in
if error != nil
{
PTUtils.gobal_drop(title: error.debugDescription)

}
PTNSLog("The alternate icon's name is \(String(describing: iconName))")
}
}
}
}
4 changes: 2 additions & 2 deletions PooToolsSource/Category/FileManager+PTEX.swift
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,7 @@ public extension PTProtocol where Base: FileManager {

// MARK: - 三、有关视频缩略图获取的扩展
// 视频URL的类型
enum JKVideoUrlType {
enum PTVideoUrlType {
// 本地
case local
// 服务器
Expand Down Expand Up @@ -681,7 +681,7 @@ public extension PTProtocol where Base: FileManager {
/// - maximumSize: 设置图片的最大size(分辨率)
/// - preferredTrackTransform: 设定缩略图的方向,如果不设定,可能会在视频旋转90/180/270°时,获取到的缩略图是被旋转过的,而不是正向的
/// - Returns: 返回获取的图片
private static func getVideoImage(videoUrlSouceType: JKVideoUrlType = .local, path: String, seconds: Double = 1, preferredTimescale: CMTimeScale = 10, maximumSize: CGSize?, preferredTrackTransform: Bool = true) -> UIImage? {
private static func getVideoImage(videoUrlSouceType: PTVideoUrlType = .local, path: String, seconds: Double = 1, preferredTimescale: CMTimeScale = 10, maximumSize: CGSize?, preferredTrackTransform: Bool = true) -> UIImage? {
var videoURL: URL?

if videoUrlSouceType == .local {
Expand Down
40 changes: 40 additions & 0 deletions PooToolsSource/Category/NSData+PTEX.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
//
// NSData+PTEX.swift
// PooTools_Example
//
// Created by 邓杰豪 on 6/12/22.
// Copyright © 2022 crazypoo. All rights reserved.
//

import UIKit

public extension NSData
{
@objc func getImageDataType() -> PTAboutImageType {
var c: UInt8 = 0
self.getBytes(&c, length: 1)
switch c {
case 0xff:
return .JPEG
case 0x89:
return .PNG
case 0x47:
return .GIF
case 0x49, 0x4d:
return .TIFF
case 0x52:
if (self.count) < 12 {
return .UNKNOW
}
var testString = NSString(data: self.subdata(with: NSMakeRange(0, 12)), encoding: NSASCIIStringEncoding)

if testString?.hasPrefix("RIFF") ?? false && testString?.hasSuffix("WEBP") ?? false {
return .WEBP
}
return .UNKNOW
default:
break
}
return .UNKNOW
}
}
19 changes: 19 additions & 0 deletions PooToolsSource/Category/NSString+PTEX.swift
Original file line number Diff line number Diff line change
Expand Up @@ -228,5 +228,24 @@ public extension NSString
}
}
}

@objc func contentTypeForUrl()->PTUrlStringVideoType
{
let pathEX = self.pathExtension.lowercased()

if pathEX.contains("mp4")
{
return .MP4
}
else if pathEX.contains("mov")
{
return .MOV
}
else if pathEX.contains("3gp")
{
return .ThreeGP
}
return .UNKNOW
}
}

16 changes: 8 additions & 8 deletions PooToolsSource/Category/String+PTEX.swift
Original file line number Diff line number Diff line change
Expand Up @@ -907,14 +907,14 @@ public extension String
//默认封面图
return UIColor.randomColor.createImageWithColor()
}
let aset = AVURLAsset(url: URL(fileURLWithPath: self), options: nil)
let assetImg = AVAssetImageGenerator(asset: aset)
assetImg.appliesPreferredTrackTransform = true
assetImg.apertureMode = AVAssetImageGenerator.ApertureMode.encodedPixels
do{
let cgimgref = try assetImg.copyCGImage(at: CMTime(seconds: 10, preferredTimescale: 50), actualTime: nil)
return UIImage(cgImage: cgimgref)
}catch{

let image = FileManager.pt.getLocalVideoImage(videoPath: self)
if image != nil
{
return image!
}
else
{
return UIColor.randomColor.createImageWithColor()
}
}
Expand Down
21 changes: 21 additions & 0 deletions PooToolsSource/Category/UIView+PTEX.swift
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,27 @@ public extension UIView {
self.setNeedsDisplay()
}
}

func isRolling()->Bool
{
if self is UIScrollView
{
let scrollView = self as! UIScrollView
if scrollView.isDragging || scrollView.isDecelerating
{
return true
}
}

for subView in self.subviews
{
if subView.isRolling()
{
return true
}
}
return false
}
}

public extension UIView
Expand Down
60 changes: 40 additions & 20 deletions PooToolsSource/Core/PTUtils.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@ import AVFoundation
import NotificationBannerSwift
import SwiftDate

@objc public enum CheckContractTimeRelationships:Int
{
case Expire
case ReadyExpire
case Normal
case Error
}

@objc public enum PTUrlStringVideoType:Int {
case MP4
case MOV
Expand Down Expand Up @@ -316,26 +324,7 @@ public class PTUtils: NSObject {
}
}
}

public class func contentTypeForUrl(url:String)->PTUrlStringVideoType
{
let pathEX = url.pathExtension.lowercased()

if pathEX.contains("mp4")
{
return .MP4
}
else if pathEX.contains("mov")
{
return .MOV
}
else if pathEX.contains("3gp")
{
return .ThreeGP
}
return .UNKNOW
}


public class func sizeFor(string:String,
font:UIFont,
lineSpacing:CGFloat? = nil,
Expand Down Expand Up @@ -917,6 +906,37 @@ public class PTUtils: NSObject {
}
return prefix.appending(suffix as String) as NSString
}

//MARK: 合同时间状态检测
open class func checkContractTimeType(begainTime:String,endTime:String,readyExpTime:Int)->CheckContractTimeRelationships
{
let begainTimeDate = begainTime.toDate("yyyy-MM-dd")!
let endTimeDate = endTime.toDate("yyyy-MM-dd")!
let timeDifference = endTimeDate.timeIntervalSince(begainTimeDate)
let thirty = NSNumber(integerLiteral: readyExpTime).floatValue
let result = timeDifference.float - thirty
if result > (-thirty) && result < thirty
{
return .ReadyExpire
}
else if result < (-thirty)
{
return .Expire
}
else if result > 0
{
return .Normal
}
else
{
return .Error
}
}

open class func checkContractTimeType_now(endTime:String,readyExpTime:Int)->CheckContractTimeRelationships
{
return PTUtils.checkContractTimeType(begainTime: Date().toFormat("yyyy-MM-dd"), endTime: endTime, readyExpTime: readyExpTime)
}
}

//MARK: OC-FUNCTION
Expand Down
Loading

0 comments on commit 3d044d2

Please sign in to comment.