@@ -9,9 +9,9 @@ import Foundation
99
1010internal struct DisplayReceiptCacheHelper {
1111
12- private static let coordinator = NSFileCoordinator ( filePresenter: nil )
12+ private let coordinator = NSFileCoordinator ( filePresenter: nil )
1313
14- static func sharedGroupId( ) throws -> String {
14+ func sharedGroupId( ) throws -> String {
1515
1616 let groupIdOverride = Bundle . main. object ( forInfoDictionaryKey: " BATCH_APP_GROUP_ID " )
1717 if let groupId = groupIdOverride as? String , !groupId. isEmpty {
@@ -26,7 +26,7 @@ internal struct DisplayReceiptCacheHelper {
2626 throw DisplayReceiptHelperError . appGroupError
2727 }
2828
29- static func sharedDirectory( ) throws -> URL {
29+ func sharedDirectory( ) throws -> URL {
3030 do {
3131 guard let sharedDir = FileManager
3232 . default
@@ -41,7 +41,7 @@ internal struct DisplayReceiptCacheHelper {
4141 }
4242 }
4343
44- static func sharedDefaults( ) throws -> UserDefaults {
44+ func sharedDefaults( ) throws -> UserDefaults {
4545 let groupId = try self . sharedGroupId ( )
4646 guard let defaults = UserDefaults . init ( suiteName: groupId)
4747 else { throw DisplayReceiptHelperError . appGroupError }
@@ -50,11 +50,11 @@ internal struct DisplayReceiptCacheHelper {
5050
5151 // MARK: Methods updating cache files
5252
53- static func newFilename( ) -> String {
53+ func newFilename( ) -> String {
5454 return String ( format: Consts . receiptCacheFileFormat, UUID ( ) . uuidString)
5555 }
5656
57- static func write( toFile file: URL , _ data: Data ) throws {
57+ func write( toFile file: URL , _ data: Data ) throws {
5858 var error : NSError ?
5959 var writeError : Error ?
6060 coordinator. coordinate ( writingItemAt: file, options: . forReplacing, error: & error) { url in
@@ -70,7 +70,7 @@ internal struct DisplayReceiptCacheHelper {
7070 }
7171 }
7272
73- static func write( _ data: Data ) throws {
73+ func write( _ data: Data ) throws {
7474 do {
7575 let cacheDir = try sharedDirectory ( )
7676 let cacheFile = cacheDir. appendingPathComponent ( newFilename ( ) )
@@ -81,7 +81,7 @@ internal struct DisplayReceiptCacheHelper {
8181 }
8282 }
8383
84- static func read( fromFile file: URL ) throws -> Data {
84+ func read( fromFile file: URL ) throws -> Data {
8585 var error : NSError ?
8686 var data : Data ?
8787 coordinator. coordinate ( readingItemAt: file, options: . withoutChanges, error: & error) { url in
@@ -98,7 +98,7 @@ internal struct DisplayReceiptCacheHelper {
9898 throw DisplayReceiptHelperError . readCacheError ( underlyingError: error ?? NSError ( ) )
9999 }
100100
101- static func delete( _ file: URL ) -> Error ? {
101+ func delete( _ file: URL ) -> Error ? {
102102 var error : NSError ?
103103 var deleteError : Error ?
104104 coordinator. coordinate ( writingItemAt: file, options: . forDeleting, error: & error) { url in
@@ -115,7 +115,7 @@ internal struct DisplayReceiptCacheHelper {
115115 return nil
116116 }
117117
118- static func cachedFiles( ) throws -> [ URL ] {
118+ func cachedFiles( ) throws -> [ URL ] {
119119 do {
120120 let cacheDir = try sharedDirectory ( )
121121 let urls = try FileManager . default. contentsOfDirectory ( at: cacheDir,
@@ -148,7 +148,7 @@ internal struct DisplayReceiptCacheHelper {
148148
149149 // MARK: Methods reading user defaults
150150
151- static func isOptOut( ) throws -> Bool {
151+ func isOptOut( ) throws -> Bool {
152152 let defaults = try self . sharedDefaults ( )
153153 if defaults. object ( forKey: " batch_shared_optout " ) != nil {
154154 // Key is missing, we don't send display receipt
0 commit comments