mirror of
https://github.com/twonlyapp/twonly-app.git
synced 2026-04-22 08:32:53 +00:00
show toast and fix user deletion
Some checks are pending
Flutter analyze & test / flutter_analyze_and_test (push) Waiting to run
Some checks are pending
Flutter analyze & test / flutter_analyze_and_test (push) Waiting to run
This commit is contained in:
parent
c1065772f8
commit
5383496bb6
14 changed files with 123 additions and 51 deletions
|
|
@ -2,9 +2,11 @@
|
||||||
|
|
||||||
## 0.0.98
|
## 0.0.98
|
||||||
|
|
||||||
- Fix: Issue with contact requests
|
- Fix: Problem during contact requests
|
||||||
|
- Fix: Problem with deleting a contact
|
||||||
- Improve: Video compression with progress updates
|
- Improve: Video compression with progress updates
|
||||||
- Improve: Show message "Flames restored"
|
- Improve: Show message "Flames restored"
|
||||||
|
- Improve: Show toast message if user was added via QR
|
||||||
|
|
||||||
## 0.0.96
|
## 0.0.96
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -685,7 +685,7 @@ abstract class AppLocalizations {
|
||||||
/// No description provided for @settingsPrivacy.
|
/// No description provided for @settingsPrivacy.
|
||||||
///
|
///
|
||||||
/// In en, this message translates to:
|
/// In en, this message translates to:
|
||||||
/// **'Privacy'**
|
/// **'Privacy & Security'**
|
||||||
String get settingsPrivacy;
|
String get settingsPrivacy;
|
||||||
|
|
||||||
/// No description provided for @settingsPrivacyBlockUsers.
|
/// No description provided for @settingsPrivacyBlockUsers.
|
||||||
|
|
@ -3039,6 +3039,18 @@ abstract class AppLocalizations {
|
||||||
/// In en, this message translates to:
|
/// In en, this message translates to:
|
||||||
/// **'{count} flames restored'**
|
/// **'{count} flames restored'**
|
||||||
String chatEntryFlameRestored(Object count);
|
String chatEntryFlameRestored(Object count);
|
||||||
|
|
||||||
|
/// No description provided for @requestedUserToastText.
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'{username} was successfully requested.'**
|
||||||
|
String requestedUserToastText(Object username);
|
||||||
|
|
||||||
|
/// No description provided for @profileYourQrCode.
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'Your QR code'**
|
||||||
|
String get profileYourQrCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
class _AppLocalizationsDelegate
|
class _AppLocalizationsDelegate
|
||||||
|
|
|
||||||
|
|
@ -326,7 +326,7 @@ class AppLocalizationsDe extends AppLocalizations {
|
||||||
String get settingsAppearance => 'Erscheinungsbild';
|
String get settingsAppearance => 'Erscheinungsbild';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get settingsPrivacy => 'Datenschutz';
|
String get settingsPrivacy => 'Datenschutz & Sicherheit';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get settingsPrivacyBlockUsers => 'Benutzer blockieren';
|
String get settingsPrivacyBlockUsers => 'Benutzer blockieren';
|
||||||
|
|
@ -1700,4 +1700,12 @@ class AppLocalizationsDe extends AppLocalizations {
|
||||||
String chatEntryFlameRestored(Object count) {
|
String chatEntryFlameRestored(Object count) {
|
||||||
return '$count Flammen wiederhergestellt';
|
return '$count Flammen wiederhergestellt';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String requestedUserToastText(Object username) {
|
||||||
|
return '$username wurde erfolgreich angefragt.';
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get profileYourQrCode => 'Dein QR-Code';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -322,7 +322,7 @@ class AppLocalizationsEn extends AppLocalizations {
|
||||||
String get settingsAppearance => 'Appearance';
|
String get settingsAppearance => 'Appearance';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get settingsPrivacy => 'Privacy';
|
String get settingsPrivacy => 'Privacy & Security';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get settingsPrivacyBlockUsers => 'Block users';
|
String get settingsPrivacyBlockUsers => 'Block users';
|
||||||
|
|
@ -1688,4 +1688,12 @@ class AppLocalizationsEn extends AppLocalizations {
|
||||||
String chatEntryFlameRestored(Object count) {
|
String chatEntryFlameRestored(Object count) {
|
||||||
return '$count flames restored';
|
return '$count flames restored';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String requestedUserToastText(Object username) {
|
||||||
|
return '$username was successfully requested.';
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get profileYourQrCode => 'Your QR code';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -322,7 +322,7 @@ class AppLocalizationsSv extends AppLocalizations {
|
||||||
String get settingsAppearance => 'Appearance';
|
String get settingsAppearance => 'Appearance';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get settingsPrivacy => 'Privacy';
|
String get settingsPrivacy => 'Privacy & Security';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get settingsPrivacyBlockUsers => 'Block users';
|
String get settingsPrivacyBlockUsers => 'Block users';
|
||||||
|
|
@ -1688,4 +1688,12 @@ class AppLocalizationsSv extends AppLocalizations {
|
||||||
String chatEntryFlameRestored(Object count) {
|
String chatEntryFlameRestored(Object count) {
|
||||||
return '$count flames restored';
|
return '$count flames restored';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String requestedUserToastText(Object username) {
|
||||||
|
return '$username was successfully requested.';
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get profileYourQrCode => 'Your QR code';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
Subproject commit 6147155ce50caa97864d56e42e49a6f54702785d
|
Subproject commit 4c566ea0b455d7f5ee81dd93ee4f785dc634befa
|
||||||
|
|
@ -81,22 +81,27 @@ Future<void> handleMediaError(MediaFile media) async {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> importSignalContactAndCreateRequest(
|
Future<bool> importSignalContactAndCreateRequest(
|
||||||
server.Response_UserData userdata,
|
server.Response_UserData userdata,
|
||||||
) async {
|
) async {
|
||||||
if (await processSignalUserData(userdata)) {
|
if (!await processSignalUserData(userdata)) {
|
||||||
// 1. Setup notifications keys with the other user
|
return false;
|
||||||
await setupNotificationWithUsers(
|
|
||||||
forceContact: userdata.userId.toInt(),
|
|
||||||
);
|
|
||||||
// 2. Then send user request
|
|
||||||
await sendCipherText(
|
|
||||||
userdata.userId.toInt(),
|
|
||||||
EncryptedContent(
|
|
||||||
contactRequest: EncryptedContent_ContactRequest(
|
|
||||||
type: EncryptedContent_ContactRequest_Type.REQUEST,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 1. Setup notifications keys with the other user
|
||||||
|
await setupNotificationWithUsers(
|
||||||
|
forceContact: userdata.userId.toInt(),
|
||||||
|
);
|
||||||
|
|
||||||
|
// 2. Then send user request
|
||||||
|
await sendCipherText(
|
||||||
|
userdata.userId.toInt(),
|
||||||
|
EncryptedContent(
|
||||||
|
contactRequest: EncryptedContent_ContactRequest(
|
||||||
|
type: EncryptedContent_ContactRequest_Type.REQUEST,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -302,7 +302,7 @@ Color getMessageColorFromType(
|
||||||
) {
|
) {
|
||||||
Color color;
|
Color color;
|
||||||
|
|
||||||
if (message.type == MessageType.text.name) {
|
if (message.type == MessageType.restoreFlameCounter.name) {
|
||||||
color = Colors.orange;
|
color = Colors.orange;
|
||||||
} else if (message.type == MessageType.text.name) {
|
} else if (message.type == MessageType.text.name) {
|
||||||
color = Colors.blueAccent;
|
color = Colors.blueAccent;
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,7 @@ PublicProfile? parseQrCodeData(Uint8List rawBytes) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> addNewContactFromPublicProfile(PublicProfile profile) async {
|
Future<bool> addNewContactFromPublicProfile(PublicProfile profile) async {
|
||||||
final userdata = Response_UserData(
|
final userdata = Response_UserData(
|
||||||
userId: profile.userId,
|
userId: profile.userId,
|
||||||
publicIdentityKey: profile.publicIdentityKey,
|
publicIdentityKey: profile.publicIdentityKey,
|
||||||
|
|
@ -77,5 +77,8 @@ Future<void> addNewContactFromPublicProfile(PublicProfile profile) async {
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
if (added > 0) await importSignalContactAndCreateRequest(userdata);
|
if (added > 0) {
|
||||||
|
return importSignalContactAndCreateRequest(userdata);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -761,7 +761,21 @@ class _CameraPreviewViewState extends State<CameraPreviewView> {
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
c.isLoading = true;
|
c.isLoading = true;
|
||||||
widget.mainCameraController.setState();
|
widget.mainCameraController.setState();
|
||||||
await addNewContactFromPublicProfile(c.profile);
|
if (await addNewContactFromPublicProfile(
|
||||||
|
c.profile,
|
||||||
|
) &&
|
||||||
|
context.mounted) {
|
||||||
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
|
SnackBar(
|
||||||
|
content: Text(
|
||||||
|
context.lang.requestedUserToastText(
|
||||||
|
c.profile.username,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
duration: const Duration(seconds: 8),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
child: Container(
|
child: Container(
|
||||||
padding: const EdgeInsets.all(12),
|
padding: const EdgeInsets.all(12),
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ import 'package:twonly/src/database/tables/messages.table.dart'
|
||||||
import 'package:twonly/src/database/twonly.db.dart';
|
import 'package:twonly/src/database/twonly.db.dart';
|
||||||
import 'package:twonly/src/model/memory_item.model.dart';
|
import 'package:twonly/src/model/memory_item.model.dart';
|
||||||
import 'package:twonly/src/services/mediafiles/mediafile.service.dart';
|
import 'package:twonly/src/services/mediafiles/mediafile.service.dart';
|
||||||
|
import 'package:twonly/src/utils/log.dart';
|
||||||
import 'package:twonly/src/views/chats/chat_messages_components/chat_reaction_row.dart';
|
import 'package:twonly/src/views/chats/chat_messages_components/chat_reaction_row.dart';
|
||||||
import 'package:twonly/src/views/chats/chat_messages_components/entries/chat_audio_entry.dart';
|
import 'package:twonly/src/views/chats/chat_messages_components/entries/chat_audio_entry.dart';
|
||||||
import 'package:twonly/src/views/chats/chat_messages_components/entries/chat_contacts.entry.dart';
|
import 'package:twonly/src/views/chats/chat_messages_components/entries/chat_contacts.entry.dart';
|
||||||
|
|
@ -79,6 +80,10 @@ class _ChatListEntryState extends State<ChatListEntry> {
|
||||||
if (mediaFiles != null) {
|
if (mediaFiles != null) {
|
||||||
mediaService = MediaFileService(mediaFiles);
|
mediaService = MediaFileService(mediaFiles);
|
||||||
if (mounted) setState(() {});
|
if (mounted) setState(() {});
|
||||||
|
} else {
|
||||||
|
Log.error(
|
||||||
|
'Media file not found for ${widget.message.messageId} => ${widget.message.mediaId}',
|
||||||
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ class ContactView extends StatefulWidget {
|
||||||
|
|
||||||
class _ContactViewState extends State<ContactView> {
|
class _ContactViewState extends State<ContactView> {
|
||||||
Contact? _contact;
|
Contact? _contact;
|
||||||
bool _contactIsStillAGroupMember = true;
|
List<GroupMember> _memberOfGroups = [];
|
||||||
|
|
||||||
late StreamSubscription<Contact?> _contactSub;
|
late StreamSubscription<Contact?> _contactSub;
|
||||||
late StreamSubscription<List<GroupMember>> _groupMemberSub;
|
late StreamSubscription<List<GroupMember>> _groupMemberSub;
|
||||||
|
|
@ -44,10 +44,8 @@ class _ContactViewState extends State<ContactView> {
|
||||||
});
|
});
|
||||||
_groupMemberSub = twonlyDB.groupsDao
|
_groupMemberSub = twonlyDB.groupsDao
|
||||||
.watchContactGroupMember(widget.userId)
|
.watchContactGroupMember(widget.userId)
|
||||||
.listen((update) {
|
.listen((groups) async {
|
||||||
setState(() {
|
_memberOfGroups = groups;
|
||||||
_contactIsStillAGroupMember = update.isNotEmpty;
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
super.initState();
|
super.initState();
|
||||||
}
|
}
|
||||||
|
|
@ -60,7 +58,18 @@ class _ContactViewState extends State<ContactView> {
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> handleUserRemoveRequest(Contact contact) async {
|
Future<void> handleUserRemoveRequest(Contact contact) async {
|
||||||
if (_contactIsStillAGroupMember) {
|
var delete = true;
|
||||||
|
for (final groupM in _memberOfGroups) {
|
||||||
|
final group = await twonlyDB.groupsDao.getGroup(groupM.groupId);
|
||||||
|
if (group?.deletedContent ?? false) {
|
||||||
|
await twonlyDB.groupsDao.deleteGroup(group!.groupId);
|
||||||
|
} else {
|
||||||
|
delete = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!mounted) return;
|
||||||
|
|
||||||
|
if (!delete) {
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
SnackBar(
|
SnackBar(
|
||||||
content: Text(context.lang.deleteUserErrorMessage),
|
content: Text(context.lang.deleteUserErrorMessage),
|
||||||
|
|
@ -211,26 +220,6 @@ class _ContactViewState extends State<ContactView> {
|
||||||
setState(() {});
|
setState(() {});
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
// BetterListTile(
|
|
||||||
// icon: FontAwesomeIcons.eraser,
|
|
||||||
// iconSize: 16,
|
|
||||||
// text: context.lang.deleteAllContactMessages,
|
|
||||||
// onTap: () async {
|
|
||||||
// final block = await showAlertDialog(
|
|
||||||
// context,
|
|
||||||
// context.lang.deleteAllContactMessages,
|
|
||||||
// context.lang.deleteAllContactMessagesBody(
|
|
||||||
// getContactDisplayName(contact),
|
|
||||||
// ),
|
|
||||||
// );
|
|
||||||
// if (block) {
|
|
||||||
// if (context.mounted) {
|
|
||||||
// await twonlyDB.messagesDao
|
|
||||||
// .deleteMessagesByContactId(contact.userId);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// },
|
|
||||||
// ),
|
|
||||||
BetterListTile(
|
BetterListTile(
|
||||||
icon: FontAwesomeIcons.flag,
|
icon: FontAwesomeIcons.flag,
|
||||||
text: context.lang.reportUser,
|
text: context.lang.reportUser,
|
||||||
|
|
|
||||||
|
|
@ -43,6 +43,13 @@ class _PrivacyViewState extends State<PrivacyView> {
|
||||||
),
|
),
|
||||||
onTap: () => context.push(Routes.settingsPrivacyBlockUsers),
|
onTap: () => context.push(Routes.settingsPrivacyBlockUsers),
|
||||||
),
|
),
|
||||||
|
ListTile(
|
||||||
|
title: Text(context.lang.contactVerifyNumberTitle),
|
||||||
|
onTap: () async {
|
||||||
|
await context.push(Routes.settingsPublicProfile);
|
||||||
|
setState(() {});
|
||||||
|
},
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -120,6 +120,17 @@ class _ProfileViewState extends State<ProfileView> {
|
||||||
),
|
),
|
||||||
const SizedBox(height: 20),
|
const SizedBox(height: 20),
|
||||||
const Divider(),
|
const Divider(),
|
||||||
|
BetterListTile(
|
||||||
|
leading: const Padding(
|
||||||
|
padding: EdgeInsets.only(right: 5, left: 1),
|
||||||
|
child: FaIcon(
|
||||||
|
FontAwesomeIcons.qrcode,
|
||||||
|
size: 20,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
onTap: () => context.push(Routes.settingsPublicProfile),
|
||||||
|
text: context.lang.profileYourQrCode,
|
||||||
|
),
|
||||||
BetterListTile(
|
BetterListTile(
|
||||||
leading: const Padding(
|
leading: const Padding(
|
||||||
padding: EdgeInsets.only(right: 5, left: 1),
|
padding: EdgeInsets.only(right: 5, left: 1),
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue