Fix for displaying recording popup
This commit is contained in:
parent
f7bcaa96a2
commit
3332d12b05
@ -76,6 +76,7 @@
|
|||||||
7A7547DE2403180A004E8406 /* SectionHeader.xib in Resources */ = {isa = PBXBuildFile; fileRef = 7A7547DC2403180A004E8406 /* SectionHeader.xib */; };
|
7A7547DE2403180A004E8406 /* SectionHeader.xib in Resources */ = {isa = PBXBuildFile; fileRef = 7A7547DC2403180A004E8406 /* SectionHeader.xib */; };
|
||||||
7A7547E024032CB6004E8406 /* VehiclePhotoCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A7547DF24032CB6004E8406 /* VehiclePhotoCell.swift */; };
|
7A7547E024032CB6004E8406 /* VehiclePhotoCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A7547DF24032CB6004E8406 /* VehiclePhotoCell.swift */; };
|
||||||
7A813DBE2506A57100CC93B9 /* AuthenticationServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7A813DBD2506A57100CC93B9 /* AuthenticationServices.framework */; };
|
7A813DBE2506A57100CC93B9 /* AuthenticationServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7A813DBD2506A57100CC93B9 /* AuthenticationServices.framework */; };
|
||||||
|
7A813DC12508C4D900CC93B9 /* ExceptionCatcher in Frameworks */ = {isa = PBXBuildFile; productRef = 7A813DC02508C4D900CC93B9 /* ExceptionCatcher */; };
|
||||||
7A8A2209248D10EC0073DFD9 /* ResizeImage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A8A2208248D10EC0073DFD9 /* ResizeImage.swift */; };
|
7A8A2209248D10EC0073DFD9 /* ResizeImage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A8A2208248D10EC0073DFD9 /* ResizeImage.swift */; };
|
||||||
7A8A220B248D67B60073DFD9 /* VehicleReportImage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A8A220A248D67B60073DFD9 /* VehicleReportImage.swift */; };
|
7A8A220B248D67B60073DFD9 /* VehicleReportImage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A8A220A248D67B60073DFD9 /* VehicleReportImage.swift */; };
|
||||||
7A96AE2A246AFD6200297C33 /* Eureka in Frameworks */ = {isa = PBXBuildFile; productRef = 7A96AE29246AFD6200297C33 /* Eureka */; };
|
7A96AE2A246AFD6200297C33 /* Eureka in Frameworks */ = {isa = PBXBuildFile; productRef = 7A96AE29246AFD6200297C33 /* Eureka */; };
|
||||||
@ -185,6 +186,7 @@
|
|||||||
7A813DBE2506A57100CC93B9 /* AuthenticationServices.framework in Frameworks */,
|
7A813DBE2506A57100CC93B9 /* AuthenticationServices.framework in Frameworks */,
|
||||||
7AF58D342402A91C00CE01A0 /* Kingfisher in Frameworks */,
|
7AF58D342402A91C00CE01A0 /* Kingfisher in Frameworks */,
|
||||||
7A0516162414EC1200FC55AC /* Differentiator in Frameworks */,
|
7A0516162414EC1200FC55AC /* Differentiator in Frameworks */,
|
||||||
|
7A813DC12508C4D900CC93B9 /* ExceptionCatcher in Frameworks */,
|
||||||
7A96AE2F246B2BCD00297C33 /* WebKit.framework in Frameworks */,
|
7A96AE2F246B2BCD00297C33 /* WebKit.framework in Frameworks */,
|
||||||
7A11472823FEA1F400B424AF /* RealmSwift in Frameworks */,
|
7A11472823FEA1F400B424AF /* RealmSwift in Frameworks */,
|
||||||
7A11472123FEA18700B424AF /* RxCocoa in Frameworks */,
|
7A11472123FEA18700B424AF /* RxCocoa in Frameworks */,
|
||||||
@ -431,6 +433,7 @@
|
|||||||
7A0516152414EC1200FC55AC /* Differentiator */,
|
7A0516152414EC1200FC55AC /* Differentiator */,
|
||||||
7A0516172414EC1200FC55AC /* RxDataSources */,
|
7A0516172414EC1200FC55AC /* RxDataSources */,
|
||||||
7A96AE29246AFD6200297C33 /* Eureka */,
|
7A96AE29246AFD6200297C33 /* Eureka */,
|
||||||
|
7A813DC02508C4D900CC93B9 /* ExceptionCatcher */,
|
||||||
);
|
);
|
||||||
productName = AutoCat;
|
productName = AutoCat;
|
||||||
productReference = 7A1146FD23FDE7E500B424AF /* AutoCat.app */;
|
productReference = 7A1146FD23FDE7E500B424AF /* AutoCat.app */;
|
||||||
@ -470,6 +473,7 @@
|
|||||||
7A05160F241412CA00FC55AC /* XCRemoteSwiftPackageReference "SwiftDate" */,
|
7A05160F241412CA00FC55AC /* XCRemoteSwiftPackageReference "SwiftDate" */,
|
||||||
7A0516142414EC1200FC55AC /* XCRemoteSwiftPackageReference "RxDataSources" */,
|
7A0516142414EC1200FC55AC /* XCRemoteSwiftPackageReference "RxDataSources" */,
|
||||||
7A96AE28246AFD6200297C33 /* XCRemoteSwiftPackageReference "Eureka" */,
|
7A96AE28246AFD6200297C33 /* XCRemoteSwiftPackageReference "Eureka" */,
|
||||||
|
7A813DBF2508C4D900CC93B9 /* XCRemoteSwiftPackageReference "ExceptionCatcher" */,
|
||||||
);
|
);
|
||||||
productRefGroup = 7A1146FE23FDE7E500B424AF /* Products */;
|
productRefGroup = 7A1146FE23FDE7E500B424AF /* Products */;
|
||||||
projectDirPath = "";
|
projectDirPath = "";
|
||||||
@ -711,7 +715,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 = 26;
|
CURRENT_PROJECT_VERSION = 28;
|
||||||
DEVELOPMENT_TEAM = 46DTTB8X4S;
|
DEVELOPMENT_TEAM = 46DTTB8X4S;
|
||||||
INFOPLIST_FILE = AutoCat/Info.plist;
|
INFOPLIST_FILE = AutoCat/Info.plist;
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
|
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
|
||||||
@ -733,7 +737,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 = 26;
|
CURRENT_PROJECT_VERSION = 28;
|
||||||
DEVELOPMENT_TEAM = 46DTTB8X4S;
|
DEVELOPMENT_TEAM = 46DTTB8X4S;
|
||||||
INFOPLIST_FILE = AutoCat/Info.plist;
|
INFOPLIST_FILE = AutoCat/Info.plist;
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
|
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
|
||||||
@ -821,6 +825,14 @@
|
|||||||
minimumVersion = 3.0.0;
|
minimumVersion = 3.0.0;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
7A813DBF2508C4D900CC93B9 /* XCRemoteSwiftPackageReference "ExceptionCatcher" */ = {
|
||||||
|
isa = XCRemoteSwiftPackageReference;
|
||||||
|
repositoryURL = "https://github.com/sindresorhus/ExceptionCatcher";
|
||||||
|
requirement = {
|
||||||
|
kind = upToNextMajorVersion;
|
||||||
|
minimumVersion = 1.1.0;
|
||||||
|
};
|
||||||
|
};
|
||||||
7A96AE28246AFD6200297C33 /* XCRemoteSwiftPackageReference "Eureka" */ = {
|
7A96AE28246AFD6200297C33 /* XCRemoteSwiftPackageReference "Eureka" */ = {
|
||||||
isa = XCRemoteSwiftPackageReference;
|
isa = XCRemoteSwiftPackageReference;
|
||||||
repositoryURL = "https://github.com/xmartlabs/Eureka";
|
repositoryURL = "https://github.com/xmartlabs/Eureka";
|
||||||
@ -903,6 +915,11 @@
|
|||||||
package = 7A530B89240181F500CBFE6E /* XCRemoteSwiftPackageReference "RxRealm" */;
|
package = 7A530B89240181F500CBFE6E /* XCRemoteSwiftPackageReference "RxRealm" */;
|
||||||
productName = RxRealm;
|
productName = RxRealm;
|
||||||
};
|
};
|
||||||
|
7A813DC02508C4D900CC93B9 /* ExceptionCatcher */ = {
|
||||||
|
isa = XCSwiftPackageProductDependency;
|
||||||
|
package = 7A813DBF2508C4D900CC93B9 /* XCRemoteSwiftPackageReference "ExceptionCatcher" */;
|
||||||
|
productName = ExceptionCatcher;
|
||||||
|
};
|
||||||
7A96AE29246AFD6200297C33 /* Eureka */ = {
|
7A96AE29246AFD6200297C33 /* Eureka */ = {
|
||||||
isa = XCSwiftPackageProductDependency;
|
isa = XCSwiftPackageProductDependency;
|
||||||
package = 7A96AE28246AFD6200297C33 /* XCRemoteSwiftPackageReference "Eureka" */;
|
package = 7A96AE28246AFD6200297C33 /* XCRemoteSwiftPackageReference "Eureka" */;
|
||||||
|
|||||||
@ -10,6 +10,15 @@
|
|||||||
"version": "5.2.1"
|
"version": "5.2.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"package": "ExceptionCatcher",
|
||||||
|
"repositoryURL": "https://github.com/sindresorhus/ExceptionCatcher",
|
||||||
|
"state": {
|
||||||
|
"branch": null,
|
||||||
|
"revision": "3787f25119e1406b4c5e47fc654626a9d5d7e111",
|
||||||
|
"version": "1.1.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"package": "InputMask",
|
"package": "InputMask",
|
||||||
"repositoryURL": "https://github.com/RedMadRobot/input-mask-ios",
|
"repositoryURL": "https://github.com/RedMadRobot/input-mask-ios",
|
||||||
|
|||||||
@ -7,6 +7,7 @@ import RxDataSources
|
|||||||
import Intents
|
import Intents
|
||||||
import CoreSpotlight
|
import CoreSpotlight
|
||||||
import MobileCoreServices
|
import MobileCoreServices
|
||||||
|
import os.log
|
||||||
|
|
||||||
class RecordsController: UIViewController, UITableViewDelegate {
|
class RecordsController: UIViewController, UITableViewDelegate {
|
||||||
|
|
||||||
@ -113,6 +114,8 @@ class RecordsController: UIViewController, UITableViewDelegate {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
self.addButton.isEnabled = false
|
||||||
|
|
||||||
var alert: UIAlertController?
|
var alert: UIAlertController?
|
||||||
var url: URL!
|
var url: URL!
|
||||||
|
|
||||||
@ -134,12 +137,11 @@ class RecordsController: UIViewController, UITableViewDelegate {
|
|||||||
}
|
}
|
||||||
self.audioSessionObserver = NotificationCenter.default.addObserver(forName: AVAudioSession.routeChangeNotification, object: nil, queue: .main) { notification in
|
self.audioSessionObserver = NotificationCenter.default.addObserver(forName: AVAudioSession.routeChangeNotification, object: nil, queue: .main) { notification in
|
||||||
guard let dict = notification.userInfo as? [String: Any],
|
guard let dict = notification.userInfo as? [String: Any],
|
||||||
let prev = dict["AVAudioSessionRouteChangePreviousRouteKey"] as? AVAudioSessionRouteDescription,
|
|
||||||
let reasonInt = dict["AVAudioSessionRouteChangeReasonKey"] as? NSNumber,
|
let reasonInt = dict["AVAudioSessionRouteChangeReasonKey"] as? NSNumber,
|
||||||
let reason = AVAudioSession.RouteChangeReason(rawValue: reasonInt.uintValue),
|
let reason = AVAudioSession.RouteChangeReason(rawValue: reasonInt.uintValue),
|
||||||
let session = notification.object as? AVAudioSession else { return }
|
let session = notification.object as? AVAudioSession else { return }
|
||||||
|
|
||||||
if reason == .categoryChange && session.category == .playAndRecord && prev.inputs.isEmpty && !session.currentRoute.inputs.isEmpty {
|
if reason == .categoryChange && session.category == .playAndRecord {
|
||||||
alert = self.showRecordingAlert()
|
alert = self.showRecordingAlert()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -163,6 +165,7 @@ class RecordsController: UIViewController, UITableViewDelegate {
|
|||||||
realm?.add(record)
|
realm?.add(record)
|
||||||
}
|
}
|
||||||
alert?.dismiss(animated: true)
|
alert?.dismiss(animated: true)
|
||||||
|
self.addButton.isEnabled = true
|
||||||
}) { error in
|
}) { error in
|
||||||
if let alert = alert {
|
if let alert = alert {
|
||||||
alert.dismiss(animated: true) {
|
alert.dismiss(animated: true) {
|
||||||
@ -171,6 +174,7 @@ class RecordsController: UIViewController, UITableViewDelegate {
|
|||||||
} else {
|
} else {
|
||||||
IHProgressHUD.show(error: error)
|
IHProgressHUD.show(error: error)
|
||||||
}
|
}
|
||||||
|
self.addButton.isEnabled = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -87,7 +87,7 @@ class ReportController: UIViewController, UICollectionViewDataSource, UICollecti
|
|||||||
private let fullWidth = MagazineLayoutItemSizeMode(widthMode: .fullWidth(respectsHorizontalInsets: true), heightMode: .dynamic)
|
private let fullWidth = MagazineLayoutItemSizeMode(widthMode: .fullWidth(respectsHorizontalInsets: true), heightMode: .dynamic)
|
||||||
private var reportImageUrl: URL?
|
private var reportImageUrl: URL?
|
||||||
|
|
||||||
private var vehicle: Vehicle? {
|
var vehicle: Vehicle? {
|
||||||
didSet {
|
didSet {
|
||||||
loadViewIfNeeded()
|
loadViewIfNeeded()
|
||||||
self.collection.reloadData()
|
self.collection.reloadData()
|
||||||
@ -275,6 +275,7 @@ class ReportController: UIViewController, UICollectionViewDataSource, UICollecti
|
|||||||
else if let events = self.vehicle?.events, indexPath.row == ReportGeneralSection.events.rawValue && events.count > 0 {
|
else if let events = self.vehicle?.events, indexPath.row == ReportGeneralSection.events.rawValue && events.count > 0 {
|
||||||
let controller = sb.instantiateViewController(identifier: "EventsController") as EventsController
|
let controller = sb.instantiateViewController(identifier: "EventsController") as EventsController
|
||||||
controller.events = Array(events)
|
controller.events = Array(events)
|
||||||
|
controller.title = self.vehicle?.number ?? "Events"
|
||||||
self.navigationController?.pushViewController(controller, animated: true)
|
self.navigationController?.pushViewController(controller, animated: true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -67,7 +67,7 @@ class SearchController: UIViewController, UISearchResultsUpdating {
|
|||||||
if let detail = detail {
|
if let detail = detail {
|
||||||
detail.popToRootViewController(animated: true)
|
detail.popToRootViewController(animated: true)
|
||||||
let report = detail.viewControllers.first as? ReportController
|
let report = detail.viewControllers.first as? ReportController
|
||||||
report?.number = vehicle.number
|
report?.vehicle = vehicle
|
||||||
splitViewController.showDetailViewController(detail, sender: self)
|
splitViewController.showDetailViewController(detail, sender: self)
|
||||||
//self.performSegue(withIdentifier: "OpenDetailSegue", sender: self)
|
//self.performSegue(withIdentifier: "OpenDetailSegue", sender: self)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,9 +3,9 @@ import Foundation
|
|||||||
enum Constants {
|
enum Constants {
|
||||||
static var baseUrl: String {
|
static var baseUrl: String {
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
return "http://127.0.0.1:3000/"
|
//return "http://127.0.0.1:3000/"
|
||||||
//return "http://192.168.1.67:3000/"
|
//return "http://192.168.1.67:3000/"
|
||||||
//return "https://vps.aliencat.pro:8443/"
|
return "https://vps.aliencat.pro:8443/"
|
||||||
#else
|
#else
|
||||||
return "https://vps.aliencat.pro:8443/"
|
return "https://vps.aliencat.pro:8443/"
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -4,6 +4,7 @@ import AVFoundation
|
|||||||
import AudioToolbox
|
import AudioToolbox
|
||||||
import RxSwift
|
import RxSwift
|
||||||
import os.log
|
import os.log
|
||||||
|
import ExceptionCatcher
|
||||||
|
|
||||||
class Recorder {
|
class Recorder {
|
||||||
|
|
||||||
@ -93,9 +94,11 @@ class Recorder {
|
|||||||
let inFormat = self.engine.inputNode.outputFormat(forBus: 0)
|
let inFormat = self.engine.inputNode.outputFormat(forBus: 0)
|
||||||
ExtAudioFileSetProperty(fileRef, kExtAudioFileProperty_ClientDataFormat, UInt32(MemoryLayout<AudioStreamBasicDescription>.size), inFormat.streamDescription)
|
ExtAudioFileSetProperty(fileRef, kExtAudioFileProperty_ClientDataFormat, UInt32(MemoryLayout<AudioStreamBasicDescription>.size), inFormat.streamDescription)
|
||||||
|
|
||||||
self.engine.inputNode.installTap(onBus: 0, bufferSize: 1024, format: inFormat) { buffer, time in
|
try ExceptionCatcher.catch {
|
||||||
self.request.append(buffer)
|
self.engine.inputNode.installTap(onBus: 0, bufferSize: 1024, format: inFormat) { buffer, time in
|
||||||
ExtAudioFileWrite(fileRef, buffer.frameLength, buffer.audioBufferList)
|
self.request.append(buffer)
|
||||||
|
ExtAudioFileWrite(fileRef, buffer.frameLength, buffer.audioBufferList)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
self.recognitionTask = self.recognizer!.recognitionTask(with: self.request) { result, error in
|
self.recognitionTask = self.recognizer!.recognitionTask(with: self.request) { result, error in
|
||||||
@ -138,6 +141,7 @@ class Recorder {
|
|||||||
self.request.endAudio()
|
self.request.endAudio()
|
||||||
self.recognitionTask?.cancel()
|
self.recognitionTask?.cancel()
|
||||||
try? AVAudioSession.sharedInstance().setActive(false, options: .notifyOthersOnDeactivation)
|
try? AVAudioSession.sharedInstance().setActive(false, options: .notifyOthersOnDeactivation)
|
||||||
|
try? AVAudioSession.sharedInstance().setCategory(.soloAmbient)
|
||||||
|
|
||||||
if let fileRef = self.fileRef {
|
if let fileRef = self.fileRef {
|
||||||
ExtAudioFileDispose(fileRef)
|
ExtAudioFileDispose(fileRef)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user