Skip to content

Commit

Permalink
Event Location and Map Caching Fix (#634)
Browse files Browse the repository at this point in the history
* set self.mapView.image to nil before the if let mapUrl = URL(string: imageUrlString) check in HIEventDetailViewController.swift. Added coreDataEvent.removeFromLocations before coreDataEvent.addToLocations in HIEventDataSource.swift

* Bumping up version

* Update core data event refresh

---------

Co-authored-by: anushkasankaran <[email protected]>
  • Loading branch information
nathannwangg and anushkasankaran authored Feb 23, 2025
1 parent 642dd03 commit 2c9e96e
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 22 deletions.
4 changes: 2 additions & 2 deletions HIAPI/Models/CartItem.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import Foundation
import APIManager

public struct CartItemContainer: Decodable, APIReturnable {
public let items: [String: Int]
public let userId: String
public let items: [String: Int]

public init(from decoder: Decoder) throws {
let container = try decoder.container(keyedBy: CodingKeys.self)
Expand All @@ -20,7 +20,7 @@ public struct CartItemContainer: Decodable, APIReturnable {
}

private enum CodingKeys: String, CodingKey {
case items, userId
case userId, items
}
}

Expand Down
40 changes: 20 additions & 20 deletions HackIllinois.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1380,18 +1380,18 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 2024.11.1;
MARKETING_VERSION = 2025.1.1;
ONLY_ACTIVE_ARCH = YES;
OTHER_SWIFT_FLAGS = "$(inherited) \"-D\" \"COCOAPODS\" -Xfrontend -warn-long-expression-type-checking=150";
PRODUCT_BUNDLE_IDENTIFIER = org.hackillinois.ios;
PRODUCT_NAME = "$(TARGET_NAME)";
REGISTER_APP_GROUPS = NO;
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
SUPPORTS_MACCATALYST = NO;
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = NO;
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = YES;
SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = YES;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = 1;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
};
Expand All @@ -1417,17 +1417,17 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 2024.11.1;
MARKETING_VERSION = 2025.1.1;
ONLY_ACTIVE_ARCH = YES;
PRODUCT_BUNDLE_IDENTIFIER = org.hackillinois.ios;
PRODUCT_NAME = "$(TARGET_NAME)";
REGISTER_APP_GROUPS = NO;
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
SUPPORTS_MACCATALYST = NO;
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = NO;
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = YES;
SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = YES;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = 1;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
};
Expand Down Expand Up @@ -1465,11 +1465,11 @@
SKIP_INSTALL = YES;
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
SUPPORTS_MACCATALYST = NO;
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = NO;
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = YES;
SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = 1;
TARGETED_DEVICE_FAMILY = "1,2";
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
};
Expand Down Expand Up @@ -1508,10 +1508,10 @@
SKIP_INSTALL = YES;
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
SUPPORTS_MACCATALYST = NO;
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = NO;
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = YES;
SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = YES;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = 1;
TARGETED_DEVICE_FAMILY = "1,2";
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
};
Expand Down Expand Up @@ -1542,9 +1542,9 @@
SKIP_INSTALL = YES;
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
SUPPORTS_MACCATALYST = NO;
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = NO;
TARGETED_DEVICE_FAMILY = 1;
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = YES;
SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = YES;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
};
Expand Down Expand Up @@ -1572,9 +1572,9 @@
SKIP_INSTALL = YES;
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
SUPPORTS_MACCATALYST = NO;
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = NO;
TARGETED_DEVICE_FAMILY = 1;
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = YES;
SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = YES;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
};
Expand Down
2 changes: 2 additions & 0 deletions HackIllinois/DataSources/HIEventDataSource.swift
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,10 @@ final class HIEventDataSource {
coreDataEvent.endTime = apiEvent.endTime
coreDataEvent.eventType = apiEvent.eventType
coreDataEvent.info = apiEvent.info
coreDataEvent.locations = []
apiEvent.locations.forEach { apiLocation in
guard let coreDataLocation = coreDataLocationsDicionary[apiLocation.name] else { fatalError("Event Location Error") }
// coreDataEvent.removeFromLocations(coreDataLocation)
coreDataEvent.addToLocations(coreDataLocation)
}
coreDataEvent.name = apiEvent.name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,8 @@ extension HIEventDetailViewController {
imageUrlString = imageUrlString.replacingOccurrences(of: "svg", with: "png")
}

self.mapView.image = nil

if let mapUrl = URL(string: imageUrlString) {
let session = URLSession.shared
self.mapView.image = nil
Expand Down

0 comments on commit 2c9e96e

Please sign in to comment.