From ef367cad1dda9dbc4f1c494aed9d9b838e6c96e2 Mon Sep 17 00:00:00 2001 From: "Bryant, Charles" Date: Fri, 10 Sep 2021 08:01:13 -0700 Subject: [PATCH 1/3] Package upgrade: flutter_local_notifications 6.1.1 --> 8.2.0 --- pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pubspec.yaml b/pubspec.yaml index 3d1c31e36..64c514cdb 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -29,7 +29,7 @@ dependencies: url: https://github.com/UCSD/flutter_blue.git ref: 470b128cd463373d0ec4b668d5b4f449dc728d72 flutter_linkify: 5.0.2 - flutter_local_notifications: 6.1.1 + flutter_local_notifications: 8.2.0 flutter_secure_storage: 4.2.0 flutter_sticky_header: 0.6.0 get: 4.1.4 From 528e11a5c063e346873e53c6c6ef034b0e65b857 Mon Sep 17 00:00:00 2001 From: Charles Bryant Date: Mon, 22 Nov 2021 08:56:24 -0800 Subject: [PATCH 2/3] Revert "Update endpoint in news.dart" --- lib/core/services/news.dart | 35 ++--------------------------------- 1 file changed, 2 insertions(+), 33 deletions(-) diff --git a/lib/core/services/news.dart b/lib/core/services/news.dart index 6cae9be84..9800295c6 100644 --- a/lib/core/services/news.dart +++ b/lib/core/services/news.dart @@ -9,12 +9,8 @@ class NewsService { String? _error; final NetworkHelper _networkHelper = NetworkHelper(); - final Map headers = { - "accept": "application/json", - }; - final String endpoint = - "https://api-qa.ucsd.edu:8243/qa/campusnews/v1/ucsdnewsaggregator"; + 'https://s3-us-west-2.amazonaws.com/ucsd-its-wts/now_ucsandiego/v1/allstories.json'; NewsModel _newsModels = NewsModel(); @@ -23,46 +19,19 @@ class NewsService { _isLoading = true; try { /// fetch data - String _response = - await (_networkHelper.authorizedFetch(endpoint, headers)); + String _response = await _networkHelper.fetchData(endpoint); /// parse data _newsModels = newsModelFromJson(_response); _isLoading = false; return true; } catch (e) { - if (e.toString().contains("401")) { - if (await getNewToken()) { - return await fetchData(); - } - } - _error = e.toString(); _isLoading = false; return false; } } - Future getNewToken() async { - final String tokenEndpoint = "https://api-qa.ucsd.edu:8243/token"; - final Map tokenHeaders = { - "content-type": 'application/x-www-form-urlencoded', - "Authorization": - "Basic djJlNEpYa0NJUHZ5akFWT0VRXzRqZmZUdDkwYTp2emNBZGFzZWpmaWZiUDc2VUJjNDNNVDExclVh" - }; - try { - var response = await _networkHelper.authorizedPost( - tokenEndpoint, tokenHeaders, "grant_type=client_credentials"); - - headers["Authorization"] = "Bearer " + response["access_token"]; - - return true; - } catch (e) { - _error = e.toString(); - return false; - } - } - String? get error => _error; NewsModel get newsModels => _newsModels; bool get isLoading => _isLoading; From c6538f164c585a28d4607338eb4f56e462476fd4 Mon Sep 17 00:00:00 2001 From: Charles Bryant Date: Mon, 22 Nov 2021 09:04:04 -0800 Subject: [PATCH 3/3] Update pubspec.yaml --- pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pubspec.yaml b/pubspec.yaml index 40c320c82..b5cdcf509 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -28,7 +28,7 @@ dependencies: url: https://github.com/UCSD/flutter_blue.git ref: 470b128cd463373d0ec4b668d5b4f449dc728d72 flutter_linkify: 5.0.2 - flutter_local_notifications: 8.2.0 + flutter_local_notifications: 6.1.1 flutter_secure_storage: 4.2.0 flutter_sticky_header: 0.6.0 get: 4.1.4