- 行程一级页面

- 创建行程UI   30%
This commit is contained in:
linshujie 2026-06-23 18:34:12 +08:00
parent 5fc06a11c2
commit 0a1c309ad1
58 changed files with 2320 additions and 73 deletions

View File

@ -46,6 +46,7 @@ target 'QuickLocation' do
pod 'SDCycleScrollView'
pod 'lottie-ios'
pod 'TagListView', '~> 1.0'
pod 'BRPickerView'
#第三方SDk
pod 'GYSDK' #个推一键登录

View File

@ -6,6 +6,16 @@ PODS:
- AMapFoundation-NO-IDFA (>= 1.9.0)
- AMapNavi-NO-IDFA (11.2.000):
- AMapFoundation-NO-IDFA (>= 1.9.0)
- BRPickerView (3.0.0):
- BRPickerView/Default (= 3.0.0)
- BRPickerView/Core (3.0.0)
- BRPickerView/DatePicker (3.0.0):
- BRPickerView/Core
- BRPickerView/Default (3.0.0):
- BRPickerView/DatePicker
- BRPickerView/TextPicker
- BRPickerView/TextPicker (3.0.0):
- BRPickerView/Core
- CocoaLumberjack/Core (3.9.1)
- CocoaLumberjack/Swift (3.9.1):
- CocoaLumberjack/Core
@ -178,6 +188,7 @@ DEPENDENCIES:
- AlipaySDK-iOS
- AMapLocation-NO-IDFA
- AMapNavi-NO-IDFA
- BRPickerView
- CocoaLumberjack/Swift
- CocoaMQTT
- GYSDK
@ -220,6 +231,7 @@ SPEC REPOS:
- AMapFoundation-NO-IDFA
- AMapLocation-NO-IDFA
- AMapNavi-NO-IDFA
- BRPickerView
- CocoaLumberjack
- CocoaMQTT
- Differentiator
@ -284,6 +296,7 @@ SPEC CHECKSUMS:
AMapFoundation-NO-IDFA: a2e3c895398d7ee757278e1a0a8f9359da4b146e
AMapLocation-NO-IDFA: 7cd8fc837ea41edfbf4d937cd20572e277b77d18
AMapNavi-NO-IDFA: d55b9b138c6e540f737c689975cae2c9dbd1026a
BRPickerView: cd2e0e3aa87af062bc7a1b6f78d3dfd5f04f04bb
CocoaLumberjack: e4ba3b414dfca8c1916c6303d37f63b3a95134c6
CocoaMQTT: 1e2fa493d57045d66fb1eba2bb5ffb8d77039c60
Differentiator: e8497ceab83c1b10ca233716d547b9af21b9344d
@ -334,6 +347,6 @@ SPEC CHECKSUMS:
YYImage: 1e1b62a9997399593e4b9c4ecfbbabbf1d3f3b54
ZXSDK: 786338c0a18e98e03eda00699c3bfd2700b97117
PODFILE CHECKSUM: 4d254b7f0c48f2a2100703f9ac600d5d826b586a
PODFILE CHECKSUM: 848cd9ba02b2f1c209ac9eef708dd2c43b005385
COCOAPODS: 1.16.2

View File

@ -195,6 +195,17 @@
30CCDE582FE39F8C00F5214A /* SOSView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 30CCDE572FE39F8C00F5214A /* SOSView.swift */; };
30CCDE5A2FE39F9D00F5214A /* SOSViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 30CCDE592FE39F9D00F5214A /* SOSViewController.swift */; };
30CCDE5C2FE3A1A800F5214A /* SOSPracticeView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 30CCDE5B2FE3A1A800F5214A /* SOSPracticeView.swift */; };
30D74AAB2FE8C7700050EB2C /* GPSSignalHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 30D74AAA2FE8C7700050EB2C /* GPSSignalHelper.swift */; };
30D74AAE2FEA13E00050EB2C /* ScheduleView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 30D74AAD2FEA13E00050EB2C /* ScheduleView.swift */; };
30D74AB02FEA13ED0050EB2C /* ScheduleVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 30D74AAF2FEA13ED0050EB2C /* ScheduleVC.swift */; };
30D74AB22FEA1D5D0050EB2C /* ScheduleViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 30D74AB12FEA1D5D0050EB2C /* ScheduleViewModel.swift */; };
30D74AB42FEA25B90050EB2C /* ViewedModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 30D74AB32FEA25B90050EB2C /* ViewedModel.swift */; };
30D74AB62FEA34FF0050EB2C /* ItineraryAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 30D74AB52FEA34FF0050EB2C /* ItineraryAPI.swift */; };
30D74AB82FEA36A50050EB2C /* ItineraryService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 30D74AB72FEA36A50050EB2C /* ItineraryService.swift */; };
30D74ABA2FEA37AD0050EB2C /* ScheduleModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 30D74AB92FEA37AD0050EB2C /* ScheduleModel.swift */; };
30D74ABD2FEA67EA0050EB2C /* CreateScheduleVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 30D74ABC2FEA67EA0050EB2C /* CreateScheduleVC.swift */; };
30D74ABF2FEA67F30050EB2C /* CreateScheduleView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 30D74ABE2FEA67F30050EB2C /* CreateScheduleView.swift */; };
30D74AC12FEA6EEF0050EB2C /* CreateSchedulePopView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 30D74AC02FEA6EEF0050EB2C /* CreateSchedulePopView.swift */; };
30D87CDB2FDFA9EE00E958FD /* MQTTService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 30D87CDA2FDFA9EE00E958FD /* MQTTService.swift */; };
30D87CDD2FDFF07500E958FD /* InteractionView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 30D87CDC2FDFF07500E958FD /* InteractionView.swift */; };
30D87CDF2FDFF1A100E958FD /* QuickMessageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 30D87CDE2FDFF1A100E958FD /* QuickMessageView.swift */; };
@ -441,6 +452,17 @@
30CCDE572FE39F8C00F5214A /* SOSView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SOSView.swift; sourceTree = "<group>"; };
30CCDE592FE39F9D00F5214A /* SOSViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SOSViewController.swift; sourceTree = "<group>"; };
30CCDE5B2FE3A1A800F5214A /* SOSPracticeView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SOSPracticeView.swift; sourceTree = "<group>"; };
30D74AAA2FE8C7700050EB2C /* GPSSignalHelper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GPSSignalHelper.swift; sourceTree = "<group>"; };
30D74AAD2FEA13E00050EB2C /* ScheduleView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ScheduleView.swift; sourceTree = "<group>"; };
30D74AAF2FEA13ED0050EB2C /* ScheduleVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ScheduleVC.swift; sourceTree = "<group>"; };
30D74AB12FEA1D5D0050EB2C /* ScheduleViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ScheduleViewModel.swift; sourceTree = "<group>"; };
30D74AB32FEA25B90050EB2C /* ViewedModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewedModel.swift; sourceTree = "<group>"; };
30D74AB52FEA34FF0050EB2C /* ItineraryAPI.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ItineraryAPI.swift; sourceTree = "<group>"; };
30D74AB72FEA36A50050EB2C /* ItineraryService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ItineraryService.swift; sourceTree = "<group>"; };
30D74AB92FEA37AD0050EB2C /* ScheduleModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ScheduleModel.swift; sourceTree = "<group>"; };
30D74ABC2FEA67EA0050EB2C /* CreateScheduleVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CreateScheduleVC.swift; sourceTree = "<group>"; };
30D74ABE2FEA67F30050EB2C /* CreateScheduleView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CreateScheduleView.swift; sourceTree = "<group>"; };
30D74AC02FEA6EEF0050EB2C /* CreateSchedulePopView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CreateSchedulePopView.swift; sourceTree = "<group>"; };
30D87CDA2FDFA9EE00E958FD /* MQTTService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MQTTService.swift; sourceTree = "<group>"; };
30D87CDC2FDFF07500E958FD /* InteractionView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InteractionView.swift; sourceTree = "<group>"; };
30D87CDE2FDFF1A100E958FD /* QuickMessageView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = QuickMessageView.swift; sourceTree = "<group>"; };
@ -497,21 +519,29 @@
/* Begin PBXFileSystemSynchronizedRootGroup section */
30CCDF8E2FE3E63B00F5214A /* sound */ = {
isa = PBXFileSystemSynchronizedRootGroup;
exceptions = (
);
path = sound;
sourceTree = "<group>";
};
30CCDF902FE3E63B00F5214A /* video */ = {
isa = PBXFileSystemSynchronizedRootGroup;
exceptions = (
);
path = video;
sourceTree = "<group>";
};
30CCE01E2FE3E64700F5214A /* lotties */ = {
isa = PBXFileSystemSynchronizedRootGroup;
exceptions = (
);
path = lotties;
sourceTree = "<group>";
};
30D87CEF2FDFF52100E958FD /* TTGTagCollectionView */ = {
isa = PBXFileSystemSynchronizedRootGroup;
exceptions = (
);
path = TTGTagCollectionView;
sourceTree = "<group>";
};
@ -551,6 +581,7 @@
305A74CF2FCA8C7000227D26 /* UserAPI.swift */,
30BAB8502FCD331C00C33B5C /* GroupAPI.swift */,
30D891F42FE22E0600E958FD /* OrderAPI.swift */,
30D74AB52FEA34FF0050EB2C /* ItineraryAPI.swift */,
);
path = API;
sourceTree = "<group>";
@ -950,6 +981,7 @@
305A762A2FCA8C7000227D26 /* Home */,
305A76352FCA8C7000227D26 /* Map */,
305A76262FCA8C7000227D26 /* Group */,
30D74AAC2FEA13BD0050EB2C /* Schedule */,
305A76392FCA8C7000227D26 /* Mine */,
305A798E2FCAC5F600227D26 /* InviteMember */,
3062E8C52FCFD01000CEF511 /* VipRecharge */,
@ -969,6 +1001,7 @@
305A763C2FCA8C7000227D26 /* UserService.swift */,
30BAB8522FCD337C00C33B5C /* GroupService.swift */,
30D891F62FE22E6E00E958FD /* OrderService.swift */,
30D74AB72FEA36A50050EB2C /* ItineraryService.swift */,
);
path = Service;
sourceTree = "<group>";
@ -995,6 +1028,7 @@
305A76452FCA8C7000227D26 /* Tool */ = {
isa = PBXGroup;
children = (
30D74AAA2FE8C7700050EB2C /* GPSSignalHelper.swift */,
305A76412FCA8C7000227D26 /* AutoLayout */,
305A76442FCA8C7000227D26 /* Router */,
);
@ -1241,6 +1275,29 @@
path = SOS;
sourceTree = "<group>";
};
30D74AAC2FEA13BD0050EB2C /* Schedule */ = {
isa = PBXGroup;
children = (
30D74AAF2FEA13ED0050EB2C /* ScheduleVC.swift */,
30D74AB12FEA1D5D0050EB2C /* ScheduleViewModel.swift */,
30D74AAD2FEA13E00050EB2C /* ScheduleView.swift */,
30D74AB32FEA25B90050EB2C /* ViewedModel.swift */,
30D74AB92FEA37AD0050EB2C /* ScheduleModel.swift */,
30D74ABB2FEA67CE0050EB2C /* CreateSchedule */,
);
path = Schedule;
sourceTree = "<group>";
};
30D74ABB2FEA67CE0050EB2C /* CreateSchedule */ = {
isa = PBXGroup;
children = (
30D74ABC2FEA67EA0050EB2C /* CreateScheduleVC.swift */,
30D74ABE2FEA67F30050EB2C /* CreateScheduleView.swift */,
30D74AC02FEA6EEF0050EB2C /* CreateSchedulePopView.swift */,
);
path = CreateSchedule;
sourceTree = "<group>";
};
30D87CD52FDF9F1900E958FD /* MQTT */ = {
isa = PBXGroup;
children = (
@ -1498,14 +1555,10 @@
inputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-QuickLocation/Pods-QuickLocation-frameworks-${CONFIGURATION}-input-files.xcfilelist",
);
inputPaths = (
);
name = "[CP] Embed Pods Frameworks";
outputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-QuickLocation/Pods-QuickLocation-frameworks-${CONFIGURATION}-output-files.xcfilelist",
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-QuickLocation/Pods-QuickLocation-frameworks.sh\"\n";
@ -1519,14 +1572,10 @@
inputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-QuickLocation/Pods-QuickLocation-resources-${CONFIGURATION}-input-files.xcfilelist",
);
inputPaths = (
);
name = "[CP] Copy Pods Resources";
outputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-QuickLocation/Pods-QuickLocation-resources-${CONFIGURATION}-output-files.xcfilelist",
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-QuickLocation/Pods-QuickLocation-resources.sh\"\n";
@ -1542,6 +1591,7 @@
305A76882FCA8C7000227D26 /* MoyaProvider+Rx.swift in Sources */,
305A76892FCA8C7000227D26 /* Observable+Response.swift in Sources */,
305A768A2FCA8C7000227D26 /* Single+Response.swift in Sources */,
30D74AB62FEA34FF0050EB2C /* ItineraryAPI.swift in Sources */,
305A768B2FCA8C7000227D26 /* API.swift in Sources */,
30EFF3AE2FD7FF1400EB35D4 /* TextInputViewController.swift in Sources */,
305A768C2FCA8C7000227D26 /* APIProvider.swift in Sources */,
@ -1585,6 +1635,7 @@
305A76A32FCA8C7000227D26 /* ControlEvents+Block.swift in Sources */,
3062E8B72FCE6BFE00CEF511 /* ScanView.swift in Sources */,
305A76A42FCA8C7000227D26 /* Date+Extension.swift in Sources */,
30D74AAE2FEA13E00050EB2C /* ScheduleView.swift in Sources */,
305A76A52FCA8C7000227D26 /* Dictionay+Extension.swift in Sources */,
305A76A62FCA8C7000227D26 /* Int+Extension.swift in Sources */,
30EFF3D62FDA8F0100EB35D4 /* EmergencyContactView.swift in Sources */,
@ -1597,6 +1648,7 @@
305A76AB2FCA8C7000227D26 /* ScaleType.swift in Sources */,
30EFF3E72FDAA93D00EB35D4 /* PrivacyPolicyView.swift in Sources */,
305A76AC2FCA8C7000227D26 /* String+Extension.swift in Sources */,
30D74AB82FEA36A50050EB2C /* ItineraryService.swift in Sources */,
30EFF3C62FDA433E00EB35D4 /* ChangePhoneView.swift in Sources */,
305A76AD2FCA8C7000227D26 /* UIApplicationExtension.swift in Sources */,
305A76AE2FCA8C7000227D26 /* UIButton+Extension.swift in Sources */,
@ -1636,6 +1688,7 @@
30C4C01D2FDBF557009215C1 /* RemoveMemberViewModel.swift in Sources */,
305A76C52FCA8C7000227D26 /* Account.swift in Sources */,
305A76C62FCA8C7000227D26 /* AppContextManager.swift in Sources */,
30D74ABD2FEA67EA0050EB2C /* CreateScheduleVC.swift in Sources */,
305A76C72FCA8C7000227D26 /* UserConfigModel.swift in Sources */,
305A76C82FCA8C7000227D26 /* UserConfigResponse.swift in Sources */,
305A76C92FCA8C7000227D26 /* ApiManager.swift in Sources */,
@ -1644,6 +1697,7 @@
30CCDE552FE2903100F5214A /* SignInModel.swift in Sources */,
305A76CC2FCA8C7000227D26 /* FileTools.swift in Sources */,
305A76CD2FCA8C7000227D26 /* Permission.swift in Sources */,
30D74AB02FEA13ED0050EB2C /* ScheduleVC.swift in Sources */,
305A76CE2FCA8C7000227D26 /* RouterManager.swift in Sources */,
3062E8C72FCFD02F00CEF511 /* VipRechargeView.swift in Sources */,
305A76CF2FCA8C7000227D26 /* CountDownService.swift in Sources */,
@ -1668,10 +1722,12 @@
305A76DE2FCA8C7000227D26 /* ObservableType+ObjectMapper.swift in Sources */,
305A76DF2FCA8C7000227D26 /* Single+ObjectMapper.swift in Sources */,
30DC18602FD12A020041DCD1 /* VipWaivePopView.swift in Sources */,
30D74AAB2FE8C7700050EB2C /* GPSSignalHelper.swift in Sources */,
305A76E02FCA8C7000227D26 /* GroupView.swift in Sources */,
30EFF3BB2FD90D7600EB35D4 /* ConfirmPopVC.swift in Sources */,
30BAB8512FCD331C00C33B5C /* GroupAPI.swift in Sources */,
305A76E12FCA8C7000227D26 /* GroupViewController.swift in Sources */,
30D74AB22FEA1D5D0050EB2C /* ScheduleViewModel.swift in Sources */,
30EFF3B52FD8F1D000EB35D4 /* ReviewMemberListVC.swift in Sources */,
30BAB84D2FCD2FDE00C33B5C /* InviteJoinView.swift in Sources */,
30EFF3CF2FDA669800EB35D4 /* MyProfileVC.swift in Sources */,
@ -1697,11 +1753,13 @@
305A76EA2FCA8C7000227D26 /* OneTapLoginView.swift in Sources */,
305A76EB2FCA8C7000227D26 /* CircleMember.swift in Sources */,
30CCDE5A2FE39F9D00F5214A /* SOSViewController.swift in Sources */,
30D74AB42FEA25B90050EB2C /* ViewedModel.swift in Sources */,
305A76EC2FCA8C7000227D26 /* MemberAnnotation.swift in Sources */,
305A76ED2FCA8C7000227D26 /* MemberAnnotationView.swift in Sources */,
30BAB8532FCD337C00C33B5C /* GroupService.swift in Sources */,
305A76EE2FCA8C7000227D26 /* MineView.swift in Sources */,
305A76EF2FCA8C7000227D26 /* MineViewController.swift in Sources */,
30D74ABF2FEA67F30050EB2C /* CreateScheduleView.swift in Sources */,
305A76F02FCA8C7000227D26 /* MineViewModel.swift in Sources */,
305A76F12FCA8C7000227D26 /* SystemService.swift in Sources */,
30DC18522FD009CD0041DCD1 /* VipExpenseModel.swift in Sources */,
@ -1740,6 +1798,7 @@
305A77072FCA8C7000227D26 /* Helper.swift in Sources */,
305A77082FCA8C7000227D26 /* PageCollectionViewFlowLayout.swift in Sources */,
3062E8C42FCFC90F00CEF511 /* CreateGroupVipPopView.swift in Sources */,
30D74ABA2FEA37AD0050EB2C /* ScheduleModel.swift in Sources */,
30CCDE512FE2785D00F5214A /* SignInVC.swift in Sources */,
305A77092FCA8C7000227D26 /* PageContentView.swift in Sources */,
305A770A2FCA8C7000227D26 /* PageStyle.swift in Sources */,
@ -1759,6 +1818,7 @@
3062E8BA2FCEAC6500CEF511 /* CreateGroupView.swift in Sources */,
30D891F72FE22E6E00E958FD /* OrderService.swift in Sources */,
305A77192FCA8C7000227D26 /* CollectionHFlowLayout.swift in Sources */,
30D74AC12FEA6EEF0050EB2C /* CreateSchedulePopView.swift in Sources */,
305A771A2FCA8C7000227D26 /* JJPageControl.swift in Sources */,
305A771B2FCA8C7000227D26 /* ReusableView.swift in Sources */,
305A771C2FCA8C7000227D26 /* AppDelegate.swift in Sources */,

View File

@ -0,0 +1,55 @@
//
// ItineraryAPI.swift
// QuickLocation
//
// Created by 八条 on 2026/6/23.
//
import Moya
import SwiftyUserDefaults
internal import Alamofire
/// 行程API
enum ItineraryAPI {
/// 查询行程
/// - Parameters:
/// - follow: 只查看关注的行程
/// - own: 只查看自己创建的行程
/// - history: true查看历史行程,默认查看今天之后的行程
/// - group_key: 过滤圈子查询
case query(follow: Bool, own: Bool, history: Bool, group_key: String, page: Int)
}
extension ItineraryAPI: MultiTargetProtocol {
var path: String {
switch self {
case .query:
return "mapi/itinerary/route"
}
}
var method: Moya.Method {
switch self {
case .query:
return .get
default:
return .post
}
}
var task: Moya.Task {
switch self {
case let .query(follow, own, history, group_key, page):
var params = Parameters()
params["follow"] = follow
params["own"] = own
params["history"] = history
params["group_key"] = group_key
params["page"] = page
params["limit"] = 20
return .requestParameters(parameters: params, encoding: URLEncoding())
}
}
}

View File

@ -20,6 +20,9 @@ enum SystemAPI {
/// 微信客服
case wechatService
/// SOS
case sos(enable: Bool)
}
extension SystemAPI: MultiTargetProtocol {
@ -32,6 +35,8 @@ extension SystemAPI: MultiTargetProtocol {
return "api/user/sms/code"
case .wechatService:
return "api/weixin/service"
case .sos:
return "mapi/sos/operate"
}
}
@ -39,7 +44,7 @@ extension SystemAPI: MultiTargetProtocol {
switch self {
case .userConfig, .wechatService:
return .get
case .sendCode:
case .sendCode, .sos:
return .post
}
}
@ -56,6 +61,12 @@ extension SystemAPI: MultiTargetProtocol {
case .wechatService:
return .requestParameters(parameters: parameters, encoding: URLEncoding())
case let .sos(enable):
var params = Parameters()
params["enable"] = enable
return .requestParameters(parameters: params, encoding: JSONEncoding())
}
}
}

View File

@ -60,6 +60,12 @@ enum UserAPI {
/// - group_key:频道的key
/// - emote_idx:表情符号的下标
case sendEmote(emoteIdx: Int, groupKey: String, targetUid: String)
/// 公告
case notice
/// 查看关注用户列表
case followList
}
extension UserAPI: MultiTargetProtocol {
@ -90,12 +96,16 @@ extension UserAPI: MultiTargetProtocol {
return "api/user/logout"
case .sendEmote:
return "mapi/user/sendemote"
case .notice:
return "api/user/notice"
case .followList:
return "mapi/user/followed"
}
}
var method: Moya.Method {
switch self {
case .userInfo, .signInInfo:
case .userInfo, .signInInfo, .notice, .followList:
return .get
case .changePhone, .setGender:
return .put
@ -167,6 +177,12 @@ extension UserAPI: MultiTargetProtocol {
params["group_key"] = groupKey
params["target_uid"] = targetUid
return .requestParameters(parameters: params, encoding: JSONEncoding())
case .notice:
return .requestParameters(parameters: Parameters(), encoding: URLEncoding())
case .followList:
return .requestParameters(parameters: Parameters(), encoding: URLEncoding())
}
}
}

View File

@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "Group_2309@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "Group_2309@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 846 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "x@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "x@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 566 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 711 B

View File

@ -0,0 +1,9 @@
{
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"provides-namespace" : true
}
}

View File

@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "Group_2267@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "Group_2267@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "Group_2250@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "Group_2250@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

View File

@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "Group_2308@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "Group_2308@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "Group_2264@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "Group_2264@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

@ -28,6 +28,8 @@ extension Notification.Name {
static let RefreshUserConfigNotification = Notification.Name("RefreshUserConfigNotification")
/// 刷新用户圈子数据
static let RefreshGroupInfoNotification = Notification.Name("RefreshGroupInfoNotification")
/// 刷新IM圈子列表数据
static let RefreshIMGroupListNotification = Notification.Name("RefreshIMGroupListNotification")
/// 支付宝/微信支付结果回调
static let RequestOrderPayStatusNotification = Notification.Name("RequestOrderPayStatusNotification")
}

View File

@ -9,7 +9,7 @@ final class MainTabBarController: UITabBarController {
// MARK: - View Controllers
private lazy var locationNav = BaseNavigationController(rootViewController: HomeViewController())
private lazy var exploreNav = BaseNavigationController(rootViewController: ViewController())
private lazy var exploreNav = BaseNavigationController(rootViewController: ScheduleVC())
private lazy var circlesNav = BaseNavigationController(rootViewController: GroupViewController())
private lazy var mineNav = BaseNavigationController(rootViewController: MineViewController())
@ -57,6 +57,14 @@ final class MainTabBarController: UITabBarController {
view.addSubview(customTabBar)
customTabBar.delegate = self
// 点击"探索"(index=1)时游客跳登录、不选中
customTabBar.shouldSelectTab = { index in
if index == 1, AppContextManager.shared.isGuest {
AppRouter.push(Route.login)
return false
}
return true
}
customTabBar.translatesAutoresizingMaskIntoConstraints = false
let tabBarHeight = customTabBar.intrinsicContentSize.height
@ -89,6 +97,11 @@ final class MainTabBarController: UITabBarController {
// MARK: - QuickLocationTabBarDelegate
extension MainTabBarController: QuickLocationTabBarDelegate {
func tabBar(_ tabBar: QuickLocationTabBar, didSelectTabAt index: Int) {
// 点击"探索"(index=1)时判断游客,是则跳登录、不选中
if index == 1, AppContextManager.shared.isGuest {
AppRouter.push(Route.login)
return
}
selectedIndex = index
}
}

View File

@ -40,6 +40,8 @@ final class QuickLocationTabBar: UIView {
// MARK: - Properties
weak var delegate: QuickLocationTabBarDelegate?
/// 返回 false 阻止选中(用于游客拦截等)
var shouldSelectTab: ((Int) -> Bool)?
private let items: [TabItem]
private var tabViews: [UIView] = []
@ -121,6 +123,7 @@ final class QuickLocationTabBar: UIView {
guard let view = gesture.view else { return }
let index = view.tag
guard index != selectedIndex else { return }
if shouldSelectTab?(index) == false { return }
selectedIndex = index
updateSelection(animated: true)
delegate?.tabBar(self, didSelectTabAt: index)

View File

@ -53,6 +53,8 @@ enum Route: String {
case privacyPolicy = "privacyPolicy"
/// 权限检测
case checkPermission = "checkPermission"
/// 创建行程
case createSchedule = "createSchedule"
}
extension Route: RouterTarget {
@ -257,6 +259,11 @@ extension AppRouter: AppRouterProtocol {
AppRouter.register(Route.checkPermission) { url, parameters in
CheckPermissionVC()
}
// MARK: - 创建行程
AppRouter.register(Route.createSchedule) { url, parameters in
CreateScheduleVC()
}
}
}

View File

@ -82,7 +82,7 @@ class CreateGroupViewModel {
"description": desc,
"labels": selectedTagList]).subscribe(onNext: { response in
DLToast.showSuccess(text: "创建成功") {
NotificationCenter.default.post(name: .RefreshGroupInfoNotification, object: nil)
NotificationCenter.default.post(name: .RefreshIMGroupListNotification, object: nil)
AppRouter.shared.popOrDismiss()
}
}, onError: { (error) in

View File

@ -406,7 +406,7 @@ final class GroupChatVC: BaseViewController {
}
guard let url = recordFileURL, recordDuration >= 1 else {
DLToast.show(text: "说话时间太短")
self.dl.show(text: "说话时间太短")
if let url = recordFileURL { try? FileManager.default.removeItem(at: url) }
return
}

View File

@ -39,10 +39,10 @@ class GroupInfoVC: BaseViewController {
// MARK: - API
private func requestOperateGroup() {
guard let model = groupInModel else { return }
DLToast.showLoading()
dl.showLoading()
GroupService.operate(opType: "join",
requestData: ["share_code" : model.share_code]).subscribe(onNext: { response in
DLToast.show(text: "申请成功")
self.dl.show(text: "申请成功")
}, onError: { (error) in }).disposed(by: disposeBag)
}

View File

@ -168,20 +168,20 @@ class GroupSettingVC: BaseViewController {
}
private func requestLeaveGroup() {
DLToast.showLoading()
dl.showLoading()
GroupService.leave(requestData: ["group_key": viewModel.groupId]).subscribe { response in
DLToast.dismiss()
DLToast.show(text: "成功退出") {
self.dl.dismiss()
self.dl.show(text: "成功退出") {
AppRouter.shared.popToRoot()
}
}.disposed(by: disposeBag)
}
private func requestDismissGroup() {
DLToast.showLoading()
dl.showLoading()
GroupService.dismiss(requestData: ["group_key": viewModel.groupId]).subscribe { response in
DLToast.dismiss()
DLToast.show(text: "成功解散") {
self.dl.dismiss()
self.dl.show(text: "成功解散") {
AppRouter.shared.popToRoot()
}
}.disposed(by: disposeBag)

View File

@ -141,6 +141,13 @@ final class GroupViewController: BaseViewController {
})
.disposed(by: disposeBag)
// MQTT join/leave/dismiss 后刷新群列表
NotificationCenter.default.rx.notification(.RefreshIMGroupListNotification)
.subscribe(onNext: { [weak self] _ in
self?.requestGroupInfo()
})
.disposed(by: disposeBag)
NotificationCenter.default.rx.notification(.RefreshUserConfigNotification)
.subscribe(onNext: { [weak self] _ in
self?.requestRecommandGroup()

View File

@ -30,6 +30,14 @@ class JoinGroupVC: BaseViewController {
rootView.submitBtn.rx.tap.subscribe(onNext: { _ in
self.requestOperateGroup()
}).disposed(by: disposeBag)
rootView.scanBtn.rx.tap.subscribe(onNext: { _ in
let vc = ScanVC { code in
self.rootView.textField.text = code
self.rootView.textField.resignFirstResponder()
}
AppRouter.push(vc)
}).disposed(by: disposeBag)
}
override func viewDidAppear(_ animated: Bool) {
@ -43,9 +51,9 @@ class JoinGroupVC: BaseViewController {
DLToast.show(text: "请填写完整的邀请码")
return
}
DLToast.showLoading()
dl.showLoading()
GroupService.operate(opType: "join", requestData: ["share_code" : rootView.inviteCode]).subscribe(onNext: { response in
DLToast.showSuccess(text: "申请成功") {
self.dl.showSuccess(text: "申请成功") {
AppRouter.shared.popOrDismiss()
}
}).disposed(by: disposeBag)

View File

@ -55,9 +55,7 @@ class JoinGroupView: UIView {
AppRouter.shared.popOrDismiss()
}).disposed(by: disposeBag)
scanBtn.rx.tap.subscribe(onNext: { _ in
AppRouter.push(Route.scan)
}).disposed(by: disposeBag)
}
private func setupUI() {

View File

@ -11,6 +11,7 @@ import RxCocoa
import Lottie
#if !targetEnvironment(simulator)
import AMapNaviKit
import MarqueeLabel
#endif
class HomeView: UIView {
@ -23,6 +24,16 @@ class HomeView: UIView {
let interactionView = InteractionView(frame: CGRectMake(0, kScreenHeight, kScreenWidth, 384))
var gpsSignalViewList: [UIView] = []
/// 根据信号格数更新信号条颜色
func updateGPSSignal(bars: Int) {
let filled = max(0, min(bars, gpsSignalViewList.count))
for (i, view) in gpsSignalViewList.enumerated() {
view.backgroundColor = i < filled ? UIColor(hexStr: "#4ED178") : UIColor(hexStr: "#E0E0E0")
}
}
// MARK: - groupMemberView 拖拽
private var groupMemberTopConstraint: NSLayoutConstraint?
private var groupMemberUpLimit: CGFloat = 0
@ -91,11 +102,7 @@ class HomeView: UIView {
}
})
.disposed(by: disposeBag)
// 收回互动view
quickMessageView.closeBtn.rx.tap.subscribe(onNext: { _ in
self.dismissMemberPanel()
}).disposed(by: disposeBag)
}
private func setupUI() {
@ -175,7 +182,7 @@ class HomeView: UIView {
.edgesHorzontal(15)
toolsView.layoutChain
.left(23)
.left(15)
.bottom(kScreenHeight / 2 - 58)
.width(40)
@ -279,6 +286,13 @@ class HomeView: UIView {
override func layoutSubviews() {
super.layoutSubviews()
noticeView.layoutIfNeeded()
noticeInfoView.setGradientLayer(frame: noticeInfoView.bounds,
startPoint: CGPoint(x: 0, y: 0.5),
endPoint: CGPoint(x: 1, y: 0.5),
colors: [UIColor(hexStr: "#FFFFFF", alpha: 0), UIColor(hexStr: "#FFFFFF"), UIColor(hexStr: "#FFFFFF", alpha: 0)],
locations: [0, 0.5, 1])
if !isGroupMemberLimitsSet {
isGroupMemberLimitsSet = true
groupMemberDownLimit = groupMemberView.frame.minY
@ -438,25 +452,153 @@ class HomeView: UIView {
}()
lazy var messageStackView: UIStackView = {
let view = UIStackView(arrangedSubviews: [noticeView, messageBubbleView])
let view = UIStackView(arrangedSubviews: [tipsView, messageBubbleView])
view.axis = .vertical
view.alignment = .leading
view.spacing = 15
view.spacing = 5
view.backgroundColor = .clear
return view
}()
lazy var tipsView: UIView = {
let view = UIView()
view.backgroundColor = .clear
view.layoutChain.height(22)
view.addSubview(gpsSignalView)
gpsSignalView.layoutChain
.left()
.centerY()
view.addSubview(noticeView)
noticeView.layoutChain
.leftToRightOfView(gpsSignalView, offset: 0)
.right(15)
.edgesVertical()
return view
}()
// MARK: - 卫星信号
lazy var gpsSignalView: UIView = {
let view = UIView()
view.cornerRadius = 5
view.backgroundColor = .black.withAlphaComponent(0.4)
let signalView1 = UIView()
signalView1.backgroundColor = UIColor(hexStr: "#E6E6E6")
view.addSubview(signalView1)
signalView1.layoutChain
.left(7)
.bottom(5)
.width(3)
.height(4)
let signalView2 = UIView()
signalView2.backgroundColor = UIColor(hexStr: "#E6E6E6")
view.addSubview(signalView2)
signalView2.layoutChain
.leftToRightOfView(signalView1, offset: 2)
.bottomToView(signalView1)
.width(3)
.height(6)
let signalView3 = UIView()
signalView3.backgroundColor = UIColor(hexStr: "#E6E6E6")
view.addSubview(signalView3)
signalView3.layoutChain
.leftToRightOfView(signalView2, offset: 2)
.bottomToView(signalView1)
.width(3)
.height(8)
let signalView4 = UIView()
signalView4.backgroundColor = UIColor(hexStr: "#E6E6E6")
view.addSubview(signalView4)
signalView4.layoutChain
.leftToRightOfView(signalView3, offset: 2)
.bottomToView(signalView1)
.width(3)
.height(10)
let label = UILabel()
label.text = "卫星信号"
label.font = .systemFont(ofSize: 10, weight: .medium)
label.textColor = .white
view.addSubview(label)
label.layoutChain
.leftToRightOfView(signalView4, offset: 2)
.edgesVertical(4)
.right(7)
gpsSignalViewList = [signalView1, signalView2, signalView3, signalView4]
return view
}()
// MARK: - 公告
lazy var noticeView: UIView = {
let view = UIView()
view.isHidden = true
view.backgroundColor = .clear
view.layoutChain
.height(22)
view.addSubview(noticeInfoView)
noticeInfoView.layoutChain
.left()
.right()
.edgesVertical()
view.addSubview(noticeCloseBtn)
noticeCloseBtn.layoutChain
.right()
.width(16)
.height(16)
.centerY()
return view
}()
lazy var noticeInfoView: UIView = {
let view = UIView()
view.backgroundColor = .clear
// let titleLab = UILabel()
// titleLab.text = "公告信息"
// titleLab.font = .systemFont(ofSize: 10, weight: .medium)
// titleLab.textColor = UIColor(hexStr: "#0F2948")
// view.addSubview(titleLab)
// titleLab.layoutChain
// .left(16)
// .centerY()
// .width(40)
view.addSubview(noticeLab)
noticeLab.layoutChain
.left(16)
.centerY()
.right(24)
return view
}()
lazy var noticeLab: CallbackMarqueeLabel = {
let label = CallbackMarqueeLabel()
label.font = .systemFont(ofSize: 10, weight: .medium)
label.textColor = UIColor(hexStr: "#0F2948")
return label
}()
lazy var noticeCloseBtn: UIButton = {
let btn = UIButton()
btn.setImage(UIImage(named: "Common/x_black"), for: .normal)
btn.backgroundColor = .white
btn.cornerRadius = 8
btn.extendEdgeInsets = UIEdgeInsets(top: 15, left: 15, bottom: 15, right: 15)
btn.rx.tap.subscribe(onNext: { [weak self] _ in
self?.noticeView.isHidden = true
}).disposed(by: disposeBag)
return btn
}()
// MARK: - 消息气泡
lazy var messageBubbleView: UIView = {
let view = UIView()
@ -654,3 +796,24 @@ extension HomeView: UIGestureRecognizerDelegate {
return true
}
}
// MARK: - CallbackMarqueeLabel
class CallbackMarqueeLabel: MarqueeLabel {
// 闭包回调对外抛出事件
var onScrollLoopComplete: (() -> Void)?
var onScrollStart: (() -> Void)?
// 滚动开始
override func labelWillBeginScroll() {
super.labelWillBeginScroll()
onScrollStart?()
}
// 单次滚动一圈完成
override func labelReturnedToHome(_ finished: Bool) {
super.labelReturnedToHome(finished)
// 只处理正常滚动结束,过滤中途重置
guard finished else { return }
onScrollLoopComplete?()
}
}

View File

@ -17,7 +17,7 @@ import SwiftyUserDefaults
import AMapNaviKit
import CocoaMQTT
import Lottie
import AVFAudio
import MarqueeLabel
#endif
class HomeViewController: BaseViewController {
@ -52,6 +52,8 @@ class HomeViewController: BaseViewController {
private var offlineCheckTimer: Timer?
private var sosPlayerKey: UInt8 = 0
private var groupRefreshWorkItem: DispatchWorkItem?
private var groupSwitchWorkItem: DispatchWorkItem?
override func loadView() {
#if !targetEnvironment(simulator)
@ -71,7 +73,7 @@ class HomeViewController: BaseViewController {
reactiveAction()
requestUserConfig()
rootView.quickMessageView.tagListView.delegate = self
// MQTT 位置上报
UIDevice.current.isBatteryMonitoringEnabled = true
@ -250,6 +252,8 @@ class HomeViewController: BaseViewController {
self.requestUserInfo { [weak self] in
self?.requestGroupInfo()
}
// 首页公告
self.requestNotice()
}).disposed(by: disposeBag)
}
@ -274,10 +278,13 @@ class HomeViewController: BaseViewController {
}.disposed(by: disposeBag)
}
private func requestGroupInfo() {
private func requestGroupInfo(isDefaultGroup: Bool=true) {
GroupService.groupInfo().subscribe { response in
guard let model = response.model else { return }
self.viewModel.groupModel = model
NotificationCenter.default.post(name: .RefreshIMGroupListNotification, object: nil)
guard isDefaultGroup else { return }
self.rootView.groupMemberView.setupCountData(self.viewModel.memberCount, 1)
self.rootView.groupNameLab.text = self.viewModel.groupName
self.syncMemberAnnotations(model.select_group_employee)
@ -291,6 +298,22 @@ class HomeViewController: BaseViewController {
}.disposed(by: disposeBag)
}
private func requestNotice() {
UserService.notice().subscribe { response in
self.rootView.noticeLab.text = ""
guard let data = response.data, let noticeList = data["notice"] as? [String] else { return }
self.rootView.noticeView.isHidden = noticeList.count == 0
self.rootView.noticeLab.text = noticeList.joined(separator: " ") + " "
if let loop = data["loop"] as? Bool {
self.rootView.noticeLab.type = loop ? .continuous : .leftRight
self.rootView.noticeLab.onScrollLoopComplete = {
guard loop == false else { return }
self.rootView.noticeView.isHidden = true
}
}
}.disposed(by: disposeBag)
}
// MARK: - Map Setup
private func setupMap() {
#if !targetEnvironment(simulator)
@ -423,6 +446,24 @@ class HomeViewController: BaseViewController {
// MARK: - MQTT
extension HomeViewController {
/// join/leave/dismiss 防抖刷新(500ms 内多次触发只调一次)
private func debounceGroupSwitch(groupKey: String) {
groupSwitchWorkItem?.cancel()
let work = DispatchWorkItem { [weak self] in
self?.requestOperateGroup(groupKey: groupKey)
}
groupSwitchWorkItem = work
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5, execute: work)
}
private func debounceGroupRefresh() {
groupRefreshWorkItem?.cancel()
let work = DispatchWorkItem { [weak self] in
self?.requestGroupInfo()
}
groupRefreshWorkItem = work
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5, execute: work)
}
/// 切换圈子时刷新 MQTT 订阅
private func refreshMQTTSubscriptions(_ members: [GroupMemberModel]) {
// let currentId = AppContextManager.shared.userId
@ -544,7 +585,10 @@ extension HomeViewController {
}
}
}
case "sos":
case "sos": // 求助
self.requestGroupInfo(isDefaultGroup: false)
guard let userId = msg.data?.user_id,
userId != AppContextManager.shared.userId else { return }
playSOSAlarm()
rootView.sosPopView.isHidden = false
rootView.sosPopView.play(toFrame: 30.0) { completed in
@ -552,6 +596,55 @@ extension HomeViewController {
self.rootView.sosPopView.stop()
self.rootView.sosPopView.isHidden = true
}
case "join": // 圈子有成员加入
guard let gk = msg.data?.group_key,
let defaultGk = self.viewModel.groupModel?.default_group_key,
gk == defaultGk else {
self.requestGroupInfo(isDefaultGroup: false)
return
}
debounceGroupRefresh()
case "leave": // 圈子有成员离开
guard let userId = msg.data?.user_id, let gk = msg.data?.group_key,
let defaultGk = self.viewModel.groupModel?.default_group_key,
defaultGk.hasPrefix(gk) else {
self.requestGroupInfo(isDefaultGroup: false)
return
}
// 是当前选中圈子就移除成员
if userId == AppContextManager.shared.userId { // 当前用户就切换到第一个圈子
guard let model = self.viewModel.groupModel,
let groupInfoModel = model.groups.first else { return }
if model.groups.count > 1 {
self.debounceGroupSwitch(groupKey: groupInfoModel.group_key)
}
else {
debounceGroupRefresh()
}
}
else { // 移除成员
guard self.viewModel.memberIsExist(userId: userId) else { return }
self.viewModel.removeMember(userId: userId)
self.removeAnnotation(userId: userId)
self.rootView.groupMemberView.setupCountData(self.viewModel.memberList.count, 1)
MQTTService.shared.unsubscribe(topic: "smartdrive/\(userId)")
}
case "dismiss": // 圈子解散
guard let gk = msg.data?.group_key,
let defaultGk = self.viewModel.groupModel?.default_group_key,
gk == defaultGk,
let model = self.viewModel.groupModel,
let groupInfoModel = model.groups.first else {
self.requestGroupInfo(isDefaultGroup: false)
return
}
if model.groups.count > 1 {
self.debounceGroupSwitch(groupKey: groupInfoModel.group_key)
}
else {
debounceGroupRefresh()
}
default:
print("📩 未处理 type=\(msg.type ?? "")")
}
@ -638,6 +731,12 @@ extension HomeViewController: MAMapViewDelegate {
func mapView(_ mapView: MAMapView!, didUpdate userLocation: MAUserLocation!, updatingLocation: Bool) {
guard updatingLocation, let location = userLocation.location else { return }
// 卫星信号
let strength = gpsSignalStrength(from: location)
rootView.updateGPSSignal(bars: strength.barCount)
// 地图标注
lastLocation = location
let coordinate = location.coordinate
guard CLLocationCoordinate2DIsValid(coordinate) else { return }
@ -662,6 +761,10 @@ extension HomeViewController {
}
private func playSOSAlarm() {
// 停止上一次报警
sosPlayer?.stop()
sosPlayer = nil
guard let url = Bundle.main.url(forResource: "sos", withExtension: "mp3") ?? Bundle.main.url(forResource: "sos", withExtension: "mp3", subdirectory: "sound") else {
print("❌ SOS: sos.mp3 not found in bundle")
return
@ -677,11 +780,11 @@ extension HomeViewController {
return
}
print("✅ SOS: playing alarm")
player.numberOfLoops = -1
player.numberOfLoops = 0
player.volume = 1.0
player.play()
self.sosPlayer = player
DispatchQueue.main.asyncAfter(deadline: .now() + 30) { [weak self] in
DispatchQueue.main.asyncAfter(deadline: .now() + 15) { [weak self] in
self?.sosPlayer?.stop()
self?.sosPlayer = nil
}

View File

@ -114,6 +114,19 @@ class HomeViewModel {
updated[idx].last_active_time = lastUpdateTime
memberList = updated // 触发 didSet → 排序 + 重发 sectionedItems
}
/// 成员是否存在
func memberIsExist(userId: String) -> Bool {
(memberList.first(where: { $0.user_id == userId }) != nil)
}
/// 移除成员
func removeMember(userId: String) {
guard let idx = memberList.firstIndex(where: { $0.user_id == userId }) else { return }
var updated = memberList
updated.remove(at: idx)
memberList = updated
}
// MARK: - Init
init() {

View File

@ -18,6 +18,8 @@ class SOSView: UIView {
var sosPracticeView: SOSPracticeView = SOSPracticeView()
var didSendSOS: ((Bool) -> Void)?
var countDownFinish: Bool = false
private func setupRx() {
@ -37,6 +39,9 @@ class SOSView: UIView {
self.countDownLottieView.play()
self.countDownTipsLab.text = "已将你的SOS和位置发送到你的圈子和紧急联系人。\n\n您的 SOS 将发送给5个人"
self.countDownFinish = true
if let didSendSOS = self.didSendSOS {
didSendSOS(true)
}
}
}
})
@ -57,7 +62,9 @@ class SOSView: UIView {
case .ended:
if self.sliderIcon.frame.minX >= maxX - 5 {
if countDownFinish {
if let didSendSOS = self.didSendSOS {
didSendSOS(false)
}
}
else {
self.countDownView.alpha = 0
@ -313,16 +320,6 @@ class SOSView: UIView {
let isHidden = Defaults[\.sosIsPracticeList].first(where: { $0 == AppContextManager.shared.userId }) != nil
sosPracticeView.isHidden = isHidden
guard AppContextManager.shared.status == 1 else { return }
countDownView.alpha = 1
countDownFinish = true
if let path = Bundle.main.path(forResource: "red-exclamation", ofType: "json") {
self.countDownLottieView.animation = LottieAnimation.filepath(path)
self.countDownLottieView.loopMode = .loop
self.countDownLottieView.play()
self.countDownTipsLab.text = "已将你的SOS和位置发送到你的圈子和紧急联系人。\n\n您的 SOS 将发送给5个人"
}
}
required init?(coder aDecoder: NSCoder) {

View File

@ -6,6 +6,8 @@
//
import UIKit
import RxSwift
import Lottie
class SOSViewController: BaseViewController {
@ -21,17 +23,37 @@ class SOSViewController: BaseViewController {
// Do any additional setup after loading the view.
fd_interactivePopDisabled = true
// requestUserInfo()
rootView.didSendSOS = { status in
self.requestSOS(status)
}
}
/*
// MARK: - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
// Get the new view controller using segue.destination.
// Pass the selected object to the new view controller.
private func requestUserInfo(completion: (() -> Void)? = nil) {
UserService.userInfo().subscribe { response in
guard let model = response.model else { return }
AppContextManager.shared.saveAccount(model)
guard model.status == 1 else { return }
self.rootView.countDownView.alpha = 1
self.rootView.countDownFinish = true
if let path = Bundle.main.path(forResource: "red-exclamation", ofType: "json") {
self.rootView.countDownLottieView.animation = LottieAnimation.filepath(path)
self.rootView.countDownLottieView.loopMode = .loop
self.rootView.countDownLottieView.play()
self.rootView.countDownTipsLab.text = "已将你的SOS和位置发送到你的圈子和紧急联系人。\n\n您的 SOS 将发送给5个人"
}
}.disposed(by: disposeBag)
}
private func requestSOS(_ enable: Bool) {
dl.showLoading()
SystemService.sos(enable: enable).subscribe(onNext: { response in
self.dl.show(text: enable ? "发送成功" : "取消成功") {
AppRouter.shared.popOrDismiss()
}
}, onError: { (error) in }).disposed(by: disposeBag)
}
*/
}

View File

@ -31,17 +31,17 @@ class SignInVC: BaseViewController {
requestSignInInfo()
rootView.signInLottieView.rx.tapGesture.subscribe(onNext: { [weak self] _ in
self?.dl.showLoading()
guard let self = self, let loc = self.lastLocation, isSignIn == false else { return }
DLToast.showLoading()
self.geocoder.reverseGeocodeLocation(loc) { [weak self] placemarks, error in
DLToast.dismiss()
self?.dl.dismiss()
guard let self = self else { return }
let address = placemarks?.first?.name
?? placemarks?.first?.thoroughfare
?? placemarks?.first?.locality
?? ""
MQTTService.shared.reportSignIn(lat: loc.coordinate.latitude, lon: loc.coordinate.longitude, addr: address)
DLToast.show(text: "签到成功") {
self.dl.show(text: "签到成功") {
self.requestSignInInfo()
}
}

View File

@ -20,6 +20,8 @@ class ScanVC: BaseViewController {
view = rootView
}
private let scanDoneAction: ((String) -> Void)?
private var captureSession: AVCaptureSession!
private var previewLayer: AVCaptureVideoPreviewLayer!
private var isScanning = false
@ -51,6 +53,15 @@ class ScanVC: BaseViewController {
}
rootView.scanLineView.layer.removeAllAnimations()
}
init(scanDoneAction: ((String) -> Void)? = nil) {
self.scanDoneAction = scanDoneAction
super.init(nibName: nil, bundle: nil)
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
private func handleScanResult(text: String) {
guard !isScanning else { return }
@ -58,15 +69,18 @@ class ScanVC: BaseViewController {
captureSession.stopRunning()
rootView.scanLineView.alpha = 0
rootView.scanLineView.layer.removeAllAnimations()
requestJoinGroup(code: text)
if let scanDoneAction = scanDoneAction {
scanDoneAction(text)
AppRouter.shared.popOrDismiss()
}
// requestJoinGroup(code: text)
}
// MARK: - API
private func requestJoinGroup(code: String) {
DLToast.showLoading()
dl.showLoading()
GroupService.operate(opType: "join", requestData: ["share_code" : code]).subscribe(onNext: { response in
DLToast.show(text: "申请成功") {
NotificationCenter.default.post(name: .RefreshGroupInfoNotification, object: nil)
self.dl.show(text: "申请成功") {
AppRouter.shared.popOrDismiss()
}
}, onError: { [weak self] (error) in

View File

@ -0,0 +1,447 @@
//
// CreateSchedulePopView.swift
// QuickLocation
//
// Created by 八条 on 2026/6/23.
//
import UIKit
import RxSwift
import RxCocoa
import RxDataSources
import BRPickerView
// MARK: - 行程点编辑模型
struct SchedulePointItem: IdentifiableType, Equatable {
let identity: String = UUID().uuidString
var locationName: String = ""
var address: String = ""
var expectedTime: Date?
var remark: String = ""
}
typealias SchedulePointSection = SectionModel<String, SchedulePointItem>
// MARK: - CreateSchedulePopView
class CreateSchedulePopView: UIView {
var disposeBag = DisposeBag()
let pointsRelay = BehaviorRelay<[SchedulePointItem]>(value: [SchedulePointItem()])
// MARK: - Setup
private func setupRx() {
dateLab.rx.tapGesture.subscribe { _ in
let picker = BRDatePickerView(pickerMode: .YMD)
picker.minDate = Date()
picker.maxDate = Calendar.current.date(byAdding: .day, value: 6, to: Date())
let style = BRPickerStyle()
style.selectRowTextColor = UIColor(hexStr: "#16B3FF")
picker.pickerStyle = style
picker.resultBlock = { [weak self] selectDate, value in
guard let date = selectDate else { return }
let fmt = DateFormatter()
fmt.dateFormat = "yyyy年MM月dd日"
self?.dateLab.text = fmt.string(from: date)
}
picker.show()
}.disposed(by: disposeBag)
// 新增行程点
addBtn.rx.tap
.subscribe(onNext: { [weak self] _ in
guard let self = self else { return }
var list = self.pointsRelay.value
list.append(SchedulePointItem(
locationName: "",
address: "",
expectedTime: nil,
remark: ""
))
self.pointsRelay.accept(list)
})
.disposed(by: disposeBag)
// 绑定 tableView
pointsRelay
.observe(on: MainScheduler.asyncInstance)
.map { [SchedulePointSection(model: "", items: $0)] }
.bind(to: tableView.rx.items(dataSource: dataSource))
.disposed(by: disposeBag)
// 动态更新 tableView 高度
pointsRelay
.subscribe(onNext: { [weak self] items in
guard let self = self else { return }
let rowHeight: CGFloat = 122
var h = CGFloat(items.count) * rowHeight
h = max(h, rowHeight)
self.tableView.layoutChain.height(h)
})
.disposed(by: disposeBag)
}
private lazy var dataSource: RxTableViewSectionedReloadDataSource<SchedulePointSection> = {
RxTableViewSectionedReloadDataSource<SchedulePointSection>(
configureCell: { [weak self] _, tv, indexPath, item in
let cell: SchedulePointCell = tv.dequeueReusableCell(for: indexPath)
cell.configure(item: item,
index: indexPath.row,
total: self?.pointsRelay.value.count ?? 0,
onDelete: { [weak self] in
guard let self = self else { return }
var list = self.pointsRelay.value
guard indexPath.row < list.count else { return }
list.remove(at: indexPath.row)
self.pointsRelay.accept(list)
})
return cell
})
}()
// MARK: - UI
private func setupUI() {
addSubview(lineView)
addSubview(dateView)
addSubview(detailView)
addSubview(scrollView)
lineView.layoutChain
.top(15)
.centerX()
.width(36)
.height(4)
dateView.layoutChain
.topToBottomOfView(lineView, offset: 19)
.edgesHorzontal()
.height(22)
detailView.layoutChain
.topToBottomOfView(dateView, offset: 20)
.edgesHorzontal()
.height(22)
scrollView.layoutChain
.topToBottomOfView(detailView, offset: 15)
.edges(excludingEdge: .top)
}
// MARK: - Views
lazy var lineView: UIView = {
let v = UIView()
v.backgroundColor = UIColor(hexStr: "#EBEBEB")
v.cornerRadius = 2
return v
}()
lazy var dateView: UIView = {
let view = UIView()
view.backgroundColor = .clear
let titleLab = UILabel()
titleLab.text = "行程日期:"
titleLab.font = .systemFont(ofSize: 14, weight: .medium)
titleLab.textColor = ThemeManager.shared.color.titleAuxColor
view.addSubview(titleLab)
titleLab.layoutChain.left(15).centerY()
view.addSubview(dateLab)
dateLab.layoutChain.leftToRightOfView(titleLab).centerY()
return view
}()
lazy var dateLab: UILabel = {
let label = UILabel()
label.font = .systemFont(ofSize: 14, weight: .medium)
label.textColor = UIColor(hexStr: "#16B3FF")
label.isUserInteractionEnabled = true
let fmt = DateFormatter()
fmt.dateFormat = "yyyy年MM月dd日"
label.text = fmt.string(from: Date())
return label
}()
lazy var detailView: UIView = {
let view = UIView()
view.backgroundColor = .clear
let titleLab = UILabel()
titleLab.text = "行程详情"
titleLab.font = .systemFont(ofSize: 14, weight: .medium)
titleLab.textColor = ThemeManager.shared.color.titleAuxColor
view.addSubview(titleLab)
titleLab.layoutChain.left(15).centerY()
view.addSubview(addBtn)
addBtn.layoutChain.right(15).centerY().width(18).height(18)
return view
}()
lazy var addBtn: UIButton = {
let btn = UIButton(type: .custom)
btn.setImage(UIImage(named: "Schedule/add"), for: .normal)
btn.backgroundColor = .clear
btn.extendEdgeInsets = UIEdgeInsets(top: 30, left: 10, bottom: 10, right: 15)
return btn
}()
lazy var scrollView: UIScrollView = {
let view = UIScrollView()
view.backgroundColor = .white
view.showsHorizontalScrollIndicator = false
view.bounces = false
let contentView = UIView()
contentView.backgroundColor = .clear
view.addSubview(contentView)
contentView.layoutChain
.edges().widthToView(view)
contentView.addSubview(tableView)
tableView.layoutChain
.top()
.edgesHorzontal()
contentView.addSubview(createBtn)
createBtn.layoutChain
.topToBottomOfView(tableView, offset: 30)
.edgesHorzontal(30)
.height(50)
.bottom(kSafeBottomMargin + 10)
return view
}()
lazy var tableView: UITableView = {
let tv = UITableView(frame: .zero, style: .plain)
tv.backgroundColor = .clear
tv.separatorStyle = .none
tv.estimatedRowHeight = 122
tv.isScrollEnabled = false
tv.showsVerticalScrollIndicator = false
tv.bounces = false
tv.register(SchedulePointCell.self)
return tv
}()
lazy var createBtn: UIButton = {
let btn = UIButton(type: .custom)
btn.setTitle("立即创建", for: .normal)
btn.setTitleColor(.white, for: .normal)
btn.titleLabel?.font = .systemFont(ofSize: 16, weight: .medium)
btn.setBackgroundImage(UIImage(named: "Common/button_bg_2"), for: .normal)
btn.cornerRadius = 25
return btn
}()
override init(frame: CGRect) {
super.init(frame: frame)
backgroundColor = .white
setupUI()
setupRx()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
override func layoutSubviews() {
super.layoutSubviews()
layoutIfNeeded()
setCornerRadius(corners: [.topLeft, .topRight], withCornerRadii: CGSize(width: 30, height: 30))
}
}
// MARK: - SchedulePointCell
class SchedulePointCell: UITableViewCell {
var disposeBag = DisposeBag()
func configure(item: SchedulePointItem, index: Int, total: Int, onDelete: @escaping () -> Void) {
disposeBag = DisposeBag()
indexLabel.text = "\(index + 1)"
locationLabel.text = item.locationName.isEmpty ? "点击选择地点" : item.locationName
if let expectedTime = item.expectedTime {
timeLabel.text = formatTime(expectedTime)
}
else {
timeLabel.text = "请选择到达时间"
}
// 左侧竖线:仅有一条时不显示虚线,首条顶部不画、末条底部不画
topDashView.isHidden = total <= 1 || index == 0
bottomDashView.isHidden = total <= 1 || index == total - 1
// 删除
deleteBtn.rx.tap
.subscribe(onNext: { onDelete() })
.disposed(by: disposeBag)
}
private func formatTime(_ date: Date) -> String {
let fmt = DateFormatter()
fmt.dateFormat = "HH:mm"
return fmt.string(from: date)
}
// MARK: - Init
override init(style: CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
selectionStyle = .none
backgroundColor = .clear
setupViews()
}
required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") }
private func setupViews() {
contentView.addSubview(topDashView)
contentView.addSubview(pointIcon)
contentView.addSubview(bottomDashView)
contentView.addSubview(cardView)
cardView.addSubview(cardCornerView)
cardCornerView.addSubview(indexLabel)
cardCornerView.addSubview(locationLabel)
cardCornerView.addSubview(timeLabel)
cardCornerView.addSubview(remarkTF)
cardCornerView.addSubview(deleteBtn)
topDashView.layoutChain
.top().width(2)
pointIcon.layoutChain
.centerY()
.left(22)
.width(18).height(18)
topDashView.layoutChain
.centerX(pointIcon)
.bottomToTopOfView(pointIcon, offset: -10)
bottomDashView.layoutChain
.topToBottomOfView(pointIcon, offset: 10)
.centerX(pointIcon)
.width(2)
.bottom()
// 右侧卡片
cardView.layoutChain
.top(15)
.leftToRightOfView(pointIcon, offset: 20)
.right(15)
.height(92)
.bottom(15)
cardCornerView.layoutChain.edges()
indexLabel.layoutChain
.top().left()
.width(30).height(20)
locationLabel.layoutChain
.topToBottomOfView(indexLabel, offset: 10)
.left(10)
timeLabel.layoutChain
.centerY(locationLabel)
.leftToRightOfView(locationLabel, offset: 38)
deleteBtn.layoutChain
.bottom(15).right(15)
.width(14).height(14)
remarkTF.layoutChain
.topToBottomOfView(locationLabel, offset: 15)
.leftToView(locationLabel)
.rightToLeftOfView(deleteBtn, offset: -10)
}
// MARK: - Views
private let topDashView: UIView = {
let v = UIView()
v.backgroundColor = UIColor(hexStr: "#E0E0E0")
v.isHidden = true
return v
}()
private let pointIcon: UIImageView = {
let iv = UIImageView(image: UIImage(named: "Schedule/point"))
iv.contentMode = .scaleAspectFit
return iv
}()
private let bottomDashView: UIView = {
let v = UIView()
v.backgroundColor = UIColor(hexStr: "#E0E0E0")
v.isHidden = true
return v
}()
private let cardView: UIView = {
let view = UIView()
view.backgroundColor = .clear
view.layer.shadowColor = UIColor(red: 0, green: 0, blue: 0, alpha: 0.05).cgColor
view.layer.shadowOffset = CGSize(width: 0, height: 0)
view.layer.shadowOpacity = 1
view.layer.shadowRadius = 8
return view
}()
lazy var cardCornerView: UIView = {
let view = UIView()
view.backgroundColor = .white
view.cornerRadius = 10
return view
}()
private let indexLabel: UILabel = {
let l = UILabel()
l.backgroundColor = UIColor(hexStr: "#DCF4FF")
l.textColor = UIColor(hexStr: "#176F9B")
l.font = .systemFont(ofSize: 12, weight: .medium)
l.textAlignment = .center
return l
}()
private let locationLabel: UILabel = {
let l = UILabel()
l.font = .systemFont(ofSize: 14, weight: .medium)
l.textColor = UIColor(hexStr: "#333333")
l.lineBreakMode = .byTruncatingTail
return l
}()
private let timeLabel: UILabel = {
let l = UILabel()
l.font = .systemFont(ofSize: 12, weight: .medium)
l.textColor = UIColor(hexStr: "#333333")
l.isUserInteractionEnabled = true
return l
}()
lazy var remarkTF: UITextField = {
let tf = UITextField()
tf.font = .systemFont(ofSize: 12)
tf.placeholder = "在此添加备注..."
tf.returnKeyType = .done
return tf
}()
private let deleteBtn: UIButton = {
let btn = UIButton(type: .custom)
btn.setImage(UIImage(named: "Schedule/delete"), for: .normal)
btn.extendEdgeInsets = UIEdgeInsets(top: 10, left: 15, bottom: 15, right: 15)
return btn
}()
override func layoutSubviews() {
super.layoutSubviews()
cardCornerView.layoutIfNeeded()
indexLabel.setCornerRadius(corners: [.bottomRight], withCornerRadii: CGSize(width: 10, height: 10))
}
}

View File

@ -0,0 +1,36 @@
//
// CreateScheduleVC.swift
// QuickLocation
//
// Created by 八条 on 2026/6/23.
//
import UIKit
class CreateScheduleVC: BaseViewController {
fileprivate var rootView: CreateScheduleView!
override func loadView() {
rootView = CreateScheduleView(frame: UIScreen.main.bounds)
view = rootView
}
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
/*
// MARK: - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
// Get the new view controller using segue.destination.
// Pass the selected object to the new view controller.
}
*/
}

View File

@ -0,0 +1,219 @@
//
// CreateScheduleView.swift
// QuickLocation
//
// Created by 八条 on 2026/6/23.
//
import UIKit
import RxSwift
import RxCocoa
#if !targetEnvironment(simulator)
import AMapNaviKit
#endif
class CreateScheduleView: UIView {
var disposeBag = DisposeBag()
let createSchedulePopView = CreateSchedulePopView()
// MARK: - PopView 拖拽
private var popTopConstraint: NSLayoutConstraint?
private var popUpLimit: CGFloat = 0
private var popDownLimit: CGFloat = 0
private var isLimitsSet = false
private var panStartTop: CGFloat = 0
private var isSubCanScroll = false
private func setupRx() {
backBtn.rx.tap.subscribe(onNext: { _ in
AppRouter.shared.popOrDismiss()
}).disposed(by: disposeBag)
// tableView 到达顶部继续下拉时,改由 PopView 的 pan 手势接管
createSchedulePopView.scrollView.rx.contentOffset
.subscribe(onNext: { [weak self] offset in
guard let self = self else { return }
if self.isSubCanScroll {
if offset.y <= 0 {
self.isSubCanScroll = false
self.createSchedulePopView.scrollView.setContentOffset(.zero, animated: false)
}
} else if offset.y != 0 {
self.createSchedulePopView.scrollView.setContentOffset(.zero, animated: false)
}
})
.disposed(by: disposeBag)
}
private func setupUI() {
#if !targetEnvironment(simulator)
addSubview(mapView)
#endif
addSubview(navBgView)
addSubview(navBarView)
navBarView.addSubview(backBtn)
navBarView.addSubview(navTitleLabel)
addSubview(createSchedulePopView)
navBgView.layoutChain
.edges(excludingEdge: .bottom)
.heightToWidth(160/375)
navBarView.layoutChain
.edges(excludingEdge: .bottom)
.height(kNaviHeight)
backBtn.layoutChain
.centerY(navTitleLabel)
.left(15)
.width(24).height(24)
navTitleLabel.layoutChain
.top(kStatusBarHeight + 12)
.centerX()
#if !targetEnvironment(simulator)
mapView.layoutChain
.top()
.edgesHorzontal()
.bottom()
#endif
// PopView: 初始底部 1/3,最大滑到 navBar 底部
createSchedulePopView.layoutChain
.edgesHorzontal()
.bottom()
.top(kScreenHeight / 3 * 2)
popTopConstraint = createSchedulePopView.jh_constraint(
.top, toAttribute: .top, otherView: createSchedulePopView.superview, relation: .equal
)
let pan = UIPanGestureRecognizer(target: self, action: #selector(handlePopPan(_:)))
pan.delegate = self
createSchedulePopView.addGestureRecognizer(pan)
}
// MARK: - Pan Gesture
@objc private func handlePopPan(_ pan: UIPanGestureRecognizer) {
guard isLimitsSet, let topConstraint = popTopConstraint else { return }
switch pan.state {
case .began:
layoutIfNeeded()
panStartTop = createSchedulePopView.frame.minY
case .changed:
let newTop = panStartTop + pan.translation(in: self).y
if isSubCanScroll {
let tableViewOffset = self.createSchedulePopView.scrollView.contentOffset.y
if tableViewOffset > 0, newTop >= popUpLimit {
return
}
isSubCanScroll = false
panStartTop = createSchedulePopView.frame.minY
}
let clamped = max(popUpLimit, min(popDownLimit, newTop))
topConstraint.constant = clamped
case .ended, .cancelled:
let velocity = pan.velocity(in: self)
let isNearUp = abs(createSchedulePopView.frame.minY - popUpLimit) < abs(createSchedulePopView.frame.minY - popDownLimit)
let target: CGFloat
if abs(velocity.y) > 200 {
target = velocity.y < 0 ? popUpLimit : popDownLimit
} else {
target = isNearUp ? popUpLimit : popDownLimit
}
topConstraint.constant = target
UIView.animate(withDuration: 0.2, delay: 0,
options: [.curveEaseInOut, .allowUserInteraction]) {
self.layoutIfNeeded()
} completion: { _ in
let atTop = target == self.popUpLimit
self.isSubCanScroll = atTop
if !atTop {
self.createSchedulePopView.scrollView.contentOffset.y = 0
}
}
default:
break
}
}
override func layoutSubviews() {
super.layoutSubviews()
if !isLimitsSet {
isLimitsSet = true
popDownLimit = kScreenHeight / 3 * 2
popUpLimit = navBarView.frame.maxY
}
}
// MARK: - Views
lazy var navBgView: UIImageView = {
let iv = UIImageView()
iv.image = UIImage(named: "Common/navBar_bg_2")
iv.contentMode = .scaleAspectFill
return iv
}()
lazy var navBarView: UIView = {
let v = UIView()
v.backgroundColor = .clear
return v
}()
lazy var backBtn: UIButton = {
let btn = UIButton(type: .custom)
btn.setImage(UIImage(named: "Common/back"), for: .normal)
btn.extendEdgeInsets = UIEdgeInsets(top: 10, left: 10, bottom: 10, right: 30)
return btn
}()
lazy var navTitleLabel: UILabel = {
let label = UILabel()
label.font = .systemFont(ofSize: 18, weight: .medium)
label.textColor = ThemeManager.shared.color.titleAuxColor
label.text = "创建行程"
return label
}()
#if !targetEnvironment(simulator)
lazy var mapView: MAMapView = {
let mv = MAMapView()
mv.zoomLevel = 14
mv.showsUserLocation = false
mv.showsCompass = false
mv.userTrackingMode = .none
return mv
}()
#endif
override init(frame: CGRect) {
super.init(frame: frame)
backgroundColor = .clear
setupUI()
setupRx()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}
// MARK: - UIGestureRecognizerDelegate
extension CreateScheduleView: UIGestureRecognizerDelegate {
func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer,
shouldRecognizeSimultaneouslyWith other: UIGestureRecognizer) -> Bool {
return true
}
}

View File

@ -0,0 +1,153 @@
//
// ScheduleModel.swift
// QuickLocation
//
// Created by 八条 on 2026/6/23.
//
import ObjectMapper
import RxDataSources
// 分页查询行程
struct ScheduleListResponse: BaseModelProtocol, ListModelType {
var pagination: PaginationModel?
// 当前页索引
var pageIndex = 1
// 每页大小
var pageSize = 20
// 总条数
var count = 0
// 总页数
var page_count = -99
// 返回码
var code: String?
// 返回信息
var message: String?
// 行程列表
var list: [ScheduleModel] = []
init() {}
init?(map: Map) {
}
mutating func mapping(map: Map) {
code <- map["code"]
message <- map["msg"]
list <- map["data"]
count = list.count
pagination = PaginationModel(pageIndex: pageIndex,
pageSize: pageSize,
totalNum: count,
totalPage: page_count)
}
}
struct ScheduleModel: Mappable, Equatable {
var uuid: String = UUID().uuidString
/// 行程id
var id: String = ""
/// 创建人id
var creator_id: String = ""
/// 行程创建者名称
var nick_name: String = ""
var head_pic: String = ""
/// 头像
var userIcon: UIImage {
UIImage(named: "UserIcon/\(head_pic)") ?? UIImage()
}
/// 时间戳
var timestamp: Int64 = 0
/// 是否关注该行程
var is_follow: Bool = false
/// 是否是行程创建者
var is_own: Bool = false
/// 行程点
var points: [SchedulePointModel] = []
/// 圈子名
// var group_name: String = ""
/// 圈子key
// var group_key: String = ""
init?(map: Map) {
}
mutating func mapping(map: Map) {
id <- map["id"]
creator_id <- map["creator_id"]
nick_name <- map["nick_name"]
head_pic <- map["head_pic"]
timestamp <- map["timestamp"]
is_follow <- map["is_follow"]
is_own <- map["is_own"]
points <- map["points"]
// group_name <- map["groups.group_name"]
// group_key <- map["groups.group_key"]
}
}
extension ScheduleModel: IdentifiableType {
public typealias Identity = String
public var identity: String {
return id
}
}
/// 行程点
struct SchedulePointModel: Mappable, Equatable {
/// 行程点id
var id: String = ""
/// 节点类型:0起点 1中间点 2终点
var type: Int = 0
/// 期望到达的毫秒时间戳
var expected_timestamp: Int64 = 0
/// 经度
var longitude: Double?
/// 纬度
var latitude: Double?
/// 详细地址
var province: String = ""
var district: String = ""
var country: String = ""
var street: String = ""
var city: String = ""
var formatted_address: String = ""
/// 备注
var remark: String = ""
/// 事件
var eventText: String = ""
/// 节点顺序
var sequence: Int = 0
init?(map: Map) {
}
mutating func mapping(map: Map) {
id <- map["id"]
type <- map["type"]
expected_timestamp <- map["expected_timestamp"]
longitude <- map["location.longitude"]
latitude <- map["location.latitude"]
remark <- map["remark"]
eventText <- map["events.text"]
province <- map["address.province"]
district <- map["address.district"]
country <- map["address.country"]
street <- map["address.street"]
city <- map["address.city"]
formatted_address <- map["address.formatted_address"]
sequence <- map["sequence"]
}
}
extension SchedulePointModel: IdentifiableType {
public typealias Identity = String
public var identity: String {
return id
}
}

View File

@ -0,0 +1,105 @@
//
// ScheduleVC.swift
// QuickLocation
//
// Created by 八条 on 2026/6/23.
//
import UIKit
import RxSwift
import RxCocoa
import RxDataSources
import MJRefresh
class ScheduleVC: BaseViewController {
fileprivate var rootView: ScheduleView!
override func loadView() {
rootView = ScheduleView(frame: UIScreen.main.bounds)
view = rootView
}
private var viewModel = ScheduleViewModel()
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
setupTableViewHeaderFooter()
bindViewModel()
reactiveAction()
requestData()
requestFollowList()
}
private func bindViewModel() {
viewModel.output.sectionedItems
.bind(to: rootView.collectionView.rx.items(dataSource: dataSource))
.disposed(by: disposeBag)
viewModel.output.scheduleSectionedItems
.bind(to: rootView.tableView.rx.items(dataSource: tableViewDataSource))
.disposed(by: disposeBag)
viewModel.output.refreshResult.subscribe(onNext: { [weak self] (status, isEmpty) in
guard let self = self else { return }
self.dl.dismiss()
self.rootView.tableView.refresh(status: status, isEmpty: isEmpty)
}).disposed(by: disposeBag)
}
private func reactiveAction() {
}
private func setupTableViewHeaderFooter() {
// 设置刷新header/footer
let header = MJRefreshNormalHeader(refreshingBlock: { [weak self] in
self?.viewModel.refresh()
})
header.addFeedbackGenerator()
header.stateLabel?.isHidden = true
rootView.tableView.mj_header = header
let footer = MJRefreshAutoNormalFooter(refreshingBlock: viewModel.loadMore)
footer.isHidden = true
rootView.tableView.mj_footer = footer
}
// MARK: - API
private func requestFollowList() {
dl.showLoading()
UserService.followList().subscribe(onNext: { response in
self.dl.dismiss()
self.viewModel.loadViewedData(response.list)
}, onError: { _ in }).disposed(by: disposeBag)
}
// MARK: - API 行程列表
private func requestData() {
dl.showLoading()
viewModel.refresh()
}
// MARK: - dataSource
private lazy var dataSource: RxCollectionViewSectionedReloadDataSource<ViewedListSectionModel> = {
RxCollectionViewSectionedReloadDataSource<ViewedListSectionModel> { datasource, collectionView, indexPath, model in
let cell: ViewedCell = collectionView.dequeueReusableCell(for: indexPath)
cell.configure(model)
return cell
}
}()
// MARK: - UITableViewDataSource
lazy private var tableViewDataSource: RxTableViewSectionedReloadDataSource<ScheduleListSectionModel> = {
return RxTableViewSectionedReloadDataSource<ScheduleListSectionModel>(
configureCell: { (_, tableView, indexPath, model) in
let cell: ScheduleListPopCell = tableView.dequeueReusableCell(for: indexPath)
cell.configure(model)
return cell
}
)
}()
}

View File

@ -0,0 +1,422 @@
//
// ScheduleView.swift
// QuickLocation
//
// Created by 八条 on 2026/6/23.
//
import UIKit
import RxSwift
import RxCocoa
class ScheduleView: UIView {
var disposeBag = DisposeBag()
private func setupRx() {
createBtn.rx.tap.subscribe(onNext: { _ in
AppRouter.push(Route.createSchedule)
}).disposed(by: disposeBag)
}
private func setupUI() {
addSubview(navBgView)
addSubview(navBarView)
navBarView.addSubview(navTitleLabel)
addSubview(headerView)
addSubview(travelRouteView)
addSubview(tableView)
addSubview(createBtn)
navBgView.layoutChain
.edges(excludingEdge: .bottom)
.height(kNaviHeight)
navBarView.layoutChain
.edges(excludingEdge: .bottom)
.height(kNaviHeight)
navTitleLabel.layoutChain
.top(kStatusBarHeight + 12)
.centerX()
headerView.layoutChain
.topToBottomOfView(navBarView)
.edgesHorzontal()
// .height(147)
travelRouteView.layoutChain
.topToBottomOfView(headerView)
.edgesHorzontal()
tableView.layoutChain
.topToBottomOfView(travelRouteView)
.edges(excludingEdge: .top)
createBtn.layoutChain
.bottom(kSafeBottomMargin + 102)
.right(10)
.width(60)
.heightToWidth(1)
}
lazy var navBgView: UIImageView = {
let iv = UIImageView()
iv.image = UIImage(named: "Common/navBar_bg_1")
iv.contentMode = .scaleAspectFill
return iv
}()
lazy var navBarView: UIView = {
let view = UIView()
view.backgroundColor = .clear
return view
}()
lazy var navTitleLabel: UILabel = {
let label = UILabel()
label.text = "行程"
label.font = .systemFont(ofSize: 18, weight: .medium)
label.textColor = ThemeManager.shared.color.titleAuxColor
label.textAlignment = .center
return label
}()
/// 谁看过我
lazy var headerView: UIView = {
let view = UIView()
view.backgroundColor = .clear
let titleLab = UILabel()
titleLab.text = "谁看过我"
titleLab.font = .systemFont(ofSize: 16, weight: .medium)
titleLab.textColor = ThemeManager.shared.color.titleAuxColor
view.addSubview(titleLab)
titleLab.layoutChain
.top(15)
let dotView = UIView()
dotView.backgroundColor = UIColor(hexStr: "#16B3FF")
dotView.cornerRadius = 2
view.addSubview(dotView)
dotView.layoutChain
.left(15)
.centerY(titleLab)
.width(4)
.height(11)
titleLab.layoutChain.leftToRightOfView(dotView, offset: 5)
let historyBtn = UIButton()
historyBtn.setTitle("历史行程", for: .normal)
historyBtn.setTitleColor(ThemeManager.shared.color.titleAuxColor, for: .normal)
historyBtn.titleLabel?.font = .systemFont(ofSize: 12, weight: .medium)
view.addSubview(historyBtn)
historyBtn.layoutChain
.right(15)
.centerY(titleLab)
historyBtn.sizeToFit()
view.addSubview(collectionView)
collectionView.layoutChain
.topToBottomOfView(titleLab, offset: 15)
.edgesHorzontal()
.height(80)
.bottom(15)
return view
}()
lazy var collectionView: UICollectionView = {
let layout = UICollectionViewFlowLayout()
layout.scrollDirection = .horizontal
layout.itemSize = CGSize(width: 80, height: 80)
layout.minimumLineSpacing = 15
layout.sectionInset = UIEdgeInsets(top: 0, left: 15, bottom: 0, right: 15)
let cv = UICollectionView(frame: .zero, collectionViewLayout: layout)
cv.backgroundColor = .clear
cv.showsHorizontalScrollIndicator = false
cv.register(ViewedCell.self)
return cv
}()
/// 行程路线
lazy var travelRouteView: UIView = {
let view = UIView()
view.backgroundColor = .clear
let titleLab = UILabel()
titleLab.text = "行程路线"
titleLab.font = .systemFont(ofSize: 16, weight: .medium)
titleLab.textColor = ThemeManager.shared.color.titleAuxColor
view.addSubview(titleLab)
titleLab.layoutChain
.top(15)
.edgesVertical(5)
let dotView = UIView()
dotView.backgroundColor = UIColor(hexStr: "#16B3FF")
dotView.cornerRadius = 2
view.addSubview(dotView)
dotView.layoutChain
.left(15)
.centerY(titleLab)
.width(4)
.height(11)
titleLab.layoutChain.leftToRightOfView(dotView, offset: 5)
return view
}()
lazy var tableView: UITableView = {
let tableView = UITableView(frame: .zero, style: .plain)
tableView.backgroundColor = .clear
tableView.separatorStyle = .none
tableView.estimatedRowHeight = 80
tableView.register(ScheduleListPopCell.self)
return tableView
}()
lazy var createBtn: UIButton = {
let btn = UIButton()
btn.setImage(UIImage(named: "Schedule/create"), for: .normal)
return btn
}()
override init(frame: CGRect) {
super.init(frame: .zero)
backgroundColor = .white
setupUI()
setupRx()
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}
// MARK: - ViewedCell
final class ViewedCell: UICollectionViewCell {
func configure(_ model: ViewedModel) {
iconView.image = model.userIcon
// 会员权益
blurView.isHidden = AppContextManager.shared.vip > 1
lockView.isHidden = AppContextManager.shared.vip > 1
viewedCountLab.text = "看了\(model.count)次"
}
lazy var iconView: UIImageView = {
let iv = UIImageView()
iv.contentMode = .scaleAspectFill
iv.cornerRadius = 40
iv.clipsToBounds = true
iv.backgroundColor = .clear
iv.addSubview(blurView)
blurView.layoutChain.edges()
return iv
}()
lazy var blurView: UIVisualEffectView = {
let blurEffect = UIBlurEffect(style: .systemUltraThinMaterialLight)
let view = UIVisualEffectView(effect: blurEffect)
return view
}()
lazy var lockView: UIView = {
let view = UIView()
view.backgroundColor = .clear
let lockIcon = UIImageView(image: UIImage(named: "Common/lock_white"))
lockIcon.contentMode = .scaleAspectFill
view.addSubview(lockIcon)
lockIcon.layoutChain
.top(17)
.centerX()
view.addSubview(viewedCountLab)
viewedCountLab.layoutChain
.bottom(17)
.edgesHorzontal()
return view
}()
lazy var viewedCountLab: UILabel = {
let label = UILabel()
label.font = .systemFont(ofSize: 12, weight: .medium)
label.textColor = .white
label.textAlignment = .center
return label
}()
override init(frame: CGRect) {
super.init(frame: frame)
contentView.addSubview(iconView)
contentView.addSubview(lockView)
iconView.layoutChain
.edges()
lockView.layoutChain
.edges()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}
// MARK: - ScheduleListPopCell
class ScheduleListPopCell: UITableViewCell {
func configure(_ model: ScheduleModel) {
nameLab.text = model.nick_name + " 的行程路线"
monthLab.text = getDateInterval2String(date: "\(model.timestamp/1000)", dateFormat: "MM月")
if model.is_own {
editBtn.isHidden = false
followBtn.isHidden = true
}
else {
editBtn.isHidden = true
followBtn.isHidden = model.is_follow ? true : false
}
guard let pointModel = model.points.last else { return }
dateLab.text = getDateInterval2String(date: "\(pointModel.expected_timestamp/1000)", dateFormat: "MM.dd")
}
override init(style: CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
selectionStyle = .none
backgroundColor = .clear
setupSubviews()
}
private func setupSubviews() {
contentView.addSubview(bgView)
bgView.addSubview(cornerView)
cornerView.addSubview(nameLab)
cornerView.addSubview(monthLab)
cornerView.addSubview(dateLab)
cornerView.addSubview(editBtn)
cornerView.addSubview(followBtn)
bgView.layoutChain
.edgesVertical(15)
.edgesHorzontal(15)
.height(80)
cornerView.layoutChain.edges()
monthLab.layoutChain
.bottomToCenterYOfView(cornerView)
.left(11)
dateLab.layoutChain
.topToBottomOfView(monthLab)
.leftToView(monthLab)
nameLab.layoutChain
.centerY()
.leftToRightOfView(monthLab, offset: 15)
editBtn.layoutChain
.right(10)
.centerY()
.width(56)
.height(28)
followBtn.layoutChain
.topToView(editBtn)
.rightToView(editBtn)
.width(56)
.height(28)
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
}
override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
// Configure the view for the selected state
}
lazy var bgView: UIView = {
let view = UIView()
view.backgroundColor = .clear
view.layer.shadowColor = UIColor(red: 0, green: 0, blue: 0, alpha: 0.05).cgColor
view.layer.shadowOffset = CGSize(width: 0, height: 0)
view.layer.shadowOpacity = 1
view.layer.shadowRadius = 8
return view
}()
lazy var cornerView: UIView = {
let view = UIView()
view.backgroundColor = .white
view.cornerRadius = 10
return view
}()
lazy var monthLab: UILabel = {
let label = UILabel()
label.textColor = ThemeManager.shared.color.titleAuxColor
label.font = .systemFont(ofSize: 14, weight: .medium)
return label
}()
lazy var dateLab: UILabel = {
let label = UILabel()
label.textColor = ThemeManager.shared.color.subTitleColor
label.font = .systemFont(ofSize: 12, weight: .regular)
return label
}()
lazy var nameLab: UILabel = {
let label = UILabel()
label.textColor = ThemeManager.shared.color.titleAuxColor
label.font = .systemFont(ofSize: 14, weight: .medium)
return label
}()
lazy var editBtn: UIButton = {
let btn = UIButton()
btn.isHidden = true
btn.setTitle("编辑", for: .normal)
btn.titleLabel?.font = .systemFont(ofSize: 12, weight: .medium)
btn.setTitleColor(UIColor(hexStr: "#0F2846"), for: .normal)
btn.backgroundColor = UIColor(hexStr: "#EEFAFF")
btn.borderWidth = 0.5
btn.borderColor = UIColor(hexStr: "#16B3FF")
btn.cornerRadius = 14
return btn
}()
lazy var followBtn: UIButton = {
let btn = UIButton()
btn.isHidden = true
btn.setTitle("关注", for: .normal)
btn.titleLabel?.font = .systemFont(ofSize: 12, weight: .medium)
btn.setTitleColor(UIColor(hexStr: "#16B3FF"), for: .normal)
btn.backgroundColor = .white
btn.borderWidth = 0.5
btn.borderColor = UIColor(hexStr: "#16B3FF")
btn.cornerRadius = 14
return btn
}()
}

View File

@ -0,0 +1,63 @@
//
// ScheduleViewModel.swift
// QuickLocation
//
// Created by 八条 on 2026/6/23.
//
import RxSwift
import RxCocoa
import RxDataSources
import MJRefresh
typealias ViewedListSectionModel = SectionModel<String, ViewedModel>
typealias ScheduleListSectionModel = AnimatableSectionModel<String, ScheduleModel>
class ScheduleViewModel: ViewModelType {
struct Input {}
struct Output {
var sectionedItems: Observable<[ViewedListSectionModel]>
var scheduleSectionedItems: Observable<[ScheduleListSectionModel]>
var refreshResult: Observable<RefreshResult>
var pagination: Observable<PaginationModel?>
var error: Observable<Error>
}
let input: Input
let output: Output
private var listService: ListService<ScheduleListResponse>
private let sectionedItems = PublishSubject<[ViewedListSectionModel]>()
private let scheduleSectionedItems = PublishSubject<[ScheduleListSectionModel]>()
var refresh: MJRefreshComponentAction {
return {
self.listService.request.onNext(.refresh)
}
}
var loadMore: MJRefreshComponentAction {
return {
self.listService.request.onNext(.more)
}
}
func loadViewedData(_ list: [ViewedModel]) {
sectionedItems.onNext(list.mapSection())
}
// MARK: - init
init() {
listService = ItineraryService.query()
input = Input()
output = Output(
sectionedItems: sectionedItems.asObservable(),
scheduleSectionedItems: listService.animatableSectionedItems,
refreshResult: listService.refreshResult,
pagination: listService.pagination,
error: listService.error
)
}
}

View File

@ -0,0 +1,60 @@
//
// ViewedModel.swift
// QuickLocation
//
// Created by 八条 on 2026/6/23.
//
import ObjectMapper
import RxDataSources
/// 看过我列表
struct ViewedListResponse: BaseModelProtocol {
// 状态码
var code: String?
// 消息
var message: String?
//
var list: [ViewedModel] = []
init?(map: Map) {}
mutating func mapping(map: Map) {
code <- map["code"]
message <- map["msg"]
list <- map["data"]
}
}
struct ViewedModel: Mappable, Equatable {
var uuid: String = UUID().uuidString
///
var user_id: String = ""
var nick_name: String = ""
var head_pic: String = ""
/// 头像
var userIcon: UIImage {
UIImage(named: "UserIcon/\(head_pic)") ?? UIImage()
}
/// 查看次数
var count: Int = 0
init?(map: Map) {
}
mutating func mapping(map: Map) {
user_id <- map["user_id"]
nick_name <- map["nick_name"]
head_pic <- map["head_pic"]
count <- map["count"]
}
}
extension ViewedModel: IdentifiableType {
public typealias Identity = String
public var identity: String {
return user_id
}
}

View File

@ -0,0 +1,33 @@
//
// ItineraryService.swift
// QuickLocation
//
// Created by 八条 on 2026/6/23.
//
import RxSwift
import Moya
struct ItineraryService {
static let disposeBag = DisposeBag()
/// 查询行程
/// - Parameters:
/// - follow: 只查看关注的行程
/// - own: 只查看自己创建的行程
/// - history: true查看历史行程,默认查看今天之后的行程
/// - group_key: 过滤圈子查询
static func query(follow: Bool=false,
own: Bool=false,
history: Bool=false,
group_key: String="") -> ListService<ScheduleListResponse> {
ListService(newPaging: true) {
ItineraryAPI.query(follow: follow,
own: own,
history: history,
group_key: group_key,
page: $0).multiTarget
}
}
}

View File

@ -33,4 +33,12 @@ struct SystemService {
.map(ResponseModel.self)
.asObservable()
}
/// SOS
static func sos(enable: Bool) -> Observable<ResponseModel> {
let api = SystemAPI.sos(enable: enable).multiTarget
return APIProvider.request(token: api)
.map(ResponseModel.self)
.asObservable()
}
}

View File

@ -124,4 +124,20 @@ struct UserService {
.map(ResponseModel.self)
.asObservable()
}
/// 首页公告
static func notice() -> Observable<ResponseModel> {
let api = UserAPI.notice.multiTarget
return APIProvider.request(token: api)
.map(ResponseModel.self)
.asObservable()
}
/// 查看关注用户列表
static func followList() -> Observable<ViewedListResponse> {
let api = UserAPI.followList.multiTarget
return APIProvider.request(token: api)
.map(ViewedListResponse.self)
.asObservable()
}
}

View File

@ -0,0 +1,32 @@
//
// GPSSignalHelper.swift
// QuickLocation
//
// Created by 八条 on 2026/6/18.
//
import CoreLocation
/// GPS 信号强度(4 格)
enum GPSSignalStrength: Int {
case none = 0
case weak = 1
case fair = 2
case good = 3
case excellent = 4
var barCount: Int { rawValue }
}
/// 根据 CLLocation 的 horizontalAccuracy 估算 GPS 信号强度
func gpsSignalStrength(from location: CLLocation?) -> GPSSignalStrength {
guard let loc = location else { return .none }
let acc = loc.horizontalAccuracy
guard acc > 0 else { return .none }
switch acc {
case ..<10: return .excellent // GPS 锁定强
case ..<30: return .good // GPS 良好
case ..<100: return .fair // 一般
default: return .weak // 基站/WiFi
}
}

View File

@ -214,5 +214,11 @@ public extension AppRouter {
func popToRoot() {
navigationController?.popToRootViewController(animated: true)
// popToRoot 后恢复 tabBar 可见性
DispatchQueue.main.async {
if let tab = UIViewController.topMost?.tabBarController as? MainTabBarController {
tab.setTabBarHidden(false)
}
}
}
}

View File

@ -40,7 +40,7 @@ public extension UIScrollView {
mj_footer?.isHidden = false
case .noMoreData: // 没有更多数据
mj_footer?.endRefreshingWithNoMoreData()
mj_footer?.isHidden = false
mj_footer?.isHidden = true
}
// 数据为空,隐藏footer
if isEmpty {