mirror of
https://github.com/hackku21/loc-chain-app.git
synced 2026-03-02 03:40:13 +00:00
updates to allow server communication
This commit is contained in:
@@ -5,6 +5,7 @@ import 'package:loc_chain_app/widgets/navbar.dart';
|
||||
import 'package:flutter_udid/flutter_udid.dart';
|
||||
|
||||
void main() async {
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
runApp(App());
|
||||
(await SharedPreferences.getInstance())
|
||||
.setString('userName', await FlutterUdid.consistentUdid);
|
||||
@@ -14,11 +15,10 @@ class App extends StatelessWidget {
|
||||
// This widget is the root of your application.
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
Connect.stop();
|
||||
Connect.start();
|
||||
|
||||
return MaterialApp(
|
||||
title: 'Flutter Demo',
|
||||
title: 'Loc-Chain',
|
||||
theme: ThemeData(
|
||||
primarySwatch: Colors.lightBlue,
|
||||
),
|
||||
|
||||
@@ -78,4 +78,6 @@ class _HomePageState extends State<HomePage> {
|
||||
content: Text(a.toString()),
|
||||
));
|
||||
}
|
||||
|
||||
Future<void> reportExposure() async {}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_udid/flutter_udid.dart';
|
||||
import 'package:loc_chain_app/util/keyfile_manager.dart';
|
||||
|
||||
@@ -19,3 +20,50 @@ class Transaction {
|
||||
Future<String> generateP2PPayload(String otherUserId) async =>
|
||||
"${await generateHash(otherUserId)}:${KeyFileManager.keyPair.publicKey}";
|
||||
}
|
||||
|
||||
class EncounterTransaction {
|
||||
EncounterTransaction({
|
||||
required this.combinedHash,
|
||||
required this.encodedGPSLocation,
|
||||
required this.partnerPublicKey,
|
||||
required this.validationSignature,
|
||||
}) : timestamp = "${DateTime.now().millisecondsSinceEpoch}";
|
||||
final String combinedHash;
|
||||
final String timestamp;
|
||||
final String encodedGPSLocation;
|
||||
final String partnerPublicKey;
|
||||
final String validationSignature;
|
||||
|
||||
EncounterTransaction.fromJson(Map<String, dynamic> json)
|
||||
: combinedHash = json['combinedHash'],
|
||||
timestamp = json['timestamp'],
|
||||
encodedGPSLocation = json['encodedGPSLocation'],
|
||||
partnerPublicKey = json['partnerPublicKey'],
|
||||
validationSignature = json['validationSignature'];
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"combinedHash": combinedHash,
|
||||
"timestamp": timestamp,
|
||||
"encodedGPSLocation": encodedGPSLocation,
|
||||
"partnerPublicKey": partnerPublicKey,
|
||||
"validationSignature": validationSignature,
|
||||
};
|
||||
}
|
||||
|
||||
class ExposureTransaction {
|
||||
final String clientID;
|
||||
final String timestamp;
|
||||
|
||||
ExposureTransaction({
|
||||
required this.clientID,
|
||||
}) : timestamp = "${DateTime.now().millisecondsSinceEpoch}";
|
||||
|
||||
ExposureTransaction.fromJson(Map<String, dynamic> json)
|
||||
: clientID = json['clientID'],
|
||||
timestamp = json['timestamp'];
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"clientID": clientID,
|
||||
"timestamp": timestamp,
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user