contact.dart 650 B

1234567891011121314151617181920212223242526272829
  1. import 'package:e2ee_chat/common/api.dart';
  2. import 'package:e2ee_chat/model/user.dart';
  3. import 'package:flutter/cupertino.dart';
  4. import 'contact_list.dart';
  5. class UserProfilePresenter extends ChangeNotifier {
  6. UserProfilePresenter(this.user);
  7. final User user;
  8. Future<bool> refresh() async {
  9. bool _result = true;
  10. try {
  11. var json = (await Api().userProfile(user.username))!;
  12. user.bio = json["bio"];
  13. user.phone = json["phone"];
  14. notifyListeners();
  15. // TODO: avatar
  16. } catch (e) {
  17. _result = false;
  18. }
  19. return _result;
  20. }
  21. @override
  22. void notifyListeners() {
  23. super.notifyListeners();
  24. }
  25. }