From dceeb1851330a58680327b615ea086c8db7534e9 Mon Sep 17 00:00:00 2001 From: Zachary Atkins Date: Sat, 10 Apr 2021 15:36:05 -0500 Subject: [PATCH] fixed lookup references --- loc_chain_app/lib/main.dart | 2 +- loc_chain_app/lib/util/transaction_manager.dart | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/loc_chain_app/lib/main.dart b/loc_chain_app/lib/main.dart index 07e1381..5cc6355 100644 --- a/loc_chain_app/lib/main.dart +++ b/loc_chain_app/lib/main.dart @@ -7,7 +7,7 @@ void main() async { runApp(App()); final prefs = await SharedPreferences.getInstance(); final userName = prefs.getString('userName') ?? '0'; - if (id == '0') { + if (userName == '0') { prefs.setString('id', Random().nextInt(10000).toString()); } } diff --git a/loc_chain_app/lib/util/transaction_manager.dart b/loc_chain_app/lib/util/transaction_manager.dart index 659fc0a..d882d38 100644 --- a/loc_chain_app/lib/util/transaction_manager.dart +++ b/loc_chain_app/lib/util/transaction_manager.dart @@ -9,13 +9,14 @@ import 'dart:io'; class Transaction { Transaction({required this.hash}) { - SharedPreferences.getInstance().then((s) => _id = s.getString('id') ?? '0'); + SharedPreferences.getInstance() + .then((s) => _id = s.getString('userName') ?? '0'); } late final String _id; final String hash; - static Future makeTransactionHash(String otherUserId) async { + static Future signTransaction(String otherUserId) async { String id = await SharedPreferences.getInstance() - .then((s) => s.getString('id') ?? ''); + .then((s) => s.getString('userName') ?? ''); bool idLess = id.compareTo(otherUserId) < 0; var lesser = idLess ? id : otherUserId; var greater = idLess ? otherUserId : id;