Skip to content

Commit

Permalink
Merge pull request #2092 from morebytes/7.28_fixes
Browse files Browse the repository at this point in the history
7.28 deployment fixes
  • Loading branch information
c3bryant authored Oct 22, 2024
2 parents 400e76f + a323704 commit 3814bb3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 28 deletions.
32 changes: 6 additions & 26 deletions lib/core/providers/speed_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import 'package:campus_mobile_experimental/core/providers/user.dart';
import 'package:campus_mobile_experimental/core/services/speed_test.dart';
import 'package:dio/dio.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter_dotenv/flutter_dotenv.dart';
import 'package:path_provider/path_provider.dart';

class SpeedTestProvider extends ChangeNotifier {
Expand Down Expand Up @@ -36,8 +37,7 @@ class SpeedTestProvider extends ChangeNotifier {
"accept": "application/json",
};
Map<String, String>? offloadDataHeader;
final String mobileLoggerApi =
'https://api-qa.ucsd.edu:8243/mobileapplogger/v1.1.0/log';
final mobileLoggerApi = dotenv.get('MOBILE_APP_LOGGER');

SpeedTestProvider() {
_isLoading = false;
Expand Down Expand Up @@ -261,12 +261,12 @@ class SpeedTestProvider extends ChangeNotifier {
}
} else {
try {
getNewToken().then((value) {
_networkHelper.getNewToken(headers).then((value) {
_networkHelper.authorizedPost(
mobileLoggerApiWifi, headers, json.encode(log));
});
} catch (exception) {
getNewToken().then((value) {
_networkHelper.getNewToken(headers).then((value) {
_networkHelper.authorizedPost(
mobileLoggerApiWifi, headers, json.encode(log));
});
Expand Down Expand Up @@ -330,39 +330,19 @@ class SpeedTestProvider extends ChangeNotifier {
}
} else {
try {
getNewToken().then((value) {
_networkHelper.getNewToken(headers).then((value) {
_networkHelper.authorizedPost(
mobileLoggerApiWifiReport, headers, json.encode(wiFiLog));
});
} catch (exception) {
getNewToken().then((value) {
_networkHelper.getNewToken(headers).then((value) {
_networkHelper.authorizedPost(
mobileLoggerApiWifiReport, headers, json.encode(wiFiLog));
});
}
}
}

Future<bool> getNewToken() async {
final String tokenEndpoint = "https://api-qa.ucsd.edu:8243/token";
final Map<String, String> tokenHeaders = {
"content-type": 'application/x-www-form-urlencoded',
"Authorization":
"Basic djJlNEpYa0NJUHZ5akFWT0VRXzRqZmZUdDkwYTp2emNBZGFzZWpmaWZiUDc2VUJjNDNNVDExclVh"
};
try {
return _networkHelper
.authorizedPost(
tokenEndpoint, tokenHeaders, "grant_type=client_credentials")
.then((response) {
headers["Authorization"] = "Bearer " + response["access_token"];
return true;
});
} catch (e) {
return false;
}
}

bool? get isLoading => _isLoading;
String? get error => _error;
double? get speed => _speedDownload;
Expand Down
4 changes: 2 additions & 2 deletions lib/ui/employee_id/employee_id_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import 'package:campus_mobile_experimental/core/utils/webview.dart';
import 'package:campus_mobile_experimental/ui/common/card_container.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:flutter_dotenv/flutter_dotenv.dart';
import 'package:provider/provider.dart';

class EmployeeIdCard extends StatefulWidget {
Expand All @@ -17,8 +18,7 @@ class EmployeeIdCard extends StatefulWidget {

class _EmployeeIdCardState extends State<EmployeeIdCard> {
String cardId = "employee_id";
String placeholderPhotoUrl =
"https://mobile.ucsd.edu/replatform/v1/qa/webview/resources/img/placeholderPerson.png";
final placeholderPhotoUrl = dotenv.get('PLACEHOLDER_PERSON_PHOTO');
bool isValidId = false;

@override
Expand Down

0 comments on commit 3814bb3

Please sign in to comment.