Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Points Shop Implementation #571

Merged
merged 6 commits into from
Feb 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions HIAPI/Models/Item.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,12 @@ public struct Item: Codable {
case price
case isRaffle
case quantity
case imageURL
}
public let name: String
public let price: Int
public let isRaffle: Bool
public let quantity: Int
public let imageURL: String

}
4 changes: 3 additions & 1 deletion HIAPI/Services/ProfileService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ public final class ProfileService: BaseService {
return super.baseURL + "profile/"
}

public static func getUserProfile() -> APIRequest<Profile> {
public static func getUserProfile(userToken: String) -> APIRequest<Profile> {
var headers = HTTPHeaders()
headers["Authorization"] = userToken
return APIRequest<Profile>(service: self, endpoint: "", headers: headers, method: .GET)
}

Expand Down
2 changes: 1 addition & 1 deletion HIAPI/Services/ShopService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ public final class ShopService: BaseService {
}

public static func getAllItems() -> APIRequest<ItemContainer> {
return APIRequest<ItemContainer>(service: self, endpoint: "shop/", method: .GET)
return APIRequest<ItemContainer>(service: self, endpoint: "shop/", headers: headers, method: .GET)
}
}
8 changes: 8 additions & 0 deletions HackIllinois.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
1C9045D4274F065F00DDA74E /* HIOnboardingViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1C9045D3274F065F00DDA74E /* HIOnboardingViewController.swift */; };
2FA73B4E2B58CAA0002658C0 /* ShopService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2FA73B4D2B58CAA0002658C0 /* ShopService.swift */; };
2FA73B502B58CAC3002658C0 /* Item.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2FA73B4F2B58CAC3002658C0 /* Item.swift */; };
2FF0F9302B58D56700017D08 /* HIPointsShopViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2FF0F92F2B58D56700017D08 /* HIPointsShopViewController.swift */; };
2FF0F9322B58D5A200017D08 /* HIPointsShopSwiftUIView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2FF0F9312B58D5A200017D08 /* HIPointsShopSwiftUIView.swift */; };
3521FFA92207C03E00634A63 /* Attendee.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3521FFA82207C03E00634A63 /* Attendee.swift */; };
35240BD1201408DB00E0C0D8 /* HICountdownViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 35240BD0201408DB00E0C0D8 /* HICountdownViewController.swift */; };
35B4A44F21E091BA001B3AF0 /* Logger.swift in Sources */ = {isa = PBXBuildFile; fileRef = 35B4A44D21E091B9001B3AF0 /* Logger.swift */; };
Expand Down Expand Up @@ -226,6 +228,8 @@
1C9045D3274F065F00DDA74E /* HIOnboardingViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HIOnboardingViewController.swift; sourceTree = "<group>"; };
2FA73B4D2B58CAA0002658C0 /* ShopService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShopService.swift; sourceTree = "<group>"; };
2FA73B4F2B58CAC3002658C0 /* Item.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Item.swift; sourceTree = "<group>"; };
2FF0F92F2B58D56700017D08 /* HIPointsShopViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HIPointsShopViewController.swift; sourceTree = "<group>"; };
2FF0F9312B58D5A200017D08 /* HIPointsShopSwiftUIView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HIPointsShopSwiftUIView.swift; sourceTree = "<group>"; };
3521FFA82207C03E00634A63 /* Attendee.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Attendee.swift; sourceTree = "<group>"; };
35240BD0201408DB00E0C0D8 /* HICountdownViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HICountdownViewController.swift; sourceTree = "<group>"; };
35B4A44D21E091B9001B3AF0 /* Logger.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Logger.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -589,8 +593,10 @@
95C18DC42009618C004784B5 /* HIHomeViewController.swift */,
954EE1D21FD0F1680078F39E /* HILoginSelectionViewController.swift */,
95CCEA1E203D6B3600E3E28C /* HINavigationController.swift */,
2FF0F9312B58D5A200017D08 /* HIPointsShopSwiftUIView.swift */,
95C18DC820096539004784B5 /* HIScheduleViewController.swift */,
98CA2A3D25C899CF003E842A /* HIProfileViewController.swift */,
2FF0F92F2B58D56700017D08 /* HIPointsShopViewController.swift */,
E170038929679D08009B99A8 /* HIProfileCardView.swift */,
60EAF98A273B1AC4002CD205 /* HIScanQRCodeViewController.swift */,
D12B40FE2AC0B0BD001BCB05 /* HIScanAttendanceViewController.swift */,
Expand Down Expand Up @@ -1076,6 +1082,7 @@
95CD0ED52015217E00D79DCC /* HIApplicationStateController.swift in Sources */,
E1E4A5DB291C9BF800780BA1 /* HIOnboardingViewModel.swift in Sources */,
AC0DDDDC261111B60086BDE0 /* HITextView.swift in Sources */,
2FF0F9302B58D56700017D08 /* HIPointsShopViewController.swift in Sources */,
95A7D292203D4F54005EAEAF /* HILoginSelectionCell.swift in Sources */,
3C26401923ADE7AA004E1DBE /* Project+CoreDataProperties.swift in Sources */,
1C9045D2274F048A00DDA74E /* HICarouselView.swift in Sources */,
Expand All @@ -1096,6 +1103,7 @@
D12B40FF2AC0B0BD001BCB05 /* HIScanAttendanceViewController.swift in Sources */,
95C18DCA20096539004784B5 /* HIEventDetailViewController.swift in Sources */,
9523A2902218BA2600341EBD /* HIImageView.swift in Sources */,
2FF0F9322B58D5A200017D08 /* HIPointsShopSwiftUIView.swift in Sources */,
95C18DC52009618C004784B5 /* HIHomeViewController.swift in Sources */,
35240BD1201408DB00E0C0D8 /* HICountdownViewController.swift in Sources */,
3C7E552723AA199900213E1F /* HITimeDataSource.swift in Sources */,
Expand Down
23 changes: 23 additions & 0 deletions HackIllinois/Assets.xcassets/Coin.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "Group 293.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "Group 294.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "Group 295.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions HackIllinois/Assets.xcassets/KnickKnacks.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "knick knacks (3).png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "knick knacks (1).png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "knick knacks (2).png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "Group 1771x.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "Group 1772x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "Group 1773x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
"author" : "xcode",
"version" : 1
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ extension HIApplicationStateController {
viewControllers.append(HIHomeViewController())
viewControllers.append(HIScheduleViewController())
viewControllers.append(HIScanQRCodeViewController())
viewControllers.append(HIPointsShopViewController())
viewControllers.append(HIProfileViewController())
viewControllers.append(HILeaderboardViewController())
return viewControllers
}
@objc func loginUser(_ notification: Notification) {
Expand Down
3 changes: 2 additions & 1 deletion HackIllinois/FlowControllers/HILoginFlowController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,8 @@ private extension HILoginFlowController {
}

private func populateProfileData(buildingProfile profile: HIProfile, sender: HIBaseViewController) {
HIAPI.ProfileService.getUserProfile()
guard let user = HIApplicationStateController.shared.user else { return }
HIAPI.ProfileService.getUserProfile(userToken: user.token)
.onCompletion { [weak self] result in
do {
let (apiProfile, _) = try result.get()
Expand Down
Loading
Loading