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

Implement Rotating Cursor Feature with Dependency Fixes #229

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
6 changes: 6 additions & 0 deletions game/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ PODS:
- GoogleUtilities/UserDefaults (~> 7.8)
- PromisesObjC (~> 2.1)
- Flutter (1.0.0)
- flutter_compass (0.0.1):
- Flutter
- flutter_config (0.0.1):
- Flutter
- flutter_secure_storage (6.0.0):
Expand Down Expand Up @@ -162,6 +164,7 @@ DEPENDENCIES:
- Firebase
- Firebase/Analytics
- Flutter (from `Flutter`)
- flutter_compass (from `.symlinks/plugins/flutter_compass/ios`)
- flutter_config (from `.symlinks/plugins/flutter_config/ios`)
- flutter_secure_storage (from `.symlinks/plugins/flutter_secure_storage/ios`)
- fluttertoast (from `.symlinks/plugins/fluttertoast/ios`)
Expand Down Expand Up @@ -201,6 +204,8 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/device_info_plus/ios"
Flutter:
:path: Flutter
flutter_compass:
:path: ".symlinks/plugins/flutter_compass/ios"
flutter_config:
:path: ".symlinks/plugins/flutter_config/ios"
flutter_secure_storage:
Expand Down Expand Up @@ -236,6 +241,7 @@ SPEC CHECKSUMS:
FirebaseCoreInternal: 910a81992c33715fec9263ca7381d59ab3a750b7
FirebaseInstallations: 91950fe859846fff0fbd296180909dd273103b09
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
flutter_compass: cbbd285cea1584c7ac9c4e0c3e1f17cbea55e855
flutter_config: f48f0d47a284f1791aacce2687eabb3309ba7a41
flutter_secure_storage: d33dac7ae2ea08509be337e775f6b59f1ff45f12
fluttertoast: e9a18c7be5413da53898f660530c56f35edfba9c
Expand Down
2 changes: 1 addition & 1 deletion game/ios/Runner/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import Firebase
import GoogleMaps
import flutter_config

@UIApplicationMain
@main
@objc class AppDelegate: FlutterAppDelegate {
override func application(
_ application: UIApplication,
Expand Down
24 changes: 22 additions & 2 deletions game/lib/gameplay/gameplay_map.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import 'dart:math';
import 'package:game/gameplay/challenge_completed.dart';
import 'package:game/utils/utility_functions.dart';
import 'dart:ui' as ui;
import 'package:flutter_compass/flutter_compass.dart';

// for backend connection
import 'package:provider/provider.dart';
Expand Down Expand Up @@ -66,6 +67,8 @@ class _GameplayMapState extends State<GameplayMap> {
GeoPoint? hintCenter;
double defaultHintRadius = 200.0;
double? hintRadius;
double? compassHeading = 0.0;
// Timer? mockHeadingTimer; // mock compass data

// whether the picture is expanded over the map
bool isExpanded = false;
Expand All @@ -76,10 +79,28 @@ class _GameplayMapState extends State<GameplayMap> {
super.initState();
streamStarted = startPositionStream();
setStartingHintCircle();
compassHeading = 0.0;

// Listen to compass events
FlutterCompass.events!.listen((event) {
setState(() {
compassHeading = event.heading;
});
});

// Mock compass data for testing
// mockHeadingTimer = Timer.periodic(Duration(milliseconds: 100), (timer) {
// setState(() {
// // Increment by 10 degrees
// compassHeading = (compassHeading! + 10) % 360;
// print('Updated compassHeading: $compassHeading');
// });
// });
}

@override
void dispose() {
// mockHeadingTimer?.cancel(); // mock compass data
positionStream.cancel();
_disposeController();
super.dispose();
Expand Down Expand Up @@ -374,8 +395,7 @@ class _GameplayMapState extends State<GameplayMap> {
? _center
: LatLng(currentLocation!.lat, currentLocation!.long),
anchor: Offset(0.5, 0.5),
rotation:
currentLocation == null ? 0 : currentLocation!.heading,
rotation: compassHeading ?? 0,
),
},
circles: {
Expand Down
52 changes: 30 additions & 22 deletions game/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "3.4.1"
flutter_compass:
dependency: "direct main"
description:
name: flutter_compass
sha256: "1a0121bff32df95193812b4e0f69e95f45fdec042ebd7a326ba087c0f6ec8304"
url: "https://pub.dev"
source: hosted
version: "0.7.0"
flutter_config:
dependency: "direct main"
description:
Expand Down Expand Up @@ -553,10 +561,10 @@ packages:
dependency: "direct main"
description:
name: intl
sha256: "3bc132a9dbce73a7e4a21a17d06e1878839ffbf975568bc875c60537824b0c4d"
sha256: d6f56758b7d3014a48af9701c085700aac781a92a87a62b1333b46d8879661cf
url: "https://pub.dev"
source: hosted
version: "0.18.1"
version: "0.19.0"
js:
dependency: transitive
description:
Expand Down Expand Up @@ -593,26 +601,26 @@ packages:
dependency: transitive
description:
name: leak_tracker
sha256: "78eb209deea09858f5269f5a5b02be4049535f568c07b275096836f01ea323fa"
sha256: "3f87a60e8c63aecc975dda1ceedbc8f24de75f09e4856ea27daf8958f2f0ce05"
url: "https://pub.dev"
source: hosted
version: "10.0.0"
version: "10.0.5"
leak_tracker_flutter_testing:
dependency: transitive
description:
name: leak_tracker_flutter_testing
sha256: b46c5e37c19120a8a01918cfaf293547f47269f7cb4b0058f21531c2465d6ef0
sha256: "932549fb305594d82d7183ecd9fa93463e9914e1b67cacc34bc40906594a1806"
url: "https://pub.dev"
source: hosted
version: "2.0.1"
version: "3.0.5"
leak_tracker_testing:
dependency: transitive
description:
name: leak_tracker_testing
sha256: a597f72a664dbd293f3bfc51f9ba69816f84dcd403cdac7066cb3f6003f3ab47
sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3"
url: "https://pub.dev"
source: hosted
version: "2.0.1"
version: "3.0.1"
linkify:
dependency: transitive
description:
Expand Down Expand Up @@ -681,18 +689,18 @@ packages:
dependency: transitive
description:
name: material_color_utilities
sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a"
sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec
url: "https://pub.dev"
source: hosted
version: "0.8.0"
version: "0.11.1"
meta:
dependency: transitive
description:
name: meta
sha256: d584fa6707a52763a52446f02cc621b077888fb63b93bbcb1143a7be5a0c0c04
sha256: bdb68674043280c3428e9ec998512fb681678676b3c54e773629ffe74419f8c7
url: "https://pub.dev"
source: hosted
version: "1.11.0"
version: "1.15.0"
mgrs_dart:
dependency: transitive
description:
Expand Down Expand Up @@ -1078,10 +1086,10 @@ packages:
dependency: transitive
description:
name: test_api
sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b"
sha256: "5b8a98dafc4d5c4c9c72d8b31ab2b23fc13422348d2997120294d3bac86b4ddb"
url: "https://pub.dev"
source: hosted
version: "0.6.1"
version: "0.7.2"
tuple:
dependency: "direct main"
description:
Expand Down Expand Up @@ -1214,18 +1222,18 @@ packages:
dependency: "direct main"
description:
name: velocity_x
sha256: "38585b8ed87c17ccb42a5c13d55bdafdc65e7cd3f41dceb61c38714c758fa228"
sha256: "99b910c80cc2010b184ef921f0af6894a8d632e13169cf77e6f6cb5a7f310698"
url: "https://pub.dev"
source: hosted
version: "4.1.2"
version: "4.2.1"
vm_service:
dependency: transitive
description:
name: vm_service
sha256: b3d56ff4341b8f182b96aceb2fa20e3dcb336b9f867bc0eafc0de10f1048e957
sha256: "5c5f338a667b4c644744b661f309fb8080bb94b18a7e91ef1dbd343bed00ed6d"
url: "https://pub.dev"
source: hosted
version: "13.0.0"
version: "14.2.5"
vxstate:
dependency: transitive
description:
Expand All @@ -1243,13 +1251,13 @@ packages:
source: hosted
version: "0.5.1"
win32:
dependency: transitive
dependency: "direct main"
description:
name: win32
sha256: "0eaf06e3446824099858367950a813472af675116bf63f008a4c2a75ae13e9cb"
sha256: "2294c64768987ea280b43a3d8357d42d5679f3e2b5b69b602be45b2abbd165b0"
url: "https://pub.dev"
source: hosted
version: "5.5.0"
version: "5.6.1"
win32_registry:
dependency: transitive
description:
Expand Down Expand Up @@ -1291,5 +1299,5 @@ packages:
source: hosted
version: "3.1.2"
sdks:
dart: ">=3.3.0 <4.0.0"
dart: ">=3.5.0 <4.0.0"
flutter: ">=3.19.0"
2 changes: 2 additions & 0 deletions game/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ dependencies:
carousel_slider: ^5.0.0
tuple: ^2.0.2
sticky_headers: ^0.3.0+2
win32: ^5.6.1
flutter_compass: ^0.7.0

dev_dependencies:
flutter_launcher_icons:
Expand Down
29 changes: 29 additions & 0 deletions server/src/auth/auth.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ interface IntermediatePayload {
email: string;
}

/**
* The `AuthService` class provides authentication-related functionality for the application,
* including login, token management, and user verification.
*
* Now supports Google and Apple (OAuth), and device login. Only Cornell emails are allowed.
*/
@Injectable()
export class AuthService {
constructor(
Expand All @@ -37,6 +43,13 @@ export class AuthService {
secret: process.env.JWT_ACCESS_SECRET,
};

/**
* Verifies an Apple ID token and extracts the user's ID and email.
*
* @param idToken - The ID token from Apple Sign-In.
* @returns An object containing the user’s `id` and `email` if verification is successful;
* otherwise, `null` if verification fails.
*/
async payloadFromApple(idToken: string): Promise<IntermediatePayload | null> {
try {
const payload = await appleSignin.verifyIdToken(
Expand All @@ -54,6 +67,14 @@ export class AuthService {
}
}

/**
* Verifies a Google ID token based on the audience (platform) and extracts the user's ID and email.
*
* @param idToken - The ID token received from Google.
* @param aud - The platform that issued the token: 'android', 'ios', or 'web'.
* @returns An object containing the user's `id` and `email` if verification is successful;
* otherwise, `null` if verification fails.
*/
async payloadFromGoogle(
idToken: string,
aud: 'android' | 'ios' | 'web',
Expand Down Expand Up @@ -89,6 +110,14 @@ export class AuthService {
}
}

/**
* Authenticates a user based on the user credentials, issues access and refresh tokens.
*
* @param authType - The type of authentication used.
* @param req - The login DTO containing user credentials.
* @returns A tuple `[accessToken, refreshToken]` if login is successful;
* otherwise, `null` if authentication fails.
*/
async login(
authType: AuthType,
req: LoginDto,
Expand Down
Loading