From bf1711eaaa0496647a0c5e81e3c34051cf8721d9 Mon Sep 17 00:00:00 2001 From: virajl <116128339+virajl@users.noreply.github.com> Date: Tue, 7 Nov 2023 13:14:48 -0800 Subject: [PATCH 1/9] adding special hours handling --- android/gradle.properties | 1 + ios/Podfile.lock | 24 ++++++++++++------------ ios/Runner/AppDelegate.swift | 2 +- lib/core/models/dining.dart | 25 +++++++++++++++++-------- lib/ui/dining/dining_detail_view.dart | 17 +++++++++++++++++ 5 files changed, 48 insertions(+), 21 deletions(-) diff --git a/android/gradle.properties b/android/gradle.properties index a6738207f..68daa86f3 100644 --- a/android/gradle.properties +++ b/android/gradle.properties @@ -2,3 +2,4 @@ org.gradle.jvmargs=-Xmx1536M android.useAndroidX=true android.enableJetifier=true android.enableR8=true +org.gradle.java.home=/Users/virajlohia/Library/Java/JavaVirtualMachines/corretto-11.0.21/Contents/Home diff --git a/ios/Podfile.lock b/ios/Podfile.lock index d650b6e9a..e390eccfd 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -119,7 +119,7 @@ PODS: - GoogleUtilities/Network (~> 7.4) - "GoogleUtilities/NSData+zlib (~> 7.4)" - nanopb (~> 2.30908.0) - - GoogleDataTransport (9.2.1): + - GoogleDataTransport (9.2.5): - GoogleUtilities/Environment (~> 7.7) - nanopb (< 2.30910.0, >= 2.30908.0) - PromisesObjC (< 3.0, >= 1.2) @@ -128,24 +128,24 @@ PODS: - GoogleMaps/Base (5.2.0) - GoogleMaps/Maps (5.2.0): - GoogleMaps/Base - - GoogleUtilities/AppDelegateSwizzler (7.11.0): + - GoogleUtilities/AppDelegateSwizzler (7.11.6): - GoogleUtilities/Environment - GoogleUtilities/Logger - GoogleUtilities/Network - - GoogleUtilities/Environment (7.11.0): + - GoogleUtilities/Environment (7.11.6): - PromisesObjC (< 3.0, >= 1.2) - - GoogleUtilities/Logger (7.11.0): + - GoogleUtilities/Logger (7.11.6): - GoogleUtilities/Environment - - GoogleUtilities/MethodSwizzler (7.11.0): + - GoogleUtilities/MethodSwizzler (7.11.6): - GoogleUtilities/Logger - - GoogleUtilities/Network (7.11.0): + - GoogleUtilities/Network (7.11.6): - GoogleUtilities/Logger - "GoogleUtilities/NSData+zlib" - GoogleUtilities/Reachability - - "GoogleUtilities/NSData+zlib (7.11.0)" - - GoogleUtilities/Reachability (7.11.0): + - "GoogleUtilities/NSData+zlib (7.11.6)" + - GoogleUtilities/Reachability (7.11.6): - GoogleUtilities/Logger - - GoogleUtilities/UserDefaults (7.11.0): + - GoogleUtilities/UserDefaults (7.11.6): - GoogleUtilities/Logger - just_audio (0.0.1): - Flutter @@ -300,9 +300,9 @@ SPEC CHECKSUMS: geolocator_apple: cc556e6844d508c95df1e87e3ea6fa4e58c50401 google_maps_flutter_ios: abdac20d6ce8931f6ebc5f46616df241bfaa2cfd GoogleAppMeasurement: c6bbc9753d046b5456dd4f940057fbad2c28419e - GoogleDataTransport: ea169759df570f4e37bdee1623ec32a7e64e67c4 + GoogleDataTransport: 54dee9d48d14580407f8f5fbf2f496e92437a2f2 GoogleMaps: 025272d5876d3b32604e5c080dc25eaf68764693 - GoogleUtilities: c2bdc4cf2ce786c4d2e6b3bcfd599a25ca78f06f + GoogleUtilities: 202e7a9f5128accd11160fb9c19612de1911aa19 just_audio: baa7252489dbcf47a4c7cc9ca663e9661c99aafa nanopb: a0ba3315591a9ae0a16a309ee504766e90db0c96 package_info: 873975fc26034f0b863a300ad47e7f1ac6c7ec62 @@ -321,4 +321,4 @@ SPEC CHECKSUMS: PODFILE CHECKSUM: e0bbf5c8e53a75b510552973e41d17cf5c6e2c02 -COCOAPODS: 1.11.3 +COCOAPODS: 1.14.2 diff --git a/ios/Runner/AppDelegate.swift b/ios/Runner/AppDelegate.swift index f4b9147e1..d822806be 100644 --- a/ios/Runner/AppDelegate.swift +++ b/ios/Runner/AppDelegate.swift @@ -1,6 +1,6 @@ import UIKit import Flutter - import GoogleMaps +import GoogleMaps import Firebase @UIApplicationMain diff --git a/lib/core/models/dining.dart b/lib/core/models/dining.dart index 963e4c43c..7c7d02245 100644 --- a/lib/core/models/dining.dart +++ b/lib/core/models/dining.dart @@ -176,22 +176,31 @@ class RegularHours { } class SpecialHour { - String? title; - String? hours; + String? specialHoursEvent; + String? specialHoursEventDetails; + String? specialHoursValidFrom; + String? specialHoursValidTo; SpecialHour({ - this.title, - this.hours, + this.specialHoursEvent, + this.specialHoursEventDetails, + this.specialHoursValidFrom, + this.specialHoursValidTo }); factory SpecialHour.fromJson(Map json) => SpecialHour( - title: json["title"] == null ? null : json["title"], - hours: json["hours"] == null ? null : json["hours"], + specialHoursEvent: json["specialHoursEvent"] == null ? null : json["specialHoursEvent"], + specialHoursEventDetails: json["specialHoursEventDetails"] == null ? null : json["specialHoursEventDetails"], + specialHoursValidFrom: json["specialHoursValidFrom"] == null ? null : json["specialHoursValidFrom"], + specialHoursValidTo: json["specialHoursValidTo"] == null ? null : json["specialHoursValidTo"], ); Map toJson() => { - "title": title == null ? null : title, - "hours": hours == null ? null : hours, + "specialHoursEvent": specialHoursEvent == null ? null : specialHoursEvent, + "specialHoursEventDetails": specialHoursEventDetails == null ? null : specialHoursEventDetails, + "specialHoursValidFrom": specialHoursValidFrom == null ? null : specialHoursValidFrom, + "specialHoursValidTo": specialHoursValidTo == null ? null : specialHoursValidTo + }; } diff --git a/lib/ui/dining/dining_detail_view.dart b/lib/ui/dining/dining_detail_view.dart index 5a6662a05..65d4cd7e6 100644 --- a/lib/ui/dining/dining_detail_view.dart +++ b/lib/ui/dining/dining_detail_view.dart @@ -39,6 +39,7 @@ class DiningDetailView extends StatelessWidget { style: TextStyle(fontSize: 15), ), buildHours(context, model), + buildSpecialHours(context,model), buildPaymentOptions(context, model), buildPictures(model), Divider(), @@ -168,6 +169,22 @@ class DiningDetailView extends StatelessWidget { Divider(height: 10), ]); } +Widget buildSpecialHours(BuildContext context, prefix0.DiningModel model){ + return RichText( + text: TextSpan( + style: TextStyle( + fontSize: Theme.of(context).textTheme.bodyText2!.fontSize, + color: Theme.of(context).textTheme.bodyText2!.color), + children: [ + TextSpan( + text: "Special Hours:", + style: TextStyle(fontWeight: FontWeight.bold, fontSize: 16), + ), + TextSpan(text: model.specialHours?.elementAt(0).toString()) + ], + ), + ); +} Widget buildPaymentOptions(BuildContext context, prefix0.DiningModel model) { String options = model.paymentOptions!.join(', '); From 5bbd5e737f53ab81938453d032dd6affff151f58 Mon Sep 17 00:00:00 2001 From: virajl <116128339+virajl@users.noreply.github.com> Date: Wed, 8 Nov 2023 10:41:51 -0800 Subject: [PATCH 2/9] Update to handle SpecialHours --- lib/core/models/dining.dart | 10 +++++----- lib/ui/common/card_container.dart | 1 + lib/ui/dining/dining_detail_view.dart | 11 ++++++++--- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/lib/core/models/dining.dart b/lib/core/models/dining.dart index 7c7d02245..b1f83da90 100644 --- a/lib/core/models/dining.dart +++ b/lib/core/models/dining.dart @@ -25,7 +25,7 @@ class DiningModel { List? images; Coordinates? coordinates; RegularHours? regularHours; - List? specialHours; + SpecialHour? specialHours; String? url; String? menuWebsite; double? distance; @@ -70,10 +70,10 @@ class DiningModel { regularHours: json["regularHours"] == null ? null : RegularHours.fromJson(json["regularHours"]), - specialHours: json["specialHours"] == null + specialHours: (json["specialHours"] == null || json["specialHours"].isEmpty) ? null - : List.from( - json["specialHours"].map((x) => SpecialHour.fromJson(x))), + : SpecialHour.fromJson(json["specialHours"]), + url: json["url"] == null ? null : json["url"], menuWebsite: json["menuWebsite"] == null ? null : json["menuWebsite"], ); @@ -97,7 +97,7 @@ class DiningModel { "regularHours": regularHours == null ? null : regularHours!.toJson(), "specialHours": specialHours == null ? null - : List.from(specialHours!.map((x) => x.toJson())), + : specialHours?.toJson(), "url": url == null ? null : url, "menuWebsite": menuWebsite == null ? null : menuWebsite, "distance": distance == null ? null : distance, diff --git a/lib/ui/common/card_container.dart b/lib/ui/common/card_container.dart index 30640ea1c..0884de8e2 100644 --- a/lib/ui/common/card_container.dart +++ b/lib/ui/common/card_container.dart @@ -72,6 +72,7 @@ class CardContainer extends StatelessWidget { Widget buildBody(context) { if (errorText != null) { + print(errorText); if (titleText == 'News') { return Text('No articles found.'); } else if (titleText == 'Events') { diff --git a/lib/ui/dining/dining_detail_view.dart b/lib/ui/dining/dining_detail_view.dart index 65d4cd7e6..41a37792d 100644 --- a/lib/ui/dining/dining_detail_view.dart +++ b/lib/ui/dining/dining_detail_view.dart @@ -39,7 +39,8 @@ class DiningDetailView extends StatelessWidget { style: TextStyle(fontSize: 15), ), buildHours(context, model), - buildSpecialHours(context,model), + if(model.specialHours != null) + buildSpecialHours(context,model), buildPaymentOptions(context, model), buildPictures(model), Divider(), @@ -177,10 +178,14 @@ Widget buildSpecialHours(BuildContext context, prefix0.DiningModel model){ color: Theme.of(context).textTheme.bodyText2!.color), children: [ TextSpan( - text: "Special Hours:", + text: "Special Hours: \n", style: TextStyle(fontWeight: FontWeight.bold, fontSize: 16), ), - TextSpan(text: model.specialHours?.elementAt(0).toString()) + TextSpan( + text: model.specialHours!.specialHoursEvent! + "\n" + ), + TextSpan(text: model.specialHours!.specialHoursEventDetails! + "\n"), + TextSpan(text: model.specialHours!.specialHoursValidFrom ! + " to " + model.specialHours!.specialHoursValidTo ! + "\n"), ], ), ); From 45b2ea493353ded74c2182896b619f897c003693 Mon Sep 17 00:00:00 2001 From: virajl <116128339+virajl@users.noreply.github.com> Date: Wed, 8 Nov 2023 16:47:59 -0800 Subject: [PATCH 3/9] Update to handle SpecialHours --- lib/core/services/dining.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/core/services/dining.dart b/lib/core/services/dining.dart index c768c0a15..e0d3fc5a8 100644 --- a/lib/core/services/dining.dart +++ b/lib/core/services/dining.dart @@ -19,7 +19,7 @@ class DiningService { final Map headers = { "accept": "application/json", }; - final String baseEndpoint = "https://api-qa.ucsd.edu:8243/dining/v3.0.0"; + String baseEndpoint = "https://api-qa.ucsd.edu:8243/dining/v4.0.0"; Future fetchData() async { _error = null; From 2e05d774297459ecea84a3dc40ea66fc17c03584 Mon Sep 17 00:00:00 2001 From: virajl <116128339+virajl@users.noreply.github.com> Date: Thu, 9 Nov 2023 08:56:16 -0800 Subject: [PATCH 4/9] fix dependencies --- android/gradle.properties | 1 - 1 file changed, 1 deletion(-) diff --git a/android/gradle.properties b/android/gradle.properties index 68daa86f3..a6738207f 100644 --- a/android/gradle.properties +++ b/android/gradle.properties @@ -2,4 +2,3 @@ org.gradle.jvmargs=-Xmx1536M android.useAndroidX=true android.enableJetifier=true android.enableR8=true -org.gradle.java.home=/Users/virajlohia/Library/Java/JavaVirtualMachines/corretto-11.0.21/Contents/Home From a0f6fbbeb8c2c14c0986fcd83b069bae83d09b33 Mon Sep 17 00:00:00 2001 From: virajl <116128339+virajl@users.noreply.github.com> Date: Mon, 20 Nov 2023 13:34:57 -0800 Subject: [PATCH 5/9] Add handling for non-HDH locations --- lib/ui/dining/dining_detail_view.dart | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/ui/dining/dining_detail_view.dart b/lib/ui/dining/dining_detail_view.dart index 41a37792d..f312b42bb 100644 --- a/lib/ui/dining/dining_detail_view.dart +++ b/lib/ui/dining/dining_detail_view.dart @@ -171,6 +171,11 @@ class DiningDetailView extends StatelessWidget { ]); } Widget buildSpecialHours(BuildContext context, prefix0.DiningModel model){ + var specialHoursDuration = ""; + if(model.specialHours?.specialHoursValidFrom != null && model.specialHours?.specialHoursValidTo != null){ + specialHoursDuration = model.specialHours!.specialHoursValidFrom ! + " to " + + model.specialHours!.specialHoursValidTo ! + "\n"; + } return RichText( text: TextSpan( style: TextStyle( @@ -185,7 +190,9 @@ Widget buildSpecialHours(BuildContext context, prefix0.DiningModel model){ text: model.specialHours!.specialHoursEvent! + "\n" ), TextSpan(text: model.specialHours!.specialHoursEventDetails! + "\n"), - TextSpan(text: model.specialHours!.specialHoursValidFrom ! + " to " + model.specialHours!.specialHoursValidTo ! + "\n"), + // (model.specialHours!.specialHoursValidFrom != null && model.specialHours!.specialHoursValidTo != null) ? + TextSpan(text:specialHoursDuration) + // : TextSpan(text: ""), ], ), ); From 938eeb86a516a392fe1274da0fc95c7baa2faa37 Mon Sep 17 00:00:00 2001 From: virajl <116128339+virajl@users.noreply.github.com> Date: Mon, 20 Nov 2023 13:40:27 -0800 Subject: [PATCH 6/9] Add handling for non-HDH locations --- lib/ui/dining/dining_detail_view.dart | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/ui/dining/dining_detail_view.dart b/lib/ui/dining/dining_detail_view.dart index f312b42bb..bf0dd0b8e 100644 --- a/lib/ui/dining/dining_detail_view.dart +++ b/lib/ui/dining/dining_detail_view.dart @@ -190,9 +190,7 @@ Widget buildSpecialHours(BuildContext context, prefix0.DiningModel model){ text: model.specialHours!.specialHoursEvent! + "\n" ), TextSpan(text: model.specialHours!.specialHoursEventDetails! + "\n"), - // (model.specialHours!.specialHoursValidFrom != null && model.specialHours!.specialHoursValidTo != null) ? TextSpan(text:specialHoursDuration) - // : TextSpan(text: ""), ], ), ); From 392160b830a824053a0a381dfd2c6170be08f60d Mon Sep 17 00:00:00 2001 From: virajl <116128339+virajl@users.noreply.github.com> Date: Tue, 21 Nov 2023 15:46:47 -0800 Subject: [PATCH 7/9] revert podfile.lock --- ios/Podfile.lock | 24 ++++++++++++------------ lib/core/providers/scanner_message.dart | 3 ++- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/ios/Podfile.lock b/ios/Podfile.lock index e390eccfd..ce909c2ba 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -119,7 +119,7 @@ PODS: - GoogleUtilities/Network (~> 7.4) - "GoogleUtilities/NSData+zlib (~> 7.4)" - nanopb (~> 2.30908.0) - - GoogleDataTransport (9.2.5): + - GoogleDataTransport (9.2.1): - GoogleUtilities/Environment (~> 7.7) - nanopb (< 2.30910.0, >= 2.30908.0) - PromisesObjC (< 3.0, >= 1.2) @@ -128,24 +128,24 @@ PODS: - GoogleMaps/Base (5.2.0) - GoogleMaps/Maps (5.2.0): - GoogleMaps/Base - - GoogleUtilities/AppDelegateSwizzler (7.11.6): + - GoogleUtilities/AppDelegateSwizzler (7.11.0): - GoogleUtilities/Environment - GoogleUtilities/Logger - GoogleUtilities/Network - - GoogleUtilities/Environment (7.11.6): + - GoogleUtilities/Environment (7.11.0): - PromisesObjC (< 3.0, >= 1.2) - - GoogleUtilities/Logger (7.11.6): + - GoogleUtilities/Logger (7.11.0): - GoogleUtilities/Environment - - GoogleUtilities/MethodSwizzler (7.11.6): + - GoogleUtilities/MethodSwizzler (7.11.0): - GoogleUtilities/Logger - - GoogleUtilities/Network (7.11.6): + - GoogleUtilities/Network (7.11.0): - GoogleUtilities/Logger - "GoogleUtilities/NSData+zlib" - GoogleUtilities/Reachability - - "GoogleUtilities/NSData+zlib (7.11.6)" - - GoogleUtilities/Reachability (7.11.6): + - "GoogleUtilities/NSData+zlib (7.11.0)" + - GoogleUtilities/Reachability (7.11.0): - GoogleUtilities/Logger - - GoogleUtilities/UserDefaults (7.11.6): + - GoogleUtilities/UserDefaults (7.11.0): - GoogleUtilities/Logger - just_audio (0.0.1): - Flutter @@ -300,9 +300,9 @@ SPEC CHECKSUMS: geolocator_apple: cc556e6844d508c95df1e87e3ea6fa4e58c50401 google_maps_flutter_ios: abdac20d6ce8931f6ebc5f46616df241bfaa2cfd GoogleAppMeasurement: c6bbc9753d046b5456dd4f940057fbad2c28419e - GoogleDataTransport: 54dee9d48d14580407f8f5fbf2f496e92437a2f2 + GoogleDataTransport: ea169759df570f4e37bdee1623ec32a7e64e67c4 GoogleMaps: 025272d5876d3b32604e5c080dc25eaf68764693 - GoogleUtilities: 202e7a9f5128accd11160fb9c19612de1911aa19 + GoogleUtilities: c2bdc4cf2ce786c4d2e6b3bcfd599a25ca78f06f just_audio: baa7252489dbcf47a4c7cc9ca663e9661c99aafa nanopb: a0ba3315591a9ae0a16a309ee504766e90db0c96 package_info: 873975fc26034f0b863a300ad47e7f1ac6c7ec62 @@ -321,4 +321,4 @@ SPEC CHECKSUMS: PODFILE CHECKSUM: e0bbf5c8e53a75b510552973e41d17cf5c6e2c02 -COCOAPODS: 1.14.2 +COCOAPODS: 1.11.3 \ No newline at end of file diff --git a/lib/core/providers/scanner_message.dart b/lib/core/providers/scanner_message.dart index 3a9f1597b..bd9cc03d2 100644 --- a/lib/core/providers/scanner_message.dart +++ b/lib/core/providers/scanner_message.dart @@ -4,7 +4,8 @@ import 'package:campus_mobile_experimental/core/services/scanner_message.dart'; import 'package:flutter/material.dart'; class ScannerMessageDataProvider extends ChangeNotifier { - ScannerMessageDataProvider() { + // ScannerMessageDataProvider() + { ///DEFAULT STATES _isLoading = false; From b467749e350b757b82decdf084bf0863635650ad Mon Sep 17 00:00:00 2001 From: virajl <116128339+virajl@users.noreply.github.com> Date: Tue, 21 Nov 2023 15:47:23 -0800 Subject: [PATCH 8/9] revert podfile.lock --- lib/core/providers/scanner_message.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/core/providers/scanner_message.dart b/lib/core/providers/scanner_message.dart index bd9cc03d2..609823d33 100644 --- a/lib/core/providers/scanner_message.dart +++ b/lib/core/providers/scanner_message.dart @@ -4,7 +4,7 @@ import 'package:campus_mobile_experimental/core/services/scanner_message.dart'; import 'package:flutter/material.dart'; class ScannerMessageDataProvider extends ChangeNotifier { - // ScannerMessageDataProvider() + ScannerMessageDataProvider() { ///DEFAULT STATES _isLoading = false; From 27c25636888bbb115109c369ad966385863e63fc Mon Sep 17 00:00:00 2001 From: virajl <116128339+virajl@users.noreply.github.com> Date: Tue, 21 Nov 2023 15:48:24 -0800 Subject: [PATCH 9/9] revert podfile.lock --- lib/core/providers/scanner_message.dart | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/core/providers/scanner_message.dart b/lib/core/providers/scanner_message.dart index 609823d33..3a9f1597b 100644 --- a/lib/core/providers/scanner_message.dart +++ b/lib/core/providers/scanner_message.dart @@ -4,8 +4,7 @@ import 'package:campus_mobile_experimental/core/services/scanner_message.dart'; import 'package:flutter/material.dart'; class ScannerMessageDataProvider extends ChangeNotifier { - ScannerMessageDataProvider() - { + ScannerMessageDataProvider() { ///DEFAULT STATES _isLoading = false;