Skip to content
This repository was archived by the owner on Oct 12, 2025. It is now read-only.

Commit c912738

Browse files
authored
Merge branch 'development' into sruthi/schedule/page
2 parents 9d472d2 + fb41ed5 commit c912738

File tree

150 files changed

+24649
-737
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

150 files changed

+24649
-737
lines changed

app/build.gradle

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,9 @@ dependencies {
129129

130130
// Swipe-to-refresh
131131
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
132+
133+
//Json Parsing
134+
implementation 'com.google.code.gson:gson:2.8.9'
132135
}
133136

134137
apply plugin: 'com.google.gms.google-services'

app/schemas/org.hackillinois.android.database.Database/3.json

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"formatVersion": 1,
33
"database": {
44
"version": 3,
5-
"identityHash": "64145a0d233925fd28a80a38316cd145",
5+
"identityHash": "f39906469f336ff1fd8c3c6c6f1907a4",
66
"entities": [
77
{
88
"tableName": "qr_codes",
@@ -250,7 +250,7 @@
250250
},
251251
{
252252
"tableName": "profiles",
253-
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`_id` TEXT NOT NULL, `displayName` TEXT NOT NULL, `discordTag` TEXT NOT NULL, `avatarUrl` TEXT NOT NULL, `points` INTEGER NOT NULL, `userId` TEXT NOT NULL, `foodWave` INTEGER NOT NULL, `coins` INTEGER NOT NULL, `key` INTEGER NOT NULL, PRIMARY KEY(`key`))",
253+
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`_id` TEXT NOT NULL, `userId` TEXT NOT NULL, `avatrUrl` TEXT NOT NULL, `discordTag` TEXT NOT NULL, `displayName` TEXT NOT NULL, `foodWave` INTEGER NOT NULL, `points` INTEGER NOT NULL, `pointsAccumulated` INTEGER NOT NULL, `key` INTEGER NOT NULL, PRIMARY KEY(`key`))",
254254
"fields": [
255255
{
256256
"fieldPath": "_id",
@@ -259,32 +259,26 @@
259259
"notNull": true
260260
},
261261
{
262-
"fieldPath": "displayName",
263-
"columnName": "displayName",
262+
"fieldPath": "userId",
263+
"columnName": "userId",
264264
"affinity": "TEXT",
265265
"notNull": true
266266
},
267267
{
268-
"fieldPath": "discordTag",
269-
"columnName": "discordTag",
268+
"fieldPath": "avatrUrl",
269+
"columnName": "avatrUrl",
270270
"affinity": "TEXT",
271271
"notNull": true
272272
},
273273
{
274-
"fieldPath": "avatarUrl",
275-
"columnName": "avatarUrl",
274+
"fieldPath": "discordTag",
275+
"columnName": "discordTag",
276276
"affinity": "TEXT",
277277
"notNull": true
278278
},
279279
{
280-
"fieldPath": "points",
281-
"columnName": "points",
282-
"affinity": "INTEGER",
283-
"notNull": true
284-
},
285-
{
286-
"fieldPath": "userId",
287-
"columnName": "userId",
280+
"fieldPath": "displayName",
281+
"columnName": "displayName",
288282
"affinity": "TEXT",
289283
"notNull": true
290284
},
@@ -295,8 +289,14 @@
295289
"notNull": true
296290
},
297291
{
298-
"fieldPath": "coins",
299-
"columnName": "coins",
292+
"fieldPath": "points",
293+
"columnName": "points",
294+
"affinity": "INTEGER",
295+
"notNull": true
296+
},
297+
{
298+
"fieldPath": "pointsAccumulated",
299+
"columnName": "pointsAccumulated",
300300
"affinity": "INTEGER",
301301
"notNull": true
302302
},
@@ -458,7 +458,7 @@
458458
"views": [],
459459
"setupQueries": [
460460
"CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)",
461-
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, '64145a0d233925fd28a80a38316cd145')"
461+
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, 'f39906469f336ff1fd8c3c6c6f1907a4')"
462462
]
463463
}
464464
}

app/src/main/assets/swirling_oracle.json

Lines changed: 1 addition & 0 deletions
Large diffs are not rendered by default.

app/src/main/java/org/hackillinois/android/API.kt

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package org.hackillinois.android
22

3+
import RedeemCart
4+
import okhttp3.ResponseBody
35
import org.hackillinois.android.database.entity.*
46
import org.hackillinois.android.model.event.EventsList
57
import org.hackillinois.android.model.event.ShiftsList
@@ -9,12 +11,14 @@ import org.hackillinois.android.model.scanner.DietaryRestrictions
911
import org.hackillinois.android.model.scanner.EventId
1012
import org.hackillinois.android.model.scanner.MentorId
1113
import org.hackillinois.android.model.scanner.Points
14+
import org.hackillinois.android.model.scanner.QRCode
1215
import org.hackillinois.android.model.scanner.UserEventPair
1316
import org.hackillinois.android.model.shop.ItemInstance
1417
import org.hackillinois.android.model.user.FavoritesResponse
1518
import org.hackillinois.android.model.version.Version
1619
import org.hackillinois.android.notifications.DeviceToken
1720
import retrofit2.Call
21+
import retrofit2.Response
1822
import retrofit2.http.*
1923

2024
interface API {
@@ -68,6 +72,21 @@ interface API {
6872
@POST("shop/item/buy/")
6973
suspend fun buyShopItem(@Body body: ItemInstance): ShopItem
7074

75+
@POST("shop/cart/{itemId}")
76+
suspend fun addItemCart(@Path("itemId") itemId: String): Response<ResponseBody>
77+
78+
@GET("shop/cart/")
79+
suspend fun getCart(): Cart
80+
81+
@GET("shop/cart/qr/")
82+
suspend fun getCartQRCode(): QRResponse
83+
84+
@DELETE("shop/cart/{itemId}")
85+
suspend fun removeItemCart(@Path("itemId") itemId: String): Response<ResponseBody>
86+
87+
@POST("shop/cart/redeem/")
88+
suspend fun redeemCart(@Body body: QRCode): RedeemCart
89+
7190
// STAFF
7291

7392
@POST("staff/attendance/")

app/src/main/java/org/hackillinois/android/App.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,12 @@ class App : Application() {
3030
return if (apiInitialized) apiInternal else getAPI("")
3131
}
3232

33-
Log.d("TOKEN", token)
33+
Log.d("APPTOKEN", token)
3434

3535
val interceptor = { chain: Interceptor.Chain ->
3636
val newRequest = chain.request().newBuilder()
37-
.addHeader("Authorization", token)
37+
.addHeader("Authorization", "Bearer $token")
38+
.addHeader("Accept", "application/json")
3839
.build()
3940
chain.proceed(newRequest)
4041
}

app/src/main/java/org/hackillinois/android/database/Database.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import org.hackillinois.android.database.entity.*
1717
Shift::class,
1818
ShopItem::class,
1919
],
20-
version = 3,
20+
version = 4,
2121
)
2222

2323
abstract class Database : RoomDatabase() {
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package org.hackillinois.android.database.entity
2+
3+
import androidx.room.Entity
4+
import androidx.room.PrimaryKey
5+
6+
@Entity(tableName = "cart")
7+
data class Cart(
8+
@PrimaryKey val userId: String,
9+
val items: Map<String, Int> // Maps itemId to quantity
10+
)

app/src/main/java/org/hackillinois/android/database/entity/Profile.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ import org.hackillinois.android.database.Converters
99
@TypeConverters(Converters::class)
1010
data class Profile(
1111
var _id: String,
12-
var displayName: String,
13-
var discordTag: String,
14-
var avatarUrl: String,
15-
var points: Int,
1612
var userId: String,
13+
var avatarUrl: String,
14+
var discordTag: String,
15+
var displayName: String,
1716
var foodWave: Int,
18-
var coins: Int,
17+
var points: Int,
18+
var pointsAccumulated: Int
1919
) {
2020
@PrimaryKey
2121
var key = 1
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
package org.hackillinois.android.database.entity
2+
3+
data class QRResponse(val QRCode: String)
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
data class RedeemCart(
2+
val items: List<CartItem>
3+
)
4+
5+
data class CartItem(
6+
val itemId: String,
7+
val name: String,
8+
val quantity: Int
9+
)

0 commit comments

Comments
 (0)