Skip to content
This repository was archived by the owner on Oct 12, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
b5ffef0
New point shop background
anushkasankaran Feb 2, 2025
0615ff3
Tab bar items
anushkasankaran Feb 2, 2025
88ef207
Update coins color
anushkasankaran Feb 2, 2025
740cb4c
Flow of point shop to cart to QR
anushkasankaran Feb 2, 2025
8fe3811
items appear
yashjagtap23 Feb 9, 2025
f14ea61
got them to display on bottom in horizontal scroll
yashjagtap23 Feb 9, 2025
d1e1813
ui spacing fix
yashjagtap23 Feb 10, 2025
b4f382e
centered cart button
yashjagtap23 Feb 13, 2025
a265b11
Merge branch 'dev' into points-shop
anushkasankaran Feb 14, 2025
9bdcae1
Cart back button
anushkasankaran Feb 14, 2025
7582214
plist
anushkasankaran Feb 14, 2025
dbcf210
Some model stuff
anushkasankaran Feb 14, 2025
7cca03f
Started adding in points shop cart functionality --> not functional
anushkasankaran Feb 15, 2025
94333e3
key
anushkasankaran Feb 15, 2025
2399d1b
Loading in cart items: need to create temp display while waiting + fi…
anushkasankaran Feb 15, 2025
c9396ec
Add and remove functionality
anushkasankaran Feb 15, 2025
fa20a2c
plist
anushkasankaran Feb 15, 2025
959d371
Fix redeeming endpoints
anushkasankaran Feb 15, 2025
111d0ce
QR functionality
anushkasankaran Feb 16, 2025
adb8f1c
Merge branch 'dev' into points-shop
anushkasankaran Feb 17, 2025
75c64ed
Filter raffle/merch items
anushkasankaran Feb 17, 2025
574ae64
Resizing based on phone
anushkasankaran Feb 17, 2025
544ce85
Error popup for QR
anushkasankaran Feb 18, 2025
88fd498
Remove placeholder qrCode
anushkasankaran Feb 18, 2025
91fffdd
Popup for failure
anushkasankaran Feb 18, 2025
0ab847a
Success popup
anushkasankaran Feb 18, 2025
dcfd42a
Check for attendee status
anushkasankaran Feb 18, 2025
4f507a9
Cart redeeming function
anushkasankaran Feb 18, 2025
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
38 changes: 38 additions & 0 deletions HIAPI/Models/CartItem.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
//
// CartItem.swift
// HackIllinois
//
// Created by Anushka Sankaran on 2/14/25.
// Copyright © 2025 HackIllinois. All rights reserved.
//

import Foundation
import APIManager

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

public init(from decoder: Decoder) throws {
let container = try decoder.container(keyedBy: CodingKeys.self)
self.items = try container.decode([String: Int].self, forKey: .items)
self.userId = try container.decode(String.self, forKey: .userId)
}

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

public struct CartReturnItem: Codable, APIReturnable {
public let items: [String: Int]? // Return items upon success
public let userId: String?
public let error: String?
public let message: String?
}

public struct QRItem: Codable, APIReturnable {
public let QRCode: String? // Return qr code upon success
public let error: String?
public let message: String?
}
4 changes: 4 additions & 0 deletions HIAPI/Models/Item.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,16 @@ public struct ItemContainer: Decodable, APIReturnable {

public struct Item: Codable, Hashable {
internal enum CodingKeys: String, CodingKey {
case _id
case itemId
case name
case price
case isRaffle
case quantity
case imageURL
}
public let _id: String
public let itemId: String
public let name: String
public let price: Int
public let isRaffle: Bool
Expand Down
14 changes: 8 additions & 6 deletions HIAPI/Models/Profile.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,24 @@ public struct ProfileContainer: Decodable, APIReturnable {

public struct Profile: Codable, APIReturnable {
internal enum CodingKeys: String, CodingKey {
case _id
case userId
case discordTag
case displayName
case points
case foodWave
case discordTag
case points
case pointsAccumulated
case avatarUrl
case coins
}

public let _id: String
public let userId: String
public let discordTag: String
public let displayName: String
public let points: Int
public let foodWave: Int
public let discordTag: String
public let points: Int
public let pointsAccumulated: Int
public let avatarUrl: String
public let coins: Int
}

public struct Ranking: Codable, APIReturnable {
Expand Down
31 changes: 31 additions & 0 deletions HIAPI/Services/ShopService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ public final class ShopService: BaseService {
return APIRequest<ItemContainer>(service: self, endpoint: "shop/", headers: headers, method: .GET)
}

public static func getCartItems() -> APIRequest<CartItemContainer> {
return APIRequest<CartItemContainer>(service: self, endpoint: "shop/cart/", headers: headers, method: .GET)
}

public static func redeemPrize(itemId: String, itemInstance: String, userToken: String) -> APIRequest<RedeemItem> {
let jsonBody: [String: Any] = [
"itemId": itemId,
Expand All @@ -27,4 +31,31 @@ public final class ShopService: BaseService {

return APIRequest<RedeemItem>(service: self, endpoint: "shop/item/buy/", body: jsonBody, headers: headers, method: .POST)
}

public static func redeemCart(qrCode: String, userToken: String) -> APIRequest<CartReturnItem> {
let jsonBody: [String: Any] = [
"QRCode": qrCode
]
let headers: HTTPParameters = ["Authorization": userToken]

return APIRequest<CartReturnItem>(service: self, endpoint: "shop/cart/redeem/", body: jsonBody, headers: headers, method: .POST)
}

public static func addToCart(itemId: String, userToken: String) -> APIRequest<CartReturnItem> {
let headers: HTTPParameters = ["Authorization": userToken]

return APIRequest<CartReturnItem>(service: self, endpoint: "shop/cart/\(itemId)/", headers: headers, method: .POST)
}

public static func removeFromCart(itemId: String, userToken: String) -> APIRequest<CartReturnItem> {
let headers: HTTPParameters = ["Authorization": userToken]

return APIRequest<CartReturnItem>(service: self, endpoint: "shop/cart/\(itemId)/", headers: headers, method: .DELETE)
}

public static func getQR(userToken: String) -> APIRequest<QRItem> {
let headers: HTTPParameters = ["Authorization": userToken]

return APIRequest<QRItem>(service: self, endpoint: "shop/cart/qr/", headers: headers, method: .GET)
}
}
4 changes: 4 additions & 0 deletions HackIllinois.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@
D1F1463A2B605C57004E7FC9 /* Hack_Mushroom_Loading.json in Resources */ = {isa = PBXBuildFile; fileRef = D1F146392B605C57004E7FC9 /* Hack_Mushroom_Loading.json */; };
D3A309BC2211175200CBA351 /* PassKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D3A309BB2211175200CBA351 /* PassKit.framework */; };
D704DB322C73A8E200355019 /* URLImage in Frameworks */ = {isa = PBXBuildFile; productRef = D704DB312C73A8E200355019 /* URLImage */; };
D7713B5D2D5FDEAA00389128 /* CartItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7713B5C2D5FDEA100389128 /* CartItem.swift */; };
DAACDC322D3B8F5E00D15118 /* HIEventListViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DAACDC312D3B8F5E00D15118 /* HIEventListViewController.swift */; };
DF3706382925DDAA000B4278 /* GoogleMapsBase.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DF3706372925DDAA000B4278 /* GoogleMapsBase.framework */; };
DF37063B2925DDB8000B4278 /* GoogleMaps.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DF3706392925DDB7000B4278 /* GoogleMaps.framework */; };
Expand Down Expand Up @@ -375,6 +376,7 @@
D1F146392B605C57004E7FC9 /* Hack_Mushroom_Loading.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = Hack_Mushroom_Loading.json; sourceTree = "<group>"; };
D3A309BA221116A600CBA351 /* HackIllinois.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = HackIllinois.entitlements; sourceTree = "<group>"; };
D3A309BB2211175200CBA351 /* PassKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = PassKit.framework; path = System/Library/Frameworks/PassKit.framework; sourceTree = SDKROOT; };
D7713B5C2D5FDEA100389128 /* CartItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CartItem.swift; sourceTree = "<group>"; };
DAACDC312D3B8F5E00D15118 /* HIEventListViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HIEventListViewController.swift; sourceTree = "<group>"; };
DF3706372925DDAA000B4278 /* GoogleMapsBase.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = GoogleMapsBase.framework; sourceTree = "<group>"; };
DF3706392925DDB7000B4278 /* GoogleMaps.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = GoogleMaps.framework; sourceTree = "<group>"; };
Expand Down Expand Up @@ -760,6 +762,7 @@
95E3146421FAF1740092C22E /* Models */ = {
isa = PBXGroup;
children = (
D7713B5C2D5FDEA100389128 /* CartItem.swift */,
95E3146821FAF1740092C22E /* Announcement.swift */,
3521FFA82207C03E00634A63 /* Attendee.swift */,
95E3146521FAF1740092C22E /* Event.swift */,
Expand Down Expand Up @@ -1194,6 +1197,7 @@
3C8F62D4238F9639001A5DAF /* Time.swift in Sources */,
95E3147621FAF1740092C22E /* Announcement.swift in Sources */,
D1D3351B2B81DF0300BBB596 /* NotificationService.swift in Sources */,
D7713B5D2D5FDEAA00389128 /* CartItem.swift in Sources */,
95E3146C21FAF1740092C22E /* UserService.swift in Sources */,
95B12043220BEA9D00E024BB /* CheckInService.swift in Sources */,
95E3147121FAF1740092C22E /* AuthService.swift in Sources */,
Expand Down
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/Cart.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "Cart.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "Cart 2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "Cart 3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "PS Cart Background.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "PS Cart Background 2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "PS Cart Background 3x.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.
6 changes: 6 additions & 0 deletions HackIllinois/Assets.xcassets/Home/HomePage/Contents 2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
20 changes: 20 additions & 0 deletions HackIllinois/Assets.xcassets/Image 1.imageset/Contents 2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
20 changes: 20 additions & 0 deletions HackIllinois/Assets.xcassets/Image.imageset/Contents 2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"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
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "Back.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "Back 2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "Back 3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "Points Shop Background.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "Points Shop Background 2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "Points Shop Background 3x.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
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "PS Tab Selected.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "PS Tab Selected 2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "PS Tab Selected 3x.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
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "PS Tab Unselected.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "PS Tab Unselected 2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "PS Tab Unselected 3x.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/Redeem.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "Redeem.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "Redeem 2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "Redeem 3x.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.
Loading