fixed lookup references

main
Zachary Atkins 3 years ago
parent ad62f5f1b0
commit dceeb18513

@ -7,7 +7,7 @@ void main() async {
runApp(App()); runApp(App());
final prefs = await SharedPreferences.getInstance(); final prefs = await SharedPreferences.getInstance();
final userName = prefs.getString('userName') ?? '0'; final userName = prefs.getString('userName') ?? '0';
if (id == '0') { if (userName == '0') {
prefs.setString('id', Random().nextInt(10000).toString()); prefs.setString('id', Random().nextInt(10000).toString());
} }
} }

@ -9,13 +9,14 @@ import 'dart:io';
class Transaction { class Transaction {
Transaction({required this.hash}) { 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; late final String _id;
final String hash; final String hash;
static Future<String> makeTransactionHash(String otherUserId) async { static Future<String> signTransaction(String otherUserId) async {
String id = await SharedPreferences.getInstance() String id = await SharedPreferences.getInstance()
.then((s) => s.getString('id') ?? ''); .then((s) => s.getString('userName') ?? '');
bool idLess = id.compareTo(otherUserId) < 0; bool idLess = id.compareTo(otherUserId) < 0;
var lesser = idLess ? id : otherUserId; var lesser = idLess ? id : otherUserId;
var greater = idLess ? otherUserId : id; var greater = idLess ? otherUserId : id;

Loading…
Cancel
Save