@@ -29,8 +29,6 @@ final class DeviceDataManager {
29
29
/// Remember the launch date of the app for diagnostic reporting
30
30
private let launchDate = Date ( )
31
31
32
- private( set) var testingScenariosManager : TestingScenariosManager ?
33
-
34
32
/// The last error recorded by a device manager
35
33
/// Should be accessed only on the main queue
36
34
private( set) var lastError : ( date: Date , error: Error ) ?
@@ -417,10 +415,6 @@ final class DeviceDataManager {
417
415
directory: FileManager . default. exportsDirectoryURL,
418
416
historicalDuration: Bundle . main. localCacheDuration)
419
417
420
- if FeatureFlags . scenariosEnabled {
421
- testingScenariosManager = LocalTestingScenariosManager ( deviceManager: self )
422
- }
423
-
424
418
loopManager. delegate = self
425
419
426
420
alertManager. alertStore. delegate = self
@@ -658,64 +652,6 @@ final class DeviceDataManager {
658
652
self . getHealthStoreAuthorization ( completion)
659
653
}
660
654
}
661
-
662
- func generateDiagnosticReport( _ completion: @escaping ( _ report: String ) -> Void ) {
663
- self . loopManager. generateDiagnosticReport { ( loopReport) in
664
-
665
- let logDurationHours = 84.0
666
-
667
- self . alertManager. getStoredEntries ( startDate: Date ( ) - . hours( logDurationHours) ) { ( alertReport) in
668
- self . deviceLog. getLogEntries ( startDate: Date ( ) - . hours( logDurationHours) ) { ( result) in
669
- let deviceLogReport : String
670
- switch result {
671
- case . failure( let error) :
672
- deviceLogReport = " Error fetching entries: \( error) "
673
- case . success( let entries) :
674
- deviceLogReport = entries. map { " * \( $0. timestamp) \( $0. managerIdentifier) \( $0. deviceIdentifier ?? " " ) \( $0. type) \( $0. message) " } . joined ( separator: " \n " )
675
- }
676
-
677
- let report = [
678
- " ## Build Details " ,
679
- " * appNameAndVersion: \( Bundle . main. localizedNameAndVersion) " ,
680
- " * profileExpiration: \( Bundle . main. profileExpirationString) " ,
681
- " * gitRevision: \( Bundle . main. gitRevision ?? " N/A " ) " ,
682
- " * gitBranch: \( Bundle . main. gitBranch ?? " N/A " ) " ,
683
- " * workspaceGitRevision: \( Bundle . main. workspaceGitRevision ?? " N/A " ) " ,
684
- " * workspaceGitBranch: \( Bundle . main. workspaceGitBranch ?? " N/A " ) " ,
685
- " * sourceRoot: \( Bundle . main. sourceRoot ?? " N/A " ) " ,
686
- " * buildDateString: \( Bundle . main. buildDateString ?? " N/A " ) " ,
687
- " * xcodeVersion: \( Bundle . main. xcodeVersion ?? " N/A " ) " ,
688
- " " ,
689
- " ## FeatureFlags " ,
690
- " \( FeatureFlags) " ,
691
- " " ,
692
- alertReport,
693
- " " ,
694
- " ## DeviceDataManager " ,
695
- " * launchDate: \( self . launchDate) " ,
696
- " * lastError: \( String ( describing: self . lastError) ) " ,
697
- " " ,
698
- " cacheStore: \( String ( reflecting: self . cacheStore) ) " ,
699
- " " ,
700
- self . cgmManager != nil ? String ( reflecting: self . cgmManager!) : " cgmManager: nil " ,
701
- " " ,
702
- self . pumpManager != nil ? String ( reflecting: self . pumpManager!) : " pumpManager: nil " ,
703
- " " ,
704
- " ## Device Communication Log " ,
705
- deviceLogReport,
706
- " " ,
707
- String ( reflecting: self . watchManager!) ,
708
- " " ,
709
- String ( reflecting: self . statusExtensionManager!) ,
710
- " " ,
711
- loopReport,
712
- ] . joined ( separator: " \n " )
713
-
714
- completion ( report)
715
- }
716
- }
717
- }
718
- }
719
655
}
720
656
721
657
private extension DeviceDataManager {
@@ -1656,40 +1592,6 @@ fileprivate extension FileManager {
1656
1592
extension GlucoseStore : CGMStalenessMonitorDelegate { }
1657
1593
1658
1594
1659
- //MARK: - SupportInfoProvider protocol conformance
1660
-
1661
- extension DeviceDataManager : SupportInfoProvider {
1662
-
1663
- private var branchNameIfNotReleaseBranch : String ? {
1664
- return Bundle . main. gitBranch. filter { branch in
1665
- return branch != " " &&
1666
- branch != " main " &&
1667
- branch != " master " &&
1668
- !branch. starts ( with: " release/ " )
1669
- }
1670
- }
1671
-
1672
- public var localizedAppNameAndVersion : String {
1673
- if let branch = branchNameIfNotReleaseBranch {
1674
- return Bundle . main. localizedNameAndVersion + " ( \( branch) ) "
1675
- }
1676
- return Bundle . main. localizedNameAndVersion
1677
- }
1678
-
1679
- public var pumpStatus : PumpManagerStatus ? {
1680
- return pumpManager? . status
1681
- }
1682
-
1683
- public var cgmStatus : CGMManagerStatus ? {
1684
- return cgmManager? . cgmManagerStatus
1685
- }
1686
-
1687
- public func generateIssueReport( completion: @escaping ( String ) -> Void ) {
1688
- generateDiagnosticReport ( completion)
1689
- }
1690
-
1691
- }
1692
-
1693
1595
//MARK: TherapySettingsViewModelDelegate
1694
1596
struct CancelTempBasalFailedError : LocalizedError {
1695
1597
let reason : Error ?
@@ -1790,8 +1692,66 @@ extension DeviceDataManager {
1790
1692
}
1791
1693
}
1792
1694
1793
- extension DeviceDataManager {
1695
+ extension DeviceDataManager : DeviceSupportDelegate {
1794
1696
var availableSupports : [ SupportUI ] { [ cgmManager, pumpManager] . compactMap { $0 as? SupportUI } }
1697
+
1698
+ func generateDiagnosticReport( _ completion: @escaping ( _ report: String ) -> Void ) {
1699
+ self . loopManager. generateDiagnosticReport { ( loopReport) in
1700
+
1701
+ let logDurationHours = 84.0
1702
+
1703
+ self . alertManager. getStoredEntries ( startDate: Date ( ) - . hours( logDurationHours) ) { ( alertReport) in
1704
+ self . deviceLog. getLogEntries ( startDate: Date ( ) - . hours( logDurationHours) ) { ( result) in
1705
+ let deviceLogReport : String
1706
+ switch result {
1707
+ case . failure( let error) :
1708
+ deviceLogReport = " Error fetching entries: \( error) "
1709
+ case . success( let entries) :
1710
+ deviceLogReport = entries. map { " * \( $0. timestamp) \( $0. managerIdentifier) \( $0. deviceIdentifier ?? " " ) \( $0. type) \( $0. message) " } . joined ( separator: " \n " )
1711
+ }
1712
+
1713
+ let report = [
1714
+ " ## Build Details " ,
1715
+ " * appNameAndVersion: \( Bundle . main. localizedNameAndVersion) " ,
1716
+ " * profileExpiration: \( Bundle . main. profileExpirationString) " ,
1717
+ " * gitRevision: \( Bundle . main. gitRevision ?? " N/A " ) " ,
1718
+ " * gitBranch: \( Bundle . main. gitBranch ?? " N/A " ) " ,
1719
+ " * workspaceGitRevision: \( Bundle . main. workspaceGitRevision ?? " N/A " ) " ,
1720
+ " * workspaceGitBranch: \( Bundle . main. workspaceGitBranch ?? " N/A " ) " ,
1721
+ " * sourceRoot: \( Bundle . main. sourceRoot ?? " N/A " ) " ,
1722
+ " * buildDateString: \( Bundle . main. buildDateString ?? " N/A " ) " ,
1723
+ " * xcodeVersion: \( Bundle . main. xcodeVersion ?? " N/A " ) " ,
1724
+ " " ,
1725
+ " ## FeatureFlags " ,
1726
+ " \( FeatureFlags) " ,
1727
+ " " ,
1728
+ alertReport,
1729
+ " " ,
1730
+ " ## DeviceDataManager " ,
1731
+ " * launchDate: \( self . launchDate) " ,
1732
+ " * lastError: \( String ( describing: self . lastError) ) " ,
1733
+ " " ,
1734
+ " cacheStore: \( String ( reflecting: self . cacheStore) ) " ,
1735
+ " " ,
1736
+ self . cgmManager != nil ? String ( reflecting: self . cgmManager!) : " cgmManager: nil " ,
1737
+ " " ,
1738
+ self . pumpManager != nil ? String ( reflecting: self . pumpManager!) : " pumpManager: nil " ,
1739
+ " " ,
1740
+ " ## Device Communication Log " ,
1741
+ deviceLogReport,
1742
+ " " ,
1743
+ String ( reflecting: self . watchManager!) ,
1744
+ " " ,
1745
+ String ( reflecting: self . statusExtensionManager!) ,
1746
+ " " ,
1747
+ loopReport,
1748
+ ] . joined ( separator: " \n " )
1749
+
1750
+ completion ( report)
1751
+ }
1752
+ }
1753
+ }
1754
+ }
1795
1755
}
1796
1756
1797
1757
extension DeviceDataManager : DeviceStatusProvider { }
0 commit comments