Skip to content

Commit

Permalink
Case Information Modifications
Browse files Browse the repository at this point in the history
* Added two new properties to ReportedCase and set up safe parsing for the properties from JSON (since those values are not there in JSON yet)
* Updated CaseItem to display the new values
* Updated Podfile.lock created for iOS (otherwise project does not compile correctly)
  • Loading branch information
FahimF committed Mar 22, 2020
1 parent 1e24503 commit c6d9e02
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 14 deletions.
20 changes: 10 additions & 10 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ PODS:
- Flutter
- path_provider_macos (0.0.1):
- Flutter
- Protobuf (3.10.0)
- Protobuf (3.11.4)
- share (0.5.2):
- Flutter
- shared_preferences (0.0.1):
Expand Down Expand Up @@ -164,14 +164,8 @@ DEPENDENCIES:
- url_launcher_web (from `.symlinks/plugins/url_launcher_web/ios`)

SPEC REPOS:
https://cdn.cocoapods.org/:
- FirebaseAnalyticsInterop
- FirebaseCore
- FirebaseInstanceID
- FirebaseRemoteConfig
https://github.com/cocoapods/specs.git:
https://github.com/CocoaPods/Specs.git:
- Firebase
- FirebaseABTesting
- FirebaseAnalytics
- FirebaseCoreDiagnostics
- FirebaseCoreDiagnosticsInterop
Expand All @@ -183,6 +177,12 @@ SPEC REPOS:
- GoogleMaps
- GoogleUtilities
- nanopb
trunk:
- FirebaseABTesting
- FirebaseAnalyticsInterop
- FirebaseCore
- FirebaseInstanceID
- FirebaseRemoteConfig
- Protobuf

EXTERNAL SOURCES:
Expand Down Expand Up @@ -254,7 +254,7 @@ SPEC CHECKSUMS:
package_info: 48b108e75b8802c2d5e126f208ef540561c98aef
path_provider: fb74bd0465e96b594bb3b5088ee4a4e7bb1f2a9d
path_provider_macos: f760a3c5b04357c380e2fddb6f9db6f3015897e0
Protobuf: a4dc852ad69c027ca2166ed287b856697814375b
Protobuf: 176220c526ad8bd09ab1fb40a978eac3fef665f7
share: bae0a282aab4483288913fc4dc0b935d4b491f2e
shared_preferences: 430726339841afefe5142b9c1f50cb6bd7793e01
shared_preferences_macos: f3f29b71ccbb56bf40c9dd6396c9acf15e214087
Expand All @@ -266,4 +266,4 @@ SPEC CHECKSUMS:

PODFILE CHECKSUM: 1b66dae606f75376c5f2135a8290850eeb09ae83

COCOAPODS: 1.7.5
COCOAPODS: 1.8.4
15 changes: 13 additions & 2 deletions lib/models/reported_case.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ class ReportedCase extends Equatable {
List<Location> locations;
String message;
DateTime createdAt;
// New properties - need to be added to backend
bool isLocal = true;
bool isFromFacility = true;

ReportedCase(
{this.id, this.caseNumber, this.locations, this.message, this.createdAt});
Expand All @@ -23,8 +26,16 @@ class ReportedCase extends Equatable {
locations: _locations,
message: json['message'],
createdAt: DateTime.parse(json['created']));

print("CASE HAS BEEN REPORTED: ${_case.id}");
// isLocal
if (json.containsKey('isLocal')) {
_case.isLocal = json['isLocal'] as bool;
}
// Quarantine/home
if (json.containsKey('detectedFrom')) {
var from = json['detectedFrom'] as String;
_case.isFromFacility = from == 'quarantine';
}
// print("CASE HAS BEEN REPORTED: ${_case.id}");
return _case;
}

Expand Down
3 changes: 1 addition & 2 deletions lib/page/screen/case_list_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,7 @@ class _CaseListScreenState extends State<CaseListScreen> {
);
break;
case ConnectionState.done:
print("DATA: ");
print(snapshot.data);
// print('DATA: ${snapshot.data}');
if (snapshot.hasData) {
List<ReportedCase> _cases = List();
_cases = snapshot.data
Expand Down
7 changes: 7 additions & 0 deletions lib/widgets/case_item.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ class CaseItem extends StatelessWidget {

@override
Widget build(BuildContext context) {
var source = _case.isLocal ? 'Local' : 'Imported';
source += ', from: ' +
(_case.isFromFacility ? 'Quarantine Facility' : 'Community');
return GestureDetector(
child: Container(
width: 100.0,
Expand Down Expand Up @@ -53,6 +56,10 @@ class CaseItem extends StatelessWidget {
style: TextStyle(fontSize: 12.0),
),
SizedBox(height: 16.0),
Text(
source,
),
SizedBox(height: 16.0),
Text(
_case.message,
),
Expand Down

0 comments on commit c6d9e02

Please sign in to comment.