Fix for locations in voice records

This commit is contained in:
Selim Mustafaev 2025-10-18 13:48:57 +03:00
parent e7e2cb311f
commit f813fff8e4
3 changed files with 10 additions and 8 deletions

View File

@ -1721,7 +1721,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_ENTITLEMENTS = AutoCat/AutoCat.entitlements; CODE_SIGN_ENTITLEMENTS = AutoCat/AutoCat.entitlements;
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 173; CURRENT_PROJECT_VERSION = 174;
DEVELOPMENT_TEAM = 46DTTB8X4S; DEVELOPMENT_TEAM = 46DTTB8X4S;
INFOPLIST_FILE = AutoCat/Info.plist; INFOPLIST_FILE = AutoCat/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = AutoCat; INFOPLIST_KEY_CFBundleDisplayName = AutoCat;
@ -1750,7 +1750,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_ENTITLEMENTS = AutoCat/AutoCat.entitlements; CODE_SIGN_ENTITLEMENTS = AutoCat/AutoCat.entitlements;
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 173; CURRENT_PROJECT_VERSION = 174;
DEVELOPMENT_TEAM = 46DTTB8X4S; DEVELOPMENT_TEAM = 46DTTB8X4S;
INFOPLIST_FILE = AutoCat/Info.plist; INFOPLIST_FILE = AutoCat/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = AutoCat; INFOPLIST_KEY_CFBundleDisplayName = AutoCat;

View File

@ -21,6 +21,7 @@ public actor VehicleRecordService {
@AutoCancellable @AutoCancellable
var locationTask: Task<VehicleEventDto?,Error>? var locationTask: Task<VehicleEventDto?,Error>?
var locationTaskActive = false
public init( public init(
recordService: AudioRecordServiceProtocol, recordService: AudioRecordServiceProtocol,
@ -103,14 +104,15 @@ extension VehicleRecordService: VehicleRecordServiceProtocol {
try await recordService.startRecording(to: url) try await recordService.startRecording(to: url)
if locationTask == nil || locationTask?.isCancelled == true { if !locationTaskActive {
locationTaskActive = true
locationTask = Task { locationTask = Task {
do { do {
let location = try await locationService.getRecentLocation() let location = try await locationService.getRecentLocation()
locationTask = nil locationTaskActive = false
return location return location
} catch { } catch {
locationTask = nil locationTaskActive = false
return nil return nil
} }
} }
@ -130,8 +132,8 @@ extension VehicleRecordService: VehicleRecordServiceProtocol {
async let recognitionTask = recordService.recognizeText(from: url) async let recognitionTask = recordService.recognizeText(from: url)
async let durationTask = recordService.getDuration(from: url) async let durationTask = recordService.getDuration(from: url)
let (text, duration) = await (recognitionTask, try? durationTask)
var location = try? await locationTask?.value var location = try? await locationTask?.value
let (text, duration) = await (recognitionTask, try? durationTask)
// One location can be shared between multile records // One location can be shared between multile records
// So, manually give each copy it's unique id // So, manually give each copy it's unique id

View File

@ -19,8 +19,8 @@ public enum Constants {
public var baseUrl: String { public var baseUrl: String {
#if DEBUG #if DEBUG
"http://127.0.0.1:3000/" //"http://127.0.0.1:3000/"
//"https://charon.aliencat.pro:8444/" "https://charon.aliencat.pro:8444/"
#else #else
rawValue rawValue
#endif #endif