mirror of
https://gitlab.com/veilid/veilidchat.git
synced 2024-12-17 20:14:31 -05:00
remove some stuff
This commit is contained in:
parent
d39c9343b7
commit
0bc9dc3ad4
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
class Contact {
|
class Contact {
|
||||||
String name;
|
String name;
|
||||||
String publicKey;
|
String publicKey;
|
||||||
@ -19,78 +18,3 @@ class Contact {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// // Synchronize the app state contact list with the internal one
|
|
||||||
// void sortAndStoreAppStateContactList(List<dynamic> ffasContactList) {
|
|
||||||
// ffasContactList.sortBy((element) => element["name"] as String);
|
|
||||||
// FFAppState().update(() {
|
|
||||||
// FFAppState().ContactList = ffasContactList;
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
|
|
||||||
// // Called when a new contact is added or an existing one is edited
|
|
||||||
// Future<String> vcsUpdateContact(
|
|
||||||
// String id,
|
|
||||||
// String name,
|
|
||||||
// String publicKey,
|
|
||||||
// ) async {
|
|
||||||
// var api = Veilid.instance;
|
|
||||||
// try {
|
|
||||||
// // if we are adding a new contact, make its id
|
|
||||||
// var newContact = false;
|
|
||||||
// if (id.isEmpty) {
|
|
||||||
// id = const Uuid().v4();
|
|
||||||
// newContact = true;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// // Trim name
|
|
||||||
// name = name.trim();
|
|
||||||
|
|
||||||
// // Validate name and public key
|
|
||||||
// if (name.length > 127) {
|
|
||||||
// return "Name is too long.";
|
|
||||||
// }
|
|
||||||
// if (name.isEmpty) {
|
|
||||||
// return "Name can not be empty";
|
|
||||||
// }
|
|
||||||
// if (!isValidDHTKey(publicKey)) {
|
|
||||||
// return "Public key is not valid";
|
|
||||||
// }
|
|
||||||
|
|
||||||
// // update entry in internal contacts table
|
|
||||||
// var contactsDb = await api.openTableDB("contacts", 1);
|
|
||||||
// var contact = Contact(name, publicKey);
|
|
||||||
// await contactsDb.storeStringJson(0, id, contact);
|
|
||||||
|
|
||||||
// // update app state
|
|
||||||
// var contactJson = contact.toJson();
|
|
||||||
// contactJson['id'] = id;
|
|
||||||
|
|
||||||
// var ffasContactList = FFAppState().ContactList;
|
|
||||||
// if (newContact) {
|
|
||||||
// // Add new contact
|
|
||||||
// ffasContactList.add(contactJson);
|
|
||||||
// } else {
|
|
||||||
// // Update existing contact
|
|
||||||
// ffasContactList.forEachIndexedWhile((i, e) {
|
|
||||||
// if (e['id'] == id) {
|
|
||||||
// ffasContactList[i] = contactJson;
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
// return true;
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
|
|
||||||
// // Sort the contact list
|
|
||||||
// sortAndStoreAppStateContactList(ffasContactList);
|
|
||||||
// } catch (e) {
|
|
||||||
// return e.toString();
|
|
||||||
// }
|
|
||||||
|
|
||||||
// return "";
|
|
||||||
// }
|
|
||||||
|
|
||||||
// // Called when a contact is to be removed
|
|
||||||
// Future<void> vcsDeleteContact(String id) async {
|
|
||||||
// //
|
|
||||||
// }
|
|
@ -1,5 +1,6 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
|
import '../state/auth.dart';
|
||||||
|
|
||||||
class LoginPage extends ConsumerWidget {
|
class LoginPage extends ConsumerWidget {
|
||||||
const LoginPage({super.key});
|
const LoginPage({super.key});
|
||||||
@ -15,15 +16,15 @@ class LoginPage extends ConsumerWidget {
|
|||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
const Text("Login Page"),
|
const Text("Login Page"),
|
||||||
// ElevatedButton(
|
ElevatedButton(
|
||||||
// onPressed: () async {
|
onPressed: () async {
|
||||||
// ref.watch(authNotifierProvider.notifier).login(
|
await ref.watch(authNotifierProvider.notifier).login(
|
||||||
// "myEmail",
|
"myEmail",
|
||||||
// "myPassword",
|
"myPassword",
|
||||||
// );
|
);
|
||||||
// },
|
},
|
||||||
// child: const Text("Login"),
|
child: const Text("Login"),
|
||||||
// ),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -21,7 +21,7 @@ import '../state/auth.dart';
|
|||||||
class RouterNotifier extends AutoDisposeAsyncNotifier<void>
|
class RouterNotifier extends AutoDisposeAsyncNotifier<void>
|
||||||
implements Listenable {
|
implements Listenable {
|
||||||
VoidCallback? routerListener;
|
VoidCallback? routerListener;
|
||||||
bool isAuth = false; // Useful for our global redirect functio
|
bool isAuth = false; // Useful for our global redirect function
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<void> build() async {
|
Future<void> build() async {
|
||||||
@ -43,13 +43,14 @@ class RouterNotifier extends AutoDisposeAsyncNotifier<void>
|
|||||||
if (this.state.isLoading || this.state.hasError) return null;
|
if (this.state.isLoading || this.state.hasError) return null;
|
||||||
|
|
||||||
final isIndex = state.location == IndexPage.path;
|
final isIndex = state.location == IndexPage.path;
|
||||||
|
|
||||||
if (isIndex) {
|
if (isIndex) {
|
||||||
return isAuth ? HomePage.path : LoginPage.path;
|
return isAuth ? HomePage.path : LoginPage.path;
|
||||||
}
|
}
|
||||||
|
|
||||||
final isLoggingIn = state.location == LoginPage.path;
|
final isLoggingIn = state.location == LoginPage.path;
|
||||||
if (isLoggingIn) return isAuth ? HomePage.path : null;
|
if (isLoggingIn) {
|
||||||
|
return isAuth ? HomePage.path : null;
|
||||||
|
}
|
||||||
|
|
||||||
return isAuth ? null : IndexPage.path;
|
return isAuth ? null : IndexPage.path;
|
||||||
}
|
}
|
||||||
|
@ -53,7 +53,7 @@ class AuthNotifier extends AutoDisposeAsyncNotifier<User?> {
|
|||||||
|
|
||||||
/// Mock of a successful login attempt, which results come from the network.
|
/// Mock of a successful login attempt, which results come from the network.
|
||||||
Future<void> login(String publicKey, String password) async {
|
Future<void> login(String publicKey, String password) async {
|
||||||
state = await AsyncValue.guard<User>(() async {
|
state = await AsyncValue.guard<User?>(() async {
|
||||||
return Future.delayed(
|
return Future.delayed(
|
||||||
networkRoundTripTime,
|
networkRoundTripTime,
|
||||||
() => _dummyUser,
|
() => _dummyUser,
|
||||||
|
Loading…
Reference in New Issue
Block a user