新疆框架

This commit is contained in:
History
2025-06-30 09:33:34 +08:00
commit 593b22626d
1291 changed files with 107611 additions and 0 deletions
+50
View File
@@ -0,0 +1,50 @@
platform :ios, '12.0'
# 忽略引入库的所有警告
inhibit_all_warnings!
# 防止 TUIKit 组件里的 *.xcassets 与您项目里面冲突。
install! 'cocoapods', :disable_input_output_paths => true
# 通过指定use_frameworks!要求生成的是framework而不是静态库。
target 'XinjiangProject' do
pod 'MJRefresh'
pod 'MBProgressHUD'
pod 'Masonry'
pod 'YYKit'
pod 'IQKeyboardManager' #iOS8 and later
pod 'SDCycleScrollView'
pod 'TZImagePickerController'
# 列表控制
# 集成聊天功能
pod 'TUIChat/UI_Classic','~> 7.3.4358'
# 集成会话功能
pod 'TUIConversation/UI_Classic','~> 7.3.4358'
# 集成关系链功能
pod 'TUIContact/UI_Classic','~> 7.3.4358'
# 集成群组功能
pod 'TUIGroup/UI_Classic','~> 7.3.4358'
# 集成搜索功能(需要购买旗舰版套餐)
pod 'TUISearch/UI_Classic','~> 7.3.4358'
# 集成离线推送
pod 'TUIOfflinePush','~> 7.3.4358'
# 集成音视频通话功能
pod 'TUICallKit','~> 1.7.0.460'
pod 'TUICallKit/TRTC','~> 1.7.0.460'
pod 'TXIMSDK_Plus_iOS','~> 7.3.4358'
pod 'TXLiteAVSDK_TRTC/TRTC','~> 11.2.14217'
pod 'TUICore','~> 7.3.4358'
# 高德地图相关
pod 'SJVideoPlayer'
pod 'SJUIKit'
pod 'AFNetworking'
pod 'AMap3DMap','~>10.0.600'
pod 'AMapSearch','~>9.5.0'
pod 'AMapLocation','~>2.9.0'
pod 'SDWebImageWebPCoder'
pod 'SDWebImage'
pod 'FMDB'
pod 'FMDB/SQLCipher'
end
+516
View File
@@ -0,0 +1,516 @@
PODS:
- AFNetworking (4.0.1):
- AFNetworking/NSURLSession (= 4.0.1)
- AFNetworking/Reachability (= 4.0.1)
- AFNetworking/Security (= 4.0.1)
- AFNetworking/Serialization (= 4.0.1)
- AFNetworking/UIKit (= 4.0.1)
- AFNetworking/NSURLSession (4.0.1):
- AFNetworking/Reachability
- AFNetworking/Security
- AFNetworking/Serialization
- AFNetworking/Reachability (4.0.1)
- AFNetworking/Security (4.0.1)
- AFNetworking/Serialization (4.0.1)
- AFNetworking/UIKit (4.0.1):
- AFNetworking/NSURLSession
- AMap3DMap (10.0.1000):
- AMapFoundation (>= 1.8.0)
- AMapFoundation (1.8.2)
- AMapLocation (2.9.0):
- AMapFoundation (>= 1.7.0)
- AMapSearch (9.5.0):
- AMapFoundation (>= 1.8.0)
- FMDB (2.7.12):
- FMDB/standard (= 2.7.12)
- FMDB/Core (2.7.12)
- FMDB/SQLCipher (2.7.12):
- FMDB/Core
- SQLCipher (~> 4.6)
- FMDB/standard (2.7.12):
- FMDB/Core
- IQKeyboardManager (6.5.19)
- libwebp (1.5.0):
- libwebp/demux (= 1.5.0)
- libwebp/mux (= 1.5.0)
- libwebp/sharpyuv (= 1.5.0)
- libwebp/webp (= 1.5.0)
- libwebp/demux (1.5.0):
- libwebp/webp
- libwebp/mux (1.5.0):
- libwebp/demux
- libwebp/sharpyuv (1.5.0)
- libwebp/webp (1.5.0):
- libwebp/sharpyuv
- Masonry (1.1.0)
- MBProgressHUD (1.2.0)
- MJRefresh (3.7.9)
- ReactiveObjC (3.1.1)
- SDCycleScrollView (1.82):
- SDWebImage (>= 5.0.0)
- SDWebImage (5.21.0):
- SDWebImage/Core (= 5.21.0)
- SDWebImage/Core (5.21.0)
- SDWebImageWebPCoder (0.14.6):
- libwebp (~> 1.0)
- SDWebImage/Core (~> 5.17)
- SJBaseVideoPlayer (3.7.7.1):
- Masonry
- SJBaseVideoPlayer/AVPlayer (= 3.7.7.1)
- SJBaseVideoPlayer/Common (= 3.7.7.1)
- SJUIKit/AttributesFactory (>= 0.0.0.38)
- SJUIKit/ObserverHelper
- SJUIKit/Queues
- SJUIKit/SQLite3
- SJBaseVideoPlayer/AVPlayer (3.7.7.1):
- Masonry
- SJBaseVideoPlayer/Common
- SJUIKit/AttributesFactory (>= 0.0.0.38)
- SJUIKit/ObserverHelper
- SJUIKit/Queues
- SJUIKit/SQLite3
- SJBaseVideoPlayer/Common (3.7.7.1):
- Masonry
- SJBaseVideoPlayer/ResourceLoader
- SJUIKit/AttributesFactory (>= 0.0.0.38)
- SJUIKit/ObserverHelper
- SJUIKit/Queues
- SJUIKit/SQLite3
- SJBaseVideoPlayer/ResourceLoader (3.7.7.1):
- Masonry
- SJUIKit/AttributesFactory (>= 0.0.0.38)
- SJUIKit/ObserverHelper
- SJUIKit/Queues
- SJUIKit/SQLite3
- SJUIKit (0.0.0.59):
- SJUIKit/AsyncLoad (= 0.0.0.59)
- SJUIKit/AttributesFactory (= 0.0.0.59)
- SJUIKit/Base (= 0.0.0.59)
- SJUIKit/CornerMask (= 0.0.0.59)
- SJUIKit/Date (= 0.0.0.59)
- SJUIKit/ObserverHelper (= 0.0.0.59)
- SJUIKit/Other (= 0.0.0.59)
- SJUIKit/PageViewController (= 0.0.0.59)
- SJUIKit/Photo (= 0.0.0.59)
- SJUIKit/PlaybackListController (= 0.0.0.59)
- SJUIKit/Queues (= 0.0.0.59)
- SJUIKit/Refresh (= 0.0.0.59)
- SJUIKit/SQLite3 (= 0.0.0.59)
- SJUIKit/Thread (= 0.0.0.59)
- SJUIKit/UIMaker (= 0.0.0.59)
- SJUIKit/AsyncLoad (0.0.0.59):
- SJUIKit/CornerMask
- SJUIKit/AttributesFactory (0.0.0.59):
- SJUIKit/AttributesFactory/Deprecated (= 0.0.0.59)
- SJUIKit/AttributesFactory/UIKitText (= 0.0.0.59)
- SJUIKit/AttributesFactory/Deprecated (0.0.0.59)
- SJUIKit/AttributesFactory/UIKitText (0.0.0.59)
- SJUIKit/Base (0.0.0.59):
- SJUIKit/Base/Core (= 0.0.0.59)
- SJUIKit/ObserverHelper
- SJUIKit/Base/Core (0.0.0.59):
- SJUIKit/ObserverHelper
- SJUIKit/CornerMask (0.0.0.59):
- SJUIKit/ObserverHelper
- SJUIKit/Date (0.0.0.59)
- SJUIKit/ObserverHelper (0.0.0.59)
- SJUIKit/Other (0.0.0.59):
- SJUIKit/Date
- SJUIKit/PageViewController (0.0.0.59):
- SJUIKit/PageViewController/Core (= 0.0.0.59)
- SJUIKit/PageViewController/Core (0.0.0.59)
- SJUIKit/Photo (0.0.0.59)
- SJUIKit/PlaybackListController (0.0.0.59)
- SJUIKit/Queues (0.0.0.59)
- SJUIKit/Refresh (0.0.0.59):
- MJRefresh
- SJUIKit/SQLite3 (0.0.0.59):
- SJUIKit/SQLite3/Core (= 0.0.0.59)
- SJUIKit/SQLite3/Protocol (= 0.0.0.59)
- YYModel
- SJUIKit/SQLite3/Core (0.0.0.59):
- SJUIKit/SQLite3/Protocol
- YYModel
- SJUIKit/SQLite3/Protocol (0.0.0.59):
- YYModel
- SJUIKit/Thread (0.0.0.59)
- SJUIKit/UIMaker (0.0.0.59):
- SJUIKit/UIMaker/Core (= 0.0.0.59)
- SJUIKit/UIMaker/Core (0.0.0.59)
- SJVideoPlayer (3.4.3):
- SJBaseVideoPlayer (>= 3.7.5)
- SJVideoPlayer/Common (= 3.4.3)
- SJVideoPlayer/ControlLayers (= 3.4.3)
- SJVideoPlayer/ResourceLoader (= 3.4.3)
- SJVideoPlayer/Common (3.4.3):
- Masonry
- SJBaseVideoPlayer (>= 3.7.5)
- SJUIKit/AttributesFactory
- SJVideoPlayer/ResourceLoader
- SJVideoPlayer/ControlLayers (3.4.3):
- SJBaseVideoPlayer (>= 3.7.5)
- SJVideoPlayer/Common
- SJVideoPlayer/ResourceLoader (3.4.3):
- SJBaseVideoPlayer (>= 3.7.5)
- SQLCipher (4.8.0):
- SQLCipher/standard (= 4.8.0)
- SQLCipher/common (4.8.0)
- SQLCipher/standard (4.8.0):
- SQLCipher/common
- TIMCommon (7.3.4358):
- TIMCommon/BaseCell (= 7.3.4358)
- TIMCommon/CommonModel (= 7.3.4358)
- TIMCommon/UI_Classic (= 7.3.4358)
- TIMCommon/UI_Minimalist (= 7.3.4358)
- TIMCommon/BaseCell (7.3.4358):
- TIMCommon/BaseCell/CellData (= 7.3.4358)
- TIMCommon/BaseCell/CellUI (= 7.3.4358)
- TIMCommon/BaseCell/CellData (7.3.4358):
- TIMCommon/CommonModel
- TIMCommon/BaseCell/CellUI (7.3.4358):
- TIMCommon/BaseCell/CellData
- TIMCommon/CommonModel (7.3.4358):
- ReactiveObjC
- SDWebImage
- TUICore (= 7.3.4358)
- TXIMSDK_Plus_iOS (= 7.3.4358)
- TIMCommon/UI_Classic (7.3.4358):
- TIMCommon/UI_Classic/Cell (= 7.3.4358)
- TIMCommon/UI_Classic/Cell (7.3.4358):
- TIMCommon/UI_Classic/Cell/CellData (= 7.3.4358)
- TIMCommon/UI_Classic/Cell/CellUI (= 7.3.4358)
- TIMCommon/UI_Classic/Cell/CellData (7.3.4358):
- TIMCommon/BaseCell
- TIMCommon/UI_Classic/Cell/CellUI (7.3.4358):
- TIMCommon/UI_Classic/Cell/CellData
- TIMCommon/UI_Minimalist (7.3.4358):
- TIMCommon/UI_Minimalist/Cell (= 7.3.4358)
- TIMCommon/UI_Minimalist/Cell (7.3.4358):
- TIMCommon/UI_Minimalist/Cell/CellData (= 7.3.4358)
- TIMCommon/UI_Minimalist/Cell/CellUI (= 7.3.4358)
- TIMCommon/UI_Minimalist/Cell/CellData (7.3.4358):
- TIMCommon/BaseCell
- TIMCommon/UI_Minimalist/Cell/CellUI (7.3.4358):
- TIMCommon/UI_Minimalist/Cell/CellData
- TUICallEngine/TRTC (1.7.0.465):
- TXIMSDK_Plus_iOS (~> 7.3.4358)
- TXLiteAVSDK_TRTC (>= 11.0.14028)
- TUICallKit (1.7.0.460):
- Masonry
- TUICallKit/TRTC (= 1.7.0.460)
- TUICore (~> 7.3.4358)
- TUICallKit/TRTC (1.7.0.460):
- Masonry
- TUICallEngine/TRTC (~> 1.7.0.460)
- TUICore (~> 7.3.4358)
- TXLiteAVSDK_TRTC
- TUIChat/BaseCell (7.3.4358):
- TUIChat/BaseCell/CellData (= 7.3.4358)
- TUIChat/BaseCell/CellUI (= 7.3.4358)
- TUIChat/BaseCell/CellData (7.3.4358):
- TUIChat/CommonModel
- TUIChat/BaseCell/CellUI (7.3.4358):
- TUIChat/BaseCell/CellData
- TUIChat/BaseDataProvider (7.3.4358):
- TUIChat/BaseCell
- TUIChat/CommonModel (7.3.4358):
- ReactiveObjC
- SDWebImage
- TIMCommon (= 7.3.4358)
- TUIChat/VoiceConvert
- TUICore (= 7.3.4358)
- TXIMSDK_Plus_iOS (= 7.3.4358)
- TUIChat/CommonUI (7.3.4358):
- TUIChat/CommonUI/Camera (= 7.3.4358)
- TUIChat/CommonUI/Pendency (= 7.3.4358)
- TUIChat/CommonUI/Pop (= 7.3.4358)
- TUIChat/CommonUI/Camera (7.3.4358):
- TUIChat/BaseDataProvider
- TUIChat/CommonUI/Pendency (7.3.4358):
- TUIChat/BaseDataProvider
- TUIChat/CommonUI/Pop (7.3.4358):
- TUIChat/BaseDataProvider
- TUIChat/UI_Classic (7.3.4358):
- TUIChat/UI_Classic/Cell (= 7.3.4358)
- TUIChat/UI_Classic/Chat (= 7.3.4358)
- TUIChat/UI_Classic/DataProvider (= 7.3.4358)
- TUIChat/UI_Classic/Header (= 7.3.4358)
- TUIChat/UI_Classic/Input (= 7.3.4358)
- TUIChat/UI_Classic/Service (= 7.3.4358)
- TUIChat/UI_Classic/Cell (7.3.4358):
- TUIChat/UI_Classic/Cell/CellData (= 7.3.4358)
- TUIChat/UI_Classic/Cell/CellUI (= 7.3.4358)
- TUIChat/UI_Classic/Cell/CellData (7.3.4358):
- TUIChat/UI_Classic/Cell/CellData/Base (= 7.3.4358)
- TUIChat/UI_Classic/Cell/CellData/Chat (= 7.3.4358)
- TUIChat/UI_Classic/Cell/CellData/Custom (= 7.3.4358)
- TUIChat/UI_Classic/Cell/CellData/Reply (= 7.3.4358)
- TUIChat/UI_Classic/Cell/CellData/Base (7.3.4358):
- TUIChat/CommonUI
- TUIChat/UI_Classic/Cell/CellData/Chat (7.3.4358):
- TUIChat/UI_Classic/Cell/CellData/Base
- TUIChat/UI_Classic/Cell/CellData/Custom (7.3.4358):
- TUIChat/UI_Classic/Cell/CellData/Chat
- TUIChat/UI_Classic/Cell/CellData/Reply (7.3.4358):
- TUIChat/UI_Classic/Cell/CellData/Custom
- TUIChat/UI_Classic/Cell/CellUI (7.3.4358):
- TUIChat/UI_Classic/Cell/CellUI/Base (= 7.3.4358)
- TUIChat/UI_Classic/Cell/CellUI/Chat (= 7.3.4358)
- TUIChat/UI_Classic/Cell/CellUI/Custom (= 7.3.4358)
- TUIChat/UI_Classic/Cell/CellUI/Reply (= 7.3.4358)
- TUIChat/UI_Classic/Cell/CellUI/Base (7.3.4358):
- TUIChat/UI_Classic/Cell/CellData
- TUIChat/UI_Classic/Cell/CellUI/Chat (7.3.4358):
- TUIChat/UI_Classic/Cell/CellUI/Base
- TUIChat/UI_Classic/Cell/CellUI/Custom (7.3.4358):
- TUIChat/UI_Classic/Cell/CellUI/Chat
- TUIChat/UI_Classic/Cell/CellUI/Reply (7.3.4358):
- TUIChat/UI_Classic/Cell/CellUI/Custom
- TUIChat/UI_Classic/Chat (7.3.4358):
- TUIChat/UI_Classic/Input
- TUIChat/UI_Classic/DataProvider (7.3.4358):
- TUIChat/UI_Classic/Cell
- TUIChat/UI_Classic/Header (7.3.4358):
- TUIChat/UI_Classic/Service
- TUIChat/UI_Classic/Input (7.3.4358):
- TUIChat/UI_Classic/DataProvider
- TUIChat/UI_Classic/Service (7.3.4358):
- TUIChat/UI_Classic/Chat
- TUIChat/VoiceConvert (7.3.4358)
- TUIContact/BaseCell (7.3.4358):
- TUIContact/BaseCell/CellData (= 7.3.4358)
- TUIContact/BaseCell/CellUI (= 7.3.4358)
- TUIContact/BaseCell/CellData (7.3.4358):
- ReactiveObjC
- TIMCommon (= 7.3.4358)
- TUICore (= 7.3.4358)
- TXIMSDK_Plus_iOS (= 7.3.4358)
- TUIContact/BaseCell/CellUI (7.3.4358):
- TUIContact/BaseCell/CellData
- TUIContact/BaseDataProvider (7.3.4358):
- TUIContact/BaseCell
- TUIContact/CommonUI (7.3.4358):
- TUIContact/BaseDataProvider
- TUIContact/UI_Classic (7.3.4358):
- TUIContact/UI_Classic/Header (= 7.3.4358)
- TUIContact/UI_Classic/Service (= 7.3.4358)
- TUIContact/UI_Classic/UI (= 7.3.4358)
- TUIContact/UI_Classic/Header (7.3.4358):
- TUIContact/UI_Classic/Service
- TUIContact/UI_Classic/Service (7.3.4358):
- TUIContact/UI_Classic/UI
- TUIContact/UI_Classic/UI (7.3.4358):
- TUIContact/CommonUI
- TUIConversation/BaseCell (7.3.4358):
- TUIConversation/BaseCell/CellData (= 7.3.4358)
- TUIConversation/BaseCell/CellUI (= 7.3.4358)
- TUIConversation/BaseCell/CellData (7.3.4358):
- TUIConversation/CommonModel
- TUIConversation/BaseCell/CellUI (7.3.4358):
- TUIConversation/BaseCell/CellData
- TUIConversation/BaseDataProvider (7.3.4358):
- TUIConversation/BaseCell
- TUIConversation/CommonModel (7.3.4358):
- ReactiveObjC
- TIMCommon (= 7.3.4358)
- TUICore (= 7.3.4358)
- TXIMSDK_Plus_iOS (= 7.3.4358)
- TUIConversation/UI_Classic (7.3.4358):
- TUIConversation/UI_Classic/DataProvider (= 7.3.4358)
- TUIConversation/UI_Classic/Header (= 7.3.4358)
- TUIConversation/UI_Classic/Service (= 7.3.4358)
- TUIConversation/UI_Classic/UI (= 7.3.4358)
- TUIConversation/UI_Classic/DataProvider (7.3.4358):
- TUIConversation/BaseDataProvider
- TUIConversation/UI_Classic/Header (7.3.4358):
- TUIConversation/UI_Classic/Service
- TUIConversation/UI_Classic/Service (7.3.4358):
- TUIConversation/UI_Classic/UI
- TUIConversation/UI_Classic/UI (7.3.4358):
- TUIConversation/UI_Classic/DataProvider
- TUICore (7.3.4358):
- ReactiveObjC
- SDWebImage
- TUICore/ImSDK_Plus (= 7.3.4358)
- TUICore/Base (7.3.4358):
- ReactiveObjC
- SDWebImage
- TUICore/ImSDK_Plus (7.3.4358):
- ReactiveObjC
- SDWebImage
- TUICore/Base
- TXIMSDK_Plus_iOS (= 7.3.4358)
- TUIGroup/BaseCell (7.3.4358):
- TUIGroup/BaseCell/CellData (= 7.3.4358)
- TUIGroup/BaseCell/CellUI (= 7.3.4358)
- TUIGroup/BaseCell/CellData (7.3.4358):
- TUIGroup/CommonModel
- TUIGroup/BaseCell/CellUI (7.3.4358):
- TUIGroup/BaseCell/CellData
- TUIGroup/BaseDataProvider (7.3.4358):
- TUIGroup/BaseCell
- TUIGroup/CommonModel (7.3.4358):
- ReactiveObjC
- TIMCommon (= 7.3.4358)
- TUICore (= 7.3.4358)
- TXIMSDK_Plus_iOS (= 7.3.4358)
- TUIGroup/CommonUI (7.3.4358):
- TUIGroup/BaseDataProvider
- TUIGroup/UI_Classic (7.3.4358):
- TUIGroup/UI_Classic/Header (= 7.3.4358)
- TUIGroup/UI_Classic/Service (= 7.3.4358)
- TUIGroup/UI_Classic/UI (= 7.3.4358)
- TUIGroup/UI_Classic/Header (7.3.4358):
- TUIGroup/UI_Classic/Service
- TUIGroup/UI_Classic/Service (7.3.4358):
- TUIGroup/UI_Classic/UI
- TUIGroup/UI_Classic/UI (7.3.4358):
- TUIGroup/CommonUI
- TUIOfflinePush (7.3.4358):
- TUIOfflinePush/APNS (= 7.3.4358)
- TUIOfflinePush/APNS (7.3.4358):
- TUIOfflinePush/Base
- TUIOfflinePush/Base (7.3.4358):
- TUICore (= 7.3.4358)
- TXIMSDK_Plus_iOS (= 7.3.4358)
- TUISearch/BaseCell (7.3.4358):
- TUISearch/BaseCell/CellData (= 7.3.4358)
- TUISearch/BaseCell/CellUI (= 7.3.4358)
- TUISearch/BaseCell/CellData (7.3.4358):
- TIMCommon (= 7.3.4358)
- TUICore (= 7.3.4358)
- TXIMSDK_Plus_iOS (= 7.3.4358)
- TUISearch/BaseCell/CellUI (7.3.4358):
- TUISearch/BaseCell/CellData
- TUISearch/BaseDataProvider (7.3.4358):
- TUISearch/BaseCell
- TUISearch/UI_Classic (7.3.4358):
- TUISearch/UI_Classic/Header (= 7.3.4358)
- TUISearch/UI_Classic/Service (= 7.3.4358)
- TUISearch/UI_Classic/UI (= 7.3.4358)
- TUISearch/UI_Classic/Header (7.3.4358):
- TUISearch/UI_Classic/Service
- TUISearch/UI_Classic/Service (7.3.4358):
- TUISearch/UI_Classic/UI
- TUISearch/UI_Classic/UI (7.3.4358):
- TUISearch/BaseDataProvider
- TXIMSDK_Plus_iOS (7.3.4358)
- TXLiteAVSDK_TRTC (11.2.14217):
- TXLiteAVSDK_TRTC/TRTC (= 11.2.14217)
- TXLiteAVSDK_TRTC/TRTC (11.2.14217)
- TZImagePickerController (3.8.8):
- TZImagePickerController/Basic (= 3.8.8)
- TZImagePickerController/Location (= 3.8.8)
- TZImagePickerController/Basic (3.8.8)
- TZImagePickerController/Location (3.8.8)
- YYKit (1.0.9):
- YYKit/no-arc (= 1.0.9)
- YYKit/no-arc (1.0.9)
- YYModel (1.0.4)
DEPENDENCIES:
- AFNetworking
- AMap3DMap (~> 10.0.600)
- AMapLocation (~> 2.9.0)
- AMapSearch (~> 9.5.0)
- FMDB
- FMDB/SQLCipher
- IQKeyboardManager
- Masonry
- MBProgressHUD
- MJRefresh
- SDCycleScrollView
- SDWebImage
- SDWebImageWebPCoder
- SJUIKit
- SJVideoPlayer
- TUICallKit (~> 1.7.0.460)
- TUICallKit/TRTC (~> 1.7.0.460)
- TUIChat/UI_Classic (~> 7.3.4358)
- TUIContact/UI_Classic (~> 7.3.4358)
- TUIConversation/UI_Classic (~> 7.3.4358)
- TUICore (~> 7.3.4358)
- TUIGroup/UI_Classic (~> 7.3.4358)
- TUIOfflinePush (~> 7.3.4358)
- TUISearch/UI_Classic (~> 7.3.4358)
- TXIMSDK_Plus_iOS (~> 7.3.4358)
- TXLiteAVSDK_TRTC/TRTC (~> 11.2.14217)
- TZImagePickerController
- YYKit
SPEC REPOS:
trunk:
- AFNetworking
- AMap3DMap
- AMapFoundation
- AMapLocation
- AMapSearch
- FMDB
- IQKeyboardManager
- libwebp
- Masonry
- MBProgressHUD
- MJRefresh
- ReactiveObjC
- SDCycleScrollView
- SDWebImage
- SDWebImageWebPCoder
- SJBaseVideoPlayer
- SJUIKit
- SJVideoPlayer
- SQLCipher
- TIMCommon
- TUICallEngine
- TUICallKit
- TUIChat
- TUIContact
- TUIConversation
- TUICore
- TUIGroup
- TUIOfflinePush
- TUISearch
- TXIMSDK_Plus_iOS
- TXLiteAVSDK_TRTC
- TZImagePickerController
- YYKit
- YYModel
SPEC CHECKSUMS:
AFNetworking: 3bd23d814e976cd148d7d44c3ab78017b744cd58
AMap3DMap: 2896b8d63034aaf79720a402573362ca2fef0dec
AMapFoundation: 9885c48fc3a78fdfb84a0299a2293e56ea3c9fec
AMapLocation: f5eb11e11c62f0f599f80b578eec8a1f70deb985
AMapSearch: e0c81206b8ac1d27ef349095a96ea6398e3a0da3
FMDB: 728731dd336af3936ce00f91d9d8495f5718a0e6
IQKeyboardManager: c8665b3396bd0b79402b4c573eac345a31c7d485
libwebp: 02b23773aedb6ff1fd38cec7a77b81414c6842a8
Masonry: 678fab65091a9290e40e2832a55e7ab731aad201
MBProgressHUD: 3ee5efcc380f6a79a7cc9b363dd669c5e1ae7406
MJRefresh: ff9e531227924c84ce459338414550a05d2aea78
ReactiveObjC: 011caa393aa0383245f2dcf9bf02e86b80b36040
SDCycleScrollView: a0d74c3384caa72bdfc81470bdbc8c14b3e1fbcf
SDWebImage: f84b0feeb08d2d11e6a9b843cb06d75ebf5b8868
SDWebImageWebPCoder: e38c0a70396191361d60c092933e22c20d5b1380
SJBaseVideoPlayer: b3122de12225b27b71bd9a8a1f08f4dcf2f4e5ec
SJUIKit: a40111941e408cc17d4c1c23495aa92999e814b0
SJVideoPlayer: 4f09814f58522e0975cb2dccfda925f6c8643467
SQLCipher: 908f846ca79d74be4e1776b3b86c6ad9e6c0b04f
TIMCommon: 2adea2895422a640e100125f6fccc0dc2aeff44b
TUICallEngine: 01b8f82535f0c01284740a9b7c3a5cf823aa7feb
TUICallKit: fc30ed879d2a92e24ffaa194e8df1087dfbedd33
TUIChat: 557dd6872606d9da7f36913af92ee95c8e651795
TUIContact: 0079dd736935a77e6c14c864e516232cb70466bd
TUIConversation: 643823f80f0958b7263ac24411e397fcd5f37e78
TUICore: b0e525287eb03f95fe648a696c9ffb253fc87098
TUIGroup: 6a4133f356bd240997ac11bb94f89648899096f7
TUIOfflinePush: e5787da66713361da4ed64b90ca196c094f483de
TUISearch: 18a208d0ef13eb7bf7f44eae01ffefb26803aaf3
TXIMSDK_Plus_iOS: bc72c7cec1b5e975c3cc6629692c849513a932f5
TXLiteAVSDK_TRTC: cdab9adefc42a5e0a4fea4035e624af441ba3e83
TZImagePickerController: d084a7b97c82d387e7669dd86dc9a9057500aacf
YYKit: 7cda43304a8dc3696c449041e2cb3107b4e236e7
YYModel: 2a7fdd96aaa4b86a824e26d0c517de8928c04b30
PODFILE CHECKSUM: c63ef0a5edf68dd395621c435af5c0063b38442a
COCOAPODS: 1.16.2
@@ -0,0 +1,687 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 77;
objects = {
/* Begin PBXBuildFile section */
2A9D6F4901C83B23A09A207B /* libPods-XinjiangProject.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5380821CF956D8001EF91CA7 /* libPods-XinjiangProject.a */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
1809E47E2E092C740034C8FC /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 1809E45A2E092C710034C8FC /* Project object */;
proxyType = 1;
remoteGlobalIDString = 1809E4612E092C710034C8FC;
remoteInfo = XinjiangProject;
};
1809E4882E092C740034C8FC /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 1809E45A2E092C710034C8FC /* Project object */;
proxyType = 1;
remoteGlobalIDString = 1809E4612E092C710034C8FC;
remoteInfo = XinjiangProject;
};
/* End PBXContainerItemProxy section */
/* Begin PBXFileReference section */
1809E4622E092C710034C8FC /* XinjiangProject.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = XinjiangProject.app; sourceTree = BUILT_PRODUCTS_DIR; };
1809E47D2E092C740034C8FC /* XinjiangProjectTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = XinjiangProjectTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
1809E4872E092C740034C8FC /* XinjiangProjectUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = XinjiangProjectUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
5380821CF956D8001EF91CA7 /* libPods-XinjiangProject.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-XinjiangProject.a"; sourceTree = BUILT_PRODUCTS_DIR; };
D5F062871D7E5499A760A0A9 /* Pods-XinjiangProject.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-XinjiangProject.release.xcconfig"; path = "Target Support Files/Pods-XinjiangProject/Pods-XinjiangProject.release.xcconfig"; sourceTree = "<group>"; };
F4F935FBD1765B37B37D212D /* Pods-XinjiangProject.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-XinjiangProject.debug.xcconfig"; path = "Target Support Files/Pods-XinjiangProject/Pods-XinjiangProject.debug.xcconfig"; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFileSystemSynchronizedBuildFileExceptionSet section */
1809E48F2E092C740034C8FC /* Exceptions for "XinjiangProject" folder in "XinjiangProject" target */ = {
isa = PBXFileSystemSynchronizedBuildFileExceptionSet;
membershipExceptions = (
"Supporting Files/Info.plist",
);
target = 1809E4612E092C710034C8FC /* XinjiangProject */;
};
/* End PBXFileSystemSynchronizedBuildFileExceptionSet section */
/* Begin PBXFileSystemSynchronizedRootGroup section */
1809E4642E092C710034C8FC /* XinjiangProject */ = {
isa = PBXFileSystemSynchronizedRootGroup;
exceptions = (
1809E48F2E092C740034C8FC /* Exceptions for "XinjiangProject" folder in "XinjiangProject" target */,
);
path = XinjiangProject;
sourceTree = "<group>";
};
1809E4802E092C740034C8FC /* XinjiangProjectTests */ = {
isa = PBXFileSystemSynchronizedRootGroup;
path = XinjiangProjectTests;
sourceTree = "<group>";
};
1809E48A2E092C740034C8FC /* XinjiangProjectUITests */ = {
isa = PBXFileSystemSynchronizedRootGroup;
path = XinjiangProjectUITests;
sourceTree = "<group>";
};
/* End PBXFileSystemSynchronizedRootGroup section */
/* Begin PBXFrameworksBuildPhase section */
1809E45F2E092C710034C8FC /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
2A9D6F4901C83B23A09A207B /* libPods-XinjiangProject.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
1809E47A2E092C740034C8FC /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
1809E4842E092C740034C8FC /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
1809E4592E092C710034C8FC = {
isa = PBXGroup;
children = (
1809E4642E092C710034C8FC /* XinjiangProject */,
1809E4802E092C740034C8FC /* XinjiangProjectTests */,
1809E48A2E092C740034C8FC /* XinjiangProjectUITests */,
1809E4632E092C710034C8FC /* Products */,
AF58E7BBA422572602E63ED7 /* Pods */,
5E0194FB12246C95B3FA5215 /* Frameworks */,
);
sourceTree = "<group>";
};
1809E4632E092C710034C8FC /* Products */ = {
isa = PBXGroup;
children = (
1809E4622E092C710034C8FC /* XinjiangProject.app */,
1809E47D2E092C740034C8FC /* XinjiangProjectTests.xctest */,
1809E4872E092C740034C8FC /* XinjiangProjectUITests.xctest */,
);
name = Products;
sourceTree = "<group>";
};
5E0194FB12246C95B3FA5215 /* Frameworks */ = {
isa = PBXGroup;
children = (
5380821CF956D8001EF91CA7 /* libPods-XinjiangProject.a */,
);
name = Frameworks;
sourceTree = "<group>";
};
AF58E7BBA422572602E63ED7 /* Pods */ = {
isa = PBXGroup;
children = (
F4F935FBD1765B37B37D212D /* Pods-XinjiangProject.debug.xcconfig */,
D5F062871D7E5499A760A0A9 /* Pods-XinjiangProject.release.xcconfig */,
);
path = Pods;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
1809E4612E092C710034C8FC /* XinjiangProject */ = {
isa = PBXNativeTarget;
buildConfigurationList = 1809E4902E092C740034C8FC /* Build configuration list for PBXNativeTarget "XinjiangProject" */;
buildPhases = (
E4291FE3C5BA9A5AD560484A /* [CP] Check Pods Manifest.lock */,
1809E45E2E092C710034C8FC /* Sources */,
1809E45F2E092C710034C8FC /* Frameworks */,
1809E4602E092C710034C8FC /* Resources */,
FCFFDBE5429B0BC3E8B22A74 /* [CP] Embed Pods Frameworks */,
492BA72AF1480CCB968A855C /* [CP] Copy Pods Resources */,
);
buildRules = (
);
dependencies = (
);
fileSystemSynchronizedGroups = (
1809E4642E092C710034C8FC /* XinjiangProject */,
);
name = XinjiangProject;
productName = XinjiangProject;
productReference = 1809E4622E092C710034C8FC /* XinjiangProject.app */;
productType = "com.apple.product-type.application";
};
1809E47C2E092C740034C8FC /* XinjiangProjectTests */ = {
isa = PBXNativeTarget;
buildConfigurationList = 1809E4952E092C740034C8FC /* Build configuration list for PBXNativeTarget "XinjiangProjectTests" */;
buildPhases = (
1809E4792E092C740034C8FC /* Sources */,
1809E47A2E092C740034C8FC /* Frameworks */,
1809E47B2E092C740034C8FC /* Resources */,
);
buildRules = (
);
dependencies = (
1809E47F2E092C740034C8FC /* PBXTargetDependency */,
);
fileSystemSynchronizedGroups = (
1809E4802E092C740034C8FC /* XinjiangProjectTests */,
);
name = XinjiangProjectTests;
productName = XinjiangProjectTests;
productReference = 1809E47D2E092C740034C8FC /* XinjiangProjectTests.xctest */;
productType = "com.apple.product-type.bundle.unit-test";
};
1809E4862E092C740034C8FC /* XinjiangProjectUITests */ = {
isa = PBXNativeTarget;
buildConfigurationList = 1809E4982E092C740034C8FC /* Build configuration list for PBXNativeTarget "XinjiangProjectUITests" */;
buildPhases = (
1809E4832E092C740034C8FC /* Sources */,
1809E4842E092C740034C8FC /* Frameworks */,
1809E4852E092C740034C8FC /* Resources */,
);
buildRules = (
);
dependencies = (
1809E4892E092C740034C8FC /* PBXTargetDependency */,
);
fileSystemSynchronizedGroups = (
1809E48A2E092C740034C8FC /* XinjiangProjectUITests */,
);
name = XinjiangProjectUITests;
productName = XinjiangProjectUITests;
productReference = 1809E4872E092C740034C8FC /* XinjiangProjectUITests.xctest */;
productType = "com.apple.product-type.bundle.ui-testing";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
1809E45A2E092C710034C8FC /* Project object */ = {
isa = PBXProject;
attributes = {
BuildIndependentTargetsInParallel = 1;
LastUpgradeCheck = 1630;
TargetAttributes = {
1809E4612E092C710034C8FC = {
CreatedOnToolsVersion = 16.3;
};
1809E47C2E092C740034C8FC = {
CreatedOnToolsVersion = 16.3;
TestTargetID = 1809E4612E092C710034C8FC;
};
1809E4862E092C740034C8FC = {
CreatedOnToolsVersion = 16.3;
TestTargetID = 1809E4612E092C710034C8FC;
};
};
};
buildConfigurationList = 1809E45D2E092C710034C8FC /* Build configuration list for PBXProject "XinjiangProject" */;
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = 1809E4592E092C710034C8FC;
minimizedProjectReferenceProxies = 1;
preferredProjectObjectVersion = 77;
productRefGroup = 1809E4632E092C710034C8FC /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
1809E4612E092C710034C8FC /* XinjiangProject */,
1809E47C2E092C740034C8FC /* XinjiangProjectTests */,
1809E4862E092C740034C8FC /* XinjiangProjectUITests */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
1809E4602E092C710034C8FC /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
1809E47B2E092C740034C8FC /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
1809E4852E092C740034C8FC /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
492BA72AF1480CCB968A855C /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
);
name = "[CP] Copy Pods Resources";
outputFileListPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-XinjiangProject/Pods-XinjiangProject-resources.sh\"\n";
showEnvVarsInLog = 0;
};
E4291FE3C5BA9A5AD560484A /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
"${PODS_ROOT}/Manifest.lock",
);
name = "[CP] Check Pods Manifest.lock";
outputFileListPaths = (
);
outputPaths = (
"$(DERIVED_FILE_DIR)/Pods-XinjiangProject-checkManifestLockResult.txt",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
FCFFDBE5429B0BC3E8B22A74 /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
);
name = "[CP] Embed Pods Frameworks";
outputFileListPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-XinjiangProject/Pods-XinjiangProject-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
1809E45E2E092C710034C8FC /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
1809E4792E092C740034C8FC /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
1809E4832E092C740034C8FC /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
1809E47F2E092C740034C8FC /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 1809E4612E092C710034C8FC /* XinjiangProject */;
targetProxy = 1809E47E2E092C740034C8FC /* PBXContainerItemProxy */;
};
1809E4892E092C740034C8FC /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 1809E4612E092C710034C8FC /* XinjiangProject */;
targetProxy = 1809E4882E092C740034C8FC /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */
/* Begin XCBuildConfiguration section */
1809E4912E092C740034C8FC /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = F4F935FBD1765B37B37D212D /* Pods-XinjiangProject.debug.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = A7CC5LW224;
ENABLE_USER_SCRIPT_SANDBOXING = NO;
GCC_PREFIX_HEADER = "$(SRCROOT)/XinjiangProject/Supporting Files/PrefixHeader.pch";
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = "$(SRCROOT)/XinjiangProject/Supporting Files/Info.plist";
INFOPLIST_KEY_CFBundleDisplayName = "新疆亚克西";
INFOPLIST_KEY_ITSAppUsesNonExemptEncryption = NO;
INFOPLIST_KEY_NSCameraUsageDescription = "健康咨询员工端需要访问您的相机用来档案功能,是否同意?";
INFOPLIST_KEY_NSLocationAlwaysAndWhenInUseUsageDescription = "APP需要您的定位服务,否则可能无法使用。";
INFOPLIST_KEY_NSLocationAlwaysUsageDescription = "APP需要您的定位服务,否则可能无法使用。";
INFOPLIST_KEY_NSLocationWhenInUseUsageDescription = "APP需要您的定位服务,否则可能无法使用。";
INFOPLIST_KEY_NSMicrophoneUsageDescription = "健康咨询员工端需要访问您的麦克风用来视频录制,是否同意?";
INFOPLIST_KEY_NSPhotoLibraryAddUsageDescription = "新疆员工端需要访问您的相册上传图片,方便您的使用,是否同意?";
INFOPLIST_KEY_NSPhotoLibraryUsageDescription = "健康咨询想使用您的相册功能 是否同意?";
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen;
INFOPLIST_KEY_UISupportedInterfaceOrientations = UIInterfaceOrientationPortrait;
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown";
INFOPLIST_KEY_UIUserInterfaceStyle = Light;
IPHONEOS_DEPLOYMENT_TARGET = 15.6;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = com.questionTools.XinjiangProject;
PRODUCT_NAME = "$(TARGET_NAME)";
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
SUPPORTS_MACCATALYST = NO;
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = NO;
SWIFT_EMIT_LOC_STRINGS = YES;
TARGETED_DEVICE_FAMILY = 1;
};
name = Debug;
};
1809E4922E092C740034C8FC /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = D5F062871D7E5499A760A0A9 /* Pods-XinjiangProject.release.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = A7CC5LW224;
ENABLE_USER_SCRIPT_SANDBOXING = NO;
GCC_PREFIX_HEADER = "$(SRCROOT)/XinjiangProject/Supporting Files/PrefixHeader.pch";
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = "$(SRCROOT)/XinjiangProject/Supporting Files/Info.plist";
INFOPLIST_KEY_CFBundleDisplayName = "新疆亚克西";
INFOPLIST_KEY_ITSAppUsesNonExemptEncryption = NO;
INFOPLIST_KEY_NSCameraUsageDescription = "健康咨询员工端需要访问您的相机用来档案功能,是否同意?";
INFOPLIST_KEY_NSLocationAlwaysAndWhenInUseUsageDescription = "APP需要您的定位服务,否则可能无法使用。";
INFOPLIST_KEY_NSLocationAlwaysUsageDescription = "APP需要您的定位服务,否则可能无法使用。";
INFOPLIST_KEY_NSLocationWhenInUseUsageDescription = "APP需要您的定位服务,否则可能无法使用。";
INFOPLIST_KEY_NSMicrophoneUsageDescription = "健康咨询员工端需要访问您的麦克风用来视频录制,是否同意?";
INFOPLIST_KEY_NSPhotoLibraryAddUsageDescription = "新疆员工端需要访问您的相册上传图片,方便您的使用,是否同意?";
INFOPLIST_KEY_NSPhotoLibraryUsageDescription = "健康咨询想使用您的相册功能 是否同意?";
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen;
INFOPLIST_KEY_UISupportedInterfaceOrientations = UIInterfaceOrientationPortrait;
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown";
INFOPLIST_KEY_UIUserInterfaceStyle = Light;
IPHONEOS_DEPLOYMENT_TARGET = 15.6;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = com.questionTools.XinjiangProject;
PRODUCT_NAME = "$(TARGET_NAME)";
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
SUPPORTS_MACCATALYST = NO;
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = NO;
SWIFT_EMIT_LOC_STRINGS = YES;
TARGETED_DEVICE_FAMILY = 1;
};
name = Release;
};
1809E4932E092C740034C8FC /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = dwarf;
DEVELOPMENT_TEAM = A7CC5LW224;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
ENABLE_USER_SCRIPT_SANDBOXING = YES;
GCC_C_LANGUAGE_STANDARD = gnu17;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 18.4;
LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
};
name = Debug;
};
1809E4942E092C740034C8FC /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEVELOPMENT_TEAM = A7CC5LW224;
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_USER_SCRIPT_SANDBOXING = YES;
GCC_C_LANGUAGE_STANDARD = gnu17;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 18.4;
LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
SDKROOT = iphoneos;
VALIDATE_PRODUCT = YES;
};
name = Release;
};
1809E4962E092C740034C8FC /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = A7CC5LW224;
GENERATE_INFOPLIST_FILE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 18.4;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = com.questionTools.XinjiangProjectTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = NO;
TARGETED_DEVICE_FAMILY = "1,2";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/XinjiangProject.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/XinjiangProject";
};
name = Debug;
};
1809E4972E092C740034C8FC /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = A7CC5LW224;
GENERATE_INFOPLIST_FILE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 18.4;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = com.questionTools.XinjiangProjectTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = NO;
TARGETED_DEVICE_FAMILY = "1,2";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/XinjiangProject.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/XinjiangProject";
};
name = Release;
};
1809E4992E092C740034C8FC /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = A7CC5LW224;
GENERATE_INFOPLIST_FILE = YES;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = com.questionTools.XinjiangProjectUITests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = NO;
TARGETED_DEVICE_FAMILY = "1,2";
TEST_TARGET_NAME = XinjiangProject;
};
name = Debug;
};
1809E49A2E092C740034C8FC /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = A7CC5LW224;
GENERATE_INFOPLIST_FILE = YES;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = com.questionTools.XinjiangProjectUITests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = NO;
TARGETED_DEVICE_FAMILY = "1,2";
TEST_TARGET_NAME = XinjiangProject;
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
1809E45D2E092C710034C8FC /* Build configuration list for PBXProject "XinjiangProject" */ = {
isa = XCConfigurationList;
buildConfigurations = (
1809E4932E092C740034C8FC /* Debug */,
1809E4942E092C740034C8FC /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
1809E4902E092C740034C8FC /* Build configuration list for PBXNativeTarget "XinjiangProject" */ = {
isa = XCConfigurationList;
buildConfigurations = (
1809E4912E092C740034C8FC /* Debug */,
1809E4922E092C740034C8FC /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
1809E4952E092C740034C8FC /* Build configuration list for PBXNativeTarget "XinjiangProjectTests" */ = {
isa = XCConfigurationList;
buildConfigurations = (
1809E4962E092C740034C8FC /* Debug */,
1809E4972E092C740034C8FC /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
1809E4982E092C740034C8FC /* Build configuration list for PBXNativeTarget "XinjiangProjectUITests" */ = {
isa = XCConfigurationList;
buildConfigurations = (
1809E4992E092C740034C8FC /* Debug */,
1809E49A2E092C740034C8FC /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 1809E45A2E092C710034C8FC /* Project object */;
}
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:">
</FileRef>
</Workspace>
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "group:XinjiangProject.xcodeproj">
</FileRef>
<FileRef
location = "group:Pods/Pods.xcodeproj">
</FileRef>
</Workspace>
@@ -0,0 +1,90 @@
//
// NSArray+Sudoku.h
// EscortProject
//
// Created by Apple on 2024/3/4.
//
#import "MASUtilities.h"
#import "MASConstraintMaker.h"
#import "MASViewAttribute.h"
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface NSArray (Sudoku)
/**
* 九宫格布局 固定ItemSize 可变ItemSpacing
*
* @param fixedItemWidth 固定宽度
* @param fixedItemHeight 固定高度
* @param warpCount 折行点
* @param topSpacing 顶间距
* @param bottomSpacing 底间距
* @param leadSpacing 左间距
* @param tailSpacing 右间距
*/
- (void)mas_distributeSudokuViewsWithFixedItemWidth:(CGFloat)fixedItemWidth
fixedItemHeight:(CGFloat)fixedItemHeight
warpCount:(NSInteger)warpCount
topSpacing:(CGFloat)topSpacing
bottomSpacing:(CGFloat)bottomSpacing
leadSpacing:(CGFloat)leadSpacing
tailSpacing:(CGFloat)tailSpacing;
/**
* 九宫格布局 可变ItemSize 固定ItemSpacing
*
* @param fixedLineSpacing 行间距
* @param fixedInteritemSpacing 列间距
* @param warpCount 折行点
* @param topSpacing 顶间距
* @param bottomSpacing 底间距
* @param leadSpacing 左间距
* @param tailSpacing 右间距
*/
- (void)mas_distributeSudokuViewsWithFixedLineSpacing:(CGFloat)fixedLineSpacing
fixedInteritemSpacing:(CGFloat)fixedInteritemSpacing
warpCount:(NSInteger)warpCount
topSpacing:(CGFloat)topSpacing
bottomSpacing:(CGFloat)bottomSpacing
leadSpacing:(CGFloat)leadSpacing
tailSpacing:(CGFloat)tailSpacing;
/**
* 九宫格布局 固定ItemSize 固定ItemSpacing
* 可由九宫格的内容控制SuperView的大小
* 如果warpCount大于[self count],该方法将会用空白的View填充到superview中
*
* Sudoku Layout, has fixed item size, and fix item space
* If warp count greater than self.count, It's fill empty view to superview
*
* @param fixedItemWidth 固定宽度,如果设置成0,则表示自适应,If set it to zero, indicates the adaptive.
* @param fixedItemHeight 固定高度,如果设置成0,则表示自适应,If set it to zero, indicates the adaptive.
* @param fixedLineSpacing 行间距
* @param fixedInteritemSpacing 列间距
* @param warpCount 折行点
* @param topSpacing 顶间距
* @param bottomSpacing 底间距
* @param leadSpacing 左间距
* @param tailSpacing 右间距
*
* @return 一般情况下会返回[self copy], 如果warpCount大于[self count],则会返回一个被空白view填充过的数组,可以让你循环调用removeFromSuperview或者干一些其他的事情;
* @return Normal will return [self copy], If warpCount bigger than [self count] , It will return a empty views filled array, you could enumerate [subview removeFromSuperview] or do other things;
*/
- (NSArray *)mas_distributeSudokuViewsWithFixedItemWidth:(CGFloat)fixedItemWidth
fixedItemHeight:(CGFloat)fixedItemHeight
fixedLineSpacing:(CGFloat)fixedLineSpacing
fixedInteritemSpacing:(CGFloat)fixedInteritemSpacing
warpCount:(NSInteger)warpCount
topSpacing:(CGFloat)topSpacing
bottomSpacing:(CGFloat)bottomSpacing
leadSpacing:(CGFloat)leadSpacing
tailSpacing:(CGFloat)tailSpacing;
@end
NS_ASSUME_NONNULL_END
@@ -0,0 +1,209 @@
//
// NSArray+Sudoku.m
// EscortProject
//
// Created by Apple on 2024/3/4.
//
#import "NSArray+Sudoku.h"
#import "View+MASAdditions.h"
@implementation NSArray (Sudoku)
- (MAS_VIEW *)star_commonSuperviewOfViews {
if (self.count == 1) {
return ((MAS_VIEW *)self.firstObject).superview;
}
MAS_VIEW *commonSuperview = nil;
MAS_VIEW *previousView = nil;
for (id object in self) {
if ([object isKindOfClass:[MAS_VIEW class]]) {
MAS_VIEW *view = (MAS_VIEW *)object;
if (previousView) {
commonSuperview = [view mas_closestCommonSuperview:commonSuperview];
} else {
commonSuperview = view;
}
previousView = view;
}
}
NSAssert(commonSuperview, @"Can't constrain views that do not share a common superview. Make sure that all the views in this array have been added into the same view hierarchy.");
return commonSuperview;
}
- (void)mas_distributeSudokuViewsWithFixedItemWidth:(CGFloat)fixedItemWidth
fixedItemHeight:(CGFloat)fixedItemHeight
warpCount:(NSInteger)warpCount
topSpacing:(CGFloat)topSpacing
bottomSpacing:(CGFloat)bottomSpacing
leadSpacing:(CGFloat)leadSpacing
tailSpacing:(CGFloat)tailSpacing {
if (self.count < 2) {
NSAssert(self.count>1,@"views to distribute need to bigger than one");
return;
}
if (warpCount < 1) {
NSAssert(false, @"warp count need to bigger than zero");
return;
}
MAS_VIEW *tempSuperView = [self star_commonSuperviewOfViews];
NSInteger rowCount = self.count % warpCount == 0 ? self.count / warpCount : self.count / warpCount + 1;
MAS_VIEW *prev;
for (int i = 0; i < self.count; i++) {
MAS_VIEW *v = self[i];
// 当前行
NSInteger currentRow = i / warpCount;
// 当前列
NSInteger currentColumn = i % warpCount;
[v mas_makeConstraints:^(MASConstraintMaker *make) {
// 固定宽度
make.width.equalTo(@(fixedItemWidth));
make.height.equalTo(@(fixedItemHeight));
// 第一行
if (currentRow == 0) {
make.top.equalTo(tempSuperView).offset(topSpacing);
}
// 最后一行
if (currentRow == rowCount - 1) {
make.bottom.equalTo(tempSuperView).offset(-bottomSpacing);
}
// 中间的若干行
if (currentRow != 0 && currentRow != rowCount - 1){
CGFloat offset = (1-(currentRow/((CGFloat)rowCount-1)))*(fixedItemHeight+topSpacing)-currentRow*bottomSpacing/(((CGFloat)rowCount-1));
make.bottom.equalTo(tempSuperView).multipliedBy(currentRow/((CGFloat)rowCount-1)).offset(offset);
}
// 第一列
if (currentColumn == 0) {
make.left.equalTo(tempSuperView).offset(leadSpacing);
}
// 最后一列
if (currentColumn == warpCount - 1) {
make.right.equalTo(tempSuperView).offset(-tailSpacing);
}
// 中间若干列
if (currentColumn != 0 && currentColumn != warpCount - 1) {
CGFloat offset = (1-(currentColumn/((CGFloat)warpCount-1)))*(fixedItemWidth+leadSpacing)-currentColumn*tailSpacing/(((CGFloat)warpCount-1));
make.right.equalTo(tempSuperView).multipliedBy(currentColumn/((CGFloat)warpCount-1)).offset(offset);
}
}];
prev = v;
}
}
- (void)mas_distributeSudokuViewsWithFixedLineSpacing:(CGFloat)fixedLineSpacing
fixedInteritemSpacing:(CGFloat)fixedInteritemSpacing
warpCount:(NSInteger)warpCount
topSpacing:(CGFloat)topSpacing
bottomSpacing:(CGFloat)bottomSpacing
leadSpacing:(CGFloat)leadSpacing
tailSpacing:(CGFloat)tailSpacing {
[self mas_distributeSudokuViewsWithFixedItemWidth:0 fixedItemHeight:0 fixedLineSpacing:fixedLineSpacing fixedInteritemSpacing:fixedInteritemSpacing warpCount:warpCount topSpacing:topSpacing bottomSpacing:bottomSpacing leadSpacing:leadSpacing tailSpacing:tailSpacing];
}
- (NSArray *)mas_distributeSudokuViewsWithFixedItemWidth:(CGFloat)fixedItemWidth
fixedItemHeight:(CGFloat)fixedItemHeight
fixedLineSpacing:(CGFloat)fixedLineSpacing
fixedInteritemSpacing:(CGFloat)fixedInteritemSpacing
warpCount:(NSInteger)warpCount
topSpacing:(CGFloat)topSpacing
bottomSpacing:(CGFloat)bottomSpacing
leadSpacing:(CGFloat)leadSpacing
tailSpacing:(CGFloat)tailSpacing {
if (self.count < 1) {
return self.copy;
}
if (warpCount < 1) {
NSAssert(false, @"warp count need to bigger than zero");
return self.copy;
}
MAS_VIEW *tempSuperView = [self star_commonSuperviewOfViews];
NSArray *tempViews = self.copy;
if (warpCount > self.count) {
for (int i = 0; i < warpCount - self.count; i++) {
MAS_VIEW *tempView = [[MAS_VIEW alloc] init];
[tempSuperView addSubview:tempView];
tempViews = [tempViews arrayByAddingObject:tempView];
}
}
NSInteger columnCount = warpCount;
NSInteger rowCount = tempViews.count % columnCount == 0 ? tempViews.count / columnCount : tempViews.count / columnCount + 1;
MAS_VIEW *prev;
for (int i = 0; i < tempViews.count; i++) {
MAS_VIEW *v = tempViews[i];
NSInteger currentRow = i / columnCount;
NSInteger currentColumn = i % columnCount;
[v mas_makeConstraints:^(MASConstraintMaker *make) {
if (prev) {
// 固定宽度
make.width.equalTo(prev);
make.height.equalTo(prev);
}
else {
// 如果写的item高宽分别是0,则表示自适应
if (fixedItemWidth) {
make.width.equalTo(@(fixedItemWidth));
}
if (fixedItemHeight) {
make.height.equalTo(@(fixedItemHeight));
}
}
// 第一行
if (currentRow == 0) {
make.top.equalTo(tempSuperView).offset(topSpacing);
}
// 最后一行
if (currentRow == rowCount - 1) {
// 如果只有一行
if (currentRow != 0 && i-columnCount >= 0) {
make.top.equalTo(((MAS_VIEW *)tempViews[i-columnCount]).mas_bottom).offset(fixedLineSpacing);
}
make.bottom.equalTo(tempSuperView).offset(-bottomSpacing);
}
// 中间的若干行
if (currentRow != 0 && currentRow != rowCount - 1) {
make.top.equalTo(((MAS_VIEW *)tempViews[i-columnCount]).mas_bottom).offset(fixedLineSpacing);
}
// 第一列
if (currentColumn == 0) {
make.left.equalTo(tempSuperView).offset(leadSpacing);
}
// 最后一列
if (currentColumn == columnCount - 1) {
// 如果只有一列
if (currentColumn != 0) {
make.left.equalTo(prev.mas_right).offset(fixedInteritemSpacing);
}
make.right.equalTo(tempSuperView).offset(-tailSpacing);
}
// 中间若干列
if (currentColumn != 0 && currentColumn != warpCount - 1) {
make.left.equalTo(prev.mas_right).offset(fixedInteritemSpacing);
}
}];
prev = v;
}
return tempViews;
}
@end
@@ -0,0 +1,16 @@
//
// NSAttributedString+Extension.h
// EscortProject
//
// Created by 仁康信息 on 2023/3/14.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface NSAttributedString (Extension)
@end
NS_ASSUME_NONNULL_END
@@ -0,0 +1,12 @@
//
// NSAttributedString+Extension.m
// EscortProject
//
// Created by 仁康信息 on 2023/3/14.
//
#import "NSAttributedString+Extension.h"
@implementation NSAttributedString (Extension)
@end
@@ -0,0 +1,239 @@
//
// NSDate+IH.h
// IHKit
//
// Created by yl on 16/10/24.
// Copyright © 2016年 39hospital. All rights reserved.
//
//
// Learning to YYKit url https://github.com/ibireme/YYKit/blob/master/YYKit/
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
static NSString *ih_default_date_format = @"yyyy-MM-dd HH:mm:ss"; //!<常用的时间格式
@interface NSDate (Property)
@property (nonatomic, readonly) NSInteger year; // Year component
@property (nonatomic, readonly) NSInteger month; // Month component (1~12)
@property (nonatomic, readonly) NSInteger day; // Day component (1~31)
@property (nonatomic, readonly) NSInteger hour; // Hour component (0~23)
@property (nonatomic, readonly) NSInteger minute; // Minute component (0~59)
@property (nonatomic, readonly) NSInteger second; // Second component (0~59)
@property (nonatomic, readonly) NSInteger nanosecond; // Nanosecond component
@property (nonatomic, readonly) NSInteger weekday; // Weekday component (1~7, first day is based on user setting)
@property (nonatomic, readonly) NSInteger weekdayOrdinal; // WeekdayOrdinal component
@property (nonatomic, readonly) NSInteger weekOfMonth; // WeekOfMonth component (1~5)
@property (nonatomic, readonly) NSInteger weekOfYear; // WeekOfYear component (1~53)
@property (nonatomic, readonly) NSInteger yearForWeekOfYear; // YearForWeekOfYear component
@property (nonatomic, readonly) NSInteger quarter; // Quarter component
@property (nonatomic, readonly) BOOL isLeapMonth; // whether the month is leap month
@property (nonatomic, readonly) BOOL isLeapYear; // whether the year is leap year
@property (nonatomic, readonly) BOOL isToday; // whether date is today (based on current locale)
@property (nonatomic, readonly) BOOL isYesterday; // whether date is yesterday (based on current locale)
+ (NSArray *)toGetDatesWithStartDate:(NSString *)startDate endDate:(NSString *)endDate;
+ (NSString *)toGetWeekDayString:(NSInteger )weekDay;
@end
@interface NSDate (Format)
/**
获取对应format的时间字符串
@param format 时间构造format e.g. @"yyyy-MM-dd HH:mm:ss"
@return 时间字符串 nilable
*/
- (nullable NSString *)ih_stringWithFormat:(nullable NSString *)format;
/**
获取对应format的时间字符串
@param format 时间构造format e.g. @"yyyy-MM-dd HH:mm:ss"
@param timeZone 时区
@param locale 当地环境
@return 时间字符串 nilable
*/
- (nullable NSString *)ih_stringWithFormat:(nullable NSString *)format timeZone:(nullable NSTimeZone *)timeZone locale:(nullable NSLocale *)locale;
/**
标准ISO8601 format e.g. @"2016-10-24T16:40:16+12:00"
@return 时间字符串(ISO标准) nilable
*/
- (nullable NSString *)ih_stringWithISOFormat;
/**
通过时间字符串获取nsdate对象
@param dateString 时间字符串
@param format 时间字符串的format
@return nsdate对象 nilable
*/
+ (nullable NSDate *)ih_dateWithString:(nullable NSString *)dateString format:(nullable NSString *)format;
/**
通过时间字符串获取nsdate对象
@param dateString 时间字符串
@param format 时间字符串的format
@param timeZone 时区
@param locale 当地环境
@return nsdate对象 nilable
*/
+ (nullable NSDate *)ih_dateWithString:(nullable NSString *)dateString format:(nullable NSString *)format timeZone:(nullable NSTimeZone *)timeZone locale:(nullable NSLocale *)locale;
/**
通过时间字符串获取一个依据 ISO format 的nsdate对象
@param dateString 时间字符串
@return nsdate对象 nilable
*/
+ (nullable NSDate *)ih_dateWithISOFormatString:(nullable NSString *)dateString;
@end
@interface NSDate (Modify)
/**
获取自己增加添加some years之后的nsdate
@param years 年数
@return nsdate增加之后 nilable
*/
- (nullable NSDate *)ih_dateByAddingYears:(NSInteger)years;
/**
获取自己增加添加some months之后的nsdate
@param months 月数
@return nsdate增加之后 nilable
*/
- (nullable NSDate *)ih_dateByAddingMonths:(NSInteger)months;
/**
获取自己增加添加some months之后的nsdate
@param weeks 周数
@return nsdate增加之后 nilable
*/
- (nullable NSDate *)ih_dateByAddingWeeks:(NSInteger)weeks;
/**
获取自己增加添加some days之后的nsdate
@param days 天数
@return nsdate增加之后 nilable
*/
- (nullable NSDate *)ih_dateByAddingDays:(NSInteger)days;
/**
获取自己增加添加some hours之后的nsdate
@param hours 小时数
@return nsdate增加之后 nilable
*/
- (nullable NSDate *)ih_dateByAddingHours:(NSInteger)hours;
/**
获取自己增加添加some mins之后的nsdate
@param minutes 分钟数
@return nsdate增加之后 nilable
*/
- (nullable NSDate *)ih_dateByAddingMinutes:(NSInteger)minutes;
/**
获取自己增加添加some secs之后的nsdate
@param seconds 秒数
@return nsdate增加之后 nilable
*/
- (nullable NSDate *)ih_dateByAddingSeconds:(NSInteger)seconds;
@end
@interface NSDate (Compare)
/**
比较两个时间的大小 使用默认的date格式:yyyy-MM-dd HH:mm:ss
@param dateString 比较时间
@return 比较结果
*/
- (NSComparisonResult)ih_compareDateString:(nullable NSString *)dateString;
/**
比较两个时间的大小 使用的dateformat
@param dateString 时间字符串
@param format 时间字符串的构造格式
@return 比较结果 (比较结果为通过相应的format来构造自身(因为nsdate的format不一定和外部传入的一样,那样比较的话会出现明显误差),再进行比较)
*/
- (NSComparisonResult)ih_compareDateString:(nullable NSString *)dateString format:(nullable NSString *)format;
/**
两个时间之间相距多少秒
@param date 比较时间
@return 秒数
*/
- (NSTimeInterval)ih_secondTimeAwayFromDate:(nullable NSDate *)date;
/**
两个时间之间相距多少分钟
@param date 比较时间
@return 分钟数
*/
- (double)ih_minuteTimeAwayFromDate:(nullable NSDate *)date;
/**
两个时间之间相距多少小时
@param date 比较时间
@return 小时数
*/
- (double)ih_hourTimeAwayFromDate:(nullable NSDate *)date;
/**
两个时间之间相距多少小天
@param date 比较时间
@return 天数
*/
- (double)ih_dayTimeAwayFromDate:(nullable NSDate *)date;
@end
NS_ASSUME_NONNULL_END
@@ -0,0 +1,264 @@
//
// NSDate+IH.m
// IHKit
//
// Created by yl on 16/10/24.
// Copyright © 2016年 39hospital. All rights reserved.
//
#import "NSDate+IH.h"
@implementation NSDate (Property)
- (NSInteger)year {
return [[[NSCalendar currentCalendar] components:NSCalendarUnitYear fromDate:self] year];
}
- (NSInteger)month {
return [[[NSCalendar currentCalendar] components:NSCalendarUnitMonth fromDate:self] month];
}
- (NSInteger)day {
return [[[NSCalendar currentCalendar] components:NSCalendarUnitDay fromDate:self] day];
}
- (NSInteger)hour {
return [[[NSCalendar currentCalendar] components:NSCalendarUnitHour fromDate:self] hour];
}
- (NSInteger)minute {
return [[[NSCalendar currentCalendar] components:NSCalendarUnitMinute fromDate:self] minute];
}
- (NSInteger)second {
return [[[NSCalendar currentCalendar] components:NSCalendarUnitSecond fromDate:self] second];
}
- (NSInteger)nanosecond {
return [[[NSCalendar currentCalendar] components:NSCalendarUnitSecond fromDate:self] nanosecond];
}
- (NSInteger)weekday {
return [[[NSCalendar currentCalendar] components:NSCalendarUnitWeekday fromDate:self] weekday];
}
- (NSInteger)weekdayOrdinal {
return [[[NSCalendar currentCalendar] components:NSCalendarUnitWeekdayOrdinal fromDate:self] weekdayOrdinal];
}
- (NSInteger)weekOfMonth {
return [[[NSCalendar currentCalendar] components:NSCalendarUnitWeekOfMonth fromDate:self] weekOfMonth];
}
- (NSInteger)weekOfYear {
return [[[NSCalendar currentCalendar] components:NSCalendarUnitWeekOfYear fromDate:self] weekOfYear];
}
- (NSInteger)yearForWeekOfYear {
return [[[NSCalendar currentCalendar] components:NSCalendarUnitYearForWeekOfYear fromDate:self] yearForWeekOfYear];
}
- (NSInteger)quarter {
return [[[NSCalendar currentCalendar] components:NSCalendarUnitQuarter fromDate:self] quarter];
}
- (BOOL)isLeapMonth {
return [[[NSCalendar currentCalendar] components:NSCalendarUnitQuarter fromDate:self] isLeapMonth];
}
- (BOOL)isLeapYear {
NSUInteger year = self.year;
return ((year % 400 == 0) || ((year % 100 != 0) && (year % 4 == 0)));
}
- (BOOL)isToday {
if (fabs(self.timeIntervalSinceNow) >= 60 * 60 * 24) return NO;
return [NSDate new].day == self.day;
}
- (BOOL)isYesterday {
NSDate *added = [self ih_dateByAddingDays:1];
return [added isToday];
}
+ (NSArray *)toGetDatesWithStartDate:(NSString *)startDate endDate:(NSString *)endDate {
NSCalendar *calendar = [[NSCalendar alloc] initWithCalendarIdentifier: NSCalendarIdentifierGregorian];
NSDateFormatter *matter = [[NSDateFormatter alloc] init];
matter.dateFormat = @"yyyy-MM-dd";
NSDate *start = [matter dateFromString:startDate];
NSDate *end = [matter dateFromString:endDate];
NSMutableArray *componentAarray = [NSMutableArray array];
NSComparisonResult result = [start compare:end];
NSDateComponents *comps;
while (result != NSOrderedDescending) {
comps = [calendar components:NSCalendarUnitYear | NSCalendarUnitMonth | NSCalendarUnitDay | NSCalendarUnitWeekday fromDate:start];
[componentAarray addObject:start];
[comps setDay:([comps day]+1)];
start = [calendar dateFromComponents:comps];
result = [start compare:end];
}return componentAarray;
}
+ (NSString *)toGetWeekDayString:(NSInteger )weekDay {
switch (weekDay) {
case 1:
return @"星期日";
break;
case 2:
return @"星期一";
break;
case 3:
return @"星期二";
break;
case 4:
return @"星期三";
break;
case 5:
return @"星期四";
break;
case 6:
return @"星期五";
break;
case 7:
return @"星期六";
break;
default:
return @"";
break;
}
}
@end
@implementation NSDate (Format)
- (NSString *)ih_stringWithFormat:(NSString *)format {
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
[formatter setDateFormat:format];
[formatter setLocale:[NSLocale currentLocale]];
return [formatter stringFromDate:self];
}
- (NSString *)ih_stringWithFormat:(NSString *)format timeZone:(NSTimeZone *)timeZone locale:(NSLocale *)locale {
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
[formatter setDateFormat:format];
if (timeZone) [formatter setTimeZone:timeZone];
if (locale) [formatter setLocale:locale];
return [formatter stringFromDate:self];
}
- (NSString *)ih_stringWithISOFormat {
static NSDateFormatter *formatter = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
formatter = [[NSDateFormatter alloc] init];
formatter.locale = [[NSLocale alloc] initWithLocaleIdentifier:@"en_US_POSIX"];
formatter.dateFormat = @"yyyy-MM-dd'T'HH:mm:ssZ";
});
return [formatter stringFromDate:self];
}
+ (NSDate *)ih_dateWithString:(NSString *)dateString format:(NSString *)format {
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
[formatter setDateFormat:format];
return [formatter dateFromString:dateString];
}
+ (NSDate *)ih_dateWithString:(NSString *)dateString format:(NSString *)format timeZone:(NSTimeZone *)timeZone locale:(NSLocale *)locale {
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
[formatter setDateFormat:format];
if (timeZone) [formatter setTimeZone:timeZone];
if (locale) [formatter setLocale:locale];
return [formatter dateFromString:dateString];
}
+ (NSDate *)ih_dateWithISOFormatString:(nullable NSString *)dateString {
static NSDateFormatter *formatter = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
formatter = [[NSDateFormatter alloc] init];
formatter.locale = [[NSLocale alloc] initWithLocaleIdentifier:@"en_US_POSIX"];
formatter.dateFormat = @"yyyy-MM-dd'T'HH:mm:ssZ";
});
return [formatter dateFromString:dateString];
}
@end
@implementation NSDate (Modify)
- (NSDate *)ih_dateByAddingYears:(NSInteger)years {
NSCalendar *calendar = [NSCalendar currentCalendar];
NSDateComponents *components = [[NSDateComponents alloc] init];
[components setYear:years];
return [calendar dateByAddingComponents:components toDate:self options:0];
}
- (NSDate *)ih_dateByAddingMonths:(NSInteger)months {
NSCalendar *calendar = [NSCalendar currentCalendar];
NSDateComponents *components = [[NSDateComponents alloc] init];
[components setMonth:months];
return [calendar dateByAddingComponents:components toDate:self options:0];
}
- (NSDate *)ih_dateByAddingWeeks:(NSInteger)weeks {
NSCalendar *calendar = [NSCalendar currentCalendar];
NSDateComponents *components = [[NSDateComponents alloc] init];
[components setWeekOfYear:weeks];
return [calendar dateByAddingComponents:components toDate:self options:0];
}
- (NSDate *)ih_dateByAddingDays:(NSInteger)days {
return [self ih_dateByAddingHours:(24 * days)];
}
- (NSDate *)ih_dateByAddingHours:(NSInteger)hours {
return [self ih_dateByAddingMinutes:(60 * hours)];
}
- (NSDate *)ih_dateByAddingMinutes:(NSInteger)minutes {
return [self ih_dateByAddingSeconds:(60 * minutes)];
}
- (NSDate *)ih_dateByAddingSeconds:(NSInteger)seconds {
NSTimeInterval aTimeInterval = [self timeIntervalSinceReferenceDate] + seconds;
NSDate *newDate = [NSDate dateWithTimeIntervalSinceReferenceDate:aTimeInterval];
return newDate;
}
@end
@implementation NSDate (Compare)
- (NSComparisonResult)ih_compareDateString:(NSString *)dateString{
return [self ih_compareDateString:dateString format:@"yyyy-MM-dd HH:mm:ss"];
}
- (NSComparisonResult)ih_compareDateString:(NSString *)dateString format:(NSString *)format{
NSDate *selfCompareDate = [NSDate ih_dateWithString:[self ih_stringWithFormat:format] format:format];
return [selfCompareDate compare:[NSDate ih_dateWithString:dateString format:format]];
}
- (NSTimeInterval)ih_secondTimeAwayFromDate:(NSDate *)date{
return [self timeIntervalSinceDate:date];
}
- (double)ih_minuteTimeAwayFromDate:(NSDate *)date{
return ([self ih_secondTimeAwayFromDate:date]/60);
}
- (double)ih_hourTimeAwayFromDate:(NSDate *)date{
return ([self ih_minuteTimeAwayFromDate:date]/60);
}
- (double)ih_dayTimeAwayFromDate:(NSDate *)date{
return ([self ih_hourTimeAwayFromDate:date]/24);
}
- (double)ih_monthTimeAwayFromDate:(NSDate *)date{
return ([self ih_dayTimeAwayFromDate:date]/30);
}
@end
@@ -0,0 +1,20 @@
//
// NSDictionary+Log.h
// wbiaoServer
//
// Created by boai on 2020/4/13.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface NSDictionary (Log)
@end
@interface NSArray (Log)
@end
NS_ASSUME_NONNULL_END
@@ -0,0 +1,74 @@
//
// NSDictionary+Log.m
// wbiaoServer
//
// Created by boai on 2020/4/13.
//
#import "NSDictionary+Log.h"
@implementation NSDictionary (Log)
- (NSString *)jsonString{
if (self == nil) {
return nil;
}
NSError *error;
NSData *data = [NSJSONSerialization dataWithJSONObject:self options:NSJSONWritingPrettyPrinted error:&error];
NSString *jsonString = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
return jsonString;
}
- (NSString *)descriptionWithLocale:(id)locale indent:(NSUInteger)level
{
NSMutableString *mStr = [NSMutableString string];
NSMutableString *tab = [NSMutableString stringWithString:@""];
for (int i = 0; i < level; i++) {
[tab appendString:@"\t"];
}
[mStr appendString:@"{\n"];
NSArray *allKey = self.allKeys;
for (int i = 0; i < allKey.count; i++) {
id value = self[allKey[i]];
NSString *lastSymbol = (allKey.count == i + 1) ? @"":@";";
if ([value respondsToSelector:@selector(descriptionWithLocale:indent:)]) {
[mStr appendFormat:@"\t%@%@ = %@%@\n",tab,allKey[i],[value descriptionWithLocale:locale indent:level + 1],lastSymbol];
} else {
[mStr appendFormat:@"\t%@%@ = %@%@\n",tab,allKey[i],value,lastSymbol];
}
}
[mStr appendFormat:@"%@}",tab];
return mStr;
}
@end
@implementation NSArray (Log)
- (NSString *)descriptionWithLocale:(nullable id)locale indent:(NSUInteger)level{
NSMutableString *mStr = [NSMutableString string];
NSMutableString *tab = [NSMutableString stringWithString:@""];
for (int i = 0; i < level; i++) {
[tab appendString:@"\t"];
}
[mStr appendString:@"(\n"];
for (int i = 0; i < self.count; i++) {
NSString *lastSymbol = (self.count == i + 1) ? @"":@",";
id value = self[i];
if ([value respondsToSelector:@selector(descriptionWithLocale:indent:)]) {
[mStr appendFormat:@"\t%@%@%@\n",tab,[value descriptionWithLocale:locale indent:level + 1],lastSymbol];
} else {
[mStr appendFormat:@"\t%@%@%@\n",tab,value,lastSymbol];
}
}
[mStr appendFormat:@"%@)",tab];
return mStr;
}
@end
@@ -0,0 +1,17 @@
//
// NSDictionary+NilSafe.h
// NSDictionary-NilSafe
//
// Created by Allen Hsu on 6/22/16.
// Copyright © 2016 Glow Inc. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface NSDictionary (NilSafe)
@end
@interface NSMutableDictionary (NilSafe)
@end
@@ -0,0 +1,113 @@
//
// NSDictionary+NilSafe.m
// NSDictionary-NilSafe
//
// Created by Allen Hsu on 6/22/16.
// Copyright © 2016 Glow Inc. All rights reserved.
//
#import <objc/runtime.h>
#import "NSDictionary+NilSafe.h"
@implementation NSObject (Swizzling)
+ (BOOL)gl_swizzleMethod:(SEL)origSel withMethod:(SEL)altSel {
Method origMethod = class_getInstanceMethod(self, origSel);
Method altMethod = class_getInstanceMethod(self, altSel);
if (!origMethod || !altMethod) {
return NO;
}
class_addMethod(self,
origSel,
class_getMethodImplementation(self, origSel),
method_getTypeEncoding(origMethod));
class_addMethod(self,
altSel,
class_getMethodImplementation(self, altSel),
method_getTypeEncoding(altMethod));
method_exchangeImplementations(class_getInstanceMethod(self, origSel),
class_getInstanceMethod(self, altSel));
return YES;
}
+ (BOOL)gl_swizzleClassMethod:(SEL)origSel withMethod:(SEL)altSel {
return [object_getClass((id)self) gl_swizzleMethod:origSel withMethod:altSel];
}
@end
@implementation NSDictionary (NilSafe)
+ (void)load {
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
[self gl_swizzleMethod:@selector(initWithObjects:forKeys:count:) withMethod:@selector(gl_initWithObjects:forKeys:count:)];
[self gl_swizzleClassMethod:@selector(dictionaryWithObjects:forKeys:count:) withMethod:@selector(gl_dictionaryWithObjects:forKeys:count:)];
});
}
+ (instancetype)gl_dictionaryWithObjects:(const id [])objects forKeys:(const id<NSCopying> [])keys count:(NSUInteger)cnt {
id safeObjects[cnt];
id safeKeys[cnt];
NSUInteger j = 0;
for (NSUInteger i = 0; i < cnt; i++) {
id key = keys[i];
id obj = objects[i];
if (!key || !obj) {
continue;
}
safeKeys[j] = key;
safeObjects[j] = obj;
j++;
}
return [self gl_dictionaryWithObjects:safeObjects forKeys:safeKeys count:j];
}
- (instancetype)gl_initWithObjects:(const id [])objects forKeys:(const id<NSCopying> [])keys count:(NSUInteger)cnt {
id safeObjects[cnt];
id safeKeys[cnt];
NSUInteger j = 0;
for (NSUInteger i = 0; i < cnt; i++) {
id key = keys[i];
id obj = objects[i];
if (!key || !obj) {
continue;
}
if (!obj) {
obj = [NSNull null];
}
safeKeys[j] = key;
safeObjects[j] = obj;
j++;
}
return [self gl_initWithObjects:safeObjects forKeys:safeKeys count:j];
}
@end
@implementation NSMutableDictionary (NilSafe)
+ (void)load {
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
Class class = NSClassFromString(@"__NSDictionaryM");
[class gl_swizzleMethod:@selector(setObject:forKey:) withMethod:@selector(gl_setObject:forKey:)];
[class gl_swizzleMethod:@selector(setObject:forKeyedSubscript:) withMethod:@selector(gl_setObject:forKeyedSubscript:)];
});
}
- (void)gl_setObject:(id)anObject forKey:(id<NSCopying>)aKey {
if (!aKey || !anObject) {
return;
}
[self gl_setObject:anObject forKey:aKey];
}
- (void)gl_setObject:(id)obj forKeyedSubscript:(id<NSCopying>)key {
if (!key || !obj) {
return;
}
[self gl_setObject:obj forKeyedSubscript:key];
}
@end
@@ -0,0 +1,59 @@
//
// NSString+FKTools.h
// Doctor
//
// Created by 张正梅 on 2019/5/30.
// Copyright © 2019 com.longmaster. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface NSString (FKTools)
/* 为适应iOS7写的一个是否包含某字符的方法 */
- (BOOL)myContainsString:(NSString*)other;
//根据宽度确定字符串的高度
- (CGFloat)heigthWithsysFont:(CGFloat)font
withWidth:(CGFloat)width;
- (CGFloat)heigthWithboldSystemFont:(CGFloat)font
withWidth:(CGFloat)width;
+ (CGFloat)toCalculateHeightWithContent:(NSString *)contentText Width:(CGFloat)width Font:(UIFont *)font;
+ (CGSize)boundingRectWithWidth:(CGFloat)maxWidth
withTextFont:(UIFont *)font
withLineSpacing:(CGFloat)lineSpacing
text:(NSString *)text;
+ (NSMutableAttributedString *)toGetAttributedStringWithFont:(UIFont *)font
withLineSpacing:(CGFloat)lineSpacing
text:(NSString *)text;
//一行字体的宽度
- (CGFloat)widthWithsysFont:(CGFloat)font;
- (CGFloat)widthWithBordFont:(CGFloat)font;
+ (CGFloat)HeightWithHtlm5Str:(NSString *)htlmStr width:(CGFloat)width;
+ (NSString*)newlineReplacingjson:(NSString*)strJson;
- (NSMutableAttributedString *)setAttributeWithLab:(UILabel *)label LineSpacing:(CGFloat)lineSpacing;
/* 根据出生日期得到年龄 */
-(NSString *)toGetAgeByBornDate;
/* 得到高度 */
- (CGFloat)toGetRectLab:(UILabel *)lable WithWidth:(CGFloat)widthFloat;
- (BOOL)hasSubString:(NSString *)subString;
- (void)toSetAttributeWithLable:(UILabel *)lable Title:(NSString *)title TitleColor:(UIColor *)titleColor TitleFont:(UIFont *)titleFont
ContentText:(NSString *)contentText ContentColor:(UIColor *)ContentColor ContentFont:(UIFont *)ContentFont;
+ (NSAttributedString *)toGetStrWithHtmlStr:(NSString *)string;
+ (NSMutableAttributedString *)setEquipmentAttributedString:(NSString *)str;
+ (CGFloat )getHTMLHeightByStr:(NSString *)str;
+ (NSString *)toGetTimeText:(NSString *)timeText;
+ (NSString *)UIImageToBase64Str:(UIImage *) image;
+ (NSString *)toGetTimeTextByEndOfTheMinute:(NSString *)time;
- (NSString *)MD5_32BI;
@end
NS_ASSUME_NONNULL_END
@@ -0,0 +1,230 @@
//
// NSString+FKTools.m
// Doctor
//
// Created by 张正梅 on 2019/5/30.
// Copyright © 2019 com.longmaster. All rights reserved.
//
#import "NSString+FKTools.h"
#import "NSDate+IH.h"
#import <CommonCrypto/CommonDigest.h>
@implementation NSString (FKTools)
- (BOOL)myContainsString:(NSString*)other{
NSRange range = [self rangeOfString:other];
return range.length != 0;
}
- (CGFloat)heigthWithsysFont:(CGFloat)font
withWidth:(CGFloat)width{
NSDictionary * dic = [NSDictionary dictionaryWithObjectsAndKeys:[UIFont systemFontOfSize:font], NSFontAttributeName, nil];
CGRect rect = [self boundingRectWithSize:CGSizeMake(width, 0) options:NSStringDrawingUsesLineFragmentOrigin attributes:dic context:nil];
return rect.size.height;
}
- (CGFloat)heigthWithboldSystemFont:(CGFloat)font
withWidth:(CGFloat)width{
NSDictionary * dic = [NSDictionary dictionaryWithObjectsAndKeys:[UIFont boldSystemFontOfSize:font], NSFontAttributeName, nil];
CGRect rect = [self boundingRectWithSize:CGSizeMake(width, 0) options:NSStringDrawingUsesLineFragmentOrigin attributes:dic context:nil];
return rect.size.height;
}
+ (CGFloat)toCalculateHeightWithContent:(NSString *)contentText Width:(CGFloat)width Font:(UIFont *)font{
CGFloat textHeight = [NSString boundingRectWithWidth:width withTextFont:font withLineSpacing:LineSpace text:contentText].height;
return textHeight;
}
/**
* 根据文字内容动态计算UILabel宽高
* @param maxWidth label宽度
* @param font 字体
* @param lineSpacing 行间距
* @param text 内容
*/
+ (CGSize)boundingRectWithWidth:(CGFloat)maxWidth
withTextFont:(UIFont *)font
withLineSpacing:(CGFloat)lineSpacing
text:(NSString *)text{
CGSize maxSize = CGSizeMake(maxWidth, CGFLOAT_MAX);
//段落样式
NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
//设置行间距
[paragraphStyle setLineSpacing:lineSpacing];
#warning 此处设置NSLineBreakByTruncatingTail会导致计算文字高度方法失效
// [paragraphStyle setLineBreakMode:NSLineBreakByTruncatingTail];
//计算文字尺寸
CGSize size = [text boundingRectWithSize:maxSize options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName:font, NSParagraphStyleAttributeName:paragraphStyle} context:nil].size;
return size;
}
+ (NSMutableAttributedString *)toGetAttributedStringWithFont:(UIFont *)font withLineSpacing:(CGFloat)lineSpacing text:(NSString *)text{
NSMutableAttributedString *attr = [[NSMutableAttributedString alloc] initWithString:text attributes:@{NSFontAttributeName:font}];
NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
[paragraphStyle setLineSpacing:lineSpacing];
[paragraphStyle setLineBreakMode:NSLineBreakByTruncatingTail];
[attr addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, [text length])];
return attr;
}
- (CGFloat)widthWithsysFont:(CGFloat)font{
NSDictionary * dic = [NSDictionary dictionaryWithObjectsAndKeys:[UIFont systemFontOfSize:font], NSFontAttributeName, nil];
CGRect rect = [self boundingRectWithSize:CGSizeMake(0, 0) options:NSStringDrawingUsesLineFragmentOrigin attributes:dic context:nil];
return rect.size.width;
}
- (CGFloat)widthWithBordFont:(CGFloat)font{
NSDictionary * dic = [NSDictionary dictionaryWithObjectsAndKeys:[UIFont boldSystemFontOfSize:font], NSFontAttributeName, nil];
CGRect rect = [self boundingRectWithSize:CGSizeMake(0, 0) options:NSStringDrawingUsesLineFragmentOrigin attributes:dic context:nil];
return rect.size.width;
}
+ (CGFloat)HeightWithHtlm5Str:(NSString *)htlmStr width:(CGFloat)width{
UILabel *lab= [[UILabel alloc]init];
NSAttributedString * attrStr = [[NSAttributedString alloc] initWithData:[htlmStr dataUsingEncoding:NSUnicodeStringEncoding] options:@{NSDocumentTypeDocumentAttribute:NSHTMLTextDocumentType} documentAttributes:nil error:nil];
lab.attributedText = attrStr;
return [lab sizeThatFits:CGSizeMake(width, CGFLOAT_MAX)].height;
}
+ (NSString*)newlineReplacingjson:(NSString*)strJson{
NSString *strDoctorBrief = [strJson stringByReplacingOccurrencesOfString:@"<br>" withString:@"\r\n"];
strDoctorBrief = [strDoctorBrief stringByReplacingOccurrencesOfString:@"<br>" withString:@"\n\r"];
strDoctorBrief = [strDoctorBrief stringByReplacingOccurrencesOfString:@"<br>" withString:@"\n"];
strDoctorBrief = [strDoctorBrief stringByReplacingOccurrencesOfString:@"<br>" withString:@"\r"];
strDoctorBrief = [strDoctorBrief stringByReplacingOccurrencesOfString:@"}" withString:@"}<br>"];
strDoctorBrief = [strDoctorBrief stringByReplacingOccurrencesOfString:@"{" withString:@"{<br>"];
return strDoctorBrief;
}
- (NSMutableAttributedString *)setAttributeWithLab:(UILabel *)label LineSpacing:(CGFloat)lineSpacing{
NSMutableAttributedString *attrStr = [[NSMutableAttributedString alloc] initWithString:self];
NSMutableParagraphStyle *paragraphStyle = [NSMutableParagraphStyle new];
paragraphStyle.alignment = NSTextAlignmentJustified;
paragraphStyle.lineSpacing = lineSpacing - (label.font.lineHeight - label.font.pointSize);
NSRange range = NSMakeRange(0, attrStr.length);
[attrStr addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:range];
return attrStr;
}
-(NSString *)toGetAgeByBornDate{
NSCalendar *calendar = [NSCalendar currentCalendar];
NSDate *nowDate = [NSDate date];
NSString *date_format = @"yyyy-MM-dd";
NSDate *bornDate = [NSDate ih_dateWithString:self format:date_format];
unsigned int unitFlags = NSCalendarUnitYear | NSCalendarUnitMonth | NSCalendarUnitDay | NSCalendarUnitHour | NSCalendarUnitMinute | NSCalendarUnitSecond;
NSDateComponents *date = [calendar components:unitFlags fromDate:bornDate toDate:nowDate options:0];
if([date year] >0){
return [NSString stringWithFormat:(@"%ld岁"), (long)[date year]];
}else {
return @"0岁";
}
}
- (CGFloat)toGetRectLab:(UILabel *)lable WithWidth:(CGFloat)widthFloat{
return [lable.attributedText boundingRectWithSize:CGSizeMake(widthFloat, MAXFLOAT) options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading context:nil].size.height;
}
- (BOOL)hasSubString:(NSString *)subString{
if (!subString) {
return NO;
}
return [self rangeOfString:subString].location!=NSNotFound;
}
- (void)toSetAttributeWithLable:(UILabel *)lable Title:(NSString *)title TitleColor:(UIColor *)titleColor TitleFont:(UIFont *)titleFont
ContentText:(NSString *)contentText ContentColor:(UIColor *)ContentColor ContentFont:(UIFont *)ContentFont
{
title = title ? title : @"";
contentText = contentText ? contentText : @"";
titleColor = titleColor ? titleColor : [UIColor blackColor];
ContentColor = ContentColor ? ContentColor : [UIColor blackColor];
titleFont = titleFont ? titleFont : SYSTEMFONT(14);
ContentFont = ContentFont ? ContentFont : SYSTEMFONT(14);
NSString *muText = [NSString stringWithFormat:@"%@%@", title, contentText];
NSMutableAttributedString *attrStr = [[NSMutableAttributedString alloc] initWithString:muText];
[attrStr addAttribute:NSFontAttributeName value:titleFont range:NSMakeRange(0, title.length)];
[attrStr addAttribute:NSFontAttributeName value:ContentFont range:NSMakeRange(attrStr.length - contentText.length, contentText.length)];
[attrStr addAttribute:NSForegroundColorAttributeName value:titleColor range:NSMakeRange(0, title.length)];
[attrStr addAttribute:NSForegroundColorAttributeName value:ContentColor range:NSMakeRange(attrStr.length - contentText.length, contentText.length)];
lable.attributedText = attrStr;
}
+ (NSAttributedString *)toGetStrWithHtmlStr:(NSString *)string{
NSMutableAttributedString *attrStr = [[NSMutableAttributedString alloc] initWithData:[string dataUsingEncoding:NSUnicodeStringEncoding] options:@{NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType, NSCharacterEncodingDocumentAttribute:[NSNumber numberWithInt:NSUTF8StringEncoding]} documentAttributes:nil error:nil];
[attrStr addAttribute:NSFontAttributeName value:SYSTEMFONT(14) range:NSMakeRange(0, attrStr.length)];
[attrStr addAttribute:NSForegroundColorAttributeName value:UIColorHex(0x666666) range:NSMakeRange(0, attrStr.length)];
NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
[paragraphStyle setLineSpacing:5];
[attrStr addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, attrStr.length)];
return attrStr;
}
+ (NSMutableAttributedString *)setEquipmentAttributedString:(NSString *)str{
str = [str stringByReplacingOccurrencesOfString:@"\n" withString:@"<br/>"];
str = [NSString stringWithFormat:@"<head><style>img{width:%f !important;height:auto}</style></head>%@", WIDTH - 30, str];
NSMutableAttributedString *htmlString =[[NSMutableAttributedString alloc] initWithData:[str dataUsingEncoding:NSUTF8StringEncoding] options:@{NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType, NSCharacterEncodingDocumentAttribute:[NSNumber numberWithInt:NSUTF8StringEncoding]} documentAttributes:NULL error:nil];
[htmlString addAttributes:@{NSFontAttributeName:SYSTEMFONT(14)} range:NSMakeRange(0, htmlString.length)];
NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
[paragraphStyle setLineSpacing:5];
[htmlString addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, [htmlString length])];
return htmlString;
}
+ (CGFloat )getHTMLHeightByStr:(NSString *)str{
str = [str stringByReplacingOccurrencesOfString:@"\n" withString:@"<br/>"];
str = [NSString stringWithFormat:@"<head><style>img{width:%f !important;height:auto}</style></head>%@", [UIScreen mainScreen].bounds.size.width, str];
NSMutableAttributedString *htmlString =[[NSMutableAttributedString alloc] initWithData:[str dataUsingEncoding:NSUTF8StringEncoding] options:@{NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType, NSCharacterEncodingDocumentAttribute:[NSNumber numberWithInt:NSUTF8StringEncoding]} documentAttributes:NULL error:nil];
[htmlString addAttributes:@{NSFontAttributeName:SYSTEMFONT(14)} range:NSMakeRange(0, htmlString.length)];
//设置行间距
NSMutableParagraphStyle *paragraphStyle1 = [[NSMutableParagraphStyle alloc] init];
[paragraphStyle1 setLineSpacing:5];
[htmlString addAttribute:NSParagraphStyleAttributeName value:paragraphStyle1 range:NSMakeRange(0, [htmlString length])];
CGSize textSize = [htmlString boundingRectWithSize:(CGSize){WIDTH - 30, CGFLOAT_MAX} options:NSStringDrawingUsesLineFragmentOrigin context:nil].size;
return textSize.height ;
}
+ (NSString *)toGetTimeText:(NSString *)timeText{
NSDate *date = [NSDate ih_dateWithString:timeText format:ih_default_date_format];
NSDate *curDate = [NSDate date];
if (date) {
if ([curDate ih_secondTimeAwayFromDate:date] < 1) {
return @"刚刚";
}
if ([curDate ih_minuteTimeAwayFromDate:date] < 1) {
int second = [curDate ih_secondTimeAwayFromDate:date];
return [NSString stringWithFormat:@"%d秒前", second];
}
if ([curDate ih_hourTimeAwayFromDate:date] < 1) {
int minute = [curDate ih_minuteTimeAwayFromDate:date];
return [NSString stringWithFormat:@"%d分钟前", minute];
}
if ([date isToday]){
return [NSString stringWithFormat:@"今天%02zd:%02zd", date.hour, date.minute];
}
if ([date isYesterday]) {
return [NSString stringWithFormat:@"昨天%02zd:%02zd", date.hour, date.minute];
}
return [NSString stringWithFormat:@"%02zd.%02zd.%02zd", date.year, date.month, date.day];
} return @" ";
}
+ (NSString *)UIImageToBase64Str:(UIImage *) image{
NSData *data = UIImageJPEGRepresentation(image, 1.0f);
NSString *encodedImageStr = [data base64EncodedStringWithOptions:NSDataBase64Encoding64CharacterLineLength];
return encodedImageStr;
}
+ (NSString *)toGetTimeTextByEndOfTheMinute:(NSString *)time{
NSDate *date = [NSDate ih_dateWithString:time format:ih_default_date_format];
NSDateFormatter *format = [[NSDateFormatter alloc] init];
[format setDateFormat:@"YYYY-MM-dd HH:mm"];
NSString *currentTimeString = [format stringFromDate:date];
return currentTimeString;
}
- (NSString *)MD5_32BIT {
const char *cStr = [self UTF8String];
unsigned char digest[CC_MD5_DIGEST_LENGTH];
CC_MD5( cStr, (CC_LONG)self.length, digest );
NSMutableString *result = [NSMutableString stringWithCapacity:CC_MD5_DIGEST_LENGTH * 2];
for(int i = 0; i < CC_MD5_DIGEST_LENGTH; i++)
[result appendFormat:@"%02X", digest[i]];
return result;
}
@end
@@ -0,0 +1,14 @@
//
// UIButton+HXExtension.h
// HXPhotoPickerExample
//
// Created by Silence on 17/2/16.
// Copyright © 2017年 Silence. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface UIButton (HXExtension)
/** 扩大buuton点击范围 */
- (void)hx_setEnlargeEdgeWithTop:(CGFloat)top right:(CGFloat)right bottom:(CGFloat)bottom left:(CGFloat)left;
@end
@@ -0,0 +1,53 @@
//
// UIButton+HXExtension.m
// HXPhotoPickerExample
//
// Created by Silence on 17/2/16.
// Copyright © 2017年 Silence. All rights reserved.
//
#import "UIButton+HXExtension.h"
#import <objc/runtime.h>
@implementation UIButton (HXExtension)
static char topNameKey;
static char rightNameKey;
static char bottomNameKey;
static char leftNameKey;
- (void)hx_setEnlargeEdgeWithTop:(CGFloat)top right:(CGFloat)right bottom:(CGFloat)bottom left:(CGFloat)left
{
objc_setAssociatedObject(self, &topNameKey, [NSNumber numberWithFloat:top], OBJC_ASSOCIATION_COPY_NONATOMIC);
objc_setAssociatedObject(self, &rightNameKey, [NSNumber numberWithFloat:right], OBJC_ASSOCIATION_COPY_NONATOMIC);
objc_setAssociatedObject(self, &bottomNameKey, [NSNumber numberWithFloat:bottom], OBJC_ASSOCIATION_COPY_NONATOMIC);
objc_setAssociatedObject(self, &leftNameKey, [NSNumber numberWithFloat:left], OBJC_ASSOCIATION_COPY_NONATOMIC);
}
- (CGRect)enlargedRect{
NSNumber* topEdge = objc_getAssociatedObject(self, &topNameKey);
NSNumber* rightEdge = objc_getAssociatedObject(self, &rightNameKey);
NSNumber* bottomEdge = objc_getAssociatedObject(self, &bottomNameKey);
NSNumber* leftEdge = objc_getAssociatedObject(self, &leftNameKey);
if (topEdge && rightEdge && bottomEdge && leftEdge){
return CGRectMake(self.bounds.origin.x - leftEdge.floatValue,
self.bounds.origin.y - topEdge.floatValue,
self.bounds.size.width + leftEdge.floatValue + rightEdge.floatValue,
self.bounds.size.height + topEdge.floatValue + bottomEdge.floatValue);
} else{
return self.bounds;
}
}
- (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event{
CGRect rect = [self enlargedRect];
if (CGRectEqualToRect(rect, self.bounds)){
return [super pointInside:point withEvent:event];
}else{
return CGRectContainsPoint(rect, point);
}
}
@end
@@ -0,0 +1,41 @@
//
// UIButton+NYS.h
// NewAnju_IOS
//
// Created by 倪永胜 on 2020/5/26.
// Copyright © 2020 NiYongsheng. All rights reserved.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
typedef NS_ENUM(NSInteger, DIYStyle) {
DIYStyleDefault = 0, // 左图右文,整体居中,默认状态
DIYStyleImgLeft = 1, // 左图右文,整体居中,设置间隙
DIYStyleImgRight = 2, // 左文右图,整体居中,设置间隙
DIYStyleImgTop = 3, // 上图下文,整体居中,设置间隙
DIYStyleImgBottom = 4, // 下图上文,整体居中,设置间隙
};
@interface UIButton (NYS)
- (void)enlargeTouchEdge:(UIEdgeInsets)edge;
/** style:图文样式 padding:图文间隙 */
- (void)setDIYStyle:(DIYStyle)style padding:(CGFloat)padding;
- (void)DIYStyle:(DIYStyle)style padding:(CGFloat)padding;
/** style:图文样式 padding:图文间隙 size:设置图片的宽高 */
- (void)setDIYStyle:(DIYStyle)style padding:(CGFloat)padding imageViewSize:(CGSize)size;
- (void)DIYStyle:(DIYStyle)style padding:(CGFloat)padding titleWidth:(CGFloat)titleWidth;
- (void)setDIYStyle:(DIYStyle)style padding:(CGFloat)padding imageViewSize:(CGSize)size titleWidth:(CGFloat)titleWidth;
@end
NS_ASSUME_NONNULL_END
@@ -0,0 +1,309 @@
//
// UIButton+NYS.m
// NewAnju_IOS
//
// Created by 倪永胜 on 2020/5/26.
// Copyright © 2020 NiYongsheng. All rights reserved.
//
#import "UIButton+NYS.h"
#import <objc/runtime.h>
@interface UIButton ()
@property(nonatomic,strong)UILabel *badgeLabel;
@end
@implementation UIButton (NYS)
static char edgeKey;
- (NSString *)enlargeEdge {
return objc_getAssociatedObject(self, &edgeKey);
}
- (void)enlargeTouchEdge:(UIEdgeInsets)edge {
NSString *edgeStr = NSStringFromUIEdgeInsets(edge);
objc_setAssociatedObject(self, &edgeKey, edgeStr, OBJC_ASSOCIATION_COPY_NONATOMIC);
}
- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event {
UIEdgeInsets changeInsets = UIEdgeInsetsFromString([self enlargeEdge]);
CGFloat x = self.bounds.origin.x + changeInsets.left;
CGFloat y = self.bounds.origin.y + changeInsets.top;
CGFloat width = self.bounds.size.width - changeInsets.left - changeInsets.right;
CGFloat height = self.bounds.size.height - changeInsets.top - changeInsets.bottom;
CGRect rect = CGRectMake(x, y, width, height);
if (CGRectEqualToRect(rect, self.bounds)) {
return [super hitTest:point withEvent:event];
}
return CGRectContainsPoint(rect, point) ? self : nil;
}
- (void)setDIYStyle:(DIYStyle)style padding:(CGFloat)padding imageViewSize:(CGSize)size titleWidth:(CGFloat)titleWidth
{
if (self.imageView.image != nil && self.titleLabel.text != nil)
{
// 先还原
self.titleEdgeInsets = UIEdgeInsetsZero;
self.imageEdgeInsets = UIEdgeInsetsZero;
[self setContentVerticalAlignment:UIControlContentVerticalAlignmentCenter];
self.imageView.width=size.width;
self.imageView.height=size.height;
// 上图下文或者上文下图情况重新计算高
CGFloat imageX = self.imageView.mj_x;
CGFloat titleX = self.titleLabel.mj_x;
CGFloat imageY = self.imageView.mj_y;
CGFloat titleY = self.titleLabel.mj_y;
CGFloat imageW = self.imageView.width;
CGFloat titleW = titleWidth;
CGFloat imageH = self.imageView.height;
CGFloat titleH = self.titleLabel.height;
CGFloat totalH = imageH + titleH + padding;
CGFloat selfH = self.height;
CGFloat selfW = self.width;
switch (style)
{
case DIYStyleImgLeft:
self.titleEdgeInsets = UIEdgeInsetsMake(0, padding/2.0, 0, -padding/2.0);
self.imageEdgeInsets = UIEdgeInsetsMake(0, -padding/2.0, 0, padding/2.0);
break;
case DIYStyleImgRight:
self.titleEdgeInsets = UIEdgeInsetsMake(0, -(imageW + padding/2.0), 0, (imageW + padding/2.0));
self.imageEdgeInsets = UIEdgeInsetsMake(0, (titleW + padding/2.0), 0, -(titleW + padding/2.0));
break;
case DIYStyleImgTop:
self.titleEdgeInsets = UIEdgeInsetsMake(((selfH - totalH)/2.0 + imageH + padding - titleY),
-(titleX + titleW/2.0 - selfW/2.0),
-((selfH - totalH)/2.0 + imageH + padding - titleY),
(titleX + titleW/2.0 - selfW/2.0));
self.imageEdgeInsets = UIEdgeInsetsMake(((selfH - totalH)/2.0 - imageY),
(selfW/2.0 - imageX - imageW/2.0),
-((selfH - totalH)/2.0 - imageY),
-(selfW/2.0 - imageX - imageW/2.0));
break;
case DIYStyleImgBottom:
NSLog(@"%f",titleX);
self.titleEdgeInsets = UIEdgeInsetsMake(((selfH - totalH)/2.0 - titleY),
-(titleX + titleW/2.0 - selfW/2.0),
-((selfH - totalH)/2.0 - titleY),
(titleX + titleW/2.0 - selfW/2.0));
self.imageEdgeInsets = UIEdgeInsetsMake(((selfH - totalH)/2.0 + titleH + padding - imageY),
(selfW/2.0 - imageX - imageW/2.0),
-((selfH - totalH)/2.0 + titleH + padding - imageY),
-(selfW/2.0 - imageX - imageW/2.0));
break;
default:
break;
}
}
}
//设置图片的宽高
- (void)setDIYStyle:(DIYStyle)style padding:(CGFloat)padding imageViewSize:(CGSize)size
{
if (self.imageView.image != nil && self.titleLabel.text != nil)
{
// 先还原
self.titleEdgeInsets = UIEdgeInsetsZero;
self.imageEdgeInsets = UIEdgeInsetsZero;
[self setContentVerticalAlignment:UIControlContentVerticalAlignmentCenter];
self.contentMode = UIViewContentModeCenter;
self.imageView.width=size.width;
self.imageView.height=size.height;
// 上图下文或者上文下图情况重新计算高
CGFloat imageX = self.imageView.mj_x;
CGFloat titleX = self.titleLabel.mj_x;
CGFloat imageY = self.imageView.mj_y;
CGFloat titleY = self.titleLabel.mj_y;
CGFloat imageW = self.imageView.width;
CGFloat titleW = self.titleLabel.width;
CGFloat imageH = self.imageView.height;
CGFloat titleH = self.titleLabel.height;
CGFloat totalH = imageH + titleH + padding;
CGFloat selfH = self.height;
CGFloat selfW = self.width;
switch (style)
{
case DIYStyleImgLeft:
self.titleEdgeInsets = UIEdgeInsetsMake(0, padding/2.0, 0, -padding/2.0);
self.imageEdgeInsets = UIEdgeInsetsMake(0, -padding/2.0, 0, padding/2.0);
break;
case DIYStyleImgRight:
self.titleEdgeInsets = UIEdgeInsetsMake(0, -(imageW + padding/2.0), 0, (imageW + padding/2.0));
self.imageEdgeInsets = UIEdgeInsetsMake(0, (titleW + padding/2.0), 0, -(titleW + padding/2.0));
break;
case DIYStyleImgTop:
self.titleEdgeInsets = UIEdgeInsetsMake(((selfH - totalH)/2.0 + imageH + padding - titleY),
-2*(titleX + titleW/2.0 - selfW/2.0),
-((selfH - totalH)/2.0 + imageH + padding - titleY),
0);
self.imageEdgeInsets = UIEdgeInsetsMake(((selfH - totalH)/2.0 - imageY),
(selfW/2.0 - imageX - imageW/2.0) + kRealValue(6),
-((selfH - totalH)/2.0 - imageY),
-(selfW/2.0 - imageX - imageW/2.0));
break;
case DIYStyleImgBottom:
NSLog(@"%f",titleX);
self.titleEdgeInsets = UIEdgeInsetsMake(((selfH - totalH)/2.0 - titleY),
-(titleX + titleW/2.0 - selfW/2.0),
-((selfH - totalH)/2.0 - titleY),
(titleX + titleW/2.0 - selfW/2.0));
self.imageEdgeInsets = UIEdgeInsetsMake(((selfH - totalH)/2.0 + titleH + padding - imageY),
(selfW/2.0 - imageX - imageW/2.0),
-((selfH - totalH)/2.0 + titleH + padding - imageY),
-(selfW/2.0 - imageX - imageW/2.0));
break;
default:
break;
}
}
}
- (void)setDIYStyle:(DIYStyle)style padding:(CGFloat)padding
{
if (self.imageView.image != nil && self.titleLabel.text != nil)
{
// 先还原
self.titleEdgeInsets = UIEdgeInsetsZero;
self.imageEdgeInsets = UIEdgeInsetsZero;
[self setContentVerticalAlignment:UIControlContentVerticalAlignmentCenter];
// 上图下文或者上文下图情况重新计算高
CGFloat imageX = self.imageView.mj_x;
CGFloat titleX = self.titleLabel.mj_x;
CGFloat imageY = self.imageView.mj_y;
CGFloat titleY = self.titleLabel.mj_y;
CGFloat imageW = self.imageView.width;
CGFloat titleW = self.titleLabel.width;
CGFloat imageH = self.imageView.height;
CGFloat titleH = self.titleLabel.height;
CGFloat totalH = imageH + titleH + padding;
CGFloat selfH = self.height;
CGFloat selfW = self.width;
switch (style)
{
case DIYStyleImgLeft:
self.titleEdgeInsets = UIEdgeInsetsMake(0, padding/2.0, 0, -padding/2.0);
self.imageEdgeInsets = UIEdgeInsetsMake(0, -padding/2.0, 0, padding/2.0);
break;
case DIYStyleImgRight:
self.titleEdgeInsets = UIEdgeInsetsMake(0, -(imageW + padding/2.0), 0, (imageW + padding/2.0));
self.imageEdgeInsets = UIEdgeInsetsMake(0, (titleW + padding/2.0), 0, -(titleW + padding/2.0));
break;
case DIYStyleImgTop:
self.titleEdgeInsets = UIEdgeInsetsMake(((selfH - totalH)/2.0 + imageH + padding - titleY),
-2*(titleX + titleW/2.0 - selfW/2.0),
-((selfH - totalH)/2.0 + imageH + padding - titleY),
0);
self.imageEdgeInsets = UIEdgeInsetsMake(((selfH - totalH)/2.0 - imageY),
(selfW/2.0 - imageX - imageW/2.0),
-((selfH - totalH)/2.0 - imageY),
-(selfW/2.0 - imageX - imageW/2.0));
break;
case DIYStyleImgBottom:
NSLog(@"%f",titleX);
self.titleEdgeInsets = UIEdgeInsetsMake(((selfH - totalH)/2.0 - titleY),
-(titleX + titleW/2.0 - selfW/2.0),
-((selfH - totalH)/2.0 - titleY),
(titleX + titleW/2.0 - selfW/2.0));
self.imageEdgeInsets = UIEdgeInsetsMake(((selfH - totalH)/2.0 + titleH + padding - imageY),
(selfW/2.0 - imageX - imageW/2.0),
-((selfH - totalH)/2.0 + titleH + padding - imageY),
-(selfW/2.0 - imageX - imageW/2.0));
break;
default:
break;
}
}
}
- (void)DIYStyle:(DIYStyle)style padding:(CGFloat)padding {
[self setDIYStyle:style padding:padding];
}
- (void)DIYStyle:(DIYStyle)style padding:(CGFloat)padding titleWidth:(CGFloat)titleWidth
{
if (self.imageView.image != nil && self.titleLabel.text != nil)
{
// 先还原
self.titleEdgeInsets = UIEdgeInsetsZero;
self.imageEdgeInsets = UIEdgeInsetsZero;
[self setContentVerticalAlignment:UIControlContentVerticalAlignmentCenter];
self.contentMode=UIViewContentModeCenter;
// 上图下文或者上文下图情况重新计算高
CGFloat imageX = self.imageView.mj_x;
CGFloat titleX = self.titleLabel.mj_x;
CGFloat imageY = self.imageView.mj_y;
CGFloat titleY = self.titleLabel.mj_y;
CGFloat imageW = self.imageView.width;
CGFloat titleW = titleWidth;
CGFloat imageH = self.imageView.height;
CGFloat titleH = self.titleLabel.height;
CGFloat totalH = imageH + titleH + padding;
CGFloat selfH = self.height;
CGFloat selfW = self.width;
switch (style)
{
case DIYStyleImgLeft:
self.titleEdgeInsets = UIEdgeInsetsMake(0, padding/2.0, 0, -padding/2.0);
self.imageEdgeInsets = UIEdgeInsetsMake(0, -padding/2.0, 0, padding/2.0);
break;
case DIYStyleImgRight:
self.titleEdgeInsets = UIEdgeInsetsMake(0, -(imageW + padding/2.0), 0, (imageW + padding/2.0));
self.imageEdgeInsets = UIEdgeInsetsMake(0, (titleW + padding/2.0), 0, -(titleW + padding/2.0));
break;
case DIYStyleImgTop:
self.titleEdgeInsets = UIEdgeInsetsMake(((selfH - totalH)/2.0 + imageH + padding - titleY),
-(titleX + titleW/2.0 - selfW/2.0),
-((selfH - totalH)/2.0 + imageH + padding - titleY),
(titleX + titleW/2.0 - selfW/2.0));
self.imageEdgeInsets = UIEdgeInsetsMake(((selfH - totalH)/2.0 - imageY),
(selfW/2.0 - imageX - imageW/2.0),
-((selfH - totalH)/2.0 - imageY),
-(selfW/2.0 - imageX - imageW/2.0));
break;
case DIYStyleImgBottom:
NSLog(@"%f",titleX);
self.titleEdgeInsets = UIEdgeInsetsMake(((selfH - totalH)/2.0 - titleY),
-(titleX + titleW/2.0 - selfW/2.0),
-((selfH - totalH)/2.0 - titleY),
(titleX + titleW/2.0 - selfW/2.0));
self.imageEdgeInsets = UIEdgeInsetsMake(((selfH - totalH)/2.0 + titleH + padding - imageY),
(selfW/2.0 - imageX - imageW/2.0),
-((selfH - totalH)/2.0 + titleH + padding - imageY),
-(selfW/2.0 - imageX - imageW/2.0));
break;
default:
break;
}
}
}
@end
@@ -0,0 +1,18 @@
//
// UIDevice+model.h
// EscortProject
//
// Created by Apple on 2024/3/29.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface UIDevice (model)
- (NSString *)getCurrentDeviceModel;
@end
NS_ASSUME_NONNULL_END
@@ -0,0 +1,115 @@
//
// UIDevice+model.m
// EscortProject
//
// Created by Apple on 2024/3/29.
//
#import "UIDevice+model.h"
#import <sys/utsname.h>
//有新的产品上线,我没有更新,可以自行去查阅https://www.theiphonewiki.com/wiki/Models
@implementation UIDevice (model)
- (NSString *)getCurrentDeviceModel{
struct utsname systemInfo;
uname(&systemInfo);
NSString *deviceModel = [NSString stringWithCString:systemInfo.machine encoding:NSASCIIStringEncoding];
if ([deviceModel isEqualToString:@"iPhone3,1"]) return @"iPhone 4";
if ([deviceModel isEqualToString:@"iPhone3,2"]) return @"iPhone 4";
if ([deviceModel isEqualToString:@"iPhone3,3"]) return @"iPhone 4";
if ([deviceModel isEqualToString:@"iPhone4,1"]) return @"iPhone 4S";
if ([deviceModel isEqualToString:@"iPhone5,1"]) return @"iPhone 5";
if ([deviceModel isEqualToString:@"iPhone5,2"]) return @"iPhone 5 (GSM+CDMA)";
if ([deviceModel isEqualToString:@"iPhone5,3"]) return @"iPhone 5c (GSM)";
if ([deviceModel isEqualToString:@"iPhone5,4"]) return @"iPhone 5c (GSM+CDMA)";
if ([deviceModel isEqualToString:@"iPhone6,1"]) return @"iPhone 5s (GSM)";
if ([deviceModel isEqualToString:@"iPhone6,2"]) return @"iPhone 5s (GSM+CDMA)";
if ([deviceModel isEqualToString:@"iPhone7,1"]) return @"iPhone 6 Plus";
if ([deviceModel isEqualToString:@"iPhone7,2"]) return @"iPhone 6";
if ([deviceModel isEqualToString:@"iPhone8,1"]) return @"iPhone 6s";
if ([deviceModel isEqualToString:@"iPhone8,2"]) return @"iPhone 6s Plus";
if ([deviceModel isEqualToString:@"iPhone8,4"]) return @"iPhone SE";
// 日行两款手机型号均为日本独占,可能使用索尼FeliCa支付方案而不是苹果支付
if ([deviceModel isEqualToString:@"iPhone9,1"]) return @"iPhone 7";
if ([deviceModel isEqualToString:@"iPhone9,2"]) return @"iPhone 7 Plus";
if ([deviceModel isEqualToString:@"iPhone9,3"]) return @"iPhone 7";
if ([deviceModel isEqualToString:@"iPhone9,4"]) return @"iPhone 7 Plus";
if ([deviceModel isEqualToString:@"iPhone10,1"]) return @"iPhone_8";
if ([deviceModel isEqualToString:@"iPhone10,4"]) return @"iPhone_8";
if ([deviceModel isEqualToString:@"iPhone10,2"]) return @"iPhone_8_Plus";
if ([deviceModel isEqualToString:@"iPhone10,5"]) return @"iPhone_8_Plus";
if ([deviceModel isEqualToString:@"iPhone10,3"]) return @"iPhone X";
if ([deviceModel isEqualToString:@"iPhone10,6"]) return @"iPhone X";
if ([deviceModel isEqualToString:@"iPhone11,8"]) return @"iPhone XR";
if ([deviceModel isEqualToString:@"iPhone11,2"]) return @"iPhone XS";
if ([deviceModel isEqualToString:@"iPhone11,6"]) return @"iPhone XS Max";
if ([deviceModel isEqualToString:@"iPhone11,4"]) return @"iPhone XS Max";
if ([deviceModel isEqualToString:@"iPhone12,1"]) return @"iPhone 11";
if ([deviceModel isEqualToString:@"iPhone12,3"]) return @"iPhone 11 Pro";
if ([deviceModel isEqualToString:@"iPhone12,5"]) return @"iPhone 11 Pro Max";
if ([deviceModel isEqualToString:@"iPhone12,8"]) return @"iPhone SE2";
if ([deviceModel isEqualToString:@"iPhone13,1"]) return @"iPhone 12 mini";
if ([deviceModel isEqualToString:@"iPhone13,2"]) return @"iPhone 12";
if ([deviceModel isEqualToString:@"iPhone13,3"]) return @"iPhone 12 Pro";
if ([deviceModel isEqualToString:@"iPhone13,4"]) return @"iPhone 12 Pro Max";
if ([deviceModel isEqualToString:@"iPhone14,4"]) return @"iPhone 13 mini";
if ([deviceModel isEqualToString:@"iPhone14,5"]) return @"iPhone 13";
if ([deviceModel isEqualToString:@"iPhone14,2"]) return @"iPhone 13 Pro";
if ([deviceModel isEqualToString:@"iPhone14,3"]) return @"iPhone 13 Pro Max";
if ([deviceModel isEqualToString:@"iPhone14,7"]) return @"iPhone 14";
if ([deviceModel isEqualToString:@"iPhone14,8"]) return @"iPhone 14 Plus";
if ([deviceModel isEqualToString:@"iPhone15,2"]) return @"iPhone 14 Pro";
if ([deviceModel isEqualToString:@"iPhone15,3"]) return @"iPhone 14 Pro Max";
if ([deviceModel isEqualToString:@"iPod1,1"]) return @"iPod Touch 1G";
if ([deviceModel isEqualToString:@"iPod2,1"]) return @"iPod Touch 2G";
if ([deviceModel isEqualToString:@"iPod3,1"]) return @"iPod Touch 3G";
if ([deviceModel isEqualToString:@"iPod4,1"]) return @"iPod Touch 4G";
if ([deviceModel isEqualToString:@"iPod5,1"]) return @"iPod Touch (5 Gen)";
if ([deviceModel isEqualToString:@"iPad1,1"]) return @"iPad";
if ([deviceModel isEqualToString:@"iPad1,2"]) return @"iPad 3G";
if ([deviceModel isEqualToString:@"iPad2,1"]) return @"iPad 2 (WiFi)";
if ([deviceModel isEqualToString:@"iPad2,2"]) return @"iPad 2";
if ([deviceModel isEqualToString:@"iPad2,3"]) return @"iPad 2 (CDMA)";
if ([deviceModel isEqualToString:@"iPad2,4"]) return @"iPad 2";
if ([deviceModel isEqualToString:@"iPad2,5"]) return @"iPad Mini (WiFi)";
if ([deviceModel isEqualToString:@"iPad2,6"]) return @"iPad Mini";
if ([deviceModel isEqualToString:@"iPad2,7"]) return @"iPad Mini (GSM+CDMA)";
if ([deviceModel isEqualToString:@"iPad3,1"]) return @"iPad 3 (WiFi)";
if ([deviceModel isEqualToString:@"iPad3,2"]) return @"iPad 3 (GSM+CDMA)";
if ([deviceModel isEqualToString:@"iPad3,3"]) return @"iPad 3";
if ([deviceModel isEqualToString:@"iPad3,4"]) return @"iPad 4 (WiFi)";
if ([deviceModel isEqualToString:@"iPad3,5"]) return @"iPad 4";
if ([deviceModel isEqualToString:@"iPad3,6"]) return @"iPad 4 (GSM+CDMA)";
if ([deviceModel isEqualToString:@"iPad4,1"]) return @"iPad Air (WiFi)";
if ([deviceModel isEqualToString:@"iPad4,2"]) return @"iPad Air (Cellular)";
if ([deviceModel isEqualToString:@"iPad4,4"]) return @"iPad Mini 2 (WiFi)";
if ([deviceModel isEqualToString:@"iPad4,5"]) return @"iPad Mini 2 (Cellular)";
if ([deviceModel isEqualToString:@"iPad4,6"]) return @"iPad Mini 2";
if ([deviceModel isEqualToString:@"iPad4,7"]) return @"iPad Mini 3";
if ([deviceModel isEqualToString:@"iPad4,8"]) return @"iPad Mini 3";
if ([deviceModel isEqualToString:@"iPad4,9"]) return @"iPad Mini 3";
if ([deviceModel isEqualToString:@"iPad5,1"]) return @"iPad Mini 4 (WiFi)";
if ([deviceModel isEqualToString:@"iPad5,2"]) return @"iPad Mini 4 (LTE)";
if ([deviceModel isEqualToString:@"iPad5,3"]) return @"iPad Air 2";
if ([deviceModel isEqualToString:@"iPad5,4"]) return @"iPad Air 2";
if ([deviceModel isEqualToString:@"iPad6,3"]) return @"iPad Pro 9.7";
if ([deviceModel isEqualToString:@"iPad6,4"]) return @"iPad Pro 9.7";
if ([deviceModel isEqualToString:@"iPad6,7"]) return @"iPad Pro 12.9";
if ([deviceModel isEqualToString:@"iPad6,8"]) return @"iPad Pro 12.9";
if ([deviceModel isEqualToString:@"AppleTV2,1"]) return @"Apple TV 2";
if ([deviceModel isEqualToString:@"AppleTV3,1"]) return @"Apple TV 3";
if ([deviceModel isEqualToString:@"AppleTV3,2"]) return @"Apple TV 3";
if ([deviceModel isEqualToString:@"AppleTV5,3"]) return @"Apple TV 4";
if ([deviceModel isEqualToString:@"i386"]) return @"Simulator";
if ([deviceModel isEqualToString:@"x86_64"]) return @"Simulator";
return deviceModel;
}
@end
@@ -0,0 +1,16 @@
//
// UIImage+RoundedCorner.h
// EscortProject
//
// Created by Apple on 2024/4/24.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface UIImage (RoundedCorner)
- (UIImage *)roundCornersWithRadius:(NSInteger)radius;
@end
NS_ASSUME_NONNULL_END
@@ -0,0 +1,34 @@
//
// UIImage+RoundedCorner.m
// EscortProject
//
// Created by Apple on 2024/4/24.
//
#import "UIImage+RoundedCorner.h"
@implementation UIImage (RoundedCorner)
- (UIImage *)roundCornersWithRadius:(NSInteger)radius {
UIImage *inputImage = self;
CGImageRef image = inputImage.CGImage;
CGRect imageRect = CGRectMake(0, 0, inputImage.size.width, inputImage.size.height);
UIBezierPath *path = [UIBezierPath bezierPathWithRoundedRect:imageRect cornerRadius:radius];
CGContextRef context = CGBitmapContextCreate(NULL, inputImage.size.width, inputImage.size.height, 8, 0, CGColorSpaceCreateDeviceRGB(), kCGImageAlphaPremultipliedLast);
CGContextBeginPath(context);
CGContextAddPath(context, path.CGPath);
CGContextClip(context);
CGContextDrawImage(context, imageRect, image);
CGImageRef ref = CGBitmapContextCreateImage(context);
UIImage *outputImage = [UIImage imageWithCGImage:ref];
CGContextRelease(context);
CGImageRelease(ref);
return outputImage;
}
@end
@@ -0,0 +1,31 @@
//
// UILabel+ChangeLineSpaceAndWordSpace.h
// healthQuestion
//
// Created by 仁康信息 on 2022/10/11.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface UILabel (ChangeLineSpaceAndWordSpace)
/**
* 改变行间距
*/
+ (void)changeLineSpaceForLabel:(UILabel *)label WithSpace:(float)space;
/**
* 改变字间距
*/
+ (void)changeWordSpaceForLabel:(UILabel *)label WithSpace:(float)space;
/**
* 改变行间距和字间距
*/
+ (void)changeSpaceForLabel:(UILabel *)label withLineSpace:(float)lineSpace WordSpace:(float)wordSpace;
@end
NS_ASSUME_NONNULL_END
@@ -0,0 +1,42 @@
//
// UILabel+ChangeLineSpaceAndWordSpace.m
// healthQuestion
//
// Created by 仁康信息 on 2022/10/11.
//
#import "UILabel+ChangeLineSpaceAndWordSpace.h"
@implementation UILabel (ChangeLineSpaceAndWordSpace)
+ (void)changeLineSpaceForLabel:(UILabel *)label WithSpace:(float)space {
NSString *labelText = label.text;
NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:labelText];
NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
[paragraphStyle setLineSpacing:space];
[attributedString addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, [labelText length])];
label.attributedText = attributedString;
[label sizeToFit];
}
+ (void)changeWordSpaceForLabel:(UILabel *)label WithSpace:(float)space {
NSString *labelText = label.text;
NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:labelText attributes:@{NSKernAttributeName:@(space)}];
NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
[attributedString addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, [labelText length])];
label.attributedText = attributedString;
[label sizeToFit];
}
+ (void)changeSpaceForLabel:(UILabel *)label withLineSpace:(float)lineSpace WordSpace:(float)wordSpace {
NSString *labelText = label.text;
NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:labelText attributes:@{NSKernAttributeName:@(wordSpace)}];
NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
[paragraphStyle setLineSpacing:lineSpace];
[attributedString addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, [labelText length])];
label.attributedText = attributedString;
[label sizeToFit];
}
@end
@@ -0,0 +1,16 @@
//
// UILabel+Extension.h
// WDYAdjustFontSize
//
// Created by wdyzmx on 2022/1/19.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface UILabel (Extension)
@property (nonatomic) NSString *verticalText;
@end
NS_ASSUME_NONNULL_END
@@ -0,0 +1,62 @@
//
// UILabel+Extension.m
// WDYAdjustFontSize
//
// Created by wdyzmx on 2022/1/19.
//
#import "UILabel+Extension.h"
#import "SwapMethodManager.h"
#import <objc/runtime.h>
@implementation UILabel (Extension)
+ (void)load {
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
[SwapMethodManager swapMethodInClass:[self class] originalMethod:@selector(didMoveToSuperview) swizzledMethod:@selector(hooked_didMoveToSuperview)];
[SwapMethodManager swapMethodInClass:[self class] originalMethod:@selector(removeFromSuperview) swizzledMethod:@selector(hooked_removeFromSuperview)];
[SwapMethodManager swapMethodInClass:[self class] originalMethod:@selector(setAttributedText:) swizzledMethod:@selector(hooked_setAttributedText:)];
});
}
- (void)hooked_didMoveToSuperview {
[self hooked_didMoveToSuperview];
// 添加控件
}
- (void)hooked_removeFromSuperview {
[self hooked_removeFromSuperview];
// 删除控件
}
- (void)hooked_setAttributedText:(NSAttributedString *)attributedText {
[self hooked_setAttributedText:attributedText];
//
}
- (NSString *)verticalText
{
// 利用runtime 添加属性- (void)setVerticalText:(NSString *)verticalText
return objc_getAssociatedObject(self, @selector(verticalText));
}
- (void)setVerticalText:(NSString *)verticalText
{
objc_setAssociatedObject(self, &verticalText, verticalText, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
NSMutableString *mutableString = [[NSMutableString alloc] initWithString:verticalText];
NSInteger count = mutableString.length;
for (int i = 1; i < count; i++) {
[mutableString insertString:@"\n" atIndex:i * 2 - 1];
}
self.text = mutableString;
self.numberOfLines = 0;
}
@end
@@ -0,0 +1,25 @@
//
// UIView+FK.h
// Doctor
//
// Created by 张正梅 on 2019/5/30.
// Copyright © 2019 com.longmaster. All rights reserved.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface UIView (FK)
- (UIView *)clipCornerWithView:(UIView *)originView
andTopLeft:(BOOL)topLeft
andTopRight:(BOOL)topRight
andBottomLeft:(BOOL)bottomLeft
andBottomRight:(BOOL)bottomRight;
- (void)MaskLayerByRedius:(CGFloat)cornerRedius ByColor:(UIColor *)color ByWidth:(CGFloat)width;
- (void)MaskToBounds:(CGFloat)cornerRedius;
- (UIViewController *)viewController;
@end
NS_ASSUME_NONNULL_END
@@ -0,0 +1,55 @@
//
// UIView+FK.m
// Doctor
//
// Created by 张正梅 on 2019/5/30.
// Copyright © 2019 com.longmaster. All rights reserved.
//
#import "UIView+FK.h"
@implementation UIView (FK)
- (UIView *)clipCornerWithView:(UIView *)originView
andTopLeft:(BOOL)topLeft
andTopRight:(BOOL)topRight
andBottomLeft:(BOOL)bottomLeft
andBottomRight:(BOOL)bottomRight
{
UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:originView.bounds
byRoundingCorners:(topLeft==YES ? UIRectCornerTopLeft : 0) |
(topRight==YES ? UIRectCornerTopRight : 0) |
(bottomLeft==YES ? UIRectCornerBottomLeft : 0) |
(bottomRight==YES ? UIRectCornerBottomRight : 0)
cornerRadii:CGSizeMake(20, 20)];
// 创建遮罩层
CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
maskLayer.frame = originView.bounds;
maskLayer.path = maskPath.CGPath; // 轨迹
originView.layer.mask = maskLayer;
return originView;
}
- (void)MaskLayerByRedius:(CGFloat)cornerRedius ByColor:(UIColor *)color ByWidth:(CGFloat)width{
[self MaskToBounds:cornerRedius];
self.layer.borderColor = color.CGColor;
self.layer.borderWidth = width;
}
- (void)MaskToBounds:(CGFloat)cornerRedius{
self.layer.masksToBounds = YES;
self.layer.cornerRadius = cornerRedius;
}
- (UIViewController *)viewController{
UIResponder *next = [self nextResponder];
do {
if ([next isKindOfClass:[UIViewController class]]) {
return (UIViewController *)next;
}else{
next = [next nextResponder];
}
} while (next != nil);
return nil;
}
@end
@@ -0,0 +1,58 @@
//
// FontAndColorMacros.h
// idleBuy
//
// Created by ios on 2018/5/28.
// Copyright © 2018年 ios. All rights reserved.
//
#ifndef FontAndColorMacros_h
#define FontAndColorMacros_h
#pragma mark - 间距区
//默认间距
#define KNormalSpace 12.0f
#pragma mark - 颜色区
//主题色 导航栏颜色
//#define CNavBgColor RGBA()
#define CNavBgColor [UIColor colorWithHexString:@"00AE68"]
//#define CNavBgColor [Ulor colorWithHexString:@"ffffff"]
#define CNavBgFontColor [UIColor colorWithHexString:@"ffffff"]
//默认页面背景色
#define CViewBgColor [UIColor colorWithHexString:@"#F3F4F6"]
//分割线颜色
#define CLineColor [UIColor colorWithHexString:@"ededed"]
//次级字色
#define CFontColor1 [UIColor colorWithHexString:@"1f1f1f"]
//再次级字色
#define CFontColor2 [UIColor colorWithHexString:@"5c5c5c"]
#define kRandomColor [UIColor colorWithRed:arc4random_uniform(256)/255.0 green:arc4random_uniform(256)/255.0 blue:arc4random_uniform(256)/255.0 alpha:1.0]
#pragma mark - 第三方字体区
//十进制颜色转换
#define QMRGBA(r,g,b,a) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:a]
//十六进制颜色转换(0xFFFFFF
#define QMHEXRGB(hex) [UIColor colorWithRed:((float)((hex & 0xFF0000) >> 16))/255.0 green:((float)((hex & 0xFF00) >> 8))/255.0 blue:((float)(hex & 0xFF))/255.0 alpha:1.0]
#define QMHEXSRGB(hexStr) [UIColor colorWithRed:strtoul([[hexStr substringWithRange:NSMakeRange(hexStr.length - 6, 2)] UTF8String],0,16)/255.0 green:strtoul([[hexStr substringWithRange:NSMakeRange(hexStr.length - 4, 2)] UTF8String],0,16)/255.0 blue:strtoul([[hexStr substringWithRange:NSMakeRange(hexStr.length - 2, 2)] UTF8String],0,16)/255.0 alpha:1.0]
#ifndef kScale6
#define kScale6 (UIScreen.mainScreen.bounds.size.width/375.0)
#endif
#define FFont1 [UIFont systemFontOfSize:12.0f]
#endif /* FontAndColorMacros_h */
+93
View File
@@ -0,0 +1,93 @@
//
// StatusMacros.h
// idleBuy
//
// Created by ios on 2018/5/28.
// Copyright © 2018年 ios. All rights reserved.
//
#ifndef StatusMacros_h
#define StatusMacros_h
#pragma mark - ——————— 用户相关 ————————
//登录状态改变通知
#define KNotificationLoginStateChange @"loginStateChange"
//登录IM状态
#define KNotificationLoginIMResult @"loginIMResult"
//切换tabar
#define KNotificSelectHomePageTabbar @"SlectHomePageTabBar"
#define KNotificSelectSoSTabbar @"SlectSoSTabBar"
#define KNotificSelectPhysicalTabbar @"SlectPhysicalTabBar"
#define KNotificSelectFileTabbar @"SlectFileTabBar"
//同意协议
//切换字体
#define KNotificChangeFontSize @"changeFontSize"
//经纬度
#define USERDEFAULLONG @"USERDEFAULLONG"
#define USERDEFAULLATITUDE @"USERDEFAULLATITUDE"
//自动登录成功
#define KNotificationAutoLoginSuccess @"KNotificationAutoLoginSuccess"
//用户信息缓存 名称
#define KUserCacheName @"KUserCacheName"
//用户model缓存
#define KUserModelCache @"KUserModelCache"
//是否第一次进入 选用
#define KUserFirstStar @"FirstStar"
//健康信息token
#define KHEALTHTOKEN @"HEALTHTOKEN"
#define User_ID [HQCommonUtils loginID]
#define User_Token [HQCommonUtils loginToken]
#pragma mark - ——————— 网络状态相关 ————————
//网络状态变化
#define KNotificationNetWorkStateChange @"KNotificationNetWorkStateChange"
#define KNotificAmapAgreeProtoocl @"AMAPDELEGATE"
//取消支付
#pragma mark: 网络前缀
#define ResourceAddress [NSString stringWithFormat:@"%@/file/show/",Http]
//生产环境
//#define Http @"https://api.cqygjk.com"//
//#define H5Http @"https://console.cqygjk.com/"///
//#define H5DevHost @"cqyt.out.yg.icdat.cn"//
//#define IntervenH5 @"https://console.cqygjk.com"
//#define Http UserDefaultObjectForKey(@"HTTPS")//
//#define H5DevHost UserDefaultObjectForKey(@"H5DevHost")//
//#define IntervenH5 UserDefaultObjectForKey(@"IntervenH5")
//测试环境地址
//四合一
//正文斌 @"http://192.168.1.28"。青海项目:https://quarry-api.yg.icdat.cn 四合一://https://starry.test.icdat.cn
//#define Http @"https://starry.test.icdat.cn"
//#define H5DevHost @"starry.test.icdat.cn"//
//#define IntervenH5 @"https://starry.out.icdat.cn"
//开发环境地址
#define Http @"http://cqyt.dev.yg.dt.io"//
#define H5DevHost @"cqyt.dev.yg.dt.io"//
#define IntervenH5 @"http://cms.dev.yg.dt.io"
#define BASEURL @"https://yyjk.cqygjk.com" //北边接口前缀
#define SCHEME @"http" //
#endif /* StatusMacros_h */
+43
View File
@@ -0,0 +1,43 @@
//
// ThirdMacros.h
// idleBuy
//
// Created by ios on 2018/5/28.
// Copyright © 2018年 ios. All rights reserved.
//
#ifndef ThirdMacros_h
#define ThirdMacros_h
//微信
#define kAppKey_Wechat @""
#define kSecret_Wechat @""
#define UMShareAppKey @""
#define JpushAppKey @""
#define AlipayAppKey @""
#define buglyAppid @""
//高德key
#define AMAPSDKKEY @"e5e5b1aa469fcf577c829165bae860dd"
#define KNotificAgreeProtoocl @"AGREEPMAP"
//友盟appster
#define UMAppSecret @""
#define UMAppkey @""
#define UNiversalLink @""
//腾讯IM
#define TUISDKAPPID 1400792728
#endif /* ThirdMacros_h */
+217
View File
@@ -0,0 +1,217 @@
//
// YYUtilsMacros.h
// idleBuy
//
// Created by ios on 2018/5/28.
// Copyright © 2018年 ios. All rights reserved.
//
#ifndef YYUtilsMacros_h
#define YYUtilsMacros_h
//#define CQHttp @""//正式
//#define CQHttp @"https://cqyt.test.yg.icdat.cn"//
//获取系统对象
#define IOS7 ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0)
#define IOS8 ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0)
#define iOS9Later ([UIDevice currentDevice].systemVersion.floatValue >= 9.0f)
#define kApplication [UIApplication sharedApplication]
#define kAppWindow [UIApplication sharedApplication].delegate.window
#define kAppDelegate [AppDelegate shareAppDelegate]
#define kRootViewController [UIApplication sharedApplication].delegate.window.rootViewController
#define kUserDefaults [NSUserDefaults standardUserDefaults]
#define kNotificationCenter [NSNotificationCenter defaultCenter]
#define kStatusBarHeight [[UIApplication sharedApplication] statusBarFrame].size.height
#define kNavBarHeight 44.0
#define kTabBarHeight ([[UIApplication sharedApplication] statusBarFrame].size.height>20?83:49)
#define kTopHeight (kStatusBarHeight + kNavBarHeight)
/* 系统版本和语言 */
#define IOS_VERSION [[[UIDevice currentDevice] systemVersion] floatValue]
#define CurrentSystemVersion ([[UIDevice currentDevice] systemVersion])
#define CurrentLanguage ([[NSLocale preferredLanguages] objectAtIndex:0])
#define IPad (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
#define IOS7 ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0)
#define IOS8 ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0)
#define iOS9Later ([UIDevice currentDevice].systemVersion.floatValue >= 9.0f)
#define IPHONE4 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 960), [[UIScreen mainScreen] currentMode].size) : NO)
//判断是否是IPHONE5的宏,用法是 if(IPHONE) xxxx else xxxxx
#define IPHONE5 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 1136), [[UIScreen mainScreen] currentMode].size) : NO)
/* 判断iphonex*/
#define IPHONE_X \
({BOOL isPhoneX = NO;\
if (@available(iOS 11.0, *)) {\
isPhoneX = [[UIApplication sharedApplication] delegate].window.safeAreaInsets.bottom > 0.0;\
}\
(isPhoneX);})
/* 宽度*/
#define SCREEN_BOUNDS [[UIScreen mainScreen]bounds]
#define WIDTH [[UIScreen mainScreen]bounds].size.width
#define HEIGHT [[UIScreen mainScreen]bounds].size.height
#define SCREEN_SIZE [[UIScreen mainScreen]bounds].size
#define STATUSBAR_HEIGHT [[UIApplication sharedApplication]statusBarFrame].size.height
#define STATUSBAR_WIDTH [[UIApplication sharedApplication]statusBarFrame].size.width
#define mykeyWindow [UIApplication sharedApplication].delegate.window
#define HEIGHT_6_SCALE HEIGHT/667
#define IS_IPHONE_6P (WIDTH > 375)
#define myScale6 WIDTH/375
#define HEIGHT_TABBAR (IPHONE_X ? 83 : 49)
#define HEIGHT_NAVIGATION (IPHONE_X ? 88 : 64)
#define SafetyAreaHeight (IPHONE_X ? 24 : 0)
#define HomeHEIGHT (HEIGHT - HEIGHT_NAVIGATION - HEIGHT_TABBAR)
#define MyViewHEIGHT (HEIGHT - HEIGHT_NAVIGATION)
#define KNavigationBarHeight (44.0)
#define KStatusBarHeight ([UIApplication sharedApplication].statusBarFrame.size.height)
#define KTopHeight (KNavigationBarHeight + KStatusBarHeight)
#define LineSpace 5
//根据ip6的屏幕来拉伸
#define kRealValue(with) ((with)*(WIDTH/375.0f))
//强弱引用
#define kWeakSelf(type) __weak typeof(type) weak##type = type;
#define kStrongSelf(type) __strong typeof(type) type = weak##type;
//View 圆角和加边框
#define ViewBorderRadius(View, Radius, Width, Color)\
\
[View.layer setCornerRadius:(Radius)];\
[View.layer setMasksToBounds:YES];\
[View.layer setBorderWidth:(Width)];\
[View.layer setBorderColor:[Color CGColor]]
// View 圆角
#define ViewRadius(View, Radius)\
\
[View.layer setCornerRadius:(Radius)];\
[View.layer setMasksToBounds:YES]
//字体
#define BOLDSYSTEMFONT(FONTSIZE)[UIFont boldSystemFontOfSize:FONTSIZE]
#define SYSTEMFONT(FONTSIZE) [UIFont systemFontOfSize:FONTSIZE]
#define FONT(NAME, FONTSIZE) [UIFont fontWithName:(NAME) size:(FONTSIZE)]
#define MEDIUMFONT(FONTSIZE) [UIFont systemFontOfSize:FONTSIZE weight:UIFontWeightMedium];
#define PLACEHOLD_IMG IMAGE_NAMED(@"placeholdIMG")
#define IMAGE_NAMED(name) [UIImage imageNamed:name]
/**
* the saving objects 存储对象
*
* @param __VALUE__ V
* @param __KEY__ K
*
* @return
*/
#define UserDefaultSetObjectForKey(__VALUE__,__KEY__) \
{\
[[NSUserDefaults standardUserDefaults] setObject:__VALUE__ forKey:__KEY__];\
[[NSUserDefaults standardUserDefaults] synchronize];\
}
/**
* get the saved objects 获得存储的对象
*/
#define UserDefaultObjectForKey(__KEY__) [[NSUserDefaults standardUserDefaults] objectForKey:__KEY__]
/**
* delete objects 删除对象
*/
#define UserDefaultRemoveObjectForKey(__KEY__) \
{\
[[NSUserDefaults standardUserDefaults] removeObjectForKey:__KEY__];\
[[NSUserDefaults standardUserDefaults] synchronize];\
}
///IOS 版本判断
#define IOSAVAILABLEVERSION(version) ([[UIDevice currentDevice] availableVersion:version] < 0)
// 当前系统版本
#define CurrentSystemVersion [[UIDevice currentDevice].systemVersion doubleValue]
//当前语言
#define CurrentLanguage (NSLocale preferredLanguages] objectAtIndex:0])
//-------------------打印日志-------------------------
//DEBUG 模式下打印日志,当前行
#ifdef DEBUG
#define DLog(fmt, ...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__);
#else
#define DLog(...)
#endif
//颜色
#define KClearColor [UIColor clearColor]
#define KWhiteColor [UIColor whiteColor]
#define KBlackColor [UIColor blackColor]
#define KGrayColor [UIColor grayColor]
#define KGray2Color [UIColor lightGrayColor]
#define KBlueColor [UIColor blueColor]
#define KRedColor [UIColor redColor]
#define RGBA(r,g,b,a) ([UIColor colorWithRed:r/255.0 \
green:g/255.0 \
blue:b/255.0 \
alpha:a])
#define RGB(r,g,b) (RGBA(r,g,b,1))
#define RGB_VALUE(value) ([UIColor colorWithRed:((float)((value&0xFF0000)>>16))/255.0f \
green:((float)((value&0xFF00)>>8))/255.0f \
blue:((float)(value&0xFF))/255.0f \
alpha:1.0f])
#define Kcustom_color(R,G,B) ([UIColor colorWithRed:(R)/255.0 \
green:(G)/255.0 \
blue:(B)/255.0 \
alpha:1.0])
#define UIColorBackground (RGB(243,244,246))
#define UIColorTitle1 (RGB_VALUE(0x333333))
#define UIColorTitle2 (RGB_VALUE(0x666666))
#define UIColorTitle3 (RGB_VALUE(0x999999))
#define UITextBackColor (RGBA(169,169,169,1))
#define UIWhiteColor ([UIColor whiteColor])
#define UIColorLine (RGB_VALUE(0xE5E5E5))
#define UIColorTheme (RGB(242,48,48))
#define UIGreenColor (RGB(123,209,132))
#define UIColorMain (RGB(189,19,11))
//数据验证
#define StrValid(f) ([f isKindOfClass:[NSNull class]] || f == nil || [f length] < 1 || [f isEqualToString:@"(null)"] || [f isEqualToString:@"<null>"] || [f isEqualToString:@"null"]? YES : NO)
#define SafeStr(f) (StrValid(f) ? f:@"")
#define HasString(str,key) ([str rangeOfString:key].location!=NSNotFound)
#define ValidStr(f) StrValid(f)
#define ValidDict(f) (f!=nil && [f isKindOfClass:[NSDictionary class]])
#define ValidArray(f) (f!=nil && [f isKindOfClass:[NSArray class]] && [f count]>0)
#define ValidNum(f) (f!=nil && [f isKindOfClass:[NSNumber class]])
#define ValidClass(f,cls) (f!=nil && [f isKindOfClass:[cls class]])
#define ValidData(f) (f!=nil && [f isKindOfClass:[NSData class]])
//拼接字符串
#define NSStringFormat(format,...) [NSString stringWithFormat:format,##__VA_ARGS__]
//发送通知
#define KPostNotification(name,obj) [[NSNotificationCenter defaultCenter] postNotificationName:name object:obj];
//单例化一个类
#define SINGLETON_FOR_HEADER(className) \
\
+ (className *)shared##className;
#define SINGLETON_FOR_CLASS(className) \
\
+ (className *)shared##className { \
static className *shared##className = nil; \
static dispatch_once_t onceToken; \
dispatch_once(&onceToken, ^{ \
shared##className = [[self alloc] init]; \
}); \
return shared##className; \
}
#endif /* YYUtilsMacros_h */
@@ -0,0 +1,25 @@
//
// CQAudioPlayManager.h
// EscortProject
//
// Created by 仁康信息 on 2023/12/5.
//
#import <Foundation/Foundation.h>
#import <AVFoundation/AVFoundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface CQAudioPlayManager : NSObject
+ (AVPlayer *)initWhithUrl:(NSURL *)avUrl;
//开始播放
+ (void)avPlayIngAction:(AVPlayer *)avPlay;
//暂停播放
+ (void)avPauseAction:(AVPlayer *)avPlay;
@end
NS_ASSUME_NONNULL_END
@@ -0,0 +1,34 @@
//
// CQAudioPlayManager.m
// EscortProject
//
// Created by 仁康信息 on 2023/12/5.
//
#import "CQAudioPlayManager.h"
@implementation CQAudioPlayManager
+ (AVPlayer *)initWhithUrl:(NSURL *)avUrl {
AVPlayerItem * item = [AVPlayerItem playerItemWithURL:avUrl];// 2.创建AVPlayerItem
AVPlayer * avTools = [AVPlayer playerWithPlayerItem:item];
avTools= [AVPlayer playerWithURL:avUrl];
return avTools;
}
//开始播放
+ (void)avPlayIngAction:(AVPlayer *)avPlay {
[avPlay play];
}
//暂停播放
+ (void)avPauseAction:(AVPlayer *)avPlay {
[avPlay pause];
}
@end
@@ -0,0 +1,20 @@
//
// DownToolsManager.h
// EscortProject
//
// Created by 仁康信息 on 2023/12/1.
//
#import <Foundation/Foundation.h>
#import "ReaderViewController.h"
NS_ASSUME_NONNULL_BEGIN
@interface DownToolsManager : NSObject <ReaderViewControllerDelegate>
+ (void)downLoadReportWithURL:(NSString *)PDFURL withFileName:(NSString *)fileName;
@end
NS_ASSUME_NONNULL_END
@@ -0,0 +1,103 @@
//
// DownToolsManager.m
// EscortProject
//
// Created by 仁康信息 on 2023/12/1.
//
#import "DownToolsManager.h"
@implementation DownToolsManager
+ (void)downLoadReportWithURL:(NSString *)PDFURL withFileName:(NSString *)fileName
{
[self downLoadPdfFileByUrl:PDFURL fileName:[NSString stringWithFormat:@"%@.pdf",fileName]];
}
+(__kindof NSURLSessionTask *)downloadWithURL:(NSString *)URL
fileDir:(NSString *)fileDir
progress:(void(^)(NSProgress *progress))progress
success:(void(^)(NSString *filePath))success
failure:(void(^)(NSError *error))failure{
AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:URL]];
NSURLSessionDownloadTask *downloadTask = [manager downloadTaskWithRequest:request progress:^(NSProgress * _Nonnull downloadProgress) {
//下载进度
progress ? progress(downloadProgress) : nil;
NSLog(@"下载进度:%.2f%%",100.0*downloadProgress.completedUnitCount/downloadProgress.totalUnitCount);
} destination:^NSURL * _Nonnull(NSURL * _Nonnull targetPath, NSURLResponse * _Nonnull response) {
//拼接缓存目录
NSString *downloadStr = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject] ;
//拼接文件路径
NSString *filePath = [downloadStr stringByAppendingPathComponent:fileDir];
NSLog(@"downloadStr = %@",downloadStr);
return [NSURL fileURLWithPath:filePath];
} completionHandler:^(NSURLResponse * _Nonnull response, NSURL * _Nullable filePath, NSError * _Nullable error) {
NSLog(@"%@---%@", filePath, filePath.absoluteString);
success ? success(filePath.absoluteString /** NSURL->NSString*/) : nil;
failure && error ? failure(error) : nil;
}];
//开始下载
[downloadTask resume];
return downloadTask;
}
//下载pdf文件
+(void)downLoadPdfFileByUrl:(NSString *)url fileName:(NSString *)fileName
{
//如果存在直接打开
if ([self isFileExist:fileName]) {
//获取路径
NSString *documentsPath = [ReaderDocument documentsPath];
//可根据路径command + shift + G查看该路径下的所有的pdf文件
NSLog(@"%@", documentsPath);
NSString *filePath = [documentsPath stringByAppendingPathComponent:fileName];
ReaderDocument *document = [ReaderDocument withDocumentFilePath:filePath password:nil];
if (document != nil)
{
ReaderViewController *readerViewController = [[ReaderViewController alloc] initWithReaderDocument:document];
readerViewController.delegate = self;
[[HQCommonUtils getCurrentVC] presentViewController:readerViewController animated:YES completion:nil];
}
}else{
[self downloadWithURL:url fileDir:fileName progress:^(NSProgress *progress) {
} success:^(NSString *filePath) {
NSLog(@"%@", filePath);
//下载完成直接打开
[self downLoadPdfFileByUrl:url fileName:fileName];
} failure:^(NSError *error) {
}];
}
}
#pragma mark ReaderViewControllerDelegate因为PDF阅读器可能是push出来的,也可能是present出来的,为了更好的效果,这个代理方法可以实现很好的退出
+ (void)dismissReaderViewController:(ReaderViewController *)viewController{
[[HQCommonUtils getCurrentVC] dismissViewControllerAnimated:YES completion:nil];
}
#pragma 判断文件是否存在
+(BOOL)isFileExist:(NSString *)fileName
{
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *path = [paths objectAtIndex:0];
NSString *filePath = [path stringByAppendingPathComponent:fileName];
NSFileManager *fileManager = [NSFileManager defaultManager];
BOOL result = [fileManager fileExistsAtPath:filePath];
NSLog(@"这个文件已经存在:%@",result?@"是的":@"不存在");
return result;
}
@end
@@ -0,0 +1,126 @@
//
// API.h
// XZYNetworking
//
// Created by 徐自由 on 2017/12/25.
// Copyright © 2017年 徐自由. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "JKCQNetworkingWithCache.h"
@interface JKCQAPI : NSObject
@property (nonatomic,strong) JKCQNetworkingWithCache * httpRequest;
#pragma mark - init方法
//无需token
- (instancetype)init:(id)delegate tag:(NSString *)tag;
//携带token
- (instancetype)init:(id)delegate tag:(NSString *)tag NeedToken:(NSString *)NeedToken;
#pragma mark:应急
- (void)PostSoSPhoneEmergency:(NSMutableDictionary *)parmDic;
- (void)getSoSCreateGroupChat:(NSMutableDictionary *)parmDic;
- (void)getNearbyHomePageHospitalPoint:(NSMutableDictionary *)parmDic;
- (void)getNearbyAEDEquipmentqNumber:(NSMutableDictionary *)parmDic;
- (void)GetSoSHomePageResources:(NSMutableDictionary *)pamraDic;
- (void)PostEndSoSIMQuestion:(NSMutableDictionary *)pamraDic;
- (void)getSoSCarInfoLocationHome:(NSMutableDictionary *)parmDic;
//首页接口
- (void)GetQuetsionRecordsList:(NSMutableDictionary *)parmDic;
- (void)GetAllDoctorRecordsList:(NSMutableDictionary *)parmDic;
- (void)GetDoctoresExpireTime:(NSMutableDictionary *)parmDic;
- (void)GetAllHistoryChatRecord:(NSMutableDictionary *)parmDic;
- (void)GetverifyToken:(NSMutableDictionary *)parmDic;
#pragma mark:登录注册
- (void)PostLogin:(NSMutableDictionary *)parmDic;
- (void)GetIMLoginAccount:(NSMutableDictionary *)pamraDic;
#pragma mark:健康咨询
- (void)getQuestionRecommendDoctor:(NSMutableDictionary *)parmDic;
- (void)getSearchjibingListRightData:(NSMutableDictionary *)parmDic;
- (void)getFoundExpertHomeData:(NSMutableDictionary *)parmDic;
- (void)getSearchZongheData:(NSMutableDictionary *)parmDic;
- (void)getSearchDoctorData:(NSMutableDictionary *)parmDic;
- (void)getSearchHospatilData:(NSMutableDictionary *)parmDic;
- (void)getSearchSicksListData:(NSMutableDictionary *)parmDic;
- (void)getSearchRoomListData:(NSMutableDictionary *)parmDic;
- (void)getSearchRoomListLeftData:(NSMutableDictionary *)parmDic;
- (void)getAllHospatilData:(NSMutableDictionary *)parmDic;
- (void)getSearchConditionsData:(NSMutableDictionary *)parmDic;
- (void)getConnditionHospitalData:(NSMutableDictionary *)parmDic;
- (void)getHospatilDetail:(NSMutableDictionary *)parmDic;
- (void)getHospatilDetailRoomsDoctor:(NSMutableDictionary *)parmDic;
- (void)getHospatilEvaluate:(NSMutableDictionary *)parmDic;
- (void)getHospatilScore:(NSMutableDictionary *)parmDic;
- (void)getCollectHospatil:(NSMutableDictionary *)parmDic;
- (void)getCancelCollectHospatil:(NSMutableDictionary *)parmDic;
- (void)getDoctorExpertMainData:(NSMutableDictionary *)parmDic;
- (void)getCollectDoctorExpertData:(NSMutableDictionary *)parmDic;
- (void)getCancelCollectDoctorExpertData:(NSMutableDictionary *)parmDic;
- (void)getExpertDoctorEvluateData:(NSMutableDictionary *)parmDic;
- (void)getDoctorScore:(NSMutableDictionary *)parmDic;
- (void)getExpertDoctorHaveTimeData:(NSMutableDictionary *)parmDic;
- (void)postVideoQuestionAPI:(NSMutableDictionary *)parmDic;
- (void)postPictureQuestionAPI:(NSMutableDictionary *)parmDic;
- (void)getAppointmentReportDetailAPI:(NSMutableDictionary *)parmDic;
- (void)GetLookQuestionDetailFileData:(NSMutableDictionary *)parmaDic;
- (void)getCancelQuestion:(NSMutableDictionary *)parmDic;
- (void)getSearchjibingListLeftData:(NSMutableDictionary *)parmDic;
- (void)getOneKeyQuestionByID:(NSMutableDictionary *)parmDic;
- (void)postSearchOneKeyQuestionData:(NSMutableDictionary *)parmDic;
- (void)getHistoryReportById:(NSMutableDictionary *)parmDic;
#pragma mark:咨询人管理
- (void)getQuestionManagerList:(NSMutableDictionary *)parmDic;
- (void)delectedQuestionManagerList:(NSMutableDictionary *)parmDic;
- (void)getAddQuestionFailyMembers:(NSMutableDictionary *)parmDic;
- (void)getQustionOptionsMembers:(NSMutableDictionary *)parmDic;
- (void)getMembersSicksList:(NSMutableDictionary *)parmDic;
- (void)PostMemberShipFileData:(NSMutableDictionary *)parmaDic;
- (void)GetLookModficalMemberShipFileData:(NSMutableDictionary *)parmaDic;
- (void)GetQuestionRecordList:(NSMutableDictionary *)parmaDic;
- (void)postBaseHealthInfoAPI:(NSMutableDictionary *)parmDic;
#pragma mark:IM
- (void)GetloginIMUserSig:(NSMutableDictionary *)parmDic;
- (void)GetEndPictureEndIMQuestion:(NSMutableDictionary *)pamraDic;
- (void)PostQustionDoctorScore:(NSMutableDictionary *)pamraDic;
- (void)getsendHealthDataReportAPI:(NSMutableDictionary *)parmDic;
- (void)GetisSmallHelp:(NSMutableDictionary *)parmDic;
- (void)GetSmllHelpDetail:(NSMutableDictionary *)parmDic;
#pragma mark:查询
- (void)postImageArrayUpload:(NSArray *)imageArray withParmDic:(NSMutableDictionary *)parmDic;
- (void)getCheckKeyResult:(NSMutableDictionary *)parmDic;
- (void)getFoundPopConnetResult:(NSMutableDictionary *)parmDic;
- (void)getSelectedShow:(NSMutableDictionary *)parmDic;
- (void)getBodyReportDeatil:(NSMutableDictionary *)parmDic;
- (void)PostGroupIDArray:(NSMutableDictionary *)parmDic;
- (void)postSmallHelpGroup:(NSMutableDictionary *)parmDic;
#pragma mark:我的
- (void)getMineCenterNumber:(NSMutableDictionary *)parmDic;
- (void)getMineQuestionRecord:(NSMutableDictionary *)parmDic;
- (void)getMineCenterUserInfo:(NSMutableDictionary *)parmDic;
- (void)getEmergencyContact:(NSMutableDictionary *)parmDic;
- (void)postAddEmergencyContact:(NSMutableDictionary *)parmDic;
- (void)getDelectedEmergencyContact:(NSMutableDictionary *)parmDic;
- (void)postSetUserPassword:(NSMutableDictionary *)parmDic;
- (void)postResetUserNewPassword:(NSMutableDictionary *)parmDic;
- (void)getVesionHideRegis:(NSMutableDictionary *)parmDic;
- (void)postUpdateQuestionFailyMembers:(NSMutableDictionary *)parmDic;
#pragma mark:用户隐私协议
- (void)getUserAgreementPrivacy:(NSMutableDictionary *)parmDic;
//更新
- (void)getABMUpdate:(NSMutableDictionary *)parmDic;
- (void)getMinitringFillQusetion:(NSMutableDictionary *)parmDic;
- (void)getMinitringWatchData:(NSMutableDictionary *)parmDic;
@end
@@ -0,0 +1,751 @@
//
// API.m
// XZYNetworking
//
// Created by 徐自由 on 2017/12/25.
// Copyright © 2017年 徐自由. All rights reserved.
//
#import "JKCQAPI.h"
#define needToken httpRequest.needToken
#define isLoginFlag httpRequest.isLoginFlag
@implementation JKCQAPI
#pragma mark - init方法
@synthesize httpRequest;
//无需token
- (instancetype)init:(id)delegate tag:(NSString *)tag
{
return [self init:delegate tag:tag NeedToken:0];
}
//携带token
- (instancetype)init:(id)delegate tag:(NSString *)tag NeedToken:(NSString *)NeedToken
{
if (self=[super init]) {
if (![tag isEqualToString:@"LOGINGAPI"] || ![tag isEqualToString:@"CHANGEAPI"] || ![tag isEqualToString:@"verifyToken"]) {
HQUserInfo * user = [HQCommonUtils keyedUnarchiverWithKey:LoginUserInfo];
httpRequest = [[JKCQNetworkingWithCache alloc] initWithDelegate:delegate bindTag:tag NeedToken:user.token];
}else{
httpRequest = [[JKCQNetworkingWithCache alloc] initWithDelegate:delegate bindTag:tag NeedToken:@""];
}
}
return self;
}
#pragma mark:应急
- (void)PostSoSPhoneEmergency:(NSMutableDictionary *)parmDic {
[httpRequest httpPostRequest:[NSString stringWithFormat:@"%@/health-emergency/api/emergency/call",Http] params:parmDic];
}
- (void)getSoSCreateGroupChat:(NSMutableDictionary *)parmDic {
[httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-emergency/api/emergency/createGroupMag",Http] params:parmDic];
}
- (void)PostEndSoSIMQuestion:(NSMutableDictionary *)pamraDic {
[httpRequest httpPostRequest:[NSString stringWithFormat:@"%@/health-emergency/api/emergency/order/orderOver",Http] params:pamraDic];
}
- (void)GetSoSHomePageResources:(NSMutableDictionary *)pamraDic {
[httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-emergency/api/emergency/resource/home",Http] params:pamraDic];
}
- (void)getSoSCarInfoLocationHome:(NSMutableDictionary *)parmDic {
[httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/medical-center/api/ambulance/nearbyAmbulance",Http] params:parmDic];
}
- (void)getNearbyHomePageHospitalPoint:(NSMutableDictionary *)parmDic {
[httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/medical-center/api/resource/nearbyResource",Http] params:parmDic];
}
- (void)getNearbyAEDEquipmentqNumber:(NSMutableDictionary *)parmDic {
[httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-intervene/intervene/v2/aedEquipmentManger/nearbyAed",Http] params:parmDic];
}
//首页新接口
- (void)GetQuetsionRecordsList:(NSMutableDictionary *)parmDic {
[httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/conSession/selectSessionListByDoctorIdUnit",Http] params:parmDic];
}
- (void)GetAllDoctorRecordsList:(NSMutableDictionary *)parmDic {
[httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/conSession/selectSessionListByDoctorIdHelper",Http] params:parmDic];
}
- (void)GetDoctoresExpireTime:(NSMutableDictionary *)parmDic {
[httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/conSession/selectDoctorCardExpireTime",Http] params:parmDic];
}
- (void)GetAllHistoryChatRecord:(NSMutableDictionary *)parmDic {
//http://192.168.1.28/health-consultation/?groupId=1801087415104962560&pageNo=1&pageSize=10
[httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/conSession/selectImMessagePageListSession",Http] params:parmDic];
}
- (void)GetverifyToken:(NSMutableDictionary *)parmDic {
//https://starry.test.icdat.cn/health-consultation/api/consult/msgRecord/selectTokenExpire?token= HTTP/1.1
[httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/msgRecord/selectTokenExpire",Http] params:parmDic];
}
- (void)GetisSmallHelp:(NSMutableDictionary *)parmDic {
//https://starry.test.icdat.cn/health-consultation/api/consult/msgRecord/selectTokenExpire?token= HTTP/1.1
[httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/conHelper/selectTfHelper",Http] params:parmDic];
}
#pragma mark:登录
- (void)PostLogin:(NSMutableDictionary *)parmDic {
[httpRequest httpPostRequest:[NSString stringWithFormat:@"%@/sys/mLogin",Http] params:parmDic];
}
/*
IM登录
*/
- (void)GetIMLoginAccount:(NSMutableDictionary *)pamraDic {
[httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-im/wnapp/userSigAndroid",Http] params:pamraDic];
}
- (void)GetSmllHelpDetail:(NSMutableDictionary *)parmDic {
[httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/conHelper/selectHelperInfoDesc",Http] params:parmDic];
}
#pragma mark:健康咨询搜索
- (void)getQuestionRecommendDoctor:(NSMutableDictionary *)parmDic {
[httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/conDoctor/selectDoctorRecommend",Http] params:parmDic];
}
- (void)getFoundExpertHomeData:(NSMutableDictionary *)parmDic {
[httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/es/searchFirstpage",Http] params:parmDic];
}
- (void)getSearchZongheData:(NSMutableDictionary *)parmDic {
[httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/es/searchComprehensive",Http] params:parmDic];
}
//搜专家
- (void)getSearchDoctorData:(NSMutableDictionary *)parmDic {
[httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/es/searchConDoctor",Http] params:parmDic];
}
//搜医院
- (void)getSearchHospatilData:(NSMutableDictionary *)parmDic {
[httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/es/searchConResource",Http] params:parmDic];
}
//全部医院
- (void)getAllHospatilData:(NSMutableDictionary *)parmDic {
[httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/es/searchConResourceAll",Http] params:parmDic];
}
//医院详情
- (void)getHospatilDetail:(NSMutableDictionary *)parmDic {
[httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/conResource/hospitalDetail",Http] params:parmDic];
}
//医院科室
- (void)getHospatilDetailRoomsDoctor:(NSMutableDictionary *)parmDic {
[httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/conDoctor/selectDoctorByHospitalId",Http] params:parmDic];
}
//医院评论
- (void)getHospatilEvaluate:(NSMutableDictionary *)parmDic {
[httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/conEvaluate/selectConEvaluateListByHospitalId",Http] params:parmDic];
}
//关注医院
- (void)getCollectHospatil:(NSMutableDictionary *)parmDic {
[httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/conHospitalFollow/followHostital",Http] params:parmDic];
}
//取消关注医院
- (void)getCancelCollectHospatil:(NSMutableDictionary *)parmDic {
[httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/conHospitalFollow/cancelHostital",Http] params:parmDic];
}
//医院评分
- (void)getHospatilScore:(NSMutableDictionary *)parmDic {
[httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/conResource/selectHostitalAverageScore",Http] params:parmDic];
}
//医生评分
- (void)getDoctorScore:(NSMutableDictionary *)parmDic {
[httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/conDoctor/selectDoctorAverageScore",Http] params:parmDic];
}
//带搜索条件
- (void)getSearchConditionsData:(NSMutableDictionary *)parmDic {
// GET http://cqyt.dev.yg.dt.io/health-consultation/api/consult/conDoctor/selectDictListByNHDS?doctorName=&hospitalId=&departmentId=27424429373915145&sickId=&tfSort=1&pageNo=1&pageSize=100 HTTP/1.1
[httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/conDoctor/selectDictListByNHDS",Http] params:parmDic];
}
- (void)postSearchOneKeyQuestionData:(NSMutableDictionary *)parmDic {
// 查询关联疾病和科室的医生
// POST http://cqyt.dev.yg.dt.io/health-consultation/api/consult/conDoctor/selectDictListBySickAndDepartment HTTP/1.1
// 入参:{"departmentIds":[],"sickIds":["40289e15409841890115416524830065"],"pageNo":1,"pageSize":10}
[httpRequest httpPostRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/conDoctor/selectDictListBySickAndDepartment",Http] params:(NSMutableDictionary *)parmDic];
}
//搜疾病
- (void)getSearchSicksListData:(NSMutableDictionary *)parmDic {
//GET http://cqyt.dev.yg.dt.io/health-consultation/api/consult/es/searchconSicksList?search=%E5%A5%BD&pageNumber=1&pageSize=100 HTTP/1.1
[httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/es/searchconSicksList",Http] params:parmDic];
}
//搜科室
- (void)getSearchRoomListData:(NSMutableDictionary *)parmDic {
//老的 GET http://cqyt.dev.yg.dt.io//health-consultation/es/searchConDepartment?search=%E5%86%85%E7%A7%91&pageNumber=1&pageSize=100 HTTP/1.1
[httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/es/searchConDepartment",Http] params:parmDic];
}
//搜科室:左边
- (void)getSearchRoomListLeftData:(NSMutableDictionary *)parmDic {
// GET http://cqyt.dev.yg.dt.io/health-consultation/api/consult/conDepartment/selectDepartListVersionThree?parentId=0 HTTP/1.1
[httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/conDepartment/selectDepartListVersionThree",Http] params:parmDic];
}
//搜疾病:左边边
- (void)getSearchjibingListLeftData:(NSMutableDictionary *)parmDic {
// GET http://cqyt.dev.yg.dt.io/health-consultation/api/consult/conDepartment/selectDepartListVersionThree?parentId=27342921598501015 HTTP/1.1
//http://192.168.1.23/health-consultation/api/consult/conDepartment/selectDepartListSickVersionTwo?parentId=0
[httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/conDepartment/selectDepartListSickVersionTwo",Http] params:parmDic];
}
//搜疾病:右边
- (void)getSearchjibingListRightData:(NSMutableDictionary *)parmDic {
// GET http://cqyt.dev.yg.dt.io/health-consultation/api/consult/conDepartment/selectDepartListVersionThree?parentId=27342921598501015 HTTP/1.1
// GET http://192.168.1.23/health-consultation/api/consult/conSicks/selectSickListByDepartmentId?departmentId=27342921598501114 HTTP/1.1
[httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/conSicks/selectSickListByDepartmentId",Http] params:parmDic];
}
//医院筛选
- (void)getConnditionHospitalData:(NSMutableDictionary *)parmDic {
[httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/conResource/selectHospitalList",Http] params:parmDic];
}
//专家主页
- (void)getDoctorExpertMainData:(NSMutableDictionary *)parmDic {
[httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/conDoctor/selectDoctorInfo",Http] params:parmDic];
}
//关注专家
- (void)getCollectDoctorExpertData:(NSMutableDictionary *)parmDic {
[httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/conDoctorFollow/followDoctor",Http] params:parmDic];
}
//取消专家
- (void)getCancelCollectDoctorExpertData:(NSMutableDictionary *)parmDic {
[httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/conDoctorFollow/cancelDoctor",Http] params:parmDic];
}
//专家评论列表
- (void)getExpertDoctorEvluateData:(NSMutableDictionary *)parmDic {
[httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/conEvaluate/selectConEvaluateList",Http] params:parmDic];
}
//专家预约时间
- (void)getExpertDoctorHaveTimeData:(NSMutableDictionary *)parmDic {
[httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/conDoctorSchedulingDate/selectSchedulingDateListByDoctorId",Http] params:parmDic];
}
- (void)postVideoQuestionAPI:(NSMutableDictionary *)parmDic {
[httpRequest httpPostRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/conSession/insertTelephoneSession",Http] params:parmDic];
}
- (void)postPictureQuestionAPI:(NSMutableDictionary *)parmDic {
[httpRequest httpPostRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/conSession/insertPictureTextSession",Http] params:parmDic];
}
- (void)getABMUpdate:(NSMutableDictionary *)parmDic {
[httpRequest httpGetRequest:@"https://base.icdat.cn/v2/latest" params:parmDic];
}
//预约详情
- (void)getAppointmentReportDetailAPI:(NSMutableDictionary *)parmDic {
[httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/conSession/sessionDetail",Http] params:parmDic];
}
- (void)getOneKeyQuestionByID:(NSMutableDictionary *)parmDic {
NSString * ClassId = [parmDic objectForKey:@"ClassId"];
// http://cqyt.dev.yg.dt.io/medical/uniItemClass/getOfficeIdsAndSicksIdsRelByClassId?classId=28436350931828841 HTTP/1.1
[httpRequest httpPostRequest:[NSString stringWithFormat:@"%@/medical/uniItemClass/getOfficeIdsAndSicksIdsRelByClassId?classId=%@",Http,ClassId] params:parmDic];
}
#pragma mark:咨询人管理
- (void)getQuestionManagerList:(NSMutableDictionary *)parmDic {
[httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/familyMembers/selectMenberOnlyList",Http] params:parmDic];
}
- (void)delectedQuestionManagerList:(NSMutableDictionary *)parmDic {
[httpRequest httpPostRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/familyMembers/removeMemberById",Http] params:parmDic];
}
- (void)getAddQuestionFailyMembers:(NSMutableDictionary *)parmDic {
[httpRequest httpPostRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/familyMembers/insertFamilyMembers",Http] params:parmDic];
}
- (void)postUpdateQuestionFailyMembers:(NSMutableDictionary *)parmDic {
[httpRequest httpPostRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/familyMembers/updateFamilyMembers",Http] params:parmDic];
}
- (void)getQustionOptionsMembers:(NSMutableDictionary *)parmDic {
[httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/healthInfo/selectHealthInfo",Http] params:parmDic];
}
- (void)getMembersSicksList:(NSMutableDictionary *)parmDic {
[httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/familyMembers/selectMenberList",Http] params:parmDic];
}
- (void)PostMemberShipFileData:(NSMutableDictionary *)parmaDic {
[httpRequest httpPostRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/medicalRecords/insertConMedicalRecords",Http] params:parmaDic];
}
- (void)GetLookModficalMemberShipFileData:(NSMutableDictionary *)parmaDic {
[httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/medicalRecords/selectConMedicalRecordsById",Http] params:parmaDic];
}
- (void)GetLookQuestionDetailFileData:(NSMutableDictionary *)parmaDic {
[httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/medicalRecords/selectConMedicalRecordsByIdDoctor",Http] params:parmaDic];
}
- (void)GetQuestionRecordList:(NSMutableDictionary *)parmaDic {
// GET http://cqyt.dev.yg.dt.io/health-consultation/api/consult/conSession/selectSessionListByUserIdVersionTwo?type=2&status=5&pageNo=0&pageSize=10 HTTP/1.1
[httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/conSession/selectSessionListByUserIdVersionTwo",Http] params:parmaDic];
}
#pragma mark:im
- (void)GetloginIMUserSig:(NSMutableDictionary *)parmDic {
[httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-im/wnapp/userSigAndroid",Http] params:parmDic];
}
//结束图文咨询
- (void)GetEndPictureEndIMQuestion:(NSMutableDictionary *)pamraDic {
[httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/conSession/finishSession",Http] params:pamraDic];
}
//医生评分
- (void)PostQustionDoctorScore:(NSMutableDictionary *)pamraDic {
[httpRequest httpPostRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/conEvaluate/insertConEvaluate",Http] params:pamraDic];
}
//发送健康档案
- (void)getsendHealthDataReportAPI:(NSMutableDictionary *)parmDic {
[httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/medicalRecords/selectConMedicalRecordsByMemberId",Http] params:parmDic];
}
#pragma mark:tools
- (void)postImageArrayUpload:(NSArray *)imageArray withParmDic:(NSMutableDictionary *)parmDic {
[httpRequest upLoadDataWithUrlStr:[NSString stringWithFormat:@"%@/sys/upload/uploadFileMany",Http] params:parmDic withDataArray:imageArray];
}
- (void)getCheckKeyResult:(NSMutableDictionary *)parmDic {
// [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/sys/upload/uploadFile",CQHttp] params:parmDic];
[httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/conDoctor/selectDictList",Http] params:parmDic];
}
- (void)getFoundPopConnetResult:(NSMutableDictionary *)parmDic {
[httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/notice/selectUserNotice",Http] params:parmDic];
}
- (void)getSelectedShow:(NSMutableDictionary *)parmDic {
[httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/notice/chooseToDontShowUp",Http] params:parmDic];
}
- (void)getBodyReportDeatil:(NSMutableDictionary *)parmDic {
[httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/cqyt/middleController/getCheckItemBySfzhNewNew",Http] params:parmDic];
}
- (void)PostGroupIDArray:(NSMutableDictionary *)parmDic {
[httpRequest httpPostRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/conSession/selectSessionListPictureByUserId",Http] params:parmDic];
}
- (void)postSmallHelpGroup:(NSMutableDictionary *)parmDic {
//insertUserAndHelperSession 以前是这样
[httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/conSession/insertUserAndHelperSessionNew",Http] params:parmDic];
}
- (void)postBaseHealthInfoAPI:(NSMutableDictionary *)parmDic {
[httpRequest httpPostRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/healthInfo/inserOrUpdatetHealthInfoAnswer",Http] params:parmDic];
}
#pragma mark:我的
- (void)getMineCenterNumber:(NSMutableDictionary *)parmDic {
[httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/conSession/sessioningNum",Http] params:parmDic];
}
- (void)getMineQuestionRecord:(NSMutableDictionary *)parmDic {
[httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/conSession/selectSessionListByUserIdVersionThree",Http] params:parmDic];
}
- (void)getCancelQuestion:(NSMutableDictionary *)parmDic {
[httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/conSession/cancelSession",Http] params:parmDic];
}
- (void)getMineCenterUserInfo:(NSMutableDictionary *)parmDic {
[httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/sys/api/selectUserInfo",Http] params:parmDic];
}
- (void)postSetUserPassword:(NSMutableDictionary *)parmDic {
[httpRequest httpPostRequest:[NSString stringWithFormat:@"%@/health-system/api/anon/sys/checkUser",Http] params:parmDic];
}
- (void)postResetUserNewPassword:(NSMutableDictionary *)parmDic {
[httpRequest httpPostRequest:[NSString stringWithFormat:@"%@/health-system/api/anon/sys/resetUserPwd",Http] params:parmDic];
}
//紧急联系人
- (void)getEmergencyContact:(NSMutableDictionary *)parmDic {
[httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/sys/api/emergencyContact/selectEmergencyContactList",Http] params:parmDic];
}
- (void)postAddEmergencyContact:(NSMutableDictionary *)parmDic {
[httpRequest httpPostRequest:[NSString stringWithFormat:@"%@/sys/api/emergencyContact/updateAndInsertEmergencyContact",Http] params:parmDic];
}
- (void)getDelectedEmergencyContact:(NSMutableDictionary *)parmDic {
[httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/sys/api/emergencyContact/removeEmergencyContactList",Http] params:parmDic];
}
- (void)getUserAgreementPrivacy:(NSMutableDictionary *)parmDic {
//GET https://cqyt.test.yg.icdat.cn/health-consultation/api/consult/conDoctor/selectDictList?dictKey=jump_url HTTP/1.1
[httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-consultation/api/consult/conDoctor/selectDictList?dictKey=qh_ios_jump_url",Http] params:parmDic];
}
#pragma mark:健康现状
- (void)gethealthCurrentStatus:(NSMutableDictionary *)parmDic {
[httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-archives/api/archives/healthQuo/info",Http] params:parmDic];
}
- (void)getHistoryReportById:(NSMutableDictionary *)parmDic {
[httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-archives/historyReport/getHistoryReportById",Http] params:parmDic];
}
//获取体检语音
- (void)getReportListAudioResource:(NSMutableDictionary *)parmDic {
[httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-archives/historyReport/getVoiceUrl",Http] params:parmDic];
}
//获取体检语音
- (void)getReportListHistoryDoctorAudioResource:(NSMutableDictionary *)parmDic {
[httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-archives/historyReport/convertVoice2",Http] params:parmDic];
}
- (void)getEnergyDemandData:(NSMutableDictionary *)parmDic {
[httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-archives/api/archives/compute/energyDemand",Http] params:parmDic];
}
- (void)getidealWeightData:(NSMutableDictionary *)parmDic {
[httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-archives/api/archives/compute/idealBodyWeight",Http] params:parmDic];
}
- (void)getAllSportData:(NSMutableDictionary *)parmDic {
[httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-archives/api/archives/compute/allExercise",Http] params:parmDic];
}
- (void)getBodyScaleData:(NSMutableDictionary *)parmDic {
[httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-archives/api/archives/compute/waistHipRatio",Http] params:parmDic];
}
- (void)getOneMinUnderstandData:(NSMutableDictionary *)parmDic {
[httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-archives/api/archives/compute/knowYourselfInMinute",Http] params:parmDic];
}
- (void)getSubtractWeightData:(NSMutableDictionary *)parmDic {
[httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-archives/api/archives/compute/loseKilo",Http] params:parmDic];
}
- (void)getHealthAnalyzeData:(NSMutableDictionary *)parmDic {
[httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-archives/api/archives/medicalDataAnalysis/selectMedicalDataAnalysisVOList",Http] params:parmDic];
}
- (void)getHealthAnalyzeSubData:(NSMutableDictionary *)parmDic {
[httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-archives/api/archives/medicalDataAnalysis/selectMedicalUniItemClassList",Http] params:parmDic];
}
- (void)getHealthAnalyzeDetailData:(NSMutableDictionary *)parmDic {
[httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-archives/api/archives/medicalUserResult/selectMedicalUserResult",Http] params:parmDic];
}
- (void)getHealthAnalyzeLineChareTableData:(NSMutableDictionary *)parmDic {
[httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-archives/api/archives/medicalUserResult/selectMedicalUserResultInfoById",Http] params:parmDic];
}
- (void)selectedTimeData:(NSMutableDictionary *)parmDic {
[httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-archives/api/archives/medicalUserResult/selectMedicalUserResultInfoExDate",Http] params:parmDic];
}
- (void)getHealthAnanalyzeResultData:(NSMutableDictionary *)parmDic {
[httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-archives/api/archives/medicalUserResult/selectMedicalMiddleResultExtVO",Http] params:parmDic];
}
- (void)getHealthMonitorHomepageData:(NSMutableDictionary *)parmDic {
[httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-archives/api/archives/healthMonitoring/selectHealthMonitoringInfo",Http] params:parmDic];
}
- (void)getHealthBMIData:(NSMutableDictionary *)parmDic {
[httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-archives/api/archives/healthMonitoring/selectHeightAndWeightBmi",Http] params:parmDic];
}
- (void)getHealthRecordsListData:(NSMutableDictionary *)parmDic {
[httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-archives/api/archives/healthMonitoring/selectHeightAndWeightBmiList",Http] params:parmDic];
}
- (void)getHealthBloodPresureDetailData:(NSMutableDictionary *)parmDic {
[httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-archives/api/archives/healthMonitoring/selectBloodPresure",Http] params:parmDic];
}
- (void)getHealthBloodPresureRecordListData:(NSMutableDictionary *)parmDic {
[httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-archives/api/archives/healthMonitoring/selectBloodPresureList",Http] params:parmDic];
}
- (void)getHealthBloodlipidRecordListData:(NSMutableDictionary *)parmDic {
[httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-archives/api/archives/healthMonitoring/selectBloodFat",Http] params:parmDic];
}
- (void)getHealthBloodSugarDetailData:(NSMutableDictionary *)parmDic {
[httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-archives/api/archives/healthMonitoring/selectBloodSugarInfo",Http] params:parmDic];
}
- (void)getHealthBloodSugarRecordData:(NSMutableDictionary *)parmDic {
[httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-archives/api/archives/healthMonitoring/selectBloodSugarList",Http] params:parmDic];
}
- (void)getHealthStatusAbnomalData:(NSMutableDictionary *)parmDic {
[httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-archives/api/archives/healthQuo/exceptionList",Http] params:parmDic];
}
//获取报告列表
- (void)getchangWeiJingReportList:(NSMutableDictionary *)parmDic {
NSString * userId = [parmDic objectForKey:@"userId"];
[httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/medicalGi/phone/reportList/%@",Http,userId] params:parmDic];
}
- (void)getchangWeiJingHaveYearsPaperList:(NSMutableDictionary *)parmDic {
NSString * userId = [parmDic objectForKey:@"userId"];
NSString * medicalYear = [parmDic objectForKey:@"medicalYear"];
[httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/medicalGi/phone/getPaper/%@/%@",Http,userId,medicalYear] params:parmDic];
}
//获取报告详情
- (void)getchangWeiJingReportDetail:(NSMutableDictionary *)parmDic {
NSString * urId = [parmDic objectForKey:@"urId"];
[httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/medicalGi/phone/report/%@",Http,urId] params:nil];
}
//
//POST http://cqyt.dev.yg.dt.io/medical/uniItemClass/getOfficeIdsAndSicksIdsRelByGiType?giType=1 HTTP/1.1
//返回:{"success":true,"message":"","code":200,"result":{"officeIds":[],"sicksIds":[]},"timestamp":1701929792458}
-(void)postChangWeiJingDoctor:(NSMutableDictionary *)parmDic {
NSString * giType = [parmDic objectForKey:@"giType"];
[httpRequest httpPostRequest:[NSString stringWithFormat:@"%@/medical/uniItemClass/getOfficeIdsAndSicksIdsRelByGiType?giType=/%@",Http,giType] params:parmDic];
}
#pragma mark:监测
- (void)getMinitringFillQusetion:(NSMutableDictionary *)parmDic {
[httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-intervene/api/risk/riskMyocardialSuddenDeath/selectTfFillQuestion",Http] params:parmDic];
}
- (void)getMinitringWatchData:(NSMutableDictionary *)parmDic {
[httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-watch/watchH5Api/indexDataNew",Http] params:parmDic];
}
@end
@@ -0,0 +1,56 @@
//
// JKCQNetworkingWithCache.h
// XZYNetworking
//
// Created by 徐自由 on 2017/12/22.
// Copyright © 2017年 徐自由. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <AFNetworking/AFNetworking.h>
//#import <YYCache/YYCache.h>
@protocol JKCQNetworkingWithCacheDelegate <NSObject>
@optional
- (void)httpSuccess:(id)response bindTag:(NSString *)bindTag;
- (void)httpError:(NSString *)error bindTag:(NSString *)bindTag;
@end
typedef void (^FileDownloadSucc)(void);
typedef void (^FileDownloadFail)(int code, NSString * desc);
@interface JKCQNetworkingWithCache : NSObject
@property (nonatomic,strong) id requestDelegate;
@property (nonatomic,copy) NSString *bindTag;
@property (nonatomic,copy) NSString * needToken;
@property (nonatomic,assign) NSInteger isLoginFlag;//1时如果token可传为空就不跳出登陆界面
@property (nonatomic,copy) NSString *urlString;
- (instancetype)initWithDelegate:(id)requestDelegate bindTag:(NSString *)bindTag NeedToken:(NSString *)NeedToken;
#pragma mark - Get方法(默认方法)
//不带缓存
- (void)httpGetRequest:(NSString *)api params:(NSMutableDictionary *)params;
- (void)httpGetCacheRequest:(NSString *)api params:(NSMutableDictionary *)params;
#pragma mark - Post方法
//不带缓存
- (void)httpPostRequest:(NSString *)api params:(NSMutableDictionary *)params;
- (void)httpPostCacheRequest:(NSString *)api params:(NSMutableDictionary *)params;
#pragma mark - 上传文件方法
//上传单张图片
- (void)upLoadDataWithUrlStr:(NSString *)api params:(NSMutableDictionary *)params imageKey:(NSString *)name withData:(NSData *)data;
//上传多张图片
- (void)upLoadDataWithUrlStr:(NSString *)api params:(NSMutableDictionary *)params withDataArray:(NSArray *)dataArray;
- (void)upLoadVideoDataWithUrlStr:(NSString *)api params:(NSMutableDictionary *)params withDataArray:(NSArray *)dataArray;
#pragma mark - 下载文件方法
- (void)downLoadFileWithUrl:(NSString *)urlStr Path:(NSString*)path downloadProgress:(void (^)(NSProgress *downloadProgress))progress SuccessBlock:(FileDownloadSucc)success FileDownloadFail:(FileDownloadFail)failure;
@end
@@ -0,0 +1,508 @@
//
// XZYNetworkingWithCache.m
// XZYNetworking
//
// Created by 徐自由 on 2017/12/22.
// Copyright © 2017年 徐自由. All rights reserved.
//
#import "JKCQNetworkingWithCache.h"
#define DYLog(...) NSLog(__VA_ARGS__) //如果不需要打印数据, 注释掉NSLog
// 请求方式
typedef NS_ENUM(NSInteger, RequestType) {
RequestTypeGet,
RequestTypePost,
RequestTypeUpLoad,//单个上传
RequestTypeMultiUpload,//多个上传
RequestTypeDownload,
RequestTypeUpLoadVideo,//上传视频
};
@implementation JKCQNetworkingWithCache
{
__weak JKCQNetworkingWithCache *weakSelf;
}
- (instancetype)initWithDelegate:(id)requestDelegate bindTag:(NSString *)bindTag NeedToken:(NSString *)NeedToken
{
if (self =[super init]) {
self.requestDelegate = requestDelegate;
self.bindTag = bindTag;
self.needToken = NeedToken;
weakSelf = self;
}
return self;
}
#pragma mark - Get方法(默认方法)
//不带缓存
- (void)httpGetRequest:(NSString *)api params:(NSMutableDictionary *)params
{
[self httpRequestWithUrlStr:api params:params requestType:RequestTypeGet isCache:NO cacheKey:nil imageKey:nil withData:nil withDataArray:nil];
}
- (void)httpGetCacheRequest:(NSString *)api params:(NSMutableDictionary *)params
{
[self httpRequestWithUrlStr:api params:params requestType:RequestTypeGet isCache:YES cacheKey:api imageKey:nil withData:nil withDataArray:nil];
}
#pragma mark - Post方法
//不带缓存
- (void)httpPostRequest:(NSString *)api params:(NSMutableDictionary *)params
{
[self httpRequestWithUrlStr:api params:params requestType:RequestTypePost isCache:NO cacheKey:nil imageKey:nil withData:nil withDataArray:nil];
}
- (void)httpPostCacheRequest:(NSString *)api params:(NSMutableDictionary *)params
{
[self httpRequestWithUrlStr:api params:params requestType:RequestTypePost isCache:YES cacheKey:api imageKey:nil withData:nil withDataArray:nil];
}
#pragma mark - 上传文件方法
//上传单张图片
- (void)upLoadDataWithUrlStr:(NSString *)api params:(NSMutableDictionary *)params imageKey:(NSString *)name withData:(NSData *)data
{
[self httpRequestWithUrlStr:api params:params requestType:RequestTypeUpLoad isCache:NO cacheKey:api imageKey:name withData:data withDataArray:nil];
}
//上传多张图片
- (void)upLoadDataWithUrlStr:(NSString *)api params:(NSMutableDictionary *)params withDataArray:(NSArray *)dataArray
{
[self httpRequestWithUrlStr:api params:params requestType:RequestTypeMultiUpload isCache:NO cacheKey:api imageKey:nil withData:nil withDataArray:dataArray];
}
- (void)upLoadVideoDataWithUrlStr:(NSString *)api params:(NSMutableDictionary *)params withDataArray:(NSArray *)dataArray
{
[self httpRequestWithUrlStr:api params:params requestType:RequestTypeUpLoadVideo isCache:NO cacheKey:api imageKey:nil withData:nil withDataArray:dataArray];
}
/** 下载文件方法*/
- (void)downLoadFileWithUrl:(NSString *)urlStr Path:(NSString*)path downloadProgress:(void (^)(NSProgress *downloadProgress))progress SuccessBlock:(FileDownloadSucc)success FileDownloadFail:(FileDownloadFail)failure;
{
if (urlStr.length == 0) {
return;
}
//1.创建管理者对象
AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];
//2.确定请求的URL地址
NSURL *url = [NSURL URLWithString:urlStr];
//3.创建请求对象
NSURLRequest *request = [NSURLRequest requestWithURL:url];
//4.下载任务
NSURLSessionDownloadTask *task = [manager downloadTaskWithRequest:request progress:^(NSProgress * _Nonnull downloadProgress) {
//打印下下载进度
progress(downloadProgress);
} destination:^NSURL * _Nonnull(NSURL * _Nonnull targetPath, NSURLResponse * _Nonnull response) {
//设置文件保存路径
return [NSURL fileURLWithPath:path];
} completionHandler:^(NSURLResponse * _Nonnull response, NSURL * _Nullable filePath, NSError * _Nullable error) {
NSLog(@"完成cache%@",filePath);
NSHTTPURLResponse *response1 = (NSHTTPURLResponse *)response;
NSInteger statusCode = [response1 statusCode];
if (statusCode == 200) {
success();
}else{
failure(0,error.localizedFailureReason);
}
}];
//5.开始启动下载任务
[task resume];
}
#pragma mark - 网络请求统一处理
/**
@param api 后台的接口名
@param params 参数dict
@param requestType 请求类型
@param isCache 是否缓存标志
@param cacheKey 缓存的对应key值
@param name 图片上传的名字(upload)
@param data 图片的二进制数据(upload)
@param dataArray 多图片上传时的imageDataArray
*/
- (void)httpRequestWithUrlStr:(NSString *)api params:(NSMutableDictionary *)params requestType:(RequestType)requestType isCache:(BOOL)isCache cacheKey:(NSString *)cacheKey imageKey:(NSString *)name withData:(NSData *)data withDataArray:(NSArray *)dataArray
{
NSString *url = api;
if (params == nil) {
params = [NSMutableDictionary dictionary];
}
NSString *allUrl=[self urlDictToStringWithUrlStr:url WithDict:params];
url = [url stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
//进行网络检查
if (![self requestBeforeJudgeConnect]) {//断网
[self showError:@"请检查网络设置"];
DYLog(@"\n\n----%@------\n\n",@"没有网络");
return;
}
AFHTTPSessionManager *session=[AFHTTPSessionManager manager];
// AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
session.responseSerializer.acceptableContentTypes=[NSSet setWithObjects:@"application/json",@"text/json",@"text/javascript",@"text/html",@"text/plain", nil];
//超时时间
session.requestSerializer.timeoutInterval= 30.f;
session.responseSerializer = [AFHTTPResponseSerializer serializer];
session.requestSerializer = [AFJSONRequestSerializer serializer];
session.securityPolicy = [AFSecurityPolicy policyWithPinningMode:AFSSLPinningModeNone];
// [session.requestSerializer setValue:self.needToken forHTTPHeaderField:@"X-Access-Token"];
// [session.requestSerializer setValue:@"Quarry" forHTTPHeaderField:@"X-ClientSign"];
if (requestType == RequestTypeGet) {//Get请求
[session GET:url parameters:params headers:@{@"X-Access-Token":self.needToken} progress:^(NSProgress * _Nonnull downloadProgress) {
} success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
[weakSelf dealWithResponseObject:responseObject cacheUrl:allUrl];
} failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
NSString * statusCode = [error.userInfo objectForKey:@"NSLocalizedDescription"];
// if (stringUrlOne.count >= 1)
// {
if ([statusCode containsString:@"401"]) {
DLog(@"%@",error.userInfo);
[HQCommonUtils keyedArchiverWithData:nil key:LoginUserInfo];
KPostNotification(KNotificationLoginStateChange, @NO);
if (![HQCommonUtils isLogin]) {
[EasyTextView showErrorText:@"请您登录"];
}
else{
[EasyTextView showErrorText:@"身份信息已过期"];
}
}else
{
NSLog(@"%@",url);
[self showError:@"网络服务出错"];
}
// }
}];
} else if (requestType == RequestTypePost) {//post请求
[session POST:url parameters:params headers:@{@"X-Access-Token":self.needToken} progress:^(NSProgress * _Nonnull downloadProgress) {
} success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
[weakSelf dealWithResponseObject:responseObject cacheUrl:allUrl];
} failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
NSString * statusCode = [error.userInfo objectForKey:@"NSLocalizedDescription"];
if ([statusCode containsString:@"401"]) {
DLog(@"%@",error.userInfo);
[HQCommonUtils keyedArchiverWithData:nil key:LoginUserInfo];
KPostNotification(KNotificationLoginStateChange, @NO);
if (![HQCommonUtils isLogin]) {
[EasyTextView showErrorText:@"请您登录"];
}
else{
[EasyTextView showErrorText:@"身份信息已过期"];
}
}
else
{
[self showError:@"网络服务出错"];
}
}];
} else if (requestType == RequestTypeUpLoad) {//上传单张图片
[session POST:url parameters:params headers:@{@"X-Access-Token":self.needToken} constructingBodyWithBlock:^(id<AFMultipartFormData> _Nonnull formData) {
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
// 设置时间格式
[formatter setDateFormat:@"yyyyMMddHHmmss"];
NSString *dateString = [formatter stringFromDate:[NSDate date]];
NSString *fileName = [NSString stringWithFormat:@"%@.jpg", dateString];
[formData appendPartWithFileData:data name:name fileName:fileName mimeType:@"image/png"];
} progress:^(NSProgress * _Nonnull uploadProgress) {
//(float)uploadProgress.completedUnitCount/(float)uploadProgress.totalUnitCount
} success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
[weakSelf dealWithResponseObject:responseObject cacheUrl:allUrl];
} failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
[weakSelf showError:@"上传文件出错"];
}];
} else if (requestType == RequestTypeMultiUpload) {//上传多张图片
[session POST:url parameters:params headers:@{@"X-Access-Token":self.needToken} constructingBodyWithBlock:^(id<AFMultipartFormData> _Nonnull formData) {
// formData = [self dataWith:formData dataArray:dataArray];
for (int i = 0; i < dataArray.count; i++) {
UIImage *image = dataArray[i];
NSData *imageData = UIImageJPEGRepresentation(image, 0.5);
// 在网络开发中,上传文件时,是文件不允许被覆盖,文件重名
// 要解决此问题,
// 可以在上传时使用当前的系统事件作为文件名
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
// 设置时间格式
[formatter setDateFormat:@"yyyyMMddHHmmss"];
NSString *dateString = [formatter stringFromDate:[NSDate date]];
NSString *fileName = [NSString stringWithFormat:@"%@.jpg", dateString];
/*
*该方法的参数
1. appendPartWithFileData:要上传的照片[二进制流]
2. name:对应处理文件的字段(比如upload)
3. fileName:要保存在服务器上的文件名
4. mimeType:上传的文件的类型
*/
[formData appendPartWithFileData:imageData name:@"files" fileName:fileName mimeType:@"image/jpeg"]; //
}
} progress:^(NSProgress * _Nonnull uploadProgress) {
//(float)uploadProgress.completedUnitCount/(float)uploadProgress.totalUnitCount
} success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
[weakSelf dealWithResponseObject:responseObject cacheUrl:allUrl];
} failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
[weakSelf showError:@"上传文件出错"];
}];
}else if (requestType == RequestTypeUpLoadVideo) {//上传视频
[session POST:url parameters:params headers:@{@"X-Access-Token":self.needToken} constructingBodyWithBlock:^(id<AFMultipartFormData> _Nonnull formData) {
// video
[formData appendPartWithFileData:data name:@"video" fileName:@"video.mov" mimeType:@"video/quicktime"];
} progress:^(NSProgress * _Nonnull uploadProgress) {
//(float)uploadProgress.completedUnitCount/(float)uploadProgress.totalUnitCount
} success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
[weakSelf dealWithResponseObject:responseObject cacheUrl:allUrl];
} failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
[weakSelf showError:@"上传文件出错"];
}];
}
}
- (NSString *)stringWithDict:(NSDictionary *)dict
{
NSData *data = [NSJSONSerialization dataWithJSONObject:dict options:NSJSONWritingPrettyPrinted error:nil];
NSString *datastr = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
datastr = [datastr stringByReplacingOccurrencesOfString:@"\n" withString:@""];
datastr = [datastr stringByReplacingOccurrencesOfString:@" " withString:@""];
datastr = [datastr stringByReplacingOccurrencesOfString:@"\\" withString:@""];
return datastr;
}
#pragma mark 统一处理请求到的数据
-(void)dealWithResponseObject:(NSData *)responseData cacheUrl:(NSString *)cacheUrl
{
NSString * dataString = [[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding];
//dataString = [self deleteSpecialCodeWithStr:dataString];
DLog(@"response\n%@\n",dataString);
NSData *requestData = [dataString dataUsingEncoding:NSUTF8StringEncoding];
[self returnDataWithRequestData:requestData withUrl:cacheUrl];
}
#pragma mark - 根据返回的数据进行统一的格式处理-requestData 网络或者是缓存的数据-
- (void)returnDataWithRequestData:(NSData *)requestData withUrl:(NSString *)url
{
id myResult = [NSJSONSerialization JSONObjectWithData:requestData options:NSJSONReadingMutableContainers error:nil];
//判断是否为字典
if ([myResult isKindOfClass:[NSDictionary class]]) {
NSDictionary *response = (NSDictionary *)myResult;
response = [self removeNullsFromDictionary:response];
//根据返回的接口内容来变
BOOL flag = false;
if ([response.allKeys containsObject:@"ok"]) {
flag = [[response objectForKey:@"ok"] boolValue];
}
if ([response.allKeys containsObject:@"code"]) {
if ([[response objectForKey:@"code"] integerValue] == 200)
{
flag = true;
}else
{
flag = false;
}
}
if (flag == true) {
DLog(@" 返回Json\n%@\n %@", [HQCommonUtils DataTOjsonString:response],url);
if ([response.allKeys containsObject:@"result"]) {
[self showSuccess:[response objectForKey:@"result"]];
}
if ([response.allKeys containsObject:@"data"]) {
[self showSuccess:[response objectForKey:@"data"]];
}
}
NSString * codestring = [response objectForKey:@"message"];
if (flag == false ) {
[self showError:[response objectForKey:@"message"]];
return;
}
}
}
- (id)removeNullsFromDictionary:(id)json {
if ([json isKindOfClass:[NSDictionary class]]) {
NSMutableDictionary *mutableDict = [NSMutableDictionary dictionary];
for (NSString *key in [json allKeys]) {
id value = json[key];
mutableDict[key] = [self removeNullsFromDictionary:value];
}
return [mutableDict copy];
} else if ([json isKindOfClass:[NSArray class]]) {
NSMutableArray *mutableArray = [NSMutableArray array];
for (id value in json) {
[mutableArray addObject:[self removeNullsFromDictionary:value]];
}
return [mutableArray copy];
} else if ([json isKindOfClass:[NSNull class]]) {
return @""; // 或者替换成你想要的默认值
} else {
return json;
}
}
#pragma mark - 拼接请求的网络地址
- (NSString *)urlDictToStringWithUrlStr:(NSString *)urlString WithDict:(NSDictionary *)parameters
{
if (!parameters) {
return urlString;
}
NSMutableArray *parts = [NSMutableArray array];
//enumerateKeysAndObjectsUsingBlock会遍历dictionary并把里面所有的key和value一组一组的展示给你,每组都会执行这个block 这其实就是传递一个block到另一个方法,在这个例子里它会带着特定参数被反复调用,直到找到一个ENOUGH的key,然后就会通过重新赋值那个BOOL *stop来停止运行,停止遍历同时停止调用block
[parameters enumerateKeysAndObjectsUsingBlock:^(id _Nonnull key, id _Nonnull obj, BOOL * _Nonnull stop) {
//字符串处理
key = [NSString stringWithFormat:@"%@",key];
obj = [NSString stringWithFormat:@"%@",obj];
//接收key
NSString *finalKey = [key stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
//接收值
NSString *finalValue = [obj stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
NSString *part = [NSString stringWithFormat:@"%@=%@",finalKey,finalValue];
[parts addObject:part];
}];
NSString *queryString = [parts componentsJoinedByString:@"&"];
queryString = queryString.length != 0 ? [NSString stringWithFormat:@"?%@",queryString] : @"";
NSString *pathStr = [NSString stringWithFormat:@"%@%@",urlString,queryString];
return pathStr;
}
#pragma mark -- 处理json格式的字符串中的换行符、回车符
- (NSString *)deleteSpecialCodeWithStr:(NSString *)str {
NSString *string = [str stringByReplacingOccurrencesOfString:@"\r" withString:@""];
string = [string stringByReplacingOccurrencesOfString:@"\n" withString:@""];
string = [string stringByReplacingOccurrencesOfString:@"\n" withString:@""];
string = [string stringByReplacingOccurrencesOfString:@"\t" withString:@""];
//string = [string stringByReplacingOccurrencesOfString:@" " withString:@""];
string = [string stringByReplacingOccurrencesOfString:@"(" withString:@""];
string = [string stringByReplacingOccurrencesOfString:@")" withString:@""];
return string;
}
#pragma mark 网络判断
- (BOOL)requestBeforeJudgeConnect
{
struct sockaddr zeroAddress;
bzero(&zeroAddress, sizeof(zeroAddress));
zeroAddress.sa_len = sizeof(zeroAddress);
zeroAddress.sa_family = AF_INET;
SCNetworkReachabilityRef defaultRouteReachability =
SCNetworkReachabilityCreateWithAddress(NULL, (struct sockaddr *)&zeroAddress);
SCNetworkReachabilityFlags flags;
BOOL didRetrieveFlags =
SCNetworkReachabilityGetFlags(defaultRouteReachability, &flags);
CFRelease(defaultRouteReachability);
if (!didRetrieveFlags) {
printf("Error. Count not recover network reachability flags\n");
return NO;
}
BOOL isReachable = flags & kSCNetworkFlagsReachable;
BOOL needsConnection = flags & kSCNetworkFlagsConnectionRequired;
BOOL isNetworkEnable = (isReachable && !needsConnection) ? YES : NO;
dispatch_async(dispatch_get_main_queue(), ^{
[UIApplication sharedApplication].networkActivityIndicatorVisible = isNetworkEnable;/* 网络指示器的状态: 有网络 : 开 没有网络: 关 */
});
return isNetworkEnable;
}
#pragma mark - 返回数据的调度显示
- (void)showSuccess:(id)response
{
if(!self.requestDelegate) return;
#pragma clang diagnostic push
#pragma clang diagnostic ignored"-Wundeclared-selector"
if ([self.requestDelegate respondsToSelector:@selector(Sucess:tag:)])
{
[self.requestDelegate performSelector:@selector(Sucess:tag:) withObject:response withObject:self.bindTag];
return;
}
#pragma clang diagnostic pop
}
- (void)showError:(NSString *)error
{
if(!self.requestDelegate) return;
#pragma clang diagnostic push
#pragma clang diagnostic ignored"-Wundeclared-selector"
if ([self.requestDelegate respondsToSelector:@selector(Failed:tag:)])
{
[self.requestDelegate performSelector:@selector(Failed:tag:) withObject:error withObject:self.bindTag];
return;
}
#pragma clang diagnostic pop
}
- (void)dealloc
{
self.requestDelegate=nil;
}
@end
@@ -0,0 +1,27 @@
//
// SDGETHealthTokenManager.h
// EscortProject
//
// Created by 仁康信息 on 2024/1/4.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
typedef void (^successBlock)(NSDictionary *responseObject);
typedef void (^failedBlock)(NSError *error);
@interface SDGETHealthTokenManager : NSObject
+(SDGETHealthTokenManager *)getHealthTokenManager;
- (void)getTokenSuccess:(successBlock)success
failed:(failedBlock)failed;
-(void)getUserJoinStatusSuccess:(successBlock)success
failed:(failedBlock)failed;
@end
NS_ASSUME_NONNULL_END
@@ -0,0 +1,195 @@
//
// SDGETHealthTokenManager.m
// EscortProject
//
// Created by 仁康信息 on 2024/1/4.
//
#import "SDGETHealthTokenManager.h"
#include <CommonCrypto/CommonDigest.h>
#import "RSAObjC.h"
@interface SDGETHealthTokenManager ()
@property (nonatomic,strong)AFHTTPSessionManager *session;
@end
@implementation SDGETHealthTokenManager
#pragma mark - 初始化单例
+(SDGETHealthTokenManager *)getHealthTokenManager
{
static SDGETHealthTokenManager *manager = nil;
static dispatch_once_t pred;
dispatch_once(&pred, ^{
manager = [[self alloc] init];
});
return manager;
}
-(id)init
{
self = [super init];
if (self) {
_session = [AFHTTPSessionManager manager];
/***********请求的序列化**********/
//传Json 对象
_session.requestSerializer = [AFJSONRequestSerializer serializer];
//设置超时时间
[_session.requestSerializer willChangeValueForKey:@"timeoutInterval"];
_session.requestSerializer.timeoutInterval = 10.f;
[_session.requestSerializer didChangeValueForKey:@"timeoutInterval"];
/**********响应的序列化**************/
_session.responseSerializer = [AFJSONResponseSerializer serializer];
_session.responseSerializer.acceptableContentTypes = [NSSet setWithObjects:@"application/json",@"text/json",@"text/plain" ,@"text/javascript",@"text/html",nil];
}
return self;
}
-(void)httpRequestWithURL:(NSString *)url
parameters:(NSDictionary*)paraDic
hearders:(NSDictionary *)hearder
success:(successBlock)success
failed:(failedBlock)failed
{
NSString *fullURL = [NSString stringWithFormat:@"%@/%@",BASEURL,url];
[_session POST:fullURL parameters:paraDic headers:hearder progress:^(NSProgress * _Nonnull uploadProgress) {
} success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
success(responseObject);
} failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
failed(error);
}];
}
-(void)httpRequestGetWithURL:(NSString *)url
parameters:(NSDictionary*)paraDic
hearders:(NSDictionary *)hearder
success:(successBlock)success
failed:(failedBlock)failed
{
NSString *fullURL = [NSString stringWithFormat:@"%@/%@",BASEURL,url];
[_session GET:fullURL parameters:paraDic headers:hearder progress:nil success:^(NSURLSessionTask *task, NSDictionary * responseObject) {
success(responseObject);
} failure:^(NSURLSessionTask *operation, NSError *error) {
failed(error);
}];
}
- (void)getTokenSuccess:(successBlock)success failed:(failedBlock)failed {
NSMutableDictionary * dic = [[NSMutableDictionary alloc] init];
NSMutableDictionary * headerDic = [[NSMutableDictionary alloc] init];
NSDate * date = [NSDate date];
NSDateFormatter *matter = [[NSDateFormatter alloc] init];
matter.dateFormat = @"yyyyMMddHHmmss";
NSString * dateString = [matter stringFromDate:date];
[dic setObject:dateString forKey:@"timeSign"];
NSMutableDictionary * sigDic = [[NSMutableDictionary alloc] init];
[sigDic setObject:dateString forKey:@"timeSign"];
NSString * needSersy = [sigDic modelToJSONString];
// 时间戳
NSError *parseError;
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:sigDic options:0 error:&parseError];
if (parseError) {
//解析出错
}
NSString * str = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
// 时间戳
NSMutableString * str3 = [[NSMutableString alloc]initWithString:str];
[str3 replaceOccurrencesOfString:@"\\" withString:@"" options:1 range:NSMakeRange(0, str3.length)];
[str3 appendString:@"dd05f1c54d63749eda95f9fa6d49v442a"];
NSString * md5str = [self getMd5_32Bit_String:str3];
[headerDic setObject:dateString forKey:@"X-TIMESTAMP"];
[headerDic setObject:md5str forKey:@"X-Sign"];
[self httpRequestGetWithURL:@"gateway/sys/getPublicKey" parameters:dic hearders:@{@"X-TIMESTAMP":dateString,@"X-Sign":md5str} success:^(NSDictionary * _Nonnull responseObject) {
if ([responseObject.allKeys containsObject:@"code"]) {
if ([[responseObject objectForKey:@"code"] integerValue] == 200)
{
NSString *pubkey ;
if ([responseObject.allKeys containsObject:@"result"]) {
pubkey = [NSString stringWithFormat:@"-----BEGIN PUBLIC KEY-----\n%@\n-----END PUBLIC KEY-----",responseObject[@"result"]];
// 时间戳
}
HQUserInfo * user = [HQCommonUtils keyedUnarchiverWithKey:LoginUserInfo];
NSString *ret = [RSAObjC encrypt:user.idCard PublicKey:pubkey];
DLog(@"encrypted: %@", ret);
if (ValidStr(ret)) {
// KPostNotification(KNotificationLoginStateChange, @NO);
return;
}
NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init];
[parmDic setObject:[NSString stringWithFormat:@"RSA_%@",ret] forKey: @"idcard"];
NSDate * date = [NSDate date];
NSDateFormatter *matter = [[NSDateFormatter alloc] init];
matter.dateFormat = @"yyyyMMddHHmmss";
NSString * dateString = [matter stringFromDate:date];
NSError *parseError;
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:parmDic options:0 error:&parseError];
if (parseError) {
//解析出错
}
NSString * str = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
// 时间戳
NSMutableString * str3 = [[NSMutableString alloc]initWithString:str];
[str3 replaceOccurrencesOfString:@"\\" withString:@"" options:1 range:NSMakeRange(0, str3.length)];
[str3 appendString:@"dd05f1c54d63749eda95f9fa6d49v442a"];
NSString * md5str = [self getMd5_32Bit_String:str3];
[self httpRequestWithURL:@"gateway/sys/thirdAppGetTokenByIdCard" parameters:parmDic hearders:@{@"X-TIMESTAMP":dateString,@"X-Sign":md5str} success:success failed:failed];
}
else
{
success(responseObject);
}
}
} failed:^(NSError * _Nonnull error) {
}];
}
- (NSString *)getMd5_32Bit_String:(NSString *)srcString {
// 参数 srcString 传进来的字符串
// 参数 isUppercase 是否需要大小写
const char *cStr = [srcString UTF8String];
unsigned char digest[CC_MD5_DIGEST_LENGTH];
CC_MD5( cStr, (CC_LONG)srcString.length, digest );
NSMutableString *result = [NSMutableString stringWithCapacity:CC_MD5_DIGEST_LENGTH * 2];
for(int i = 0; i < CC_MD5_DIGEST_LENGTH; i++)
[result appendFormat:@"%02X", digest[i]];
return result;
}
@end
@@ -0,0 +1,33 @@
//
// SDHttpRequest.h
// colorPrintingMaster
//
// Created by 青山小明 on 17/5/3.
// Copyright © 2017年 zhangming. All rights reserved.
//
#import <Foundation/Foundation.h>
typedef void (^successBlock)(NSDictionary *responseObject);
typedef void (^failedBlock)(NSError *error);
@interface SDHttpRequest : NSObject
+(SDHttpRequest *)httpRequest;
#pragma mark - 首页
- (void)getInterWatchDataUrlWithParm:(NSMutableDictionary *)parmDic
Success:(successBlock)success
failed:(failedBlock)failed;
#pragma mark -
-(void)postWithParameter:(NSDictionary *)para
images:(NSArray *)images
success:(successBlock)success
failed:(failedBlock)failed;
//获取服务地址
- (void)getChangeUrlSuccess:(successBlock)success
failed:(failedBlock)failed;
@end
@@ -0,0 +1,133 @@
//
// SDHttpRequest.m
// colorPrintingMaster
//
// Created by 青山小明 on 17/5/3.
// Copyright © 2017年 zhangming. All rights reserved.
//
#import "SDHttpRequest.h"
#import "AFNetworking.h"
#include <CommonCrypto/CommonDigest.h>
#import "RSAObjC.h"
//static SDHttpRequest *singleton = nil;
@interface SDHttpRequest ()
@property (nonatomic,strong)AFHTTPSessionManager *session;
@end
@implementation SDHttpRequest
#pragma mark - 初始化单例
+(SDHttpRequest *)httpRequest
{
static SDHttpRequest *manager = nil;
static dispatch_once_t pred;
dispatch_once(&pred, ^{
manager = [[self alloc] init];
});
return manager;
}
-(id)init
{
self = [super init];
if (self) {
_session = [AFHTTPSessionManager manager];
/***********请求的序列化**********/
//传Json 对象
_session.requestSerializer = [AFJSONRequestSerializer serializer];
//设置超时时间
[_session.requestSerializer willChangeValueForKey:@"timeoutInterval"];
_session.requestSerializer.timeoutInterval = 30.f;
[_session.requestSerializer didChangeValueForKey:@"timeoutInterval"];
/**********响应的序列化**************/
_session.responseSerializer = [AFJSONResponseSerializer serializer];
_session.responseSerializer.acceptableContentTypes = [NSSet setWithObjects:@"application/json",@"text/json",@"text/plain" ,@"text/javascript",@"text/html",nil];
}
return self;
}
#pragma mark---请求调用的方法
-(void)httpRequestWithURL:(NSString *)url
parameters:(NSDictionary*)paraDic
success:(successBlock)success
failed:(failedBlock)failed
{
NSUserDefaults * tokenDefaul = [NSUserDefaults standardUserDefaults];
NSString * token = [tokenDefaul objectForKey:KHEALTHTOKEN];
NSString *fullURL = [NSString stringWithFormat:@"%@/%@",BASEURL,url];
[_session POST:fullURL parameters:paraDic headers: @{@"X-Access-Token":token} progress:^(NSProgress * _Nonnull uploadProgress) {
} success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
success(responseObject);
} failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
failed(error);
}];
}
- (void)uploadImagesWithURL:(NSString *)url
parameters:(NSDictionary *)paraDic
hearders:(NSDictionary *)hearder
imagesKey:(NSString *)imagesKey
images:(NSArray *)images
success:(successBlock)success
failed:(failedBlock)failed
{
NSString *fullURL = [NSString stringWithFormat:@"%@/%@",BASEURL,url];
[_session POST:fullURL parameters:paraDic headers:hearder constructingBodyWithBlock:^(id<AFMultipartFormData> _Nonnull formData) {
for (UIImage *image in images)
{
[formData appendPartWithFileData:UIImageJPEGRepresentation(image, 0.5)
name:imagesKey
fileName:@"1.jpeg"
mimeType:@"image/jpeg"];
}
} progress:^(NSProgress * _Nonnull uploadProgress) {
} success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
success(responseObject);
} failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
failed(error);
}];
}
-(void)httpRequestGetWithURL:(NSString *)url
parameters:(NSDictionary*)paraDic
success:(successBlock)success
failed:(failedBlock)failed
{
NSUserDefaults * tokenDefaul = [NSUserDefaults standardUserDefaults];
NSString * token = [tokenDefaul objectForKey:KHEALTHTOKEN];
NSString *fullURL = [NSString stringWithFormat:@"%@/%@",BASEURL,url];
[_session GET:fullURL parameters:paraDic headers:@{@"X-Access-Token":token} progress:nil success:^(NSURLSessionTask *task, NSDictionary * responseObject) {
success(responseObject);
} failure:^(NSURLSessionTask *operation, NSError *error) {
failed(error);
}];
}
#pragma mark - 首页
- (void)getInterWatchDataUrlWithParm:(NSMutableDictionary *)parmDic
Success:(successBlock)success
failed:(failedBlock)failed {
//参数
[self httpRequestGetWithURL:@"health-watch/watchH5Api/indexDataNew"
parameters:parmDic success:success failed:failed];
}
@end
@@ -0,0 +1,20 @@
//
// SwapMethodManager.h
// WDYAdjustFontSize
//
// Created by wdyzmx on 2022/1/19.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface SwapMethodManager : NSObject
/// runtime方法交换
/// @param class 对象的类
/// @param originalSel 对象原方法
/// @param swizzledSel 对象所要交换的方法
+ (void)swapMethodInClass:(Class)class originalMethod:(SEL)originalSel swizzledMethod:(SEL)swizzledSel;
@end
NS_ASSUME_NONNULL_END
@@ -0,0 +1,33 @@
//
// SwapMethodManager.m
// WDYAdjustFontSize
//
// Created by wdyzmx on 2022/1/19.
//
#import "SwapMethodManager.h"
#import <objc/runtime.h>
@implementation SwapMethodManager
+ (void)swapMethodInClass:(Class)class originalMethod:(SEL)originalSel swizzledMethod:(SEL)swizzledSel {
Method originalMethod = class_getInstanceMethod(class, originalSel);
Method swizzledMethod = class_getInstanceMethod(class, swizzledSel);
BOOL willAddMethod =
class_addMethod(class,
originalSel,
method_getImplementation(swizzledMethod),
method_getTypeEncoding(swizzledMethod));
if (willAddMethod) {
class_replaceMethod(class,
swizzledSel,
method_getImplementation(originalMethod),
method_getTypeEncoding(originalMethod));
} else {
method_exchangeImplementations(originalMethod, swizzledMethod);
}
}
@end
@@ -0,0 +1,68 @@
//
// ESCTUIManager.h
// EscortProject
//
// Created by 仁康信息 on 2023/2/16.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface ESCTUIManager : NSObject <TUICallObserver>
/*
是否已经登录
*/
+ (BOOL)TUIUserStatus;
/*
登录腾讯IM
*/
+ (void)loginInitTUISDKAppidWith:(int)sdkAppid UserID:(NSString *)userID userSig:(NSString *)userSig;
/*
发起聊天
isUserID:是否为单聊 false:群聊
chatConnetID:会话id
isAudio:语音是否开启
isVideo:视频是否开启
*/
+ (void)createUITUIChatViewControllerisGroup:(BOOL)isGroup
chatConnetID:(NSString *)chatConnetID
isAudio:(BOOL)isAudio
isVideo:(BOOL)isVideo;
/*
发起1对1视频通话(假设 userId 为 mike)
*/
+ (void)sendOneToOneVideo:(NSString *)userID;
/*
发起群组视频通话(假设 userId 为 mike)
*/
+ (void)sendGroupVideo:(NSString *)groupID withUserIdList:(NSArray *)userList;
/*
发起1对1语音通话(假设 userId 为 mike)
*/
+ (void)sendOneToOneAudio:(NSString *)userID;
/*
退出登录腾讯Im
*/
+ (void)outLoginTUISDK;
@end
NS_ASSUME_NONNULL_END
@@ -0,0 +1,116 @@
//
// ESCTUIManager.m
// EscortProject
//
// Created by 仁康信息 on 2023/2/16.
//
#import "ESCTUIManager.h"
#import "TUIC2CChatViewController.h"
#import "TUICallKit.h"
@implementation ESCTUIManager
+ (BOOL)TUIUserStatus {
return [TUILogin isUserLogined];
}
+ (void)loginInitTUISDKAppidWith:(int)sdkAppid UserID:(NSString *)userID userSig:(NSString *)userSig{
[[TUICallEngine createInstance] init:sdkAppid userId:userID userSig:userSig succ:^{
} fail:^(int code, NSString * _Nullable errMsg) {
}];
[TUILogin login:sdkAppid userID:userID userSig:userSig succ:^{
// KPostNotification(KNotificationLoginIMResult, @YES);
} fail:^(int code, NSString *msg) {
[EasyTextView showErrorText:@"IM登录失败"];
}];
[[TUICallEngine createInstance] addObserver:self];
}
/*
发起聊天
isUserID:是否为单聊 false:群聊
chatConnetID:会话id
isAudio:语音是否开启
isVideo:视频是否开启
*/
+ (void)createUITUIChatViewControllerisGroup:(BOOL)isGroup
chatConnetID:(NSString *)chatConnetID
isAudio:(BOOL)isAudio
isVideo:(BOOL)isVideo {
TUIChatConversationModel *data = [[TUIChatConversationModel alloc] init];
//显示对方正在输入状态
data.avatarImage = [UIImage imageNamed:@""];
data.otherSideTyping = true;
if(isGroup == false) {
data.userID = chatConnetID;
}
else
{
data.groupID = chatConnetID;
}
// TUIC2CChatViewController
TUIC2CChatViewController *vc = [[TUIC2CChatViewController alloc] init];
[vc setConversationData:data];
// 显示翻译按钮
// TUIChatConfig.defaultConfig.enableTextTranslation = YES;
//不显示视频和语音
[TUIChatConfig defaultConfig].enableVideoCall = isVideo; // YES:开启,NO:关闭
[TUIChatConfig defaultConfig].enableAudioCall = isAudio; // YES:开启,NO:关闭
// 把 TUIC2CChatViewController 添加到自己的 ViewController
HQBaseViewController * currentVc =(HQBaseViewController *)[HQCommonUtils getCurrentVC];
if (!currentVc) {
currentVc = [[HQBaseViewController alloc] init];
}
[currentVc addChildViewController:vc];
[currentVc.view addSubview:vc.view];
}
+ (void)outLoginTUISDK {
[TUILogin logout:^{
} fail:^(int code, NSString *msg) {
}];
}
+ (void)sendOneToOneVideo:(NSString *)userID {
[[TUICallKit createInstance] call:userID callMediaType:TUICallMediaTypeVideo];
}
+ (void)sendGroupVideo:(NSString *)groupID withUserIdList:(NSArray *)userList {
[[TUICallKit createInstance] groupCall:groupID userIdList:userList callMediaType:TUICallMediaTypeVideo];
}
+ (void)sendOneToOneAudio:(NSString *)userID{
[[TUICallKit createInstance] call:userID callMediaType:TUICallMediaTypeAudio];
}
@end
@@ -0,0 +1,40 @@
//
// HQUserInfo.h
// idleBuy
//
// Created by ios on 2018/5/30.
// Copyright © 2018年 ios. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface HQUserInfo : NSObject
@property (nonatomic, strong) NSDictionary *userInfo;
@property (nonatomic, copy) NSString * user_id;
@property (nonatomic, copy) NSString * username;
@property (nonatomic, copy) NSString * realname;
@property (nonatomic, copy) NSString * avatar;
@property (nonatomic, copy) NSString * phone;
@property (nonatomic, copy) NSString * orgCode;
@property (nonatomic, copy) NSString * sex;
@property (nonatomic, copy) NSString * loginTenantId;
@property (nonatomic, copy) NSString * status_dictText;
@property (nonatomic, copy) NSString * delFlag;
@property (nonatomic, copy) NSString * workNo;
@property (nonatomic, copy) NSString * idCard;
@property (nonatomic, copy) NSString * sex_dictText;
@property (nonatomic, copy) NSString * personType;
@property (nonatomic, strong) NSDictionary * secondDepart;
@property (nonatomic, copy) NSString * depart_id;
@property (nonatomic, copy) NSString * parentId;
@property (nonatomic, copy) NSString * departName;
@property (nonatomic, copy) NSString * departOrder;
@property (nonatomic, copy) NSString * token;
@end
@@ -0,0 +1,77 @@
//
// HQUserInfo.m
// idleBuy
//
// Created by ios on 2018/5/30.
// Copyright © 2018年 ios. All rights reserved.
//
#import "HQUserInfo.h"
@implementation HQUserInfo
- (void)encodeWithCoder:(NSCoder *)aCoder
{
[aCoder encodeObject:self.userInfo forKey:@"userInfo"];
[aCoder encodeObject:self.user_id forKey:@"user_id"];
[aCoder encodeObject:self.avatar forKey:@"avatar"];
[aCoder encodeObject:self.username forKey:@"username"];
[aCoder encodeObject:self.realname forKey:@"realname"];
[aCoder encodeObject:self.phone forKey:@"phone"];
[aCoder encodeObject:self.idCard forKey:@"idCard"];
[aCoder encodeObject:self.depart_id forKey:@"depart_id"];
[aCoder encodeObject:self.parentId forKey:@"parentId"];
[aCoder encodeObject:self.departName forKey:@"departName"];
[aCoder encodeObject:self.token forKey:@"token"];
[aCoder encodeObject:self.sex_dictText forKey:@"sex_dictText"];
}
- (id)initWithCoder:(NSCoder *)aDecoder
{
self = [super init];
if (self)
{
self.userInfo = [aDecoder decodeObjectForKey:@"userInfo"];
self.user_id = [aDecoder decodeObjectForKey:@"user_id"];
self.avatar = [aDecoder decodeObjectForKey:@"avatar"];
self.username = [aDecoder decodeObjectForKey:@"username"];
self.realname = [aDecoder decodeObjectForKey:@"realname"];
self.phone = [aDecoder decodeObjectForKey:@"phone"];
self.idCard = [aDecoder decodeObjectForKey:@"idCard"];
self.depart_id = [aDecoder decodeObjectForKey:@"depart_id"];
self.parentId = [aDecoder decodeObjectForKey:@"parentId"];
self.departName = [aDecoder decodeObjectForKey:@"departName"];
self.token = [aDecoder decodeObjectForKey:@"token"];
self.sex_dictText = [aDecoder decodeObjectForKey:@"sex_dictText"];
}
return self;
}
- (void)setUserInfo:(NSDictionary *)userInfo {
_userInfo = userInfo;
self.user_id = [_userInfo objectForKey:@"id"];
self.avatar = [NSString stringWithFormat:@"%@%@",ResourceAddress,[_userInfo objectForKey:@"avatar"]];
self.phone = [_userInfo objectForKey:@"phone"];
self.realname = [_userInfo objectForKey:@"realname"];
self.username = [_userInfo objectForKey:@"username"];
self.sex = [_userInfo objectForKey:@"sex"];
self.idCard = [_userInfo objectForKey:@"idCard"];
self.personType = [_userInfo objectForKey:@"personType"];
self.secondDepart = [_userInfo objectForKey:@"secondDepart"];
self.sex_dictText = [_userInfo objectForKey:@"sex_dictText"];
self.depart_id = [self.secondDepart objectForKey:@"id"];
self.parentId = [self.secondDepart objectForKey:@"parentId"];
self.departName = [self.secondDepart objectForKey:@"departName"];
}
-(void)setToken:(NSString *)token {
_token = token;
}
@end
@@ -0,0 +1,36 @@
// XMKeychainTool.h
// idleBuy
//
// Created by ios on 2018/5/28.
// Copyright © 2018年 ios. All rights reserved.
#import <Foundation/Foundation.h>
#import <Security/Security.h>
@interface XMKeychainTool : NSObject
/**
* 储存字符串到🔑钥匙串
*
* @param sValue 对应的Value
* @param sKey 对应的Key
*/
+ (void)saveKeychainValue:(NSString *)sValue key:(NSString *)sKey;
/**
* 从🔑钥匙串获取字符串
*
* @param sKey 对应的Key
*
* @return 返回储存的Value
*/
+ (NSString *)readKeychainValue:(NSString *)sKey;
/**
* 从🔑钥匙串删除字符串
*
* @param sKey 对应的Key
*/
+ (void)deleteKeychainValue:(NSString *)sKey;
@end
@@ -0,0 +1,57 @@
//
// SDKeychainTool.m
// NewLottery
//
// Created by 孙号斌 on 2017/2/14.
// Copyright © 2017年 孙号斌. All rights reserved.
//
#import "XMKeychainTool.h"
@implementation XMKeychainTool
+ (NSMutableDictionary *)getKeychainQuery:(NSString *)service{
return [NSMutableDictionary dictionaryWithObjectsAndKeys:
(__bridge_transfer id)kSecClassGenericPassword,
(__bridge_transfer id)kSecClass,service,
(__bridge_transfer id)kSecAttrService,service,
(__bridge_transfer id)kSecAttrAccount,
(__bridge_transfer id)kSecAttrAccessibleAfterFirstUnlock,
(__bridge_transfer id)kSecAttrAccessible,
nil];
}
+ (void)saveKeychainValue:(NSString *)sValue key:(NSString *)sKey{
NSMutableDictionary * keychainQuery = [self getKeychainQuery:sKey];
SecItemDelete((__bridge_retained CFDictionaryRef)keychainQuery);
[keychainQuery setObject:[NSKeyedArchiver archivedDataWithRootObject:sValue] forKey:(__bridge_transfer id)kSecValueData];
SecItemAdd((__bridge_retained CFDictionaryRef)keychainQuery, NULL);
}
+ (NSString *)readKeychainValue:(NSString *)sKey
{
NSString *ret = nil;
NSMutableDictionary *keychainQuery = [self getKeychainQuery:sKey];
[keychainQuery setObject:(id)kCFBooleanTrue forKey:(__bridge_transfer id)kSecReturnData];
[keychainQuery setObject:(__bridge_transfer id)kSecMatchLimitOne forKey:(__bridge_transfer id)kSecMatchLimit];
CFDataRef keyData = NULL;
if (SecItemCopyMatching((__bridge CFDictionaryRef)keychainQuery, (CFTypeRef *)&keyData) == noErr) {
@try {
ret = (NSString *)[NSKeyedUnarchiver unarchiveObjectWithData:(__bridge NSData *)keyData];
} @catch (NSException *e) {
NSLog(@"Unarchive of %@ failed: %@", sKey, e);
} @finally {
}
}
if (keyData)
CFRelease(keyData);
return ret;
}
+ (void)deleteKeychainValue:(NSString *)sKey {
NSMutableDictionary *keychainQuery = [self getKeychainQuery:sKey];
SecItemDelete((__bridge CFDictionaryRef)keychainQuery);
}
@end
@@ -0,0 +1,35 @@
//
// AppDelegate+appService.h
// healthQuestion
//
// Created by xulei on 2022/8/11.
//
#import <UIKit/UIKit.h>
#import "AppDelegate.h"
@interface AppDelegate (AppService)
//初始化服务
-(void)initService;
- (void)chageUrlService;
//初始化 window
-(void)initWindow;
//初始化键盘
-(void)initIQKeyBord;
//初始化高德地图
-(void)configureAPIKey;
//初始化 UMeng
-(void)initUMeng;
//单例
+ (AppDelegate *)shareAppDelegate;
@end
@@ -0,0 +1,408 @@
//
// AppDelegate+appService.m
// healthQuestion
//
// Created by xulei on 2022/8/11.
//
#import "AppDelegate+AppService.h"
#import "HQBaseTabBarController.h"
#import "HQLoginViewController.h"
#import <IQKeyboardManager/IQKeyboardManager.h>
#import <AMapFoundationKit/AMapFoundationKit.h>
#import <AMapSearchKit/AMapSearchKit.h>
@implementation AppDelegate (AppService)
#pragma mark ————— 初始化服务 —————
-(void)initService{
//网络状态监听
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(netWorkStateChange:)
name:KNotificationNetWorkStateChange
object:nil];
//登录状态改变通知
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(loginStateChange:)
name:KNotificationLoginStateChange
object:nil];
//切换SOStabbar
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(tabBarSoSChange:)
name:KNotificSelectSoSTabbar
object:nil];
//切换体检tabbar
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(tabBarPhyChange:)
name:KNotificSelectPhysicalTabbar
object:nil];
//切换档案tabbar
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(tabBarFileChange:)
name:KNotificSelectFileTabbar
object:nil];
if ([HQCommonUtils isLogin]) {
//腾讯im
JKCQAPI * proctocolApi = [[JKCQAPI alloc] init:self tag:@"IMAPI" NeedToken:nil];
[proctocolApi GetIMLoginAccount:nil];
}
}
#pragma mark ————— 初始化window —————
-(void)initWindow{
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
self.window.backgroundColor = KWhiteColor;
//直接进入显示登录页面
// if ([HQCommonUtils isLogin]) {
self.mainTabBar = [HQBaseTabBarController new];
self.mainTabBar.delegate =self;
self.window.rootViewController = self.mainTabBar;
[self.window makeKeyAndVisible];
// }else {
// HQLoginViewController * loginvc = [[HQLoginViewController alloc] init];
// HQBaseNavigationController * nav = [[HQBaseNavigationController alloc] initWithRootViewController:loginvc];
// self.window.rootViewController = nav;
// }
// [self.window makeKeyAndVisible];
//判断是否是首次启动
if(![[NSUserDefaults standardUserDefaults] boolForKey:@"agreeStatus"]){
//添加隐私合规弹窗
[self addAlertController];
//更新App是否显示隐私弹窗的状态,隐私弹窗是否包含高德SDK隐私协议内容的状态. since 8.1.0
[MAMapView updatePrivacyShow:AMapPrivacyShowStatusDidShow privacyInfo:AMapPrivacyInfoStatusDidContain];
}
[[TUICallEngine createInstance] addObserver:self];
}
#pragma mark:请求前缀
- (void)chageUrlService {
AFHTTPSessionManager *session=[AFHTTPSessionManager manager];
// AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
session.responseSerializer.acceptableContentTypes=[NSSet setWithObjects:@"application/json",@"text/json",@"text/javascript",@"text/html",@"text/plain", nil];
//超时时间
session.requestSerializer.timeoutInterval= 30.f;
session.responseSerializer = [AFHTTPResponseSerializer serializer];
session.requestSerializer = [AFJSONRequestSerializer serializer];
session.securityPolicy = [AFSecurityPolicy policyWithPinningMode:AFSSLPinningModeNone];
NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init];
// 获取应用的版本号
NSString * version = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"];
// 将版本号按照点(.)分割成数组
NSArray * components = [version componentsSeparatedByString:@"."];
// 获取数组中的最后一个元素
NSString * lastComponent = [components lastObject];
// 如果需要将其转换为整数
NSInteger lastNumber = [lastComponent integerValue];
[parmDic setObject:@(lastNumber) forKey:@"version"];
[parmDic setObject:@"com.question.QinghaiProvince" forKey:@"pkg"];
[session GET:@"https://base.icdat.cn/v2/url" parameters:parmDic headers:@{@"X-ClientSign":@"Quarry"} progress:^(NSProgress * _Nonnull downloadProgress) {
} success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
NSString * dataString = [[NSString alloc] initWithData:responseObject encoding:NSUTF8StringEncoding];
DLog(@"response\n%@\n",dataString);
NSData *requestData = [dataString dataUsingEncoding:NSUTF8StringEncoding];
id myResult = [NSJSONSerialization JSONObjectWithData:requestData options:NSJSONReadingMutableContainers error:nil];
//判断是否为字典
if ([myResult isKindOfClass:[NSDictionary class]]) {
NSDictionary *response = (NSDictionary *)myResult;
if ([response.allKeys containsObject:@"result"]) {
NSDictionary * resultDic = [response objectForKey:@"result"];
if ([resultDic.allKeys containsObject:@"api"]) {
[[NSUserDefaults standardUserDefaults] setObject:[resultDic objectForKey:@"api"] forKey:@"HTTPS"];
[[NSUserDefaults standardUserDefaults] synchronize];
NSString * apiString = [resultDic objectForKey:@"api"];
//判断是否正在审
BOOL isExmine;
if ([apiString containsString:@"api.out.icdat.cn"]) { //正在审
isExmine = true;
}else
{
isExmine = false;
}
[[NSUserDefaults standardUserDefaults] setObject:@(isExmine) forKey:@"isExmine"];
[[NSUserDefaults standardUserDefaults] synchronize];
}
if ([resultDic.allKeys containsObject:@"h5"]) {
[[NSUserDefaults standardUserDefaults] setObject:[resultDic objectForKey:@"h5"] forKey:@"IntervenH5"];
[[NSUserDefaults standardUserDefaults] synchronize];
}
if ([resultDic.allKeys containsObject:@"h5Host"]) {
[[NSUserDefaults standardUserDefaults] setObject:[resultDic objectForKey:@"h5Host"] forKey:@"H5DevHost"];
[[NSUserDefaults standardUserDefaults] synchronize];
}
if ([resultDic.allKeys containsObject:@"health"]) {
[[NSUserDefaults standardUserDefaults] setObject:[resultDic objectForKey:@"health"] forKey:@"BASEURL"];
[[NSUserDefaults standardUserDefaults] synchronize];
}
KPostNotification(KNotificAgreeProtoocl, nil);
}
}
} failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
NSString * statusCode = [error.userInfo objectForKey:@"NSLocalizedDescription"];
//请求超时
if (error.code == -1001) {
[EasyTextView showErrorText:@"请求超时"];
}
[[NSUserDefaults standardUserDefaults] setObject:@"https://api.cqygjk.com" forKey:@"HTTPS"];
[[NSUserDefaults standardUserDefaults] setObject:@"https://yyjk.cqygjk.com/" forKey:@"BASEURL"];
[[NSUserDefaults standardUserDefaults] setObject:@"api.cqygjk.com" forKey:@"IntervenH5"];
[[NSUserDefaults standardUserDefaults] setObject:@"https://api.cqygjk.com" forKey:@"H5DevHost"];
[[NSUserDefaults standardUserDefaults] synchronize];
KPostNotification(KNotificAgreeProtoocl, nil);
}];
}
#pragma mark: 键盘回收
- (void)initIQKeyBord {
IQKeyboardManager *keyboardManager = [IQKeyboardManager sharedManager]; // 获取类库的单例变量
keyboardManager.enable = YES; // 控制整个功能是否启用
keyboardManager.shouldResignOnTouchOutside = YES; // 控制点击背景是否收起键盘
keyboardManager.shouldToolbarUsesTextFieldTintColor = YES; // 控制键盘上的工具条文字颜色是否用户自定义
keyboardManager.toolbarManageBehavior = IQAutoToolbarBySubviews; // 有多个输入框时,可以通过点击Toolbar 上的“前一个”“后一个”按钮来实现移动到不同的输入框
keyboardManager.enableAutoToolbar = YES; // 控制是否显示键盘上的工具条
keyboardManager.shouldShowToolbarPlaceholder = YES; // 是否显示占位文字
keyboardManager.placeholderFont = [UIFont boldSystemFontOfSize:17]; // 设置占位文字的字体
keyboardManager.keyboardDistanceFromTextField = 10.0f; // 输入框距离键盘的距离
}
//初始化高德
- (void)configureAPIKey
{
if ([AMAPSDKKEY length] == 0)
{
NSString *reason = [NSString stringWithFormat:@"apiKey为空,请检查key是否正确设置。"];
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"提示" message:reason delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
[alert show];
}
[AMapServices sharedServices].apiKey = AMAPSDKKEY;
}
#pragma mark:进来显示弹框--隐私权限
- (void)addAlertController{
NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
paragraphStyle.alignment = NSTextAlignmentLeft;
NSMutableAttributedString *message = [[NSMutableAttributedString alloc] initWithString:@"\n亲,感谢您对健康咨询员工端一直以来的信任!我们依据最新的监管要求更新了健康咨询员工端《隐私权政策》,特向您说明如下\n1.为向您提供交易相关基本功能,我们会收集、使用必要的信息;\n2.基于您的明示授权,我们可能会获取您的位置(为您提供服务)等信息,您有权拒绝或取消授权;\n3.我们会采取业界先进的安全措施保护您的信息安全;\n4.未经您同意,我们不会从第三方处获取、共享或向提供您的信息;" attributes:@{
NSParagraphStyleAttributeName:paragraphStyle,
}];
[message setAttributes:@{NSForegroundColorAttributeName:[UIColor blueColor]} range:[[message string] rangeOfString:@"《隐私权政策》"]];
UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"温馨提示(隐私合规示例)" message:@"" preferredStyle:UIAlertControllerStyleAlert];
[alert setValue:message forKey:@"attributedMessage"];
UIAlertAction *conform = [UIAlertAction actionWithTitle:@"同意" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"agreeStatus"];
[[NSUserDefaults standardUserDefaults] synchronize];
//更新用户授权高德SDK隐私协议状态. since 8.1.0
[MAMapView updatePrivacyAgree:AMapPrivacyAgreeStatusDidAgree];
[self chageUrlService];
}];
UIAlertAction *cancel = [UIAlertAction actionWithTitle:@"不同意" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
[[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"agreeStatus"];
[[NSUserDefaults standardUserDefaults] synchronize];
//更新用户授权高德SDK隐私协议状态. since 8.1.0
[MAMapView updatePrivacyAgree:AMapPrivacyAgreeStatusNotAgree];
[self chageUrlService];
}];
[alert addAction:conform];
[alert addAction:cancel];
[self.window.rootViewController presentViewController:alert animated:YES completion:nil];
}
//代理方法,这个方法是来判断当点击某个tabBarItem时是否要点击
- (BOOL)tabBarController:(UITabBarController *)tabBarController shouldSelectViewController:(UIViewController *)viewController{
//判断用户是否登陆,这里我们可以从沙盒里面去取登陆状态
// index = [tabBarController.viewControllers indexOfObject:viewController];
// if (![HQCommonUtils isLogin] ) {
// if (index==2 || index==3) {
// HQLoginViewController *loginVC = [[HQLoginViewController alloc]init];
//// self.mainTabBar.lastSelectIndex = index;
// //这里的NO是关键,如果是这个tabBarItem,就不要让他点击进去
// UINavigationController * nav = [[UINavigationController alloc] initWithRootViewController:loginVC];
//
// [[self getCurrentVC] presentViewController:nav animated:YES completion:nil];
//
// return NO;
// }
// }
//当然其余的还是要点击进去的
return YES;
}
#pragma mark ————— 网络状态变化 —————
- (void)netWorkStateChange:(NSNotification *)notification
{
BOOL isNetWork = [notification.object boolValue];
if (isNetWork) {//有网络
}else {//无网络通知
[EasyTextView showErrorText:@"暂无网络!" config:^EasyTextConfig *{
return [EasyTextConfig shared].setStatusType(TextStatusTypeMidden) ;
}];
}
}
- (void)loginStateChange:(NSNotification *)notification {
BOOL islogin = [notification.object boolValue];
if (islogin) {//登录成功 重置Tabbar
self.mainTabBar = nil;
self.mainTabBar = [HQBaseTabBarController new];
self.mainTabBar.delegate =self;
self.window.rootViewController = self.mainTabBar;
[self.window makeKeyAndVisible];
}else {//登陆失败加载登陆页面控制器 退出登录
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
self.window.backgroundColor = KWhiteColor;
HQLoginViewController * loginvc = [[HQLoginViewController alloc] init];
HQBaseNavigationController * nav = [[HQBaseNavigationController alloc] initWithRootViewController:loginvc];
self.window.rootViewController = nav;
[self.window makeKeyAndVisible];
}
}
#pragma mark: 字体修改
- (void)fontSizeChange:(NSNotification *)notification {
}
#pragma mark: 切换tabbar
- (void)tabBarSoSChange:(NSNotification *)notification {
self.mainTabBar.selectedIndex = 2;
}
- (void)tabBarPhyChange:(NSNotification *)notification {
self.mainTabBar.selectedIndex = 3;
}
- (void)tabBarFileChange:(NSNotification *)notification {
self.mainTabBar.selectedIndex = 4;
}
+ (AppDelegate *)shareAppDelegate{
return (AppDelegate *)[[UIApplication sharedApplication] delegate];
}
#pragma mark -网络请求处理
- (void)Failed:(NSString*)message tag:(NSString*)tag
{
}
- (void)Sucess:(id)response tag:(NSString*)tag
{
if ([tag isEqualToString:@"IMAPI"]) {
NSDictionary * pamrDic = response;
IMUserInfoModel * model = [IMUserInfoModel modelWithDictionary:pamrDic];
IMUserInfoModel * iminfoModel = [[IMUserInfoModel alloc] init];
iminfoModel.IMInfo = pamrDic;
[HQCommonUtils keyedArchiverWithData:iminfoModel key:IMLoginUserInfo];
// 1. 从即时通信 IM 控制台获取应用 SDKAppID。
// 2. 初始化 config 对象
V2TIMSDKConfig *config = [[V2TIMSDKConfig alloc] init];
// 3. 指定 log 输出级别。
config.logLevel = V2TIM_LOG_INFO;
// 4. 添加 V2TIMSDKListener 的事件监听器,self 是 id<V2TIMSDKListener> 的实现类,如果您不需要监听 IM SDK 的事件,这个步骤可以忽略。
[[V2TIMManager sharedInstance] addIMSDKListener:self];
// 5. 初始化 IM SDK,调用这个接口后,可以立即调用登录接口。
[[V2TIMManager sharedInstance] initSDK:[model.sdkAppId intValue] config:config];
[[V2TIMManager sharedInstance] addSimpleMsgListener:self];
[[TUICallEngine createInstance] addObserver:self];
[ESCTUIManager loginInitTUISDKAppidWith:[model.sdkAppId intValue] UserID:model.userId userSig:model.userSig];
}
}
//在线时票据过期:此时您需要生成新的 userSig,并再次重新调用初始化。
- (void)onKickedOffline {
[HQCommonUtils keyedArchiverWithData:nil key:LoginUserInfo];
[ESCTUIManager outLoginTUISDK];
KPostNotification(KNotificationLoginStateChange, @NO);
}
@end
@@ -0,0 +1,18 @@
//
// AppDelegate+pushService.h
// healthQuestion
//
// Created by xulei on 2022/8/11.
//
#import <UIKit/UIKit.h>
#import "AppDelegate.h"
@interface AppDelegate (PushService)
- (void)initWithJPush:(NSDictionary *)launchOptions;
@end
@@ -0,0 +1,64 @@
//
// AppDelegate+pushService.m
// healthQuestion
//
// Created by xulei on 2022/8/11.
//
#import "AppDelegate+PushService.h"
@implementation AppDelegate (PushService)
- (void)initWithJPush:(NSDictionary *)launchOptions
{
/*
NSNotificationCenter *defaultCenter = [NSNotificationCenter defaultCenter];
[defaultCenter addObserver:self selector:@selector(networkDidReceiveMessage:) name:kJPFNetworkDidReceiveMessageNotification object:nil];
//Required
//notice: 3.0.0及以后版本注册可以这样写,也可以继续用之前的注册方式
JPUSHRegisterEntity * entity = [[JPUSHRegisterEntity alloc] init];
entity.types = JPAuthorizationOptionAlert|JPAuthorizationOptionBadge|JPAuthorizationOptionSound;
if ([[UIDevice currentDevice].systemVersion floatValue] >= 8.0) {
// 可以添加自定义categories
// NSSet<UNNotificationCategory *> *categories for iOS10 or later
// NSSet<UIUserNotificationCategory *> *categories for iOS8 and iOS9
}
[JPUSHService registerForRemoteNotificationConfig:entity delegate:self];
// Optional
// 获取IDFA
// 如需使用IDFA功能请添加此代码并在初始化方法的advertisingIdentifier参数中填写对应值
NSString *advertisingId = [[[ASIdentifierManager sharedManager] advertisingIdentifier] UUIDString];
// Required
// init Push
// notice: 2.1.5版本的SDK新增的注册方法,改成可上报IDFA,如果没有使用IDFA直接传nil
// 如需继续使用pushConfig.plist文件声明appKey等配置内容,请依旧使用[JPUSHService setupWithOption:launchOptions]方式初始化。
BOOL isProduction;
#ifdef DEBUG
isProduction = YES;
#else
isProduction = NO;
#endif
[JPUSHService setupWithOption:launchOptions appKey:JpushAppKey
channel:@"App Store"
apsForProduction:isProduction
advertisingIdentifier:advertisingId];
//2.1.9版本新增获取registration id block接口。
[JPUSHService registrationIDCompletionHandler:^(int resCode, NSString *registrationID) {
if(resCode == 0){
NSLog(@"registrationID获取成功:%@",registrationID);
UserDefaultSetObjectForKey(registrationID, @"registrationID");
}
else{
NSLog(@"registrationID获取失败,code%d",resCode);
UserDefaultSetObjectForKey(@"0", @"registrationID");
}
}];
*/
}
@end
@@ -0,0 +1,30 @@
//
// AppDelegate.h
// healthQuestion
//
// Created by xulei on 2022/8/9.
//
#import <UIKit/UIKit.h>
#import "HQBaseTabBarController.h"
/**腾讯IM**/
#import "TUIDefine.h"
#import "TUIBaseChatViewController.h"
#import "TUIThemeManager.h"
#import "TUILogin.h"
#import "TUIChatConfig.h"
#import "TUICallKit.h"
//Minimalist
@interface AppDelegate : UIResponder <UIApplicationDelegate,UITabBarControllerDelegate,V2TIMConversationListener, TUILoginListener,V2TIMAPNSListener, TUICallObserver>
@property (strong, nonatomic) UIWindow * window;
@property (nonatomic,assign)NSInteger allowRotate;
@property (strong, nonatomic) HQBaseTabBarController * mainTabBar;
@property (nonatomic,assign)NSInteger unreadNumber;
@end
@@ -0,0 +1,178 @@
//
// AppDelegate.m
// healthQuestion
//
// Created by xulei on 2022/8/9.
//
#import "AppDelegate.h"
#import "SJRotationManager.h"
#import <SDWebImageWebPCoder/SDWebImageWebPCoder.h>
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
//前缀请求
//初始化高德地图
[self configureAPIKey];
//前缀请求
[self chageUrlService];
[self initService];
//初始化window
[self initWindow];
//初始化IQKeybord
[self initIQKeyBord];
// 监听推送
[V2TIMManager.sharedInstance setAPNSListener:self];
// 监听会话的未读数
[[V2TIMManager sharedInstance] setConversationListener:self];
SDImageWebPCoder*webPCoder = [SDImageWebPCoder sharedCoder];
[[SDImageCodersManager sharedManager] addCoder:webPCoder];
#if DEBUG
#else
[CheckProjectTool testAll];
#endif
return YES;
}
// 2. 未读数发生变化后保存未读数
- (void)onTotalUnreadMessageCountChanged:(UInt64)totalUnreadCount {
self.unreadNumber = 0;
}
- (uint32_t)onSetAPPUnreadCount {
// 1. 获取自定义的角标
uint32_t customBadgeNumber = 0;
// 2. 加上 IM 的消息未读数
customBadgeNumber += self.unreadNumber;
// 3. 通过 IMSDK 上报给 IM 服务器
return customBadgeNumber;
}
- (UIInterfaceOrientationMask)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window {
return [SJRotationManager supportedInterfaceOrientationsForWindow:window];
}
#pragma mark - NSNotification
- (void)applicationWillResignActive:(UIApplication *)application {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
}
- (void)applicationDidEnterBackground:(UIApplication *)application {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}
- (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void(^)(NSArray<id<UIUserActivityRestoring>> * __nullable restorableObjects))restorationHandler {
return YES;
}
- (void)applicationWillEnterForeground:(UIApplication *)application {
// Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
[application setApplicationIconBadgeNumber:0];
[application cancelAllLocalNotifications];
}
- (void)applicationDidBecomeActive:(UIApplication *)application {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
[UIApplication sharedApplication].applicationIconBadgeNumber=0;
}
- (void)applicationWillTerminate:(UIApplication *)application {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
@end
#warning Configuring rotation. 请配置旋转!!
@implementation UIViewController (RotationConfiguration)
///
/// 控制器是否可以旋转
///
- (BOOL)shouldAutorotate {
return NO;
}
///
/// 控制器旋转支持的方向
///
- (UIInterfaceOrientationMask)supportedInterfaceOrientations {
return UIInterfaceOrientationMaskPortrait;
}
@end
@implementation UITabBarController (RotationConfiguration)
- (UIViewController *)sj_topViewController {
if ( self.selectedIndex == NSNotFound )
return self.viewControllers.firstObject;
return self.selectedViewController;
}
- (BOOL)shouldAutorotate {
return [[self sj_topViewController] shouldAutorotate];
}
- (UIInterfaceOrientationMask)supportedInterfaceOrientations {
return [[self sj_topViewController] supportedInterfaceOrientations];
}
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation {
return [[self sj_topViewController] preferredInterfaceOrientationForPresentation];
}
@end
@implementation UINavigationController (RotationConfiguration)
- (BOOL)shouldAutorotate {
return self.topViewController.shouldAutorotate;
}
- (UIInterfaceOrientationMask)supportedInterfaceOrientations {
return self.topViewController.supportedInterfaceOrientations;
}
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation {
return self.topViewController.preferredInterfaceOrientationForPresentation;
}
- (nullable UIViewController *)childViewControllerForStatusBarStyle {
return self.topViewController;
}
- (nullable UIViewController *)childViewControllerForStatusBarHidden {
return self.topViewController;
}
@end
@@ -0,0 +1,39 @@
//
// BaseWebViewVC.h
// ScarHousekeeper
//
// Created by 张小万 on 2021/1/21.
//
#import <WebKit/WebKit.h>
#import <JavaScriptCore/JavaScriptCore.h>
NS_ASSUME_NONNULL_BEGIN
typedef enum {
WkJSMessageTypeDefault = 0,
WkJSMessageTypeBack = 1,
}WkJSMessageType;
typedef enum {
RightDefaultType = 0,
RightCompleteType = 1,
}RightNavType;
@protocol WebJSExport <JSExport>
- (void)startFunction;
@end
@interface BaseWebViewVC : HQBaseViewController<UIAlertViewDelegate,WKNavigationDelegate, WKUIDelegate, WebJSExport, WKScriptMessageHandler>
@property (nonatomic, strong) NSString *webUrl;
@property (nonatomic, strong) NSString *webTitle;
@property (nonatomic, strong) JSContext *context;
@property (nonatomic, strong) WKWebView *wkWebView;
@property (nonatomic, assign) RightNavType rightType;
- (void)webViewRequest;
@end
NS_ASSUME_NONNULL_END
@@ -0,0 +1,249 @@
//
// BaseWebViewVC.m
// ScarHousekeeper
//
// Created by 张小万 on 2021/1/21.
//
#import "BaseWebViewVC.h"
@interface BaseWebViewVC ()<UINavigationControllerDelegate, UIImagePickerControllerDelegate>
@property (nonatomic, strong)NSURL *originalUrl;
@property (nonatomic, copy)NSString *videoUrl;
@property (nonatomic, copy)NSString *messageType;
@end
@implementation BaseWebViewVC
#pragma mark - LifeCycle
- (void)viewDidLoad {
[super viewDidLoad];
self.view.backgroundColor = [UIColor whiteColor];
self.isHidenNaviBar = false;
[self addNavigationItemWithImageNames:@[@"whiteBack_icon"] isLeft:YES target:self action:@selector(backVC) tags:@[@""]];
[self addSubviews];
if (self.webTitle) {
self.navigationItem.title = self.webTitle;
}
}
- (void)backVC {
[self.navigationController popViewControllerAnimated:YES];
}
- (void)viewWillAppear:(BOOL)animated{
[super viewWillAppear:animated];
if (_wkWebView) {
_wkWebView.navigationDelegate = self;
_wkWebView.UIDelegate = self;
_wkWebView.allowsBackForwardNavigationGestures = true;
}
}
- (void)viewWillDisappear:(BOOL)animated{
[super viewWillDisappear:animated];
_wkWebView.navigationDelegate = nil;
_wkWebView.UIDelegate = nil;
//清除cookies
NSHTTPCookie *cookie;
NSHTTPCookieStorage *storage = [NSHTTPCookieStorage sharedHTTPCookieStorage];
for (cookie in [storage cookies]) {
[storage deleteCookie:cookie];
}
[[NSURLCache sharedURLCache] removeAllCachedResponses];
[self clearWebViewCache];
}
#pragma mark - Create UI
- (void)addSubviews{
WKWebViewConfiguration *configuration = [[WKWebViewConfiguration alloc] init];
WKPreferences *preferences = [[WKPreferences alloc]init];
preferences.javaScriptEnabled = YES;
preferences.javaScriptCanOpenWindowsAutomatically = YES;
preferences.minimumFontSize = 10;
configuration.preferences = preferences;
[configuration.userContentController addScriptMessageHandler:self name:@"JSCallback"];
[configuration.userContentController addScriptMessageHandler:self name:@"htmlBack"];
//防止搜索框自动放大 注入js代码
WKUserContentController *userController = [WKUserContentController new];
NSString *jScript = @"var script = document.createElement('meta');script.name = 'viewport';script.content='width=device-width,user-scalable=no';document.getElementsByTagName('head')[0].appendChild(script);";
WKUserScript *wkUScript = [[WKUserScript alloc] initWithSource:jScript injectionTime:WKUserScriptInjectionTimeAtDocumentEnd forMainFrameOnly:YES];
WKUserContentController * wkUController = [[WKUserContentController alloc] init];
[wkUController addScriptMessageHandler: self name: @"finishActivity"];//不带参数的调用
[wkUController addUserScript:wkUScript];
configuration.userContentController= wkUController;
self.wkWebView = [[WKWebView alloc]initWithFrame:CGRectMake(0, 0, WIDTH, MyViewHEIGHT) configuration:configuration];
self.wkWebView.navigationDelegate = self;
self.wkWebView.UIDelegate = self;
if (@available(iOS 11.0, *)) {
self.wkWebView.scrollView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
}
[self.view addSubview:self.wkWebView];
self.wkWebView.scrollView.bounces = false;//禁止滑动
[self webViewRequest];
/*
[self.wkWebView evaluateJavaScript:@"htmlBack" completionHandler:^(id _Nullable response, NSError * _Nullable error) {
NSLog(@"response: %@ error: %@", response, error);
if (response) {
[self back];
}
}];
*/
}
- (void)finishActivity {
}
- (void)webViewRequest{
NSString *urlString = self.webUrl;
[self hiddenAllMBProgressHUD];
if (urlString.length > 0) {
[self showMBProgressHUDOnlyWithString:@"加载中"];
NSURL *url = [NSURL URLWithString:urlString];
NSURLRequest *urlRequest = [NSURLRequest requestWithURL:url];
if (self.wkWebView) {
[self.wkWebView loadRequest:urlRequest];
}
}
}
#pragma mark - WKNavigationDelegate
- (void)userContentController:(WKUserContentController *)userContentController didReceiveScriptMessage:(WKScriptMessage *)message{
if ([message.name isEqualToString:@"JSCallback"]) {
if (message.body) {
NSData *jsonData = [message.body dataUsingEncoding:NSUTF8StringEncoding];
NSError *err;
NSDictionary *dic = [NSJSONSerialization JSONObjectWithData:jsonData
options:NSJSONReadingMutableContainers
error:&err];
if(err) {
}
WkJSMessageType messageType = [[dic objectForKey:@"messageType"] intValue];
switch (messageType) {
case WkJSMessageTypeBack:{
// [self.navigationController popViewControllerAnimated:YES];
}
break;
default:
break;
}
}
} else if ([message.name isEqualToString:@"htmlBack"]) {
[[NSNotificationCenter defaultCenter] postNotificationName:@"fromWebToReloadData" object:nil];
}
}
#pragma mark - WKScriptMessageHandler
- (WKWebView *)webView:(WKWebView *)webView createWebViewWithConfiguration:(WKWebViewConfiguration *)configuration forNavigationAction:(WKNavigationAction *)navigationAction windowFeatures:(WKWindowFeatures *)windowFeatures {
[self hiddenAllMBProgressHUD];
if (!navigationAction.targetFrame.isMainFrame) {
[webView loadRequest:navigationAction.request];
}
return nil;
}
- (void)webView:(WKWebView *)webView didStartProvisionalNavigation:(WKNavigation *)navigation{
if (!self.webTitle) {
self.title = @"加载中...";
}
}
- (void)webView:(WKWebView *)webView didFinishNavigation:(null_unspecified WKNavigation *)navigation{
[self hiddenAllMBProgressHUD];
if (!self.webTitle) {
self.title = webView.title;
}
}
- (void)webView:(WKWebView *)webView didFailProvisionalNavigation:(WKNavigation *)navigation withError:(nonnull NSError *)error{
[self hiddenAllMBProgressHUD];
}
#pragma mark - ACTION
- (void)ToClickNavRight:(UIButton *)button{
}
#pragma mark - 自定义
- (void)onBackClicked{
if ( self.wkWebView.canGoBack){
[self.wkWebView goBack];
} else {
[self clearWebViewCache];
}
}
- (void)clearWebViewCache{
if (iOS9Later) {
NSSet *websiteDataTypes = [WKWebsiteDataStore allWebsiteDataTypes];
NSDate *dateFrom = [NSDate dateWithTimeIntervalSince1970:0];
[[WKWebsiteDataStore defaultDataStore] removeDataOfTypes:websiteDataTypes modifiedSince:dateFrom completionHandler:^{
NSLog(@"-----clear webView cache success------");
}];
} else {
NSString *libraryPath = [NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES) objectAtIndex:0];
NSString *cookiesFolderPath = [libraryPath stringByAppendingString:@"/Cookies"];
NSError *errors;
[[NSFileManager defaultManager] removeItemAtPath:cookiesFolderPath error:&errors];
if (!errors) {
NSLog(@"-----clear wkWebView cache success------");
}
}
}
- (NSString *)URLEncodedString:(NSString *)urlString{
NSString *encodePath ;
if (!IOS7) {
encodePath = [urlString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
}else{
encodePath = [urlString stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
}return encodePath;
}
#pragma mark - SETTER
- (void)setRightType:(RightNavType)rightType{
_rightType = rightType;
}
- (void)setWebUrl:(NSString *)webUrl{
_webUrl = webUrl;
[self webViewRequest];
}
@end
@@ -0,0 +1,18 @@
//
// DownPDFFileVC.h
// EscortProject
//
// Created by 仁康信息 on 2023/12/1.
//
#import "HQBaseViewController.h"
NS_ASSUME_NONNULL_BEGIN
@interface DownPDFFileVC : HQBaseViewController
@property (nonatomic, strong) NSString * PDFUrl;
@end
NS_ASSUME_NONNULL_END
@@ -0,0 +1,31 @@
//
// DownPDFFileVC.m
// EscortProject
//
// Created by 仁康信息 on 2023/12/1.
//
#import "DownPDFFileVC.h"
@interface DownPDFFileVC ()
@end
@implementation DownPDFFileVC
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
}
/*
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/
@end
@@ -0,0 +1,25 @@
//
// HQBaseNavigationController.h
// healthQuestion
//
// Created by xulei on 2022/8/12.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface HQBaseNavigationController : UINavigationController
/*!
* 返回到指定的类视图
*
* @param ClassName 类名
* @param animated 是否动画
*/
-(BOOL)popToAppointViewController:(NSString *)ClassName animated:(BOOL)animated;
@end
NS_ASSUME_NONNULL_END
@@ -0,0 +1,305 @@
//
// HQBaseNavigationController.m
// healthQuestion
//
// Created by xulei on 2022/8/12.
//
#import "HQBaseNavigationController.h"
#import "XYTransitionProtocol.h"
#import "XYTransition.h"
@interface HQBaseNavigationController ()<UINavigationControllerDelegate,UIGestureRecognizerDelegate>
@property (nonatomic, weak) id popDelegate;
@property (nonatomic,strong) UIPercentDrivenInteractiveTransition *interactivePopTransition;
@property (nonatomic,strong) UIScreenEdgePanGestureRecognizer *popRecognizer;
@property(nonatomic,assign) BOOL isSystemSlidBack;//是否开启系统右滑返回
@end
@implementation HQBaseNavigationController
//APP生命周期中 只会执行一次
+ (void)initialize
{
//导航栏主题 title文字属性
UINavigationBar *navBar = [UINavigationBar appearance];
//导航栏背景图
[navBar setBackgroundImage:[UIImage imageNamed:@"navBackImg"] forBarMetrics:UIBarMetricsDefault];
[navBar setBarTintColor:UIColorHex(#21BEBD)];
[navBar setTintColor:UIColorHex(#21BEBD)];
[navBar setTitleTextAttributes:@{NSForegroundColorAttributeName :KWhiteColor, NSFontAttributeName :[UIFont systemFontOfSize:18 weight:UIFontWeightBold] }];
[navBar setBackgroundImage:[UIImage imageWithColor:UIColorHex(#21BEBD)] forBarPosition:UIBarPositionAny barMetrics:UIBarMetricsDefault];
if (@available(iOS 15.0,*) ) {
UINavigationBarAppearance *apperance = [[UINavigationBarAppearance alloc]init];
[apperance configureWithOpaqueBackground];// 重置背景和阴影颜色
apperance.backgroundColor = UIColorHex(#21BEBD);
apperance.backgroundEffect = nil;
// 去除导航栏阴影(如果不设置clear,导航栏底下会有一条阴影线)
apperance.shadowColor = [UIColor clearColor];
[apperance setShadowImage:[UIImage imageWithColor:[UIColor clearColor]]];
[apperance setTitleTextAttributes:@{NSForegroundColorAttributeName :KWhiteColor, NSFontAttributeName : [UIFont systemFontOfSize:18 weight:UIFontWeightBold]}];
[[UINavigationBar appearance]setStandardAppearance:apperance];
[[UINavigationBar appearance]setScrollEdgeAppearance:apperance];
}else{
[[UINavigationBar appearance] setTitleTextAttributes:@{NSForegroundColorAttributeName :KWhiteColor, NSFontAttributeName :[UIFont systemFontOfSize:18 weight:UIFontWeightBold]}];
[[UINavigationBar appearance] setBarTintColor:UIColorHex(#21BEBD)];
[[UINavigationBar appearance] setShadowImage:[UIImage imageWithColor:[UIColor clearColor]]];
}
[UITabBar appearance].translucent = NO;
}
- (void)viewDidLoad {
[super viewDidLoad];
self.popDelegate = self.interactivePopGestureRecognizer.delegate;
self.delegate = self;
//默认开启系统右划返回
self.interactivePopGestureRecognizer.enabled = YES;
self.interactivePopGestureRecognizer.delegate = self;
//只有在使用转场动画时,禁用系统手势,开启自定义右划手势
_popRecognizer = [[UIScreenEdgePanGestureRecognizer alloc] initWithTarget:self action:@selector(handleNavigationTransition:)];
//下面是全屏返回
// _popRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(handleNavigationTransition:)];
_popRecognizer.edges = UIRectEdgeLeft;
[_popRecognizer setEnabled:NO];
[self.view addGestureRecognizer:_popRecognizer];
}
//解决手势失效问题
- (void)navigationController:(UINavigationController *)navigationController didShowViewController:(UIViewController *)viewController animated:(BOOL)animated
{
if (_isSystemSlidBack) {
self.interactivePopGestureRecognizer.enabled = YES;
[_popRecognizer setEnabled:NO];
}else{
self.interactivePopGestureRecognizer.enabled = NO;
[_popRecognizer setEnabled:YES];
}
}
//根视图禁用右划返回
-(BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer{
return self.childViewControllers.count == 1 ? NO : YES;
}
//push时隐藏tabbar
- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated
{
if (self.viewControllers.count > 0) {
if ([viewController conformsToProtocol:@protocol(XYTransitionProtocol)] && [self isNeedTransition:viewController]) {
viewController.hidesBottomBarWhenPushed = NO;
}else{
viewController.hidesBottomBarWhenPushed = YES;
}
}
[super pushViewController:viewController animated:animated];
// 修改tabBra的frame
CGRect frame = self.tabBarController.tabBar.frame;
frame.origin.y = [UIScreen mainScreen].bounds.size.height - frame.size.height;
self.tabBarController.tabBar.frame = frame;
}
-(void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated{
if ([viewController isKindOfClass:[HQBaseViewController class]]) {
HQBaseViewController * vc = (HQBaseViewController *)viewController;
if (vc.isHidenNaviBar) {
vc.view.top = 0;
[vc.navigationController setNavigationBarHidden:YES animated:animated];
}else{
vc.view.top = kTopHeight;
[vc.navigationController setNavigationBarHidden:NO animated:animated];
}
}
}
/**
* 返回到指定的类视图
*
* @param ClassName 类名
* @param animated 是否动画
*/
-(BOOL)popToAppointViewController:(NSString *)ClassName animated:(BOOL)animated
{
id vc = [self getCurrentViewControllerClass:ClassName];
if(vc != nil && [vc isKindOfClass:[UIViewController class]])
{
[self popToViewController:vc animated:animated];
return YES;
}
return NO;
}
/*!
* 获得当前导航器显示的视图
*
* @param ClassName 要获取的视图的名称
*
* @return 成功返回对应的对象,失败返回nil;
*/
-(instancetype)getCurrentViewControllerClass:(NSString *)ClassName
{
Class classObj = NSClassFromString(ClassName);
NSArray * szArray = self.viewControllers;
for (id vc in szArray) {
if([vc isMemberOfClass:classObj])
{
return vc;
}
}
return nil;
}
-(UIViewController *)childViewControllerForStatusBarStyle{
return self.topViewController;
}
#pragma mark ————— 转场动画区 —————
//navigation切换是会走这个代理
-(id<UIViewControllerAnimatedTransitioning>)navigationController:(UINavigationController *)navigationController animationControllerForOperation:(UINavigationControllerOperation)operation fromViewController:(UIViewController *)fromVC toViewController:(UIViewController *)toVC
{
NSLog(@"转场动画代理方法");
self.isSystemSlidBack = YES;
//如果来源VC和目标VC都实现协议,那么都做动画
if ([fromVC conformsToProtocol:@protocol(XYTransitionProtocol)] && [toVC conformsToProtocol:@protocol(XYTransitionProtocol)]) {
BOOL pinterestNedd = [self isNeedTransition:fromVC:toVC];
XYTransition *transion = [XYTransition new];
if (operation == UINavigationControllerOperationPush && pinterestNedd) {
transion.isPush = YES;
//暂时屏蔽带动画的右划返回
self.isSystemSlidBack = NO;
// self.isSystemSlidBack = YES;
}
else if(operation == UINavigationControllerOperationPop && pinterestNedd)
{
//暂时屏蔽带动画的右划返回
// return nil;
transion.isPush = NO;
self.isSystemSlidBack = NO;
}
else{
return nil;
}
return transion;
}else if([toVC conformsToProtocol:@protocol(XYTransitionProtocol)]){
//如果只有目标VC开启动画,那么isSystemSlidBack也要随之改变
BOOL pinterestNedd = [self isNeedTransition:toVC];
self.isSystemSlidBack = !pinterestNedd;
return nil;
}
return nil;
}
//判断fromVC和toVC是否需要实现pinterest效果
-(BOOL)isNeedTransition:(UIViewController<XYTransitionProtocol> *)fromVC :(UIViewController<XYTransitionProtocol> *)toVC
{
BOOL a = NO;
BOOL b = NO;
if ([fromVC respondsToSelector:@selector(isNeedTransition)] && [fromVC isNeedTransition]) {
a = YES;
}
if ([toVC respondsToSelector:@selector(isNeedTransition)] && [toVC isNeedTransition]) {
b = YES;
}
return (a && b) ;
}
//判断fromVC和toVC是否需要实现pinterest效果
-(BOOL)isNeedTransition:(UIViewController<XYTransitionProtocol> *)toVC
{
BOOL b = NO;
if ([toVC respondsToSelector:@selector(isNeedTransition)] && [toVC isNeedTransition]) {
b = YES;
}
return b;
}
#pragma mark -- NavitionContollerDelegate
- (id<UIViewControllerInteractiveTransitioning>)navigationController:(UINavigationController *)navigationController
interactionControllerForAnimationController:(id<UIViewControllerAnimatedTransitioning>)animationController
{
if (!self.interactivePopTransition) { return nil; }
return self.interactivePopTransition;
}
#pragma mark UIGestureRecognizer handlers
- (void)handleNavigationTransition:(UIScreenEdgePanGestureRecognizer*)recognizer
{
CGFloat progress = [recognizer translationInView:self.view].x / (self.view.bounds.size.width);
// progress = MIN(1.0, MAX(0.0, progress));
NSLog(@"右划progress %.2f",progress);
if (recognizer.state == UIGestureRecognizerStateBegan) {
self.interactivePopTransition = [[UIPercentDrivenInteractiveTransition alloc] init];
[self popViewControllerAnimated:YES];
}
else if (recognizer.state == UIGestureRecognizerStateChanged) {
[self.interactivePopTransition updateInteractiveTransition:progress];
}
else if (recognizer.state == UIGestureRecognizerStateEnded || recognizer.state == UIGestureRecognizerStateCancelled) {
CGPoint velocity = [recognizer velocityInView:recognizer.view];
if (progress > 0.5 || velocity.x >100) {
[self.interactivePopTransition finishInteractiveTransition];
}
else {
[self.interactivePopTransition cancelInteractiveTransition];
}
self.interactivePopTransition = nil;
}
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
/*
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/
@end
@@ -0,0 +1,25 @@
//
// HQBaseTabBarController.h
// healthQuestion
//
// Created by xulei on 2022/8/12.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface HQBaseTabBarController : UITabBarController
/**
设置小红点
@param index tabbar下标
@param isShow 是显示还是隐藏
*/
-(void)setRedDotWithIndex:(NSInteger)index isShow:(BOOL)isShow isNumber:(NSInteger)number;
@property (nonatomic, assign)NSInteger lastSelectIndex;
@end
NS_ASSUME_NONNULL_END
@@ -0,0 +1,157 @@
//
// HQBaseTabBarController.m
// healthQuestion
//
// Created by xulei on 2022/8/12.
//
#import "HQBaseTabBarController.h"
#import "HQTabBar.h"
#import "MyCenterViewController.h"
#import "ChatListViewController.h"
//主控制器
#import "QuestionViewController.h"
#import "MyCenterViewController.h"
#import "SosCenterViewController.h"
#import "HeartBadViewController.h"
//干预二期
@interface HQBaseTabBarController ()<UITabBarControllerDelegate>
@property (nonatomic,strong) NSMutableArray * VCS;//tabbar root VC
@property (nonatomic, assign) BOOL isConnecting;
@property (nonatomic, strong) UIActivityIndicatorView *indicatorView;
@property (nonatomic, copy) NSDictionary * dictionary;
@property (nonatomic, assign) BOOL isPushed;
@end
@implementation HQBaseTabBarController
- (void)viewDidLoad {
[super viewDidLoad];
self.delegate = self;
//初始化tabbar
[self setUpTabBar];
//添加子控制器
[self setUpAllChildViewController];
}
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
self.isPushed = NO;
}
- (void)viewWillDisappear:(BOOL)animated {
self.isPushed = YES;
}
#pragma mark ————— 初始化TabBar —————
-(void)setUpTabBar{
//设置背景色 去掉分割线
[self setValue:[HQTabBar new] forKey:@"tabBar"];
[self.tabBar setBackgroundColor:[UIColor whiteColor]];
[self.tabBar setBackgroundImage:[UIImage new]];
//通过这两个参数来调整badge位置
// [self.tabBar setTabIconWidth:95];
// [self.tabBar setBadgeTop:9];
[[HQTabBar appearance] setTranslucent:NO];
}
#pragma mark -——————— 初始化VC ————————
-(void)setUpAllChildViewController{
_VCS = @[].mutableCopy;
QuestionViewController * questionVC = [[QuestionViewController alloc]init];
[self setupChildViewController:questionVC title:@"咨询" imageName:@"Question_normal_icon" seleceImageName:@"Question_selected_icon"];
SosCenterViewController * sosVC = [[SosCenterViewController alloc]init];
[self setupChildViewController:sosVC title:@"就医" imageName:@"Question_normal_icon" seleceImageName:@"Question_selected_icon"];
HeartBadViewController * jianceVC = [[HeartBadViewController alloc]init];
[self setupChildViewController:jianceVC title:@"监测" imageName:@"Question_normal_icon" seleceImageName:@"Question_selected_icon"];
MyCenterViewController * centerVC = [[MyCenterViewController alloc] init];
[self setupChildViewController:centerVC title:@"我的" imageName:@"mine_normal" seleceImageName:@"mine_selected"];
self.viewControllers = _VCS;
}
-(void)setupChildViewController:(UIViewController*)controller title:(NSString *)title imageName:(NSString *)imageName seleceImageName:(NSString *)selectImageName{
controller.title = title;
controller.tabBarItem.title = title;//跟上面一样效果
controller.tabBarItem.image = [[UIImage imageNamed:imageName] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
controller.tabBarItem.selectedImage = [[UIImage imageNamed:selectImageName] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
//未选中字体颜色
[controller.tabBarItem setTitleTextAttributes:@{NSForegroundColorAttributeName:UIColorHex(#666666),NSFontAttributeName:SYSTEMFONT(10.0f)} forState:UIControlStateNormal];
//选中字体颜色
[controller.tabBarItem setTitleTextAttributes:@{NSForegroundColorAttributeName:UIColorHex(#21BEBD),NSFontAttributeName:SYSTEMFONT(10.0f)} forState:UIControlStateSelected];
//包装导航控制器
HQBaseNavigationController *nav = [[HQBaseNavigationController alloc]initWithRootViewController:controller];
[_VCS addObject:nav];
}
-(void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController
{
// tabbarSelect = [NSString stringWithFormat:@"%ld",tabBarController.selectedIndex];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (void)dealloc {
}
#pragma mark - auto rotate
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation {
return [self.selectedViewController preferredInterfaceOrientationForPresentation];
}
- (BOOL)shouldAutorotate {
return [self.selectedViewController shouldAutorotate];
}
- (UIInterfaceOrientationMask)supportedInterfaceOrientations {
return [self.selectedViewController supportedInterfaceOrientations];
}
/*
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/
@end
@@ -0,0 +1,91 @@
//
// HQBaseViewController.h
// healthQuestion
//
// Created by xulei on 2022/8/11.
//
#import <UIKit/UIKit.h>
#import "MBProgressHUD.h"
NS_ASSUME_NONNULL_BEGIN
@interface HQBaseViewController : UIViewController
/**
* 修改状态栏颜色
*/
@property (nonatomic, assign) UIStatusBarStyle StatusBarStyle;
/**
* 是否显示返回按钮,默认情况是YES
*/
@property (nonatomic, assign) BOOL isShowLiftBack;
/**
是否隐藏导航栏
*/
@property (nonatomic, assign) BOOL isHidenNaviBar;
/**
是否需要登录
*/
@property (nonatomic, assign) BOOL isNeedLogin;
/**
导航栏添加文本按钮
@param titles 文本数组
@param isLeft 是否是左边 非左即右
@param target 目标
@param action 点击方法
@param tags tags数组 回调区分用
*/
- (void)addNavigationItemWithTitles:(NSArray *)titles isLeft:(BOOL)isLeft target:(id)target action:(SEL)action tags:(NSArray *)tags;
/**
导航栏添加图标按钮
@param imageNames 图标数组
@param isLeft 是否是左边 非左即右
@param target 目标
@param action 点击方法
@param tags tags数组 回调区分用
*/
- (void)addNavigationItemWithImageNames:(NSArray *)imageNames isLeft:(BOOL)isLeft target:(id)target action:(SEL)action tags:(NSArray *)tags;
/**
* 展示轮型加载器
*
* @param string 展示的内容
* @param hidden yes自动隐藏 no不隐藏
*/
- (void)showMBProgressHUDWithString:(NSString *)string autoHidden:(BOOL)hidden;
/**
* 展示提醒文字后1.5秒后消失
*
* @param string 展示信息
*/
- (void)showMBProgressHUDOnlyWithString:(NSString *)string;
- (void)showMBProgressHUDOnlyWithString:(NSString *)string autoHidden:(BOOL)hidden;
- (void)showMBProgressHUDOnlyWithString:(NSString *)string haveDelegate:(BOOL)haveDelegate;
- (void)hudWasHidden:(MBProgressHUD *)hud; //代理方法
/**
* 展示提醒 有详情字符串
*
* @param string 简述
* @param detailString 详情
*/
- (void)showMBProgressHUDWithString:(NSString *)string detailString:(NSString *)detailString;
/**
* 隐藏提醒框
*/
- (void)hiddenAllMBProgressHUD;
@end
NS_ASSUME_NONNULL_END
@@ -0,0 +1,255 @@
//
// HQBaseViewController.m
// healthQuestion
//
// Created by xulei on 2022/8/11.
//
#import "HQBaseViewController.h"
#import "HQLoginViewController.h"
@interface HQBaseViewController ()<MBProgressHUDDelegate>
@end
@implementation HQBaseViewController
- (UIStatusBarStyle)preferredStatusBarStyle{
return _StatusBarStyle;
}
//动态更新状态栏颜色
-(void)setStatusBarStyle:(UIStatusBarStyle)StatusBarStyle{
_StatusBarStyle=StatusBarStyle;
[self setNeedsStatusBarAppearanceUpdate];
}
//
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
//是否显示返回按钮
self.isShowLiftBack = YES;
//是否需要登录/默认no
//默认导航栏样式:黑字
self.StatusBarStyle = UIStatusBarStyleLightContent;
}
/**
* 是否显示返回按钮
*/
- (void) setIsShowLiftBack:(BOOL)isShowLiftBack
{
_isShowLiftBack = isShowLiftBack;
NSInteger VCCount = self.navigationController.viewControllers.count;
//下面判断的意义是 当VC所在的导航控制器中的VC个数大于1 或者 是present出来的VC时,才展示返回按钮,其他情况不展示
if (isShowLiftBack && ( VCCount > 1 || self.navigationController.presentingViewController != nil)) {
[self addNavigationItemWithImageNames:@[@"whiteBack_icon"] isLeft:YES target:self action:@selector(backBtnClicked) tags:nil];
} else {
self.navigationItem.hidesBackButton = YES;
UIBarButtonItem * NULLBar=[[UIBarButtonItem alloc]initWithCustomView:[UIView new]];
self.navigationItem.leftBarButtonItem = NULLBar;
}
}
- (void)backBtnClicked
{
if (self.presentingViewController) {
[self dismissViewControllerAnimated:YES completion:nil];
}else{
[self.navigationController popViewControllerAnimated:YES];
}
}
#pragma mark ————— 导航栏 添加图片按钮 —————
/**
导航栏添加图标按钮
@param imageNames 图标数组
@param isLeft 是否是左边 非左即右
@param target 目标
@param action 点击方法
@param tags tags数组 回调区分用
*/
- (void)addNavigationItemWithImageNames:(NSArray *)imageNames isLeft:(BOOL)isLeft target:(id)target action:(SEL)action tags:(NSArray *)tags
{
NSMutableArray * items = [[NSMutableArray alloc] init];
//调整按钮位置
// UIBarButtonItem* spaceItem = [[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:nil action:nil];
// //将宽度设为负值
// spaceItem.width= -5;
// [items addObject:spaceItem];
NSInteger i = 0;
for (NSString * imageName in imageNames) {
UIButton * btn = [UIButton buttonWithType:UIButtonTypeCustom];
[btn setImage:[UIImage imageNamed:imageName] forState:UIControlStateNormal];
btn.frame = CGRectMake(0, 0, 30, 30);
[btn addTarget:target action:action forControlEvents:UIControlEventTouchUpInside];
btn.tag = [tags[i++] integerValue];
UIBarButtonItem * item = [[UIBarButtonItem alloc] initWithCustomView:btn];
[items addObject:item];
}
if (isLeft) {
self.navigationItem.leftBarButtonItems = items;
} else {
self.navigationItem.rightBarButtonItems = items;
}
}
#pragma mark ————— 导航栏 添加文字按钮 —————
- (NSMutableArray<UIButton *> *)addNavigationItemWithTitles:(NSArray *)titles isLeft:(BOOL)isLeft target:(id)target action:(SEL)action tags:(NSArray *)tags
{
NSMutableArray * items = [[NSMutableArray alloc] init];
NSMutableArray * buttonArray = [NSMutableArray array];
NSInteger i = 0;
for (NSString * title in titles) {
UIButton * btn = [UIButton buttonWithType:UIButtonTypeCustom];
btn.frame = CGRectMake(0, 0, 30, 30);
[btn setTitle:title forState:UIControlStateNormal];
[btn setTitleColor:KWhiteColor forState:UIControlStateNormal];
[btn addTarget:target action:action forControlEvents:UIControlEventTouchUpInside];
btn.titleLabel.font = SYSTEMFONT(15);
btn.tag = [tags[i++] integerValue];
[btn sizeToFit];
//设置偏移
if (isLeft) {
[btn setContentEdgeInsets:UIEdgeInsetsMake(0, -10, 0, 10)];
}else{
[btn setContentEdgeInsets:UIEdgeInsetsMake(0, 10, 0, -10)];
}
UIBarButtonItem * item = [[UIBarButtonItem alloc] initWithCustomView:btn];
[items addObject:item];
[buttonArray addObject:btn];
}
if (isLeft) {
self.navigationItem.leftBarButtonItems = items;
} else {
self.navigationItem.rightBarButtonItems = items;
}
return buttonArray;
}
#pragma mark - 屏幕旋转
-(UIInterfaceOrientationMask)supportedInterfaceOrientations
{
//当前支持的旋转类型
return UIInterfaceOrientationMaskPortrait;
}
- (BOOL)shouldAutorotate
{
// 是否支持旋转
return NO;
}
-(UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
// 默认进去类型
return UIInterfaceOrientationPortrait;
}
#pragma mark - ProgressHUD
/**
* 展示轮型加载器
*
* @param string 展示的内容
* @param hidden yes自动隐藏 no不隐藏
*/
- (void)showMBProgressHUDWithString:(NSString *)string autoHidden:(BOOL)hidden
{
MBProgressHUD *HUD = [MBProgressHUD showHUDAddedTo:kApplication.keyWindow animated:YES];
HUD.backgroundColor = RGBA(0, 0, 0, 0.5);
if (string != nil && ![string isEqualToString:@""])
{
HUD.label.text = string;
}
if (hidden)
{
[HUD hideAnimated:YES afterDelay:2];
}
}
/**
* 展示提醒文字后1.5秒后消失
*
* @param string 展示信息
*/
- (void)showMBProgressHUDOnlyWithString:(NSString *)string
{
[self showMBProgressHUDOnlyWithString:string haveDelegate:NO];
}
- (void)showMBProgressHUDOnlyWithString:(NSString *)string haveDelegate:(BOOL)haveDelegate
{
MBProgressHUD *HUD = [MBProgressHUD showHUDAddedTo:self.view animated:YES];
HUD.mode = MBProgressHUDModeText;//only show label
if (!ValidStr(string)) {
HUD.label.text = string;
}
HUD.label.textColor = KWhiteColor;
HUD.bezelView.style = MBProgressHUDBackgroundStyleSolidColor;
HUD.bezelView.color = UIColor.blackColor;
HUD.userInteractionEnabled = NO;
if (haveDelegate)
{
HUD.delegate = self;
}
[HUD hideAnimated:YES afterDelay:3];
}
- (void)showMBProgressHUDOnlyWithString:(NSString *)string autoHidden:(BOOL)hidden
{
MBProgressHUD *HUD = [MBProgressHUD showHUDAddedTo:kApplication.keyWindow animated:YES];
HUD.mode = MBProgressHUDModeText;//only show label
HUD.label.text = string;
if (hidden)
{
[HUD hideAnimated:YES afterDelay:1.5];
}
}
- (void)showMBProgressHUDWithString:(NSString *)string detailString:(NSString *)detailString
{
MBProgressHUD *HUD = [MBProgressHUD showHUDAddedTo:self.view animated:YES];
HUD.mode = MBProgressHUDModeText;
HUD.label.text = string;
HUD.detailsLabel.text = detailString;
[HUD hideAnimated:YES afterDelay:1.5];
}
- (void)hiddenAllMBProgressHUD
{
[MBProgressHUD hideHUDForView:kApplication.keyWindow animated:YES];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
/*
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/
@end
@@ -0,0 +1,13 @@
//
// HQTabBar.h
// idleBuy
//
// Created by ios on 2018/5/29.
// Copyright © 2018年 ios. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface HQTabBar : UITabBar
@end
@@ -0,0 +1,60 @@
//
// HQTabBar.m
// idleBuy
//
// Created by ios on 2018/5/29.
// Copyright © 2018年 ios. All rights reserved.
//
#import "HQTabBar.h"
@interface HQTabBar()
@property (nonatomic,assign)UIEdgeInsets oldSafeAreaInsets;
@end
@implementation HQTabBar
- (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
// 设置tabBarItem选中状态时的颜色
self.tintColor = UIColorHex(#21BEBD);
}
return self;
}
- (void) safeAreaInsetsDidChange
{
[super safeAreaInsetsDidChange];
if(self.oldSafeAreaInsets.left != self.safeAreaInsets.left ||
self.oldSafeAreaInsets.right != self.safeAreaInsets.right ||
self.oldSafeAreaInsets.top != self.safeAreaInsets.top ||
self.oldSafeAreaInsets.bottom != self.safeAreaInsets.bottom)
{
self.oldSafeAreaInsets = self.safeAreaInsets;
[self invalidateIntrinsicContentSize];
[self.superview setNeedsLayout];
[self.superview layoutSubviews];
}
}
- (CGSize) sizeThatFits:(CGSize) size
{
CGSize s = [super sizeThatFits:size];
if(@available(iOS 11.0, *))
{
CGFloat bottomInset = self.safeAreaInsets.bottom;
if( bottomInset > 0 && s.height < 50) {
s.height += bottomInset;
}
}
return s;
}
@end
@@ -0,0 +1,32 @@
//
// UITabBar+CustomBadge.h
// idleBuy
//
// Created by ios on 2018/5/29.
// Copyright © 2018年 ios. All rights reserved.
//
#import <UIKit/UIKit.h>
typedef NS_ENUM(NSUInteger, CustomBadgeType){
kCustomBadgeStyleRedDot,
kCustomBadgeStyleNumber,
kCustomBadgeStyleNone
};
@interface UITabBar (CustomBadge)
/**
*设置tab上icon的宽度,用于调整badge的位置
*/
- (void)setTabIconWidth:(CGFloat)width;
/**
*设置badge的top
*/
- (void)setBadgeTop:(CGFloat)top;
/**
*设置badge样、数字
*/
- (void)setBadgeStyle:(CustomBadgeType)type value:(NSInteger)badgeValue atIndex:(NSInteger)index;
@end
@@ -0,0 +1,115 @@
//
// UITabBar+CustomBadge.m
// idleBuy
//
// Created by ios on 2018/5/29.
// Copyright © 2018年 ios. All rights reserved.
//
#import "UITabBar+CustomBadge.h"
#import <objc/runtime.h>
static NSString * const kBadgeViewInitedKey = @"kBadgeViewInited";
static NSString * const kBadgeDotViewsKey = @"kBadgeDotViewsKey";
static NSString * const kBadgeNumberViewsKey = @"kBadgeNumberViewsKey";
static NSString * const kTabIconWidth = @"kTabIconWidth";
static NSString * const kBadgeTop = @"kBadgeTop";
@implementation UITabBar (CustomBadge)
-(void)setTabIconWidth:(CGFloat)width{
[self setValue:@(width) forUndefinedKey:kTabIconWidth];
}
-(void)setBadgeTop:(CGFloat)top{
[self setValue:@(top) forUndefinedKey:kBadgeTop];
}
-(void)setBadgeStyle:(CustomBadgeType)type value:(NSInteger)badgeValue atIndex:(NSInteger)index{
if( ![[self valueForKey:kBadgeViewInitedKey] boolValue] ){
[self setValue:@(YES) forKey:kBadgeViewInitedKey];
[self addBadgeViews];
}
NSMutableArray *badgeDotViews = [self valueForKey:kBadgeDotViewsKey];
NSMutableArray *badgeNumberViews = [self valueForKey:kBadgeNumberViewsKey];
[badgeDotViews[index] setHidden:YES];
[badgeNumberViews[index] setHidden:YES];
if(type == kCustomBadgeStyleRedDot){
[badgeDotViews[index] setHidden:NO];
}else if(type == kCustomBadgeStyleNumber){
[badgeNumberViews[index] setHidden:NO];
UILabel *label = badgeNumberViews[index];
[self adjustBadgeNumberViewWithLabel:label number:badgeValue];
}else if(type == kCustomBadgeStyleNone){
}
}
-(void)addBadgeViews{
id idIconWith = [self valueForKey:kTabIconWidth];
CGFloat tabIconWidth = idIconWith ? [idIconWith floatValue] : 32;
id idBadgeTop = [self valueForKey:kBadgeTop];
CGFloat badgeTop = idBadgeTop ? [idBadgeTop floatValue] : 11;
NSInteger itemsCount = self.items.count;
CGFloat itemWidth = self.bounds.size.width / itemsCount;
//dot views
NSMutableArray *badgeDotViews = [NSMutableArray new];
for(int i = 0;i < itemsCount;i ++){
UIView *redDot = [UIView new];
redDot.bounds = CGRectMake(0, 0, 10, 10);
redDot.center = CGPointMake(itemWidth*(i+0.5)+tabIconWidth/2, badgeTop);
redDot.layer.cornerRadius = redDot.bounds.size.width/2;
redDot.clipsToBounds = YES;
redDot.backgroundColor = [UIColor redColor];
redDot.hidden = YES;
[self addSubview:redDot];
[badgeDotViews addObject:redDot];
}
[self setValue:badgeDotViews forKey:kBadgeDotViewsKey];
//number views
NSMutableArray *badgeNumberViews = [NSMutableArray new];
for(int i = 0;i < itemsCount;i ++){
UILabel *redNum = [UILabel new];
redNum.layer.anchorPoint = CGPointMake(0, 0.5);
redNum.bounds = CGRectMake(0, 0, 20, 14);
redNum.center = CGPointMake(itemWidth*(i+0.5)+tabIconWidth/2-10, badgeTop);
redNum.layer.cornerRadius = redNum.bounds.size.height/2;
redNum.clipsToBounds = YES;
redNum.backgroundColor = [UIColor redColor];
redNum.hidden = YES;
redNum.textAlignment = NSTextAlignmentCenter;
redNum.font = [UIFont systemFontOfSize:12];
redNum.textColor = [UIColor whiteColor];
[self addSubview:redNum];
[badgeNumberViews addObject:redNum];
}
[self setValue:badgeNumberViews forKey:kBadgeNumberViewsKey];
}
-(void)adjustBadgeNumberViewWithLabel:(UILabel *)label number:(NSInteger)number{
[label setText:(number > 99 ? @"..." : @(number).stringValue)];
if(number < 10){
label.bounds = CGRectMake(0, 0, 14, 14);
}else if(number < 99){
label.bounds = CGRectMake(0, 0, 20, 14);
}else{
label.bounds = CGRectMake(0, 0, 20, 14);
}
}
-(id)valueForUndefinedKey:(NSString *)key{
return objc_getAssociatedObject(self, (__bridge const void *)(key));
}
-(void)setValue:(id)value forUndefinedKey:(NSString *)key{
objc_setAssociatedObject(self, (__bridge const void *)(key), value, OBJC_ASSOCIATION_COPY);
}
@end
@@ -0,0 +1,26 @@
//
// CustomSystemEvaluateModel.h
// EscortProject
//
// Created by Apple on 2024/6/19.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface CustomSystemEvaluateModel : NSObject
@property (nonatomic, copy) NSString * title;
@property (nonatomic, copy) NSString * content;
@property (nonatomic, assign) NSInteger type;
@property (nonatomic, assign) CGFloat systemHeight;
//CGFloat textMaxWidth = 245.f;
@end
NS_ASSUME_NONNULL_END
@@ -0,0 +1,12 @@
//
// CustomSystemEvaluateModel.m
// EscortProject
//
// Created by Apple on 2024/6/19.
//
#import "CustomSystemEvaluateModel.h"
@implementation CustomSystemEvaluateModel
@end
@@ -0,0 +1,42 @@
//
// CustomTUIHistoryModel.h
// EscortProject
//
// Created by Apple on 2024/6/21.
//
#import <Foundation/Foundation.h>
typedef NS_ENUM(NSUInteger, MessageType) {
MessageTypeText,
MessageTypeImage,
MessageTypeVideo,
MessageTypeReviceCustom,//评论消息
MessageTypeMapCustom,//地图消息
MessageTypeDoctorCard,//医生名片
MessageTypeHealthData,//健康档案
};
NS_ASSUME_NONNULL_BEGIN
@interface CustomTUIHistoryModel : NSObject
@property (nonatomic, assign) BOOL isSelf;
@property (nonatomic, copy) NSString * avatar;//头像
@property (nonatomic, copy) NSString * content;
@property (nonatomic, strong) NSString * image;
//视频
@property (nonatomic, copy) NSString * VideoUrl;
@property (nonatomic, copy) NSString * ThumbUrl;
@property (nonatomic, assign) CGFloat videoHeight;
@property (nonatomic, assign) NSString * customData;
@property (nonatomic, assign) CGFloat textHeight;
//评论
@property (nonatomic, copy) NSString * title;
@property (nonatomic, assign) CGFloat systemHeight;
@property (nonatomic, assign) MessageType msgType;
@end
NS_ASSUME_NONNULL_END
@@ -0,0 +1,12 @@
//
// CustomTUIHistoryModel.m
// EscortProject
//
// Created by Apple on 2024/6/21.
//
#import "CustomTUIHistoryModel.h"
@implementation CustomTUIHistoryModel
@end
@@ -0,0 +1,24 @@
//
// CustomTextModel.h
// EscortProject
//
// Created by Apple on 2024/6/19.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface CustomTextModel : NSObject
@property (nonatomic, copy) NSString * text;
@property (nonatomic, copy) NSString * imageHeard;
@property (nonatomic, assign) BOOL isSelf;
@property (nonatomic, assign) CGFloat textHeight;
//CGFloat textMaxWidth = 245.f;
@end
NS_ASSUME_NONNULL_END
@@ -0,0 +1,12 @@
//
// CustomTextModel.m
// EscortProject
//
// Created by Apple on 2024/6/19.
//
#import "CustomTextModel.h"
@implementation CustomTextModel
@end
@@ -0,0 +1,60 @@
//
// CustomTUIModel.h
// EscortProject
//
// Created by Apple on 2024/6/17.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface DataContent : NSObject
@property (nonatomic, copy) NSString *businessID;
@property (nonatomic, copy) NSString *title;
@property (nonatomic, assign) NSInteger type;
@property (nonatomic, copy) NSString *content;
@end
@interface MsgContent : NSObject
@property (nonatomic, copy) NSString *Text; //文本消息
@property (nonatomic, strong) DataContent *Data; //自定义消息
@property (nonatomic, strong) NSString *ThumbUrl; //缩略图
@property (nonatomic, strong) NSString * VideoUrl; //缩略图
@end
@interface MsgBody : NSObject
@property (nonatomic, strong) MsgContent *MsgContent;
@property (nonatomic, copy) NSString *MsgType;
@end
@interface CustomTUIModel : NSObject
@property (nonatomic, assign) BOOL isSelf;
@property (nonatomic, assign) NSInteger OnlineOnlyFlag;
@property (nonatomic, copy) NSString *CallbackCommand;
@property (nonatomic, strong) NSArray<MsgBody *> *MsgBody;
@property (nonatomic, copy) NSString *Operator_Account;
@property (nonatomic, copy) NSString *GroupId;
@property (nonatomic, copy) NSString *Type;
@property (nonatomic, assign) NSInteger Random;
@property (nonatomic, assign) NSInteger EventTime;
@property (nonatomic, copy) NSString *MsgPriority;
@property (nonatomic, assign) NSInteger MsgSeq;
@property (nonatomic, copy) NSString *From_Account;
@property (nonatomic, assign) NSInteger MsgTime;
@end
NS_ASSUME_NONNULL_END
@@ -0,0 +1,53 @@
//
// CustomTUIModel.m
// EscortProject
//
// Created by Apple on 2024/6/17.
//
#import "CustomTUIModel.h"
@implementation DataContent
@end
@implementation MsgBody
@end
@implementation MsgContent
+ (NSDictionary *)modelCustomPropertyMapper {
return @{
@"Data" : @"Data"
};
}
- (BOOL)modelCustomTransformFromDictionary:(NSDictionary *)dic {
if ([dic.allKeys containsObject:@"Data"]) {
NSString *dataString = dic[@"Data"];
NSData *data = [dataString dataUsingEncoding:NSUTF8StringEncoding];
NSDictionary *dataDict = [NSJSONSerialization JSONObjectWithData:data options:0 error:nil];
self.Data = [DataContent modelWithDictionary:dataDict];
}
return YES;
}
@end
@implementation CustomTUIModel
+ (NSDictionary *)modelContainerPropertyGenericClass {
return @{
@"MsgBody" : [MsgBody class],
};
}
@end
@@ -0,0 +1,18 @@
//
// CustomTUIBaseMessageController.h
// EscortProject
//
// Created by Apple on 2024/6/12.
//
#import "TUIBaseMessageController.h"
NS_ASSUME_NONNULL_BEGIN
@interface CustomTUIBaseMessageController : HQBaseViewController
@property(nonatomic, strong) NSString * groupID;
@end
NS_ASSUME_NONNULL_END
@@ -0,0 +1,244 @@
//
// CustomTUIBaseMessageController.m
// EscortProject
//
// Created by Apple on 2024/6/12.
//
#import "CustomTUIBaseMessageController.h"
#import "TUIChatDataProvider.h"
#import "TUIChatPopMenu.h"
#import "TUIFaceMessageCell.h"
#import "TUIFaceView.h"
#import "TUIFileMessageCell.h"
#import "TUIFileViewController.h"
#import "TUIImageMessageCell.h"
#import "TUIJoinGroupMessageCell.h"
#import "TUILinkCell.h"
#import "TUIMediaView.h"
#import "TUIMergeMessageCell.h"
#import "TUIMergeMessageListController.h"
#import "TUIMessageDataProvider.h"
#import "TUIMessageProgressManager.h"
#import "TUIMessageReadViewController.h"
#import "TUIOrderCell.h"
#import "TUIReferenceMessageCell.h"
#import "TUIRepliesDetailViewController.h"
#import "TUIReplyMessageCell.h"
#import "TUIReplyMessageCellData.h"
#import "TUITextMessageCell.h"
#import "TUIVideoMessageCell.h"
#import "TUIVoiceMessageCell.h"
#import "CustomMapMessageCell.h"
#import "CustomTUIModel.h"
//自定义模型
#import "CustomTextModel.h"
#import "CustomSystemEvaluateModel.h"
#import "CustomTUIHistoryModel.h"
#import "CustomTUIHistoryTable.h"
@interface CustomTUIBaseMessageController ()
@property(nonatomic, strong) CustomTUIHistoryTable * homeTable;
@property (nonatomic, strong) NSMutableArray * dataArray;
@end
@implementation CustomTUIBaseMessageController
- (NSMutableArray *)dataArray {
if (!_dataArray) {
_dataArray = [[NSMutableArray alloc] init];
}
return _dataArray;
}
- (void)viewDidLoad {
[super viewDidLoad];
self.isHidenNaviBar = false;
//获取历史记录
[self createUI];
self.navigationItem.title = @"聊天记录";
[self getHistoryData];
}
- (void)createUI {
self.homeTable = [[CustomTUIHistoryTable alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, kScreenHeight - kTopHeight) style:UITableViewStyleGrouped];
[self.view addSubview:self.homeTable];
}
- (void)getHistoryData {
//http:192.168.1.28/health-consultation/api/consult/conSession/selectImMessagePageListSession?groupId=1801087415104962560&pageNo=1&pageSize=10
NSMutableDictionary * parmDic = [[NSMutableDictionary alloc] init];
[parmDic setObject:self.groupID forKey:@"groupId"];
JKCQAPI * agreeAPI = [[JKCQAPI alloc] init:self tag:@"HISTORYAPI" NeedToken:@""];
[agreeAPI GetAllHistoryChatRecord:nil];
// NSDictionary * responDic = @{@"OnlineOnlyFlag":@"0",
// @"CallbackCommand":@"Group.CallbackAfterSendMsg",
// @"CloudCustomData":@"",
// @"MsgBody":@[@{@"MsgContent":@{@"Text":@"您好,欢迎咨询,请输入您的问题?"},
// @"MsgType":@"TIMTextElem"}],
// @"Operator_Account":@"administrator",
// @"GroupId":@"1800813149574791168",
// @"Type":@"Public",
// @"Random":@(4294967295),
// @"EventTime":@(1718182290636),
// @"MsgPriority":@"High",
// @"MsgSeq":@(1),
// @"From_Account":@"1684154499493081089",
// @"MsgTime":@(1718182290)};
//
}
- (void)Failed:(NSString*)message tag:(NSString*)tag
{
[EasyTextView showErrorText:message];
[self hiddenAllMBProgressHUD];
}
- (void)Sucess:(id)response tag:(NSString*)tag
{
if ([tag isEqualToString:@"HISTORYAPI"]) {
//解析模型
NSDictionary * responDic = response;
CustomTUIModel * model = [CustomTUIModel modelWithDictionary:responDic];
//用户信息
HQUserInfo * user = [HQCommonUtils keyedUnarchiverWithKey:LoginUserInfo];
if ([user.user_id isEqualToString:model.From_Account]) {
model.isSelf = true;
}else
{
model.isSelf = false;
}
for (MsgBody *msgBody in model.MsgBody) {
NSLog(@"MsgType: %@", msgBody.MsgType);
NSLog(@"MsgContent Data - title: %@", msgBody.MsgContent.Text);
if([msgBody.MsgType isEqualToString:@"TIMTextElem"]) //文本消息
{
CustomTUIHistoryModel * textModel = [[CustomTUIHistoryModel alloc] init];
textModel.content = msgBody.MsgContent.Text;
textModel.isSelf = model.isSelf;
//计算文本高度 宽度245
CGSize size = [self calculateTextSize:textModel.content withFont:[UIFont systemFontOfSize:13]];
textModel.textHeight = size.height;
textModel.msgType = MessageTypeText;
[self.dataArray addObject:textModel];
}
if([msgBody.MsgType isEqualToString:@"TIMVideoFileElem"]) //视频消息
{
CustomTUIHistoryModel * textModel = [[CustomTUIHistoryModel alloc] init];
textModel.content = msgBody.MsgContent.Text;
textModel.isSelf = model.isSelf;
textModel.ThumbUrl = msgBody.MsgContent.ThumbUrl;
textModel.VideoUrl = msgBody.MsgContent.VideoUrl;
textModel.videoHeight = 245;
//计算文本高度 宽度245
CGSize size = [self calculateTextSize:textModel.content withFont:[UIFont systemFontOfSize:13]];
textModel.textHeight = size.height;
textModel.msgType = MessageTypeText;
[self.dataArray addObject:textModel];
}
if([msgBody.MsgType isEqualToString:@"TIMCustomElem"]) //自定义消息
{
if ( [msgBody.MsgContent.Data.businessID isEqualToString:@"system"])//自定义评论
{
UILabel * commanLabel = [[UILabel alloc] init];
CGFloat h = [HQCommonUtils getSpaceLabelHeight:commanLabel withStr:msgBody.MsgContent.Data.content withFont:[UIFont systemFontOfSize:14] withWidth:245 - 28 withLineSpacing:2];
CGFloat textMaxWidth = 245.f;
CGFloat textMaxHeight = h + 100;
CustomTUIHistoryModel * systemModel = [[CustomTUIHistoryModel alloc] init];
systemModel.title = msgBody.MsgContent.Data.title;
systemModel.content = msgBody.MsgContent.Data.content;
//计算文本高度 宽度245
CGSize size = [self calculateTextSize:systemModel.content withFont:[UIFont systemFontOfSize:13]];
systemModel.systemHeight = size.height;
systemModel.textHeight = MessageTypeReviceCustom;
[self.dataArray addObject:systemModel];
}
}
if([msgBody.MsgType isEqualToString:@"TIMCustomElem"]) //自定义消息
{
if ( [msgBody.MsgContent.Data.businessID isEqualToString:@"system"])//自定义评论
{
UILabel * commanLabel = [[UILabel alloc] init];
CGFloat h = [HQCommonUtils getSpaceLabelHeight:commanLabel withStr:msgBody.MsgContent.Data.content withFont:[UIFont systemFontOfSize:14] withWidth:245 - 28 withLineSpacing:2];
CGFloat textMaxWidth = 245.f;
CGFloat textMaxHeight = h + 100;
CustomSystemEvaluateModel * systemModel = [[CustomSystemEvaluateModel alloc] init];
systemModel.title = msgBody.MsgContent.Data.title;
systemModel.content = msgBody.MsgContent.Data.content;
//计算文本高度 宽度245
CGSize size = [self calculateTextSize:systemModel.content withFont:[UIFont systemFontOfSize:13]];
systemModel.systemHeight = size.height;
[self.dataArray addObject:systemModel];
}
}
}
//自己造一个文本model
self.homeTable.dataArray = self.dataArray;
}
}
- (CGSize)calculateTextSize:(NSString *)text withFont:(UIFont *)font {
// 限制宽度为245
CGFloat maxWidth = 245.0;
CGFloat verticalPadding = 20.0; // 上下各10点边距
// 创建限制尺寸
CGSize maxSize = CGSizeMake(maxWidth, CGFLOAT_MAX);
// 设置文本属性
NSDictionary *attributes = @{NSFontAttributeName: font};
// 计算文本矩形
CGRect textRect = [text boundingRectWithSize:maxSize
options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading
attributes:attributes
context:nil];
// 返回计算出的尺寸,并加上上下边距
return CGSizeMake(textRect.size.width, textRect.size.height + verticalPadding);
}
@end
@@ -0,0 +1,18 @@
//
// CustomTUIHistoryTable.h
// EscortProject
//
// Created by Apple on 2024/6/14.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface CustomTUIHistoryTable : UITableView
@property (nonatomic, strong) NSArray * dataArray;
@end
NS_ASSUME_NONNULL_END
@@ -0,0 +1,164 @@
//
// CustomTUIHistoryTable.m
// EscortProject
//
// Created by Apple on 2024/6/14.
//
#import "CustomTUIHistoryTable.h"
#import "CustomMapMessageCell.h"
#import "CustomSystemTextCell.h"
#import "CustomSystemImageCell.h"
#import "CustomHealthFileVideoCell.h"
#import "CustomAudioCell.h"
#import "CustomHealthReportVideoCell.h"
#import "CustomReviceTableViewCell.h"
#import "CustomTUIHistoryModel.h"
#import "CustomDoctorIDTableViewCell.h"
@interface CustomTUIHistoryTable()<UITableViewDelegate,UITableViewDataSource>
@end
@implementation CustomTUIHistoryTable
- (instancetype)initWithFrame:(CGRect)frame style:(UITableViewStyle)style {
if (self = [super initWithFrame:frame style:style]) {
[self createUI];
}
return self;
}
- (void)createUI {
if ([[UIDevice currentDevice].systemVersion floatValue] >= 11) {
self.estimatedRowHeight = 0;
self.estimatedSectionFooterHeight = 0;
self.estimatedSectionHeaderHeight = 0;
self.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
}
self.delegate = self;
self.dataSource = self;
self.separatorStyle = UITableViewCellSeparatorStyleNone;
self.showsVerticalScrollIndicator = NO;
self.estimatedRowHeight = 60;
self.rowHeight = UITableViewAutomaticDimension;
}
- (void)setDataArray:(NSArray *)dataArray {
_dataArray = dataArray;
[self reloadData];
}
#pragma mark - tableview的代理方法
//组数
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 1;
}
//每组多少行
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return self.dataArray.count;
}
//注册cell
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
CustomTUIHistoryModel * model = self.dataArray[indexPath.row];
if (model.msgType == MessageTypeText) // 文本消息
{
CustomSystemTextCell * textCell = [[CustomSystemTextCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"TEXTCELLID"];
textCell.model = model;
textCell.backgroundColor = KClearColor;
return textCell;
}
if (model.msgType == MessageTypeImage) // 图文消息
{
CustomSystemImageCell * iamgeCell = [[CustomSystemImageCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"IMAGECELLID"];
return iamgeCell;
}
if (model.msgType == MessageTypeVideo) // 视频消息
{
CustomSystemImageCell * iamgeCell = [[CustomSystemImageCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"IMAGECELLID"];
return iamgeCell;
}
if (model.msgType == MessageTypeMapCustom) // 地图消息
{
CustomMapMessageCell * mapCell = [[CustomMapMessageCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"MAPCELLID"];
return mapCell;
}
if (model.msgType == MessageTypeReviceCustom) // 评论消息
{
CustomReviceTableViewCell * reviceCell = [[CustomReviceTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"REVICECELLID"];
return reviceCell;
}
if (model.msgType == MessageTypeDoctorCard) // 文本消息
{
CustomDoctorIDTableViewCell * reviceCell = [[CustomDoctorIDTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"REVICECELLID"];
return reviceCell;
}
if (model.msgType == MessageTypeHealthData) // 健康档案
{
}
return UITableViewCell.new;
}
////每行高度
//- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
//{
//
// return 40;
//}
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section {
return CGFLOAT_MIN;
}
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
return CGFLOAT_MIN;
}
//组头 --- 组尾
- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section {
return [UIView new];
}
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
return [UIView new];
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
}
@end
@@ -0,0 +1,16 @@
//
// CustomAudioCell.h
// EscortProject
//
// Created by Apple on 2024/6/14.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface CustomAudioCell : UITableViewCell
@end
NS_ASSUME_NONNULL_END
@@ -0,0 +1,23 @@
//
// CustomAudioCell.m
// EscortProject
//
// Created by Apple on 2024/6/14.
//
#import "CustomAudioCell.h"
@implementation CustomAudioCell
- (void)awakeFromNib {
[super awakeFromNib];
// Initialization code
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
@end
@@ -0,0 +1,16 @@
//
// CustomDoctorIDTableViewCell.h
// EscortProject
//
// Created by Apple on 2024/7/5.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface CustomDoctorIDTableViewCell : UITableViewCell
@end
NS_ASSUME_NONNULL_END
@@ -0,0 +1,23 @@
//
// CustomDoctorIDTableViewCell.m
// EscortProject
//
// Created by Apple on 2024/7/5.
//
#import "CustomDoctorIDTableViewCell.h"
@implementation CustomDoctorIDTableViewCell
- (void)awakeFromNib {
[super awakeFromNib];
// Initialization code
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
@end
@@ -0,0 +1,16 @@
//
// CustomHealthFileVideoCell.h
// EscortProject
//
// Created by Apple on 2024/6/14.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface CustomHealthFileVideoCell : UITableViewCell
@end
NS_ASSUME_NONNULL_END
@@ -0,0 +1,23 @@
//
// CustomHealthFileVideoCell.m
// EscortProject
//
// Created by Apple on 2024/6/14.
//
#import "CustomHealthFileVideoCell.h"
@implementation CustomHealthFileVideoCell
- (void)awakeFromNib {
[super awakeFromNib];
// Initialization code
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
@end
@@ -0,0 +1,16 @@
//
// CustomHealthReportVideoCell.h
// EscortProject
//
// Created by Apple on 2024/6/14.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface CustomHealthReportVideoCell : UITableViewCell
@end
NS_ASSUME_NONNULL_END
@@ -0,0 +1,39 @@
//
// CustomHealthReportVideoCell.m
// EscortProject
//
// Created by Apple on 2024/6/14.
//
#import "CustomHealthReportVideoCell.h"
@implementation CustomHealthReportVideoCell
- (void)awakeFromNib {
[super awakeFromNib];
// Initialization code
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
if (self = [super initWithStyle:style
reuseIdentifier:reuseIdentifier]) {
[self createUI];
}
return self;
}
- (void)createUI {
}
@end
@@ -0,0 +1,17 @@
//
// CustomMapMessageCell.h
// EscortProject
//
// Created by Apple on 2024/6/12.
//
#import <TIMCommon/TUIBubbleMessageCell.h>
#import <TIMCommon/TUIMessageCell.h>
#import "CustomMapMessageCellData.h"
@interface CustomMapMessageCell : UITableViewCell
@end
@@ -0,0 +1,79 @@
//
// CustomMapMessageCell.m
// EscortProject
//
// Created by Apple on 2024/6/12.
//
#import "CustomMapMessageCell.h"
@interface CustomMapMessageCell ()
@property (nonatomic, strong) UIImageView * heardImage;
@property (nonatomic, strong) UILabel * connetLabel;
@end
@implementation CustomMapMessageCell
- (void)awakeFromNib {
[super awakeFromNib];
// Initialization code
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
[self createUI];
}
return self;
}
- (void)createUI {
self.heardImage = [[UIImageView alloc] init];
self.heardImage.backgroundColor = KRedColor;
[self.contentView addSubview:self.heardImage];
self.heardImage.layer.cornerRadius = 15;
self.heardImage.layer.masksToBounds = true;
[self.heardImage mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(@15);
make.top.mas_equalTo(@8);
make.height.width.mas_equalTo(@30);
}];
self.connetLabel = [[UILabel alloc] init];
self.connetLabel.backgroundColor = KRedColor;
[self.contentView addSubview:self.heardImage];
self.connetLabel.layer.cornerRadius = 10;
self.connetLabel.layer.masksToBounds = true;
self.connetLabel.numberOfLines = 0;
[self.connetLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self.heardImage.right).offset(8);
make.top.mas_equalTo(@10);
make.width.mas_equalTo(@245.0);
}];
[self.connetLabel setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisVertical];
}
@end
@@ -0,0 +1,16 @@
//
// CustomReviceTableViewCell.h
// EscortProject
//
// Created by Apple on 2024/7/5.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface CustomReviceTableViewCell : UITableViewCell
@end
NS_ASSUME_NONNULL_END
@@ -0,0 +1,23 @@
//
// CustomReviceTableViewCell.m
// EscortProject
//
// Created by Apple on 2024/7/5.
//
#import "CustomReviceTableViewCell.h"
@implementation CustomReviceTableViewCell
- (void)awakeFromNib {
[super awakeFromNib];
// Initialization code
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
@end
@@ -0,0 +1,19 @@
//
// CustomSystemImageCell.h
// EscortProject
//
// Created by Apple on 2024/6/14.
//
#import <UIKit/UIKit.h>
#import "CustomTUIHistoryModel.h"
NS_ASSUME_NONNULL_BEGIN
@interface CustomSystemImageCell : UITableViewCell
@property (nonatomic, strong) CustomTUIHistoryModel * model;
@end
NS_ASSUME_NONNULL_END

Some files were not shown because too many files have changed in this diff Show More