diff --git a/.vscode/launch.json b/.vscode/launch.json
index 12bff38c..116d1df2 100644
--- a/.vscode/launch.json
+++ b/.vscode/launch.json
@@ -4,6 +4,14 @@
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
+ {
+ "type": "node",
+ "request": "attach",
+ "name": "Docker: Attach to Node",
+ "localRoot": "${workspaceFolder}/server",
+ "remoteRoot": "/app/server",
+ "port": 9229
+ },
{
"name": "game",
"cwd": "game",
@@ -25,4 +33,4 @@
"flutterMode": "release"
}
]
-}
\ No newline at end of file
+}
diff --git a/README.md b/README.md
index 6e68a3a9..c75e50dd 100644
--- a/README.md
+++ b/README.md
@@ -23,6 +23,16 @@ To access the Google Maps in the CornellGo app, you need two Google Maps API Key
docker compose up --build
```
+### Run project with backend hot reloading
+
+```
+docker compose watch
+
+If you want to see logging, run the following in a different terminal:
+docker compose logs --follow
+Or look at your docker desktop app
+```
+
### Start the container in the background
```
@@ -50,6 +60,12 @@ npx prisma studio
npm run updateapi
```
+### Format all code files
+
+```
+npm run formatall
+```
+
### Start the frontend (for debugging)
```
diff --git a/admin/public/favicon.ico b/admin/public/favicon.ico
index 0e165520..5fd02590 100644
Binary files a/admin/public/favicon.ico and b/admin/public/favicon.ico differ
diff --git a/admin/src/all.dto.ts b/admin/src/all.dto.ts
index 58f9b7f3..c11350a7 100644
--- a/admin/src/all.dto.ts
+++ b/admin/src/all.dto.ts
@@ -102,10 +102,14 @@ export interface RequestAchievementDataDto {
export interface LoginDto {
idToken: string;
- lat: number;
- long: number;
+ noRegister: boolean;
+ latF?: number;
+ longF?: number;
username?: string;
year?: string;
+ college?: string;
+ major?: string;
+ interests?: string;
aud?: LoginAudDto;
enrollmentType: LoginEnrollmentTypeDto;
}
@@ -149,26 +153,16 @@ export interface SetCurrentChallengeDto {
challengeId: string;
}
-export interface LeaderDto {
- userId: string;
- username: string;
- score: number;
-}
-
-export interface UpdateLeaderDataDto {
- eventId: string;
- offset: number;
- users: LeaderDto[];
-}
-
export interface UpdateErrorDto {
id: string;
message: string;
}
-export interface RequestAllEventDataDto {
- offset: number;
- count: number;
+export interface RequestFilteredEventsDto {
+ difficulty: string[];
+ location: string[];
+ category: string[];
+ filterId: string[];
}
export interface RequestEventDataDto {
@@ -178,6 +172,25 @@ export interface RequestEventDataDto {
export interface RequestEventLeaderDataDto {
offset: number;
count: number;
+ eventId?: string;
+}
+
+export interface LeaderDto {
+ userId: string;
+ username: string;
+ score: number;
+}
+
+export interface UpdateLeaderDataDto {
+ eventId?: string;
+ offset: number;
+ users: LeaderDto[];
+}
+
+export interface UpdateLeaderPositionDto {
+ playerId: string;
+ newTotalScore: number;
+ newEventScore: number;
eventId: string;
}
@@ -290,18 +303,6 @@ export interface UpdateOrganizationDataDto {
export interface CloseAccountDto {}
-export interface SetUsernameDto {
- newUsername: string;
-}
-
-export interface SetMajorDto {
- newMajor: string;
-}
-
-export interface SetGraduationYearDto {
- newYear: string;
-}
-
export interface BanUserDto {
userId: string;
isBanned: boolean;
@@ -338,6 +339,9 @@ export interface UserDto {
enrollmentType?: UserEnrollmentTypeDto;
email?: string;
year?: string;
+ college?: string;
+ major?: string;
+ interests?: string[];
score?: number;
isBanned?: boolean;
groupId?: string;
diff --git a/admin/src/components/Challenges.tsx b/admin/src/components/Challenges.tsx
index 0b2d9728..a70da10d 100644
--- a/admin/src/components/Challenges.tsx
+++ b/admin/src/components/Challenges.tsx
@@ -131,7 +131,9 @@ function toForm(challenge: ChallengeDto) {
{
name: "Image URL",
characterLimit: 2048,
- value: challenge.imageUrl ?? "",
+ value:
+ challenge.imageUrl ??
+ "https://upload.wikimedia.org/wikipedia/commons/b/b1/Missing-image-232x150.png",
},
{
name: "Awarding Distance (meters)",
diff --git a/admin/src/components/ServerApi.tsx b/admin/src/components/ServerApi.tsx
index 223807d2..173d4602 100644
--- a/admin/src/components/ServerApi.tsx
+++ b/admin/src/components/ServerApi.tsx
@@ -29,10 +29,6 @@ export class ServerApi {
this.send("completedChallenge", data);
}
- requestGlobalLeaderData(data: dto.RequestGlobalLeaderDataDto) {
- this.send("requestGlobalLeaderData", data);
- }
-
updateChallengeData(data: dto.UpdateChallengeDataDto) {
this.send("updateChallengeData", data);
}
@@ -41,6 +37,10 @@ export class ServerApi {
this.send("requestEventData", data);
}
+ requestFilteredEventIds(data: dto.RequestFilteredEventsDto) {
+ this.send("requestFilteredEventIds", data);
+ }
+
requestRecommendedEvents(data: dto.RequestRecommendedEventsDto) {
this.send("requestRecommendedEvents", data);
}
@@ -189,4 +189,11 @@ export class ServerApi {
this.socket.removeAllListeners("updateOrganizationData");
this.socket.on("updateOrganizationData", (data) => callback(data));
}
+
+ onUpdateLeaderPosition(
+ callback: (data: dto.UpdateLeaderPositionDto) => void
+ ) {
+ this.socket.removeAllListeners("updateLeaderPosition");
+ this.socket.on("updateLeaderPosition", (data) => callback(data));
+ }
}
diff --git a/admin/src/components/ServerConnection.tsx b/admin/src/components/ServerConnection.tsx
index 4d3f9c0b..762bd6e5 100644
--- a/admin/src/components/ServerConnection.tsx
+++ b/admin/src/components/ServerConnection.tsx
@@ -48,8 +48,10 @@ export function ServerConnectionProvider(props: { children: ReactNode }) {
lat: 1,
long: 1,
username: "guest",
+ college: "Arts and Sciences",
major: "Computer Science",
year: "2025",
+ interests: "",
aud: "web",
enrollmentType: "UNDERGRADUATE",
});
diff --git a/docker-compose.yml b/docker-compose.yml
index 0d726cde..c0c143be 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -24,6 +24,7 @@ services:
server:
ports:
- "8080:80"
+ - "9229:9229"
environment:
NO_SSL: true
DEVELOPMENT: true
@@ -35,6 +36,15 @@ services:
postgres:
condition: service_healthy
build: .
+ develop:
+ watch:
+ - action: sync
+ path: ./server/
+ target: /app/server/
+ ignore:
+ - node_modules/
+ - action: rebuild
+ path: server/package.json
networks:
- reference
networks:
diff --git a/game/android/app/google-services.json b/game/android/app/google-services.json
index 60a30e64..30406c28 100644
--- a/game/android/app/google-services.json
+++ b/game/android/app/google-services.json
@@ -21,6 +21,22 @@
"certificate_hash": "d6e7da6b98f7884510d3826068e668c5bb7ec89b"
}
},
+ {
+ "client_id": "757523123677-mdis2048vo39u7bjg7rjtm9r28a1tsto.apps.googleusercontent.com",
+ "client_type": 1,
+ "android_info": {
+ "package_name": "com.cornellgo.CornellGO",
+ "certificate_hash": "48942102c610163af43caab359452832e7bdc189"
+ }
+ },
+ {
+ "client_id": "757523123677-s7lm7n8b1vmppnh92pige13uvp722jma.apps.googleusercontent.com",
+ "client_type": 1,
+ "android_info": {
+ "package_name": "com.cornellgo.CornellGO",
+ "certificate_hash": "e8ec9df2de92f3ff018926aba9448be15c464a4e"
+ }
+ },
{
"client_id": "757523123677-2nv6haiqnvklhb134cgg5qe8bia4du4q.apps.googleusercontent.com",
"client_type": 3
@@ -28,7 +44,7 @@
],
"api_key": [
{
- "current_key": "AIzaSyDSKPt3T-sBGcaS5vQGw-FDkgOBTryxhUQ"
+ "current_key": "AIzaSyCNuTQ0eTjwXde0NMNMFaO6c3u5AYlNiXA"
},
{
"current_key": "AIzaSyBBGoQlbjlNCBfxiob-mkm1TCougaHqcu4"
@@ -42,10 +58,10 @@
"client_type": 3
},
{
- "client_id": "757523123677-cso74eimkjqkcuce69nrf4c637k3db6t.apps.googleusercontent.com",
+ "client_id": "757523123677-5uct36sksguq3v4ngeec8ofc31ipf8hl.apps.googleusercontent.com",
"client_type": 2,
"ios_info": {
- "bundle_id": "com.cornellgo.game"
+ "bundle_id": "com.cornellgo.CornellGO"
}
}
]
@@ -61,19 +77,11 @@
},
"oauth_client": [
{
- "client_id": "757523123677-lhftm1kuh7k0uqkhc62d378um4nb5e3g.apps.googleusercontent.com",
- "client_type": 1,
- "android_info": {
- "package_name": "com.cornellgo.game",
- "certificate_hash": "d6e7da6b98f7884510d3826068e668c5bb7ec89b"
- }
- },
- {
- "client_id": "757523123677-q8o2d3tahsmm9i68j1sf33ka49qsgalq.apps.googleusercontent.com",
+ "client_id": "757523123677-q8lt36h21g5kcmvvqe07f5krldkb4k4i.apps.googleusercontent.com",
"client_type": 1,
"android_info": {
"package_name": "com.cornellgo.game",
- "certificate_hash": "98efe77cdeb1f8f17e7c3634a8700ae7361aaa08"
+ "certificate_hash": "e8ec9df2de92f3ff018926aba9448be15c464a4e"
}
},
{
@@ -83,7 +91,7 @@
],
"api_key": [
{
- "current_key": "AIzaSyDSKPt3T-sBGcaS5vQGw-FDkgOBTryxhUQ"
+ "current_key": "AIzaSyCNuTQ0eTjwXde0NMNMFaO6c3u5AYlNiXA"
},
{
"current_key": "AIzaSyBBGoQlbjlNCBfxiob-mkm1TCougaHqcu4"
@@ -97,10 +105,10 @@
"client_type": 3
},
{
- "client_id": "757523123677-cso74eimkjqkcuce69nrf4c637k3db6t.apps.googleusercontent.com",
+ "client_id": "757523123677-5uct36sksguq3v4ngeec8ofc31ipf8hl.apps.googleusercontent.com",
"client_type": 2,
"ios_info": {
- "bundle_id": "com.cornellgo.game"
+ "bundle_id": "com.cornellgo.CornellGO"
}
}
]
@@ -109,4 +117,4 @@
}
],
"configuration_version": "1"
-}
\ No newline at end of file
+}
diff --git a/game/android/app/src/main/AndroidManifest.xml b/game/android/app/src/main/AndroidManifest.xml
index 852baa93..f9cdff15 100644
--- a/game/android/app/src/main/AndroidManifest.xml
+++ b/game/android/app/src/main/AndroidManifest.xml
@@ -3,7 +3,7 @@
-
+
diff --git a/game/android/app/src/main/res/mipmap-hdpi/launcher_icon.png b/game/android/app/src/main/res/mipmap-hdpi/launcher_icon.png
new file mode 100644
index 00000000..7d7c2013
Binary files /dev/null and b/game/android/app/src/main/res/mipmap-hdpi/launcher_icon.png differ
diff --git a/game/android/app/src/main/res/mipmap-mdpi/launcher_icon.png b/game/android/app/src/main/res/mipmap-mdpi/launcher_icon.png
new file mode 100644
index 00000000..786c0c4c
Binary files /dev/null and b/game/android/app/src/main/res/mipmap-mdpi/launcher_icon.png differ
diff --git a/game/android/app/src/main/res/mipmap-xhdpi/launcher_icon.png b/game/android/app/src/main/res/mipmap-xhdpi/launcher_icon.png
new file mode 100644
index 00000000..b332938f
Binary files /dev/null and b/game/android/app/src/main/res/mipmap-xhdpi/launcher_icon.png differ
diff --git a/game/android/app/src/main/res/mipmap-xxhdpi/launcher_icon.png b/game/android/app/src/main/res/mipmap-xxhdpi/launcher_icon.png
new file mode 100644
index 00000000..03bba25a
Binary files /dev/null and b/game/android/app/src/main/res/mipmap-xxhdpi/launcher_icon.png differ
diff --git a/game/android/app/src/main/res/mipmap-xxxhdpi/launcher_icon.png b/game/android/app/src/main/res/mipmap-xxxhdpi/launcher_icon.png
new file mode 100644
index 00000000..03fbcb88
Binary files /dev/null and b/game/android/app/src/main/res/mipmap-xxxhdpi/launcher_icon.png differ
diff --git a/game/assets/icons/Podium1stRed.svg b/game/assets/icons/Podium1stRed.svg
deleted file mode 100644
index 26248c19..00000000
--- a/game/assets/icons/Podium1stRed.svg
+++ /dev/null
@@ -1,12 +0,0 @@
-
diff --git a/game/assets/icons/Podium2ndRed.svg b/game/assets/icons/Podium2ndRed.svg
deleted file mode 100644
index 2f9189a7..00000000
--- a/game/assets/icons/Podium2ndRed.svg
+++ /dev/null
@@ -1,10 +0,0 @@
-
diff --git a/game/assets/icons/Podium3rdRed.svg b/game/assets/icons/Podium3rdRed.svg
deleted file mode 100644
index 552b1d3b..00000000
--- a/game/assets/icons/Podium3rdRed.svg
+++ /dev/null
@@ -1,12 +0,0 @@
-
diff --git a/game/assets/icons/achievementgold.svg b/game/assets/icons/achievementgold.svg
new file mode 100644
index 00000000..ce365544
--- /dev/null
+++ b/game/assets/icons/achievementgold.svg
@@ -0,0 +1,61 @@
+
\ No newline at end of file
diff --git a/game/assets/icons/achievementsilver.svg b/game/assets/icons/achievementsilver.svg
new file mode 100644
index 00000000..09a3cc5a
--- /dev/null
+++ b/game/assets/icons/achievementsilver.svg
@@ -0,0 +1,33 @@
+
diff --git a/game/assets/icons/bronzestar.svg b/game/assets/icons/bronzestar.svg
deleted file mode 100644
index 81569254..00000000
--- a/game/assets/icons/bronzestar.svg
+++ /dev/null
@@ -1,29 +0,0 @@
-
diff --git a/game/assets/icons/goldstar.svg b/game/assets/icons/goldstar.svg
deleted file mode 100644
index f51a4aa5..00000000
--- a/game/assets/icons/goldstar.svg
+++ /dev/null
@@ -1,29 +0,0 @@
-
diff --git a/game/assets/icons/podium1blank.svg b/game/assets/icons/podium1blank.svg
new file mode 100644
index 00000000..c97b9c42
--- /dev/null
+++ b/game/assets/icons/podium1blank.svg
@@ -0,0 +1,32 @@
+
diff --git a/game/assets/icons/podium1highlighted.svg b/game/assets/icons/podium1highlighted.svg
deleted file mode 100644
index 5ddec862..00000000
--- a/game/assets/icons/podium1highlighted.svg
+++ /dev/null
@@ -1,5 +0,0 @@
-
diff --git a/game/assets/icons/podium1red.svg b/game/assets/icons/podium1red.svg
deleted file mode 100644
index 72fa62c8..00000000
--- a/game/assets/icons/podium1red.svg
+++ /dev/null
@@ -1,5 +0,0 @@
-
diff --git a/game/assets/icons/podium1redblank.svg b/game/assets/icons/podium1redblank.svg
deleted file mode 100644
index 27a48ac6..00000000
--- a/game/assets/icons/podium1redblank.svg
+++ /dev/null
@@ -1,4 +0,0 @@
-
diff --git a/game/assets/icons/podium1user.svg b/game/assets/icons/podium1user.svg
new file mode 100644
index 00000000..5d951dbb
--- /dev/null
+++ b/game/assets/icons/podium1user.svg
@@ -0,0 +1,32 @@
+
diff --git a/game/assets/icons/podium2blank.svg b/game/assets/icons/podium2blank.svg
new file mode 100644
index 00000000..d4a80410
--- /dev/null
+++ b/game/assets/icons/podium2blank.svg
@@ -0,0 +1,31 @@
+
diff --git a/game/assets/icons/podium2highlighted.svg b/game/assets/icons/podium2highlighted.svg
deleted file mode 100644
index 99bf3920..00000000
--- a/game/assets/icons/podium2highlighted.svg
+++ /dev/null
@@ -1,5 +0,0 @@
-
diff --git a/game/assets/icons/podium2red.svg b/game/assets/icons/podium2red.svg
deleted file mode 100644
index 2baf7ca3..00000000
--- a/game/assets/icons/podium2red.svg
+++ /dev/null
@@ -1,5 +0,0 @@
-
diff --git a/game/assets/icons/podium2user.svg b/game/assets/icons/podium2user.svg
new file mode 100644
index 00000000..612e3669
--- /dev/null
+++ b/game/assets/icons/podium2user.svg
@@ -0,0 +1,31 @@
+
diff --git a/game/assets/icons/podium3blank.svg b/game/assets/icons/podium3blank.svg
new file mode 100644
index 00000000..9b7da4d6
--- /dev/null
+++ b/game/assets/icons/podium3blank.svg
@@ -0,0 +1,31 @@
+
diff --git a/game/assets/icons/podium3highlighted.svg b/game/assets/icons/podium3highlighted.svg
deleted file mode 100644
index ac807851..00000000
--- a/game/assets/icons/podium3highlighted.svg
+++ /dev/null
@@ -1,5 +0,0 @@
-
diff --git a/game/assets/icons/podium3red.svg b/game/assets/icons/podium3red.svg
deleted file mode 100644
index 62025d1e..00000000
--- a/game/assets/icons/podium3red.svg
+++ /dev/null
@@ -1,5 +0,0 @@
-
diff --git a/game/assets/icons/podium3user.svg b/game/assets/icons/podium3user.svg
new file mode 100644
index 00000000..77158a2d
--- /dev/null
+++ b/game/assets/icons/podium3user.svg
@@ -0,0 +1,31 @@
+
diff --git a/game/assets/icons/red1podium.svg b/game/assets/icons/red1podium.svg
deleted file mode 100644
index e50ce6c6..00000000
--- a/game/assets/icons/red1podium.svg
+++ /dev/null
@@ -1,11 +0,0 @@
-
diff --git a/game/assets/icons/red2podium.svg b/game/assets/icons/red2podium.svg
deleted file mode 100644
index ab2c666f..00000000
--- a/game/assets/icons/red2podium.svg
+++ /dev/null
@@ -1,11 +0,0 @@
-
diff --git a/game/assets/icons/red3podium.svg b/game/assets/icons/red3podium.svg
deleted file mode 100644
index f00dbd92..00000000
--- a/game/assets/icons/red3podium.svg
+++ /dev/null
@@ -1,11 +0,0 @@
-
diff --git a/game/assets/icons/silverstar.svg b/game/assets/icons/silverstar.svg
deleted file mode 100644
index 4144a8ce..00000000
--- a/game/assets/icons/silverstar.svg
+++ /dev/null
@@ -1,29 +0,0 @@
-
diff --git a/game/assets/icons/yellow1podium.svg b/game/assets/icons/yellow1podium.svg
deleted file mode 100644
index b837ed52..00000000
--- a/game/assets/icons/yellow1podium.svg
+++ /dev/null
@@ -1,11 +0,0 @@
-
diff --git a/game/assets/icons/yellow2podium.svg b/game/assets/icons/yellow2podium.svg
deleted file mode 100644
index c1a5ab7a..00000000
--- a/game/assets/icons/yellow2podium.svg
+++ /dev/null
@@ -1,11 +0,0 @@
-
diff --git a/game/assets/icons/yellow3podium.svg b/game/assets/icons/yellow3podium.svg
deleted file mode 100644
index fb54de24..00000000
--- a/game/assets/icons/yellow3podium.svg
+++ /dev/null
@@ -1,11 +0,0 @@
-
diff --git a/game/assets/images/challenge-completed-bg.svg b/game/assets/images/challenge-completed-bg.svg
index ab2ce837..93b29e35 100644
--- a/game/assets/images/challenge-completed-bg.svg
+++ b/game/assets/images/challenge-completed-bg.svg
@@ -1,108 +1,62 @@
\ No newline at end of file
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/game/assets/images/main_icon.png b/game/assets/images/main_icon.png
index c1c53831..9fb25e7b 100644
Binary files a/game/assets/images/main_icon.png and b/game/assets/images/main_icon.png differ
diff --git a/game/assets/images/yellow_bear_prof.svg b/game/assets/images/yellow_bear_prof.svg
new file mode 100644
index 00000000..3266dda5
--- /dev/null
+++ b/game/assets/images/yellow_bear_prof.svg
@@ -0,0 +1,9 @@
+
diff --git a/game/ios/Podfile.lock b/game/ios/Podfile.lock
index ca34db12..4c9cc639 100644
--- a/game/ios/Podfile.lock
+++ b/game/ios/Podfile.lock
@@ -1,25 +1,25 @@
PODS:
- - AppAuth (1.7.3):
- - AppAuth/Core (= 1.7.3)
- - AppAuth/ExternalUserAgent (= 1.7.3)
- - AppAuth/Core (1.7.3)
- - AppAuth/ExternalUserAgent (1.7.3):
+ - AppAuth (1.7.4):
+ - AppAuth/Core (= 1.7.4)
+ - AppAuth/ExternalUserAgent (= 1.7.4)
+ - AppAuth/Core (1.7.4)
+ - AppAuth/ExternalUserAgent (1.7.4):
- AppAuth/Core
- device_info (0.0.1):
- Flutter
- device_info_plus (0.0.1):
- Flutter
- - Firebase (10.23.0):
- - Firebase/Core (= 10.23.0)
- - Firebase/Analytics (10.23.0):
+ - Firebase (10.24.0):
+ - Firebase/Core (= 10.24.0)
+ - Firebase/Analytics (10.24.0):
- Firebase/Core
- - Firebase/Core (10.23.0):
+ - Firebase/Core (10.24.0):
- Firebase/CoreOnly
- - FirebaseAnalytics (~> 10.23.0)
- - Firebase/CoreOnly (10.23.0):
- - FirebaseCore (= 10.23.0)
- - FirebaseAnalytics (10.23.0):
- - FirebaseAnalytics/AdIdSupport (= 10.23.0)
+ - FirebaseAnalytics (~> 10.24.0)
+ - Firebase/CoreOnly (10.24.0):
+ - FirebaseCore (= 10.24.0)
+ - FirebaseAnalytics (10.24.0):
+ - FirebaseAnalytics/AdIdSupport (= 10.24.0)
- FirebaseCore (~> 10.0)
- FirebaseInstallations (~> 10.0)
- GoogleUtilities/AppDelegateSwizzler (~> 7.11)
@@ -27,22 +27,22 @@ PODS:
- GoogleUtilities/Network (~> 7.11)
- "GoogleUtilities/NSData+zlib (~> 7.11)"
- nanopb (< 2.30911.0, >= 2.30908.0)
- - FirebaseAnalytics/AdIdSupport (10.23.0):
+ - FirebaseAnalytics/AdIdSupport (10.24.0):
- FirebaseCore (~> 10.0)
- FirebaseInstallations (~> 10.0)
- - GoogleAppMeasurement (= 10.23.0)
+ - GoogleAppMeasurement (= 10.24.0)
- GoogleUtilities/AppDelegateSwizzler (~> 7.11)
- GoogleUtilities/MethodSwizzler (~> 7.11)
- GoogleUtilities/Network (~> 7.11)
- "GoogleUtilities/NSData+zlib (~> 7.11)"
- nanopb (< 2.30911.0, >= 2.30908.0)
- - FirebaseCore (10.23.0):
+ - FirebaseCore (10.24.0):
- FirebaseCoreInternal (~> 10.0)
- GoogleUtilities/Environment (~> 7.12)
- GoogleUtilities/Logger (~> 7.12)
- - FirebaseCoreInternal (10.23.0):
+ - FirebaseCoreInternal (10.24.0):
- "GoogleUtilities/NSData+zlib (~> 7.8)"
- - FirebaseInstallations (10.23.0):
+ - FirebaseInstallations (10.24.0):
- FirebaseCore (~> 10.0)
- GoogleUtilities/Environment (~> 7.8)
- GoogleUtilities/UserDefaults (~> 7.8)
@@ -55,9 +55,6 @@ PODS:
- fluttertoast (0.0.2):
- Flutter
- Toast
- - FMDB (2.7.9):
- - FMDB/standard (= 2.7.9)
- - FMDB/standard (2.7.9)
- geolocator_apple (1.2.0):
- Flutter
- google_maps_flutter_ios (0.0.1):
@@ -65,7 +62,7 @@ PODS:
- GoogleMaps (< 9.0)
- google_sign_in_ios (0.0.1):
- Flutter
- - GoogleSignIn (~> 6.2)
+ - GoogleSignIn (~> 7.0)
- GoogleAppMeasurement (10.23.0):
- GoogleAppMeasurement/AdIdSupport (= 10.23.0)
- GoogleUtilities/AppDelegateSwizzler (~> 7.11)
@@ -73,14 +70,14 @@ PODS:
- GoogleUtilities/Network (~> 7.11)
- "GoogleUtilities/NSData+zlib (~> 7.11)"
- nanopb (< 2.30911.0, >= 2.30908.0)
- - GoogleAppMeasurement/AdIdSupport (10.23.0):
- - GoogleAppMeasurement/WithoutAdIdSupport (= 10.23.0)
+ - GoogleAppMeasurement/AdIdSupport (10.24.0):
+ - GoogleAppMeasurement/WithoutAdIdSupport (= 10.24.0)
- GoogleUtilities/AppDelegateSwizzler (~> 7.11)
- GoogleUtilities/MethodSwizzler (~> 7.11)
- GoogleUtilities/Network (~> 7.11)
- "GoogleUtilities/NSData+zlib (~> 7.11)"
- nanopb (< 2.30911.0, >= 2.30908.0)
- - GoogleAppMeasurement/WithoutAdIdSupport (10.23.0):
+ - GoogleAppMeasurement/WithoutAdIdSupport (10.24.0):
- GoogleUtilities/AppDelegateSwizzler (~> 7.11)
- GoogleUtilities/MethodSwizzler (~> 7.11)
- GoogleUtilities/Network (~> 7.11)
@@ -91,10 +88,10 @@ PODS:
- GoogleMaps/Base (7.4.0)
- GoogleMaps/Maps (7.4.0):
- GoogleMaps/Base
- - GoogleSignIn (6.2.4):
+ - GoogleSignIn (7.0.0):
- AppAuth (~> 1.5)
- - GTMAppAuth (~> 1.3)
- - GTMSessionFetcher/Core (< 3.0, >= 1.1)
+ - GTMAppAuth (< 3.0, >= 1.3)
+ - GTMSessionFetcher/Core (< 4.0, >= 1.1)
- GoogleUtilities/AppDelegateSwizzler (7.13.0):
- GoogleUtilities/Environment
- GoogleUtilities/Logger
@@ -123,10 +120,10 @@ PODS:
- GoogleUtilities/UserDefaults (7.13.0):
- GoogleUtilities/Logger
- GoogleUtilities/Privacy
- - GTMAppAuth (1.3.1):
+ - GTMAppAuth (2.0.0):
- AppAuth/Core (~> 1.6)
- - GTMSessionFetcher/Core (< 3.0, >= 1.5)
- - GTMSessionFetcher/Core (2.3.0)
+ - GTMSessionFetcher/Core (< 4.0, >= 1.5)
+ - GTMSessionFetcher/Core (3.3.2)
- location (0.0.1):
- Flutter
- nanopb (2.30910.0):
@@ -137,14 +134,14 @@ PODS:
- path_provider_foundation (0.0.1):
- Flutter
- FlutterMacOS
- - permission_handler_apple (9.1.1):
+ - permission_handler_apple (9.3.0):
- Flutter
- platform_device_id (0.0.1):
- Flutter
- PromisesObjC (2.4.0)
- sqflite (0.0.3):
- Flutter
- - FMDB (>= 2.7.5)
+ - FlutterMacOS
- Toast (4.1.0)
- url_launcher_ios (0.0.1):
- Flutter
@@ -160,12 +157,12 @@ DEPENDENCIES:
- fluttertoast (from `.symlinks/plugins/fluttertoast/ios`)
- geolocator_apple (from `.symlinks/plugins/geolocator_apple/ios`)
- google_maps_flutter_ios (from `.symlinks/plugins/google_maps_flutter_ios/ios`)
- - google_sign_in_ios (from `.symlinks/plugins/google_sign_in_ios/ios`)
+ - google_sign_in_ios (from `.symlinks/plugins/google_sign_in_ios/darwin`)
- location (from `.symlinks/plugins/location/ios`)
- path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`)
- permission_handler_apple (from `.symlinks/plugins/permission_handler_apple/ios`)
- platform_device_id (from `.symlinks/plugins/platform_device_id/ios`)
- - sqflite (from `.symlinks/plugins/sqflite/ios`)
+ - sqflite (from `.symlinks/plugins/sqflite/darwin`)
- url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`)
SPEC REPOS:
@@ -176,7 +173,6 @@ SPEC REPOS:
- FirebaseCore
- FirebaseCoreInternal
- FirebaseInstallations
- - FMDB
- GoogleAppMeasurement
- GoogleMaps
- GoogleSignIn
@@ -205,7 +201,7 @@ EXTERNAL SOURCES:
google_maps_flutter_ios:
:path: ".symlinks/plugins/google_maps_flutter_ios/ios"
google_sign_in_ios:
- :path: ".symlinks/plugins/google_sign_in_ios/ios"
+ :path: ".symlinks/plugins/google_sign_in_ios/darwin"
location:
:path: ".symlinks/plugins/location/ios"
path_provider_foundation:
@@ -215,42 +211,41 @@ EXTERNAL SOURCES:
platform_device_id:
:path: ".symlinks/plugins/platform_device_id/ios"
sqflite:
- :path: ".symlinks/plugins/sqflite/ios"
+ :path: ".symlinks/plugins/sqflite/darwin"
url_launcher_ios:
:path: ".symlinks/plugins/url_launcher_ios/ios"
SPEC CHECKSUMS:
- AppAuth: a13994980c1ec792f7e2e665acd4d4aa6be43240
+ AppAuth: 182c5b88630569df5acb672720534756c29b3358
device_info: d7d233b645a32c40dfdc212de5cf646ca482f175
device_info_plus: c6fb39579d0f423935b0c9ce7ee2f44b71b9fce6
- Firebase: 333ec7c6b12fa09c77b5162cda6b862102211d50
- FirebaseAnalytics: 45f6e2e5ef8ccbb90be73ae983c3b20fa78837f7
- FirebaseCore: 63efb128decaebb04c4033ed4e05fb0bb1cccef1
- FirebaseCoreInternal: 6a292e6f0bece1243a737e81556e56e5e19282e3
- FirebaseInstallations: 42d6ead4605d6eafb3b6683674e80e18eb6f2c35
- Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
+ Firebase: 91fefd38712feb9186ea8996af6cbdef41473442
+ FirebaseAnalytics: b5efc493eb0f40ec560b04a472e3e1a15d39ca13
+ FirebaseCore: 11dc8a16dfb7c5e3c3f45ba0e191a33ac4f50894
+ FirebaseCoreInternal: bcb5acffd4ea05e12a783ecf835f2210ce3dc6af
+ FirebaseInstallations: 8f581fca6478a50705d2bd2abd66d306e0f5736e
+ Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
flutter_config: f48f0d47a284f1791aacce2687eabb3309ba7a41
flutter_secure_storage: 23fc622d89d073675f2eaa109381aefbcf5a49be
fluttertoast: 31b00dabfa7fb7bacd9e7dbee580d7a2ff4bf265
- FMDB: aa44149f6fb634b1ac54f64f47064bb0d0c5a032
- geolocator_apple: cc556e6844d508c95df1e87e3ea6fa4e58c50401
+ geolocator_apple: 9157311f654584b9bb72686c55fc02a97b73f461
google_maps_flutter_ios: d1318b4ff711612cab16862d7a87e31a7403d458
- google_sign_in_ios: 1256ff9d941db546373826966720b0c24804bcdd
+ google_sign_in_ios: 8115e3fbe097e6509beb819ed602d47369d9011f
GoogleAppMeasurement: 453eb0de99fcf2bdec9403e9ac5d7871fdba3e3f
GoogleMaps: 032f676450ba0779bd8ce16840690915f84e57ac
- GoogleSignIn: 5651ce3a61e56ca864160e79b484cd9ed3f49b7a
+ GoogleSignIn: b232380cf495a429b8095d3178a8d5855b42e842
GoogleUtilities: d053d902a8edaa9904e1bd00c37535385b8ed152
- GTMAppAuth: 0ff230db599948a9ad7470ca667337803b3fc4dd
- GTMSessionFetcher: 3a63d75eecd6aa32c2fc79f578064e1214dfdec2
+ GTMAppAuth: 99fb010047ba3973b7026e45393f51f27ab965ae
+ GTMSessionFetcher: 0e876eea9782ec6462e91ab872711c357322c94f
location: d5cf8598915965547c3f36761ae9cc4f4e87d22e
nanopb: 438bc412db1928dac798aa6fd75726007be04262
- path_provider_foundation: 29f094ae23ebbca9d3d0cec13889cd9060c0e943
+ path_provider_foundation: 3784922295ac71e43754bd15e0653ccfd36a147c
permission_handler_apple: e76247795d700c14ea09e3a2d8855d41ee80a2e6
platform_device_id: 81b3e2993881f87d0c82ef151dc274df4869aef5
PromisesObjC: f5707f49cb48b9636751c5b2e7d227e43fba9f47
- sqflite: 31f7eba61e3074736dff8807a9b41581e4f7f15a
+ sqflite: 673a0e54cc04b7d6dba8d24fb8095b31c3a99eec
Toast: ec33c32b8688982cecc6348adeae667c1b9938da
- url_launcher_ios: 68d46cc9766d0c41dbdc884310529557e3cd7a86
+ url_launcher_ios: bbd758c6e7f9fd7b5b1d4cde34d2b95fcce5e812
PODFILE CHECKSUM: 025aa7201e4cab1f9c884abb0535b2c942d9df36
diff --git a/game/ios/Runner.xcodeproj/project.pbxproj b/game/ios/Runner.xcodeproj/project.pbxproj
index c7300787..6bc91567 100644
--- a/game/ios/Runner.xcodeproj/project.pbxproj
+++ b/game/ios/Runner.xcodeproj/project.pbxproj
@@ -159,7 +159,7 @@
97C146E61CF9000F007C117D /* Project object */ = {
isa = PBXProject;
attributes = {
- LastUpgradeCheck = 1430;
+ LastUpgradeCheck = 1510;
ORGANIZATIONNAME = "";
TargetAttributes = {
97C146ED1CF9000F007C117D = {
diff --git a/game/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/game/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
index b52b2e69..e67b2808 100644
--- a/game/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
+++ b/game/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
@@ -1,6 +1,6 @@
0 ? tasksFinished / totalTasks : 0) *
+ constraints.maxWidth,
+ height: 13,
+ alignment: Alignment.centerLeft,
+ child: Container(
+ decoration: new BoxDecoration(
+ color: Color.fromARGB(197, 237, 86, 86),
+ shape: BoxShape.rectangle,
+ borderRadius: BorderRadius.all(Radius.circular(16.0)),
+ ),
+ ),
+ ),
+ Container(
+ height: 3,
+ width: (totalTasks > 0 ? tasksFinished / totalTasks : 0) *
+ constraints.maxWidth -
+ 16,
+ margin: EdgeInsets.only(left: 8, top: 3),
+ alignment: Alignment.centerLeft,
+ decoration: new BoxDecoration(
+ color: Color(0x99F3C6C6),
+ shape: BoxShape.rectangle,
+ borderRadius: BorderRadius.all(Radius.circular(5.0)),
+ ),
+ ),
+ ]);
+ })),
+ Padding(
+ padding: const EdgeInsets.only(left: 8.0),
+ child: Text(
+ tasksFinished.toString() + "/" + totalTasks.toString(),
+ ),
+ ),
+ ],
+ );
+ }
+}
+
+class AchievementCell extends StatefulWidget {
+ final SvgPicture thumbnail;
+ final String description;
+ final int tasksFinished;
+ final int totalTasks;
+
+ const AchievementCell(
+ this.description, this.thumbnail, this.tasksFinished, this.totalTasks,
+ {Key? key})
+ : super(key: key);
+
+ @override
+ State createState() =>
+ _AchievementCellState(description, thumbnail, tasksFinished, totalTasks);
+}
+
+class _AchievementCellState extends State {
+ final String description;
+ final SvgPicture thumbnail;
+ final int tasksFinished;
+ final int totalTasks;
+ // newly added field
+ // final int totalDistance;
+
+ _AchievementCellState(
+ this.description, this.thumbnail, this.tasksFinished, this.totalTasks
+ // newly added field
+ // this.totalDistance
+ );
+
+ @override
+ Widget build(BuildContext context) {
+ return GestureDetector(
+ onTap: () async {},
+ child: Container(
+ padding: EdgeInsets.all(5),
+ decoration: BoxDecoration(
+ color: Colors.white,
+ borderRadius: BorderRadius.circular(15),
+ boxShadow: [
+ BoxShadow(
+ color: Color.fromARGB(255, 198, 198, 198),
+ blurRadius: 2,
+ offset: Offset(0, 4),
+ ),
+ ],
+ ),
+ child: Container(
+ margin: EdgeInsets.all(10),
+ height: 64,
+ child: Row(
+ children: [
+ Container(margin: EdgeInsets.only(right: 12), child: thumbnail),
+ Column(
+ mainAxisSize: MainAxisSize.max,
+ crossAxisAlignment: CrossAxisAlignment.start,
+ mainAxisAlignment: MainAxisAlignment.center,
+ children: [
+ Align(
+ alignment: Alignment.centerLeft,
+ child: Text(
+ description,
+ style: TextStyle(
+ color: Color.fromARGB(204, 0, 0, 0),
+ fontSize: 14,
+ fontFamily: 'Poppins',
+ fontWeight: FontWeight.w500,
+ ),
+ ),
+ ),
+ Spacer(),
+ Align(
+ alignment: Alignment.bottomCenter,
+ child: LoadingBar(3, 4)),
+ ],
+ )
+ ],
+ ),
+ ),
+ ),
+ );
+ }
+}
diff --git a/game/lib/achievements/achievements_page.dart b/game/lib/achievements/achievements_page.dart
new file mode 100644
index 00000000..eb3f75ad
--- /dev/null
+++ b/game/lib/achievements/achievements_page.dart
@@ -0,0 +1,205 @@
+import 'dart:io';
+import 'package:flutter/material.dart';
+import 'package:flutter_svg/flutter_svg.dart';
+import 'package:game/achievements/achievement_cell.dart';
+import 'package:game/api/game_api.dart';
+import 'package:game/api/game_client_dto.dart';
+import 'package:game/model/challenge_model.dart';
+import 'package:game/model/event_model.dart';
+import 'package:game/model/group_model.dart';
+import 'package:game/utils/utility_functions.dart';
+import 'package:game/model/tracker_model.dart';
+import 'package:provider/provider.dart';
+
+class AchievementCellDto {
+ AchievementCellDto({
+ required this.location,
+ required this.name,
+ required this.lat,
+ required this.long,
+ required this.thumbnail,
+ required this.complete,
+ required this.description,
+ required this.difficulty,
+ required this.points,
+ required this.eventId,
+ });
+ late String location;
+ late String name;
+ late double? lat;
+ late double? long;
+ late SvgPicture thumbnail;
+ late bool complete;
+ late String description;
+ late String difficulty;
+ late int points;
+ late String eventId;
+}
+
+class AchievementsPage extends StatefulWidget {
+ const AchievementsPage({super.key});
+
+ @override
+ State createState() => _AchievementsPageState();
+}
+
+class _AchievementsPageState extends State {
+ List selectedCategories = [];
+ List selectedLocations = [];
+ String selectedDifficulty = '';
+
+ List eventData = [];
+
+ @override
+ Widget build(BuildContext context) {
+ return Container(
+ decoration: BoxDecoration(
+ color: Color(0xFFED5656),
+ ),
+ child: SafeArea(
+ bottom: false,
+ child: Scaffold(
+ appBar: AppBar(
+ title: const Text('Achievements'),
+ ),
+ body: Container(
+ width: double.infinity,
+ height: double.infinity,
+ decoration: BoxDecoration(
+ color: Color.fromARGB(255, 255, 248, 241),
+ ),
+ child: Padding(
+ padding: EdgeInsets.all(30),
+ child: Column(
+ children: [
+ Expanded(child: Consumer5(
+ builder: (context,
+ myEventModel,
+ groupModel,
+ trackerModel,
+ challengeModel,
+ apiClient,
+ child) {
+ if (myEventModel.searchResults == null) {
+ myEventModel.searchEvents(
+ 0,
+ 1000,
+ [
+ EventTimeLimitationDto.PERPETUAL,
+ EventTimeLimitationDto.LIMITED_TIME
+ ],
+ false,
+ false,
+ false);
+ }
+ final events = myEventModel.searchResults ?? [];
+ if (!events.any((element) =>
+ element.id == groupModel.curEventId)) {
+ final curEvent = myEventModel
+ .getEventById(groupModel.curEventId ?? "");
+ if (curEvent != null) events.add(curEvent);
+ }
+ eventData.clear();
+
+ for (EventDto event in events) {
+ var tracker =
+ trackerModel.trackerByEventId(event.id);
+ var numberCompleted =
+ tracker?.prevChallenges.length ?? 0;
+ var complete =
+ (numberCompleted == event.challenges?.length);
+ var locationCount = event.challenges?.length ?? 0;
+ DateTime now = DateTime.now();
+ DateTime endtime =
+ HttpDate.parse(event.endTime ?? "");
+
+ Duration timeTillExpire = endtime.difference(now);
+ if (locationCount != 1) continue;
+ var challenge = challengeModel
+ .getChallengeById(event.challenges?[0] ?? "");
+
+ // print("Doing Event with now/endtime " + event.description.toString() + now.toString() + "/" + endtime.toString());
+ if (challenge == null) {
+ // print("Challenge is null for event " + event.description.toString());
+
+ continue;
+ }
+ final challengeLocation =
+ challenge.location?.name ?? "";
+
+ bool eventMatchesDifficultySelection;
+ bool eventMatchesCategorySelection;
+ bool eventMatchesLocationSelection;
+
+ if (selectedDifficulty.length == 0 ||
+ selectedDifficulty == event.difficulty?.name)
+ eventMatchesDifficultySelection = true;
+ else
+ eventMatchesDifficultySelection = false;
+
+ if (selectedLocations.length > 0) {
+ if (selectedLocations.contains(challengeLocation))
+ eventMatchesLocationSelection = true;
+ else
+ eventMatchesLocationSelection = false;
+ } else
+ eventMatchesLocationSelection = true;
+
+ if (selectedCategories.length > 0) {
+ if (selectedCategories
+ .contains(event.category?.name))
+ eventMatchesCategorySelection = true;
+ else
+ eventMatchesCategorySelection = false;
+ } else
+ eventMatchesCategorySelection = true;
+ if (!complete &&
+ !timeTillExpire.isNegative &&
+ eventMatchesDifficultySelection &&
+ eventMatchesCategorySelection &&
+ eventMatchesLocationSelection) {
+ eventData.add(AchievementCellDto(
+ location:
+ friendlyLocation[challenge.location] ?? "",
+ name: event.name ?? "",
+ lat: challenge.latF ?? null,
+ long: challenge.longF ?? null,
+ thumbnail: SvgPicture.asset(
+ "assets/icons/achievementsilver.svg"),
+ complete: complete,
+ description: event.description ?? "",
+ difficulty:
+ friendlyDifficulty[event.difficulty] ?? "",
+ points: challenge.points ?? 0,
+ eventId: event.id,
+ ));
+ } else if (event.id == groupModel.curEventId) {
+ apiClient.serverApi?.setCurrentEvent(
+ SetCurrentEventDto(eventId: ""));
+ }
+ }
+
+ return ListView.separated(
+ padding: const EdgeInsets.symmetric(horizontal: 3),
+ itemCount: eventData.length,
+ itemBuilder: (context, index) {
+ return AchievementCell(
+ key: UniqueKey(),
+ eventData[index].description,
+ eventData[index].thumbnail,
+ 3,
+ 4);
+ },
+ physics: BouncingScrollPhysics(),
+ separatorBuilder: (context, index) {
+ return SizedBox(height: 10);
+ },
+ );
+ }))
+ ],
+ ),
+ )),
+ )));
+ }
+}
diff --git a/game/lib/api/game_api.dart b/game/lib/api/game_api.dart
index e60a4a3f..89171828 100644
--- a/game/lib/api/game_api.dart
+++ b/game/lib/api/game_api.dart
@@ -3,7 +3,9 @@ import 'dart:io';
import 'package:flutter/cupertino.dart';
import 'package:game/api/game_client_api.dart';
+import 'package:game/api/game_client_dto.dart';
import 'package:game/api/game_server_api.dart';
+import 'package:game/utils/utility_functions.dart';
import 'package:google_sign_in/google_sign_in.dart';
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
import 'package:socket_io_client/socket_io_client.dart' as IO;
@@ -55,6 +57,7 @@ class ApiClient extends ChangeNotifier {
IO.OptionBuilder()
.setTransports(["websocket"])
.disableAutoConnect()
+ .disableReconnection()
.setAuth({'token': _accessToken})
.build());
@@ -62,6 +65,7 @@ class ApiClient extends ChangeNotifier {
_serverApi = null;
notifyListeners();
});
+
socket.onConnect((data) {
_socket = socket;
@@ -74,6 +78,7 @@ class ApiClient extends ChangeNotifier {
notifyListeners();
});
+
socket.onConnectError((data) {
connectionFailed = true;
notifyListeners();
@@ -88,7 +93,6 @@ class ApiClient extends ChangeNotifier {
_createSocket(true);
} else {
authenticated = false;
- _clientApi.disconnectedController.add(null);
_socket?.dispose();
_socket = null;
notifyListeners();
@@ -123,59 +127,105 @@ class ApiClient extends ChangeNotifier {
_refreshToken = token;
final access = await _refreshAccess(true);
authenticated = access;
- if (!access) {
- _clientApi.disconnectedController.add(null);
- }
notifyListeners();
return access;
}
authenticated = false;
- _clientApi.disconnectedController.add(null);
notifyListeners();
return false;
}
- Future connect(String idToken, Uri url, String enrollmentType,
- String year, String username) async {
+ Future connectDevice(
+ String year,
+ LoginEnrollmentTypeDto enrollmentType,
+ String username,
+ String college,
+ String major,
+ List interests) async {
+ final String? id = await getId();
+ return connect(id!, _deviceLoginUrl, year, enrollmentType, username,
+ college, major, interests,
+ noRegister: false);
+ }
+
+ Future connectGoogle(
+ GoogleSignInAccount gAccount,
+ String year,
+ LoginEnrollmentTypeDto enrollmentType,
+ String username,
+ String college,
+ String major,
+ List interests) async {
+ final auth = await gAccount.authentication;
+ return connect(auth.idToken ?? "", _googleLoginUrl, year, enrollmentType,
+ username, college, major, interests,
+ noRegister: false);
+ }
+
+ Future connectGoogleNoRegister(
+ GoogleSignInAccount gAccount) async {
+ final auth = await gAccount.authentication;
+ return connect(auth.idToken ?? "", _googleLoginUrl, "",
+ LoginEnrollmentTypeDto.GUEST, "", "", "", [],
+ noRegister: true);
+ }
+
+ Future connect(
+ String idToken,
+ Uri url,
+ String year,
+ LoginEnrollmentTypeDto enrollmentType,
+ String username,
+ String college,
+ String major,
+ List interests,
+ {bool noRegister = false}) async {
final pos = await GeoPoint.current();
- if (true) {
- final loginResponse = await http.post(url,
- headers: {
- 'Content-Type': 'application/json; charset=UTF-8',
- },
- body: jsonEncode({
- "idToken": idToken,
- "lat": pos?.lat.toString() ?? "0",
- "enrollmentType": enrollmentType,
- "year": year,
- "username": username,
- "long": pos?.long.toString() ?? "0",
- "aud": Platform.isIOS ? "ios" : "android"
- }));
-
- if (loginResponse.statusCode == 201 && loginResponse.body != "") {
- final responseBody = jsonDecode(loginResponse.body);
- this._accessToken = responseBody["accessToken"];
- this._refreshToken = responseBody["refreshToken"];
- await _saveToken();
- _createSocket(false);
- return loginResponse;
- } else {
- print(loginResponse.body);
- }
- authenticated = false;
- _clientApi.disconnectedController.add(null);
- notifyListeners();
- print("Failed to connect to server!");
- return null;
+ final loginDto = LoginDto(
+ idToken: idToken,
+ latF: pos.lat,
+ enrollmentType: enrollmentType,
+ year: year,
+ username: username,
+ college: college,
+ major: major,
+ interests: interests.join(","),
+ longF: pos.long,
+ aud: Platform.isIOS ? LoginAudDto.ios : LoginAudDto.android,
+ noRegister: noRegister);
+ /*
+ if (post != null) { */
+ final loginResponse = await http.post(url,
+ headers: {
+ 'Content-Type': 'application/json; charset=UTF-8',
+ },
+ body: jsonEncode(loginDto.toJson()));
+
+ if (loginResponse.statusCode == 201 && loginResponse.body != "") {
+ final responseBody = jsonDecode(loginResponse.body);
+ this._accessToken = responseBody["accessToken"];
+ this._refreshToken = responseBody["refreshToken"];
+ await _saveToken();
+ _createSocket(false);
+ return loginResponse;
+ } else {
+ print(loginResponse.body);
+ }
+ authenticated = false;
+ notifyListeners();
+
+ print("Failed to connect to server!");
+ return null;
+ /*
}
print("Failed to get location data!");
return null;
+ */
}
- Future connectGoogle() async {
+ Future signinGoogle() async {
final account = await _googleSignIn.signIn();
return account;
}
@@ -191,7 +241,6 @@ class ApiClient extends ChangeNotifier {
_socket = null;
authenticated = false;
- _clientApi.disconnectedController.add(null);
notifyListeners();
}
}
diff --git a/game/lib/api/game_client_api.dart b/game/lib/api/game_client_api.dart
index 15b4a686..ae08a79e 100644
--- a/game/lib/api/game_client_api.dart
+++ b/game/lib/api/game_client_api.dart
@@ -63,22 +63,27 @@ class GameClientApi {
Stream get updateOrganizationDataStream =>
_updateOrganizationDataController.stream;
- final _reconnectedController = StreamController.broadcast(sync: true);
- Stream get reconnectedStream => _reconnectedController.stream;
+ final _updateLeaderPositionController =
+ StreamController.broadcast(sync: true);
+ Stream get updateLeaderPositionStream =>
+ _updateLeaderPositionController.stream;
- final _reconnectingController = StreamController.broadcast(sync: true);
- Stream get reconnectingStream => _reconnectingController.stream;
+ final _reconnectedController = StreamController.broadcast(sync: true);
+ Stream get reconnectedStream => _reconnectedController.stream;
- final _connectedController = StreamController.broadcast(sync: true);
- Stream get connectedStream => _connectedController.stream;
+ final _reconnectingController = StreamController.broadcast(sync: true);
+ Stream get reconnectingStream => _reconnectingController.stream;
- final disconnectedController = StreamController.broadcast(sync: true);
- Stream get disconnectedStream => disconnectedController.stream;
+ final _connectedController = StreamController.broadcast(sync: true);
+ Stream get connectedStream => _connectedController.stream;
+
+ final disconnectedController = StreamController.broadcast(sync: true);
+ Stream get disconnectedStream => disconnectedController.stream;
void connectSocket(Socket sock) {
- sock.onReconnect((data) => _reconnectingController.add(null));
- sock.onReconnecting((data) => _reconnectedController.add(null));
- sock.onDisconnect((data) => disconnectedController.add(null));
+ sock.onReconnect((data) => _reconnectedController.add(true));
+ sock.onReconnecting((data) => _reconnectingController.add(true));
+ sock.onDisconnect((data) => disconnectedController.add(true));
sock.on(
"updateUserData",
@@ -135,7 +140,12 @@ class GameClientApi {
(data) => _updateOrganizationDataController
.add(UpdateOrganizationDataDto.fromJson(data)));
- _connectedController.add(null);
+ sock.on(
+ "updateLeaderPosition",
+ (data) => _updateLeaderPositionController
+ .add(UpdateLeaderPositionDto.fromJson(data)));
+
+ _connectedController.add(true);
}
GameClientApi() {}
diff --git a/game/lib/api/game_client_dto.dart b/game/lib/api/game_client_dto.dart
index 1a73ac1e..059a88fc 100644
--- a/game/lib/api/game_client_dto.dart
+++ b/game/lib/api/game_client_dto.dart
@@ -208,7 +208,7 @@ class AchievementTrackerDto {
class UpdateAchievementDataDto {
Map toJson() {
Map fields = {};
- fields['achievement'] = achievement!.toJson();
+ fields['achievement'] = achievement.toJson();
fields['deleted'] = deleted;
return fields;
}
@@ -258,27 +258,45 @@ class LoginDto {
Map toJson() {
Map fields = {};
fields['idToken'] = idToken;
- fields['lat'] = lat;
- fields['long'] = long;
+ fields['noRegister'] = noRegister;
+ if (latF != null) {
+ fields['latF'] = latF;
+ }
+ if (longF != null) {
+ fields['longF'] = longF;
+ }
if (username != null) {
fields['username'] = username;
}
if (year != null) {
fields['year'] = year;
}
+ if (college != null) {
+ fields['college'] = college;
+ }
+ if (major != null) {
+ fields['major'] = major;
+ }
+ if (interests != null) {
+ fields['interests'] = interests;
+ }
if (aud != null) {
fields['aud'] = aud!.name;
}
- fields['enrollmentType'] = enrollmentType!.name;
+ fields['enrollmentType'] = enrollmentType.name;
return fields;
}
LoginDto.fromJson(Map fields) {
idToken = fields["idToken"];
- lat = fields["lat"];
- long = fields["long"];
+ noRegister = fields["noRegister"];
+ latF = fields.containsKey('latF') ? (fields["latF"]!.toDouble()) : null;
+ longF = fields.containsKey('longF') ? (fields["longF"]!.toDouble()) : null;
username = fields.containsKey('username') ? (fields["username"]) : null;
year = fields.containsKey('year') ? (fields["year"]) : null;
+ college = fields.containsKey('college') ? (fields["college"]) : null;
+ major = fields.containsKey('major') ? (fields["major"]) : null;
+ interests = fields.containsKey('interests') ? (fields["interests"]) : null;
aud = fields.containsKey('aud')
? (LoginAudDto.values.byName(fields['aud']))
: null;
@@ -288,29 +306,41 @@ class LoginDto {
void partialUpdate(LoginDto other) {
idToken = other.idToken;
- lat = other.lat;
- long = other.long;
+ noRegister = other.noRegister;
+ latF = other.latF == null ? latF : other.latF;
+ longF = other.longF == null ? longF : other.longF;
username = other.username == null ? username : other.username;
year = other.year == null ? year : other.year;
+ college = other.college == null ? college : other.college;
+ major = other.major == null ? major : other.major;
+ interests = other.interests == null ? interests : other.interests;
aud = other.aud == null ? aud : other.aud;
enrollmentType = other.enrollmentType;
}
LoginDto({
required this.idToken,
- required this.lat,
- required this.long,
+ required this.noRegister,
+ this.latF,
+ this.longF,
this.username,
this.year,
+ this.college,
+ this.major,
+ this.interests,
this.aud,
required this.enrollmentType,
});
late String idToken;
- late int lat;
- late int long;
+ late bool noRegister;
+ late double? latF;
+ late double? longF;
late String? username;
late String? year;
+ late String? college;
+ late String? major;
+ late String? interests;
late LoginAudDto? aud;
late LoginEnrollmentTypeDto enrollmentType;
}
@@ -487,7 +517,7 @@ class RequestChallengeDataDto {
class UpdateChallengeDataDto {
Map toJson() {
Map fields = {};
- fields['challenge'] = challenge!.toJson();
+ fields['challenge'] = challenge.toJson();
fields['deleted'] = deleted;
return fields;
}
@@ -555,74 +585,6 @@ class SetCurrentChallengeDto {
late String challengeId;
}
-class LeaderDto {
- Map toJson() {
- Map fields = {};
- fields['userId'] = userId;
- fields['username'] = username;
- fields['score'] = score;
- return fields;
- }
-
- LeaderDto.fromJson(Map fields) {
- userId = fields["userId"];
- username = fields["username"];
- score = fields["score"];
- }
-
- void partialUpdate(LeaderDto other) {
- userId = other.userId;
- username = other.username;
- score = other.score;
- }
-
- LeaderDto({
- required this.userId,
- required this.username,
- required this.score,
- });
-
- late String userId;
- late String username;
- late int score;
-}
-
-class UpdateLeaderDataDto {
- Map toJson() {
- Map fields = {};
- fields['eventId'] = eventId;
- fields['offset'] = offset;
- fields['users'] = users!
- .map