Merge branch 'master' into add-implementation-comment-fetch-xml

pull/551/head
James Sangalli 6 years ago committed by GitHub
commit ab27386b50
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      AlphaWallet/AssetDefinition/AssetDefinitionBackingStore.swift
  2. 2
      AlphaWallet/AssetDefinition/AssetDefinitionDiskBackingStore.swift
  3. 4
      AlphaWallet/AssetDefinition/AssetDefinitionDiskBackingStoreWithOverrides.swift
  4. 2
      AlphaWallet/AssetDefinition/AssetDefinitionInMemoryBackingStore.swift
  5. 6
      AlphaWallet/AssetDefinition/AssetDefinitionStore.swift

@ -6,7 +6,7 @@ protocol AssetDefinitionBackingStore {
var delegate: AssetDefinitionBackingStoreDelegate? { get set }
subscript(contract: String) -> String? { get set }
func lastModifiedDataOfCachedAssetDefinitionFile(forContract contract: String) -> Date?
func lastModifiedDateOfCachedAssetDefinitionFile(forContract contract: String) -> Date?
func forEachContractWithXML(_ body: (String) -> Void)
func isOfficial(contract: String) -> Bool
}

@ -58,7 +58,7 @@ class AssetDefinitionDiskBackingStore: AssetDefinitionBackingStore {
return isOfficial
}
func lastModifiedDataOfCachedAssetDefinitionFile(forContract contract: String) -> Date? {
func lastModifiedDateOfCachedAssetDefinitionFile(forContract contract: String) -> Date? {
let path = localURLOfXML(for: contract)
guard let lastModified = try? path.resourceValues(forKeys: [.contentModificationDateKey]) else {
return nil

@ -35,9 +35,9 @@ class AssetDefinitionDiskBackingStoreWithOverrides: AssetDefinitionBackingStore
return officialStore.isOfficial(contract: contract)
}
func lastModifiedDataOfCachedAssetDefinitionFile(forContract contract: String) -> Date? {
func lastModifiedDateOfCachedAssetDefinitionFile(forContract contract: String) -> Date? {
//Even with an override, we just want to fetch the latest official version. Doesn't imply we'll use the official version
return officialStore.lastModifiedDataOfCachedAssetDefinitionFile(forContract: contract)
return officialStore.lastModifiedDateOfCachedAssetDefinitionFile(forContract: contract)
}
func forEachContractWithXML(_ body: (String) -> Void) {

@ -16,7 +16,7 @@ class AssetDefinitionInMemoryBackingStore: AssetDefinitionBackingStore {
}
}
func lastModifiedDataOfCachedAssetDefinitionFile(forContract contract: String) -> Date? {
func lastModifiedDateOfCachedAssetDefinitionFile(forContract contract: String) -> Date? {
return nil
}

@ -107,13 +107,13 @@ class AssetDefinitionStore {
return URL(string: Constants.repoServer)?.appendingPathComponent(name)
}
private func lastModifiedDataOfCachedAssetDefinitionFile(forContract contract: String) -> Date? {
return backingStore.lastModifiedDataOfCachedAssetDefinitionFile(forContract: contract)
private func lastModifiedDateOfCachedAssetDefinitionFile(forContract contract: String) -> Date? {
return backingStore.lastModifiedDateOfCachedAssetDefinitionFile(forContract: contract)
}
private func httpHeadersWithLastModifiedTimestamp(forContract contract: String) -> HTTPHeaders {
var result = httpHeaders
if let lastModified = lastModifiedDataOfCachedAssetDefinitionFile(forContract: contract) {
if let lastModified = lastModifiedDateOfCachedAssetDefinitionFile(forContract: contract) {
result["IF-Modified-Since"] = string(fromLastModifiedDate: lastModified)
return result
} else {

Loading…
Cancel
Save