@@ -25,7 +25,7 @@ public protocol SiteSpecificAppSettingsStoreMethodsProtocol {
2525
2626/// Methods for managing site-specific app settings
2727///
28- struct SiteSpecificAppSettingsStoreMethods : SiteSpecificAppSettingsStoreMethodsProtocol {
28+ public struct SiteSpecificAppSettingsStoreMethods : SiteSpecificAppSettingsStoreMethodsProtocol {
2929 private let fileStorage : FileStorage
3030 private let generalStoreSettingsFileURL : URL
3131
@@ -44,7 +44,7 @@ struct SiteSpecificAppSettingsStoreMethods: SiteSpecificAppSettingsStoreMethodsP
4444
4545// MARK: - Store Settings
4646extension SiteSpecificAppSettingsStoreMethods {
47- func getStoreSettings( for siteID: Int64 ) -> GeneralStoreSettings {
47+ public func getStoreSettings( for siteID: Int64 ) -> GeneralStoreSettings {
4848 guard let existingData: GeneralStoreSettingsBySite = try ? fileStorage. data ( for: generalStoreSettingsFileURL) ,
4949 let storeSettings = existingData. storeSettingsBySite [ siteID] else {
5050 return GeneralStoreSettings ( )
@@ -53,7 +53,7 @@ extension SiteSpecificAppSettingsStoreMethods {
5353 return storeSettings
5454 }
5555
56- func setStoreSettings( settings: GeneralStoreSettings , for siteID: Int64 , onCompletion: ( ( Result < Void , Error > ) -> Void ) ? = nil ) {
56+ public func setStoreSettings( settings: GeneralStoreSettings , for siteID: Int64 , onCompletion: ( ( Result < Void , Error > ) -> Void ) ? = nil ) {
5757 var storeSettingsBySite : [ Int64 : GeneralStoreSettings ] = [ : ]
5858 if let existingData: GeneralStoreSettingsBySite = try ? fileStorage. data ( for: generalStoreSettingsFileURL) {
5959 storeSettingsBySite = existingData. storeSettingsBySite
@@ -70,35 +70,35 @@ extension SiteSpecificAppSettingsStoreMethods {
7070 }
7171 }
7272
73- func resetStoreSettings( ) {
73+ public func resetStoreSettings( ) {
7474 do {
7575 try fileStorage. deleteFile ( at: generalStoreSettingsFileURL)
7676 } catch {
7777 DDLogError ( " ⛔️ Deleting store settings file failed. Error: \( error) " )
7878 }
7979 }
8080
81- func setStoreID( siteID: Int64 , id: String ? ) {
81+ public func setStoreID( siteID: Int64 , id: String ? ) {
8282 let storeSettings = getStoreSettings ( for: siteID)
8383 let updatedSettings = storeSettings. copy ( storeID: id)
8484 setStoreSettings ( settings: updatedSettings, for: siteID)
8585 }
8686
87- func getStoreID( siteID: Int64 , onCompletion: ( String ? ) -> Void ) {
87+ public func getStoreID( siteID: Int64 , onCompletion: ( String ? ) -> Void ) {
8888 let storeSettings = getStoreSettings ( for: siteID)
8989 onCompletion ( storeSettings. storeID)
9090 }
9191}
9292
9393// MARK: - Search History
9494extension SiteSpecificAppSettingsStoreMethods {
95- func getSearchTerms( for itemType: POSItemType , siteID: Int64 ) -> [ String ] {
95+ public func getSearchTerms( for itemType: POSItemType , siteID: Int64 ) -> [ String ] {
9696 let storeSettings = getStoreSettings ( for: siteID)
9797 let key = itemType. storedSearchHistoryKey
9898 return storeSettings. searchTermsByKey [ key] ?? [ ]
9999 }
100100
101- func setSearchTerms( _ terms: [ String ] , for itemType: POSItemType , siteID: Int64 ) {
101+ public func setSearchTerms( _ terms: [ String ] , for itemType: POSItemType , siteID: Int64 ) {
102102 let storeSettings = getStoreSettings ( for: siteID)
103103 let key = itemType. storedSearchHistoryKey
104104 var updatedSearchTermsByKey = storeSettings. searchTermsByKey
@@ -110,21 +110,21 @@ extension SiteSpecificAppSettingsStoreMethods {
110110
111111// MARK: - POS sync eligibility tracking
112112extension SiteSpecificAppSettingsStoreMethods {
113- func getPOSLastOpenedDate( siteID: Int64 ) -> Date ? {
113+ public func getPOSLastOpenedDate( siteID: Int64 ) -> Date ? {
114114 getStoreSettings ( for: siteID) . lastPOSOpenedDate
115115 }
116116
117- func setPOSLastOpenedDate( siteID: Int64 , date: Date ) {
117+ public func setPOSLastOpenedDate( siteID: Int64 , date: Date ) {
118118 let storeSettings = getStoreSettings ( for: siteID)
119119 let updatedSettings = storeSettings. copy ( lastPOSOpenedDate: date)
120120 setStoreSettings ( settings: updatedSettings, for: siteID)
121121 }
122122
123- func getFirstPOSCatalogSyncDate( siteID: Int64 ) -> Date ? {
123+ public func getFirstPOSCatalogSyncDate( siteID: Int64 ) -> Date ? {
124124 getStoreSettings ( for: siteID) . firstPOSCatalogSyncDate
125125 }
126126
127- func setFirstPOSCatalogSyncDate( siteID: Int64 , date: Date ) {
127+ public func setFirstPOSCatalogSyncDate( siteID: Int64 , date: Date ) {
128128 let storeSettings = getStoreSettings ( for: siteID)
129129 let updatedSettings = storeSettings. copy ( firstPOSCatalogSyncDate: date)
130130 setStoreSettings ( settings: updatedSettings, for: siteID)
@@ -133,13 +133,13 @@ extension SiteSpecificAppSettingsStoreMethods{
133133
134134// MARK: - POS local catalog cellular data
135135extension SiteSpecificAppSettingsStoreMethods {
136- func setPOSLocalCatalogCellularDataAllowed( siteID: Int64 , allowed: Bool ) {
136+ public func setPOSLocalCatalogCellularDataAllowed( siteID: Int64 , allowed: Bool ) {
137137 let storeSettings = getStoreSettings ( for: siteID)
138138 let updatedSettings = storeSettings. copy ( syncPOSCatalogOverCellular: allowed)
139139 setStoreSettings ( settings: updatedSettings, for: siteID)
140140 }
141141
142- func getPOSLocalCatalogCellularDataAllowed( siteID: Int64 ) -> Bool {
142+ public func getPOSLocalCatalogCellularDataAllowed( siteID: Int64 ) -> Bool {
143143 getStoreSettings ( for: siteID) . syncPOSCatalogOverCellular
144144 }
145145}
0 commit comments