mirror of
https://github.com/twonlyapp/twonly-app.git
synced 2026-05-24 23:52:11 +00:00
change feature name and remove deleted accounts
This commit is contained in:
parent
c9b8e32d32
commit
a015cb2cb8
9 changed files with 58 additions and 144 deletions
|
|
@ -25,6 +25,7 @@ import 'package:twonly/src/services/mediafiles/mediafile.service.dart';
|
|||
import 'package:twonly/src/services/notifications/fcm.notifications.dart';
|
||||
import 'package:twonly/src/services/notifications/setup.notifications.dart';
|
||||
import 'package:twonly/src/services/user.service.dart';
|
||||
import 'package:twonly/src/services/user_discovery.service.dart';
|
||||
import 'package:twonly/src/utils/avatars.dart';
|
||||
import 'package:twonly/src/utils/log.dart';
|
||||
import 'package:twonly/src/utils/secure_storage.dart';
|
||||
|
|
@ -94,19 +95,19 @@ void main() async {
|
|||
);
|
||||
}
|
||||
|
||||
unawaited(performTwonlySafeBackup());
|
||||
unawaited(initializeBackgroundTaskManager());
|
||||
|
||||
await runMigrations();
|
||||
|
||||
await twonlyDB.messagesDao.purgeMessageTable();
|
||||
await twonlyDB.receiptsDao.purgeReceivedReceipts();
|
||||
await UserDiscoveryService.removeDeletedContacts();
|
||||
|
||||
unawaited(MediaFileService.purgeTempFolder());
|
||||
|
||||
unawaited(setupPushNotification());
|
||||
unawaited(finishStartedPreprocessing());
|
||||
unawaited(createPushAvatars());
|
||||
unawaited(performTwonlySafeBackup());
|
||||
unawaited(initializeBackgroundTaskManager());
|
||||
}
|
||||
|
||||
await apiService.listenToNetworkChanges();
|
||||
|
|
|
|||
|
|
@ -136,34 +136,40 @@ class ContactsDao extends DatabaseAccessor<TwonlyDB> with _$ContactsDaoMixin {
|
|||
|
||||
Stream<List<Contact>> watchContactsAnnouncedViaUserDiscovery() {
|
||||
return (select(contacts)..where((t) {
|
||||
var expr = t.userDiscoveryVersion.isNotNull() &
|
||||
t.userDiscoveryExcluded.equals(false) &
|
||||
t.mediaSendCounter.isBiggerOrEqualValue(
|
||||
userService.currentUser.requiredSendImages,
|
||||
);
|
||||
var expr =
|
||||
t.userDiscoveryVersion.isNotNull() &
|
||||
t.userDiscoveryExcluded.equals(false) &
|
||||
t.accountDeleted.equals(false) &
|
||||
t.mediaSendCounter.isBiggerOrEqualValue(
|
||||
userService.currentUser.requiredSendImages,
|
||||
);
|
||||
|
||||
if (userService.currentUser.userDiscoveryRequiresManualApproval) {
|
||||
expr = expr & t.userDiscoveryManualApproved.equals(true);
|
||||
}
|
||||
if (userService.currentUser.userDiscoveryRequiresManualApproval) {
|
||||
expr = expr & t.userDiscoveryManualApproved.equals(true);
|
||||
}
|
||||
|
||||
return expr;
|
||||
})).watch();
|
||||
return expr;
|
||||
}))
|
||||
.watch();
|
||||
}
|
||||
|
||||
Future<List<Contact>> getContactsAnnouncedViaUserDiscovery() async {
|
||||
return (select(contacts)..where((t) {
|
||||
var expr = t.userDiscoveryVersion.isNotNull() &
|
||||
t.userDiscoveryExcluded.equals(false) &
|
||||
t.mediaSendCounter.isBiggerOrEqualValue(
|
||||
userService.currentUser.requiredSendImages,
|
||||
);
|
||||
var expr =
|
||||
t.userDiscoveryVersion.isNotNull() &
|
||||
t.userDiscoveryExcluded.equals(false) &
|
||||
t.accountDeleted.equals(false) &
|
||||
t.mediaSendCounter.isBiggerOrEqualValue(
|
||||
userService.currentUser.requiredSendImages,
|
||||
);
|
||||
|
||||
if (userService.currentUser.userDiscoveryRequiresManualApproval) {
|
||||
expr = expr & t.userDiscoveryManualApproved.equals(true);
|
||||
}
|
||||
if (userService.currentUser.userDiscoveryRequiresManualApproval) {
|
||||
expr = expr & t.userDiscoveryManualApproved.equals(true);
|
||||
}
|
||||
|
||||
return expr;
|
||||
})).get();
|
||||
return expr;
|
||||
}))
|
||||
.get();
|
||||
}
|
||||
|
||||
Stream<List<Contact>> watchAllContacts() {
|
||||
|
|
|
|||
|
|
@ -2390,12 +2390,6 @@ abstract class AppLocalizations {
|
|||
/// **'Share your friends'**
|
||||
String get onboardingUserDiscoveryShareFriends;
|
||||
|
||||
/// No description provided for @onboardingUserDiscoveryIncreaseTrust.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Increase trust'**
|
||||
String get onboardingUserDiscoveryIncreaseTrust;
|
||||
|
||||
/// No description provided for @onboardingUserDiscoveryShareFriendsDesc.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
|
|
@ -2414,12 +2408,6 @@ abstract class AppLocalizations {
|
|||
/// **'Be informed about who is requesting'**
|
||||
String get onboardingUserDiscoveryWhoIsRequesting;
|
||||
|
||||
/// No description provided for @userDiscoverySettingsEnableAllContacts.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Enabled for all contacts'**
|
||||
String get userDiscoverySettingsEnableAllContacts;
|
||||
|
||||
/// No description provided for @userDiscoverySettingsManualApproval.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
|
|
@ -2438,12 +2426,6 @@ abstract class AppLocalizations {
|
|||
/// **'Let your friends find you'**
|
||||
String get onboardingUserDiscoveryLetFriendsFindYou;
|
||||
|
||||
/// No description provided for @onboardingUserDiscoveryLetFriendsFindYouDesc.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'To help your friends find you, *you can be suggested* to people with whom you have *mutual friends*.'**
|
||||
String get onboardingUserDiscoveryLetFriendsFindYouDesc;
|
||||
|
||||
/// No description provided for @onboardingUserDiscoveryBeRecommended.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
|
|
@ -2804,12 +2786,6 @@ abstract class AppLocalizations {
|
|||
/// **'Accept'**
|
||||
String get contactActionAccept;
|
||||
|
||||
/// No description provided for @userDiscoverySettingsMinImages.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Choose the minimum number of images you must have send to a person before you securely share your friends with them.'**
|
||||
String get userDiscoverySettingsMinImages;
|
||||
|
||||
/// No description provided for @userDiscoverySettingsMutualFriends.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
|
|
@ -2825,7 +2801,7 @@ abstract class AppLocalizations {
|
|||
/// No description provided for @userDiscoveryEnabledDisableWarning.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'If you disable the \"Share your friends\" feature, you will no longer see suggestions. You will also stop sharing your friends with new contacts.'**
|
||||
/// **'If you disable the \"Mutual Friends\" feature, you will no longer see suggestions. You will also stop sharing your friends with new contacts.'**
|
||||
String get userDiscoveryEnabledDisableWarning;
|
||||
|
||||
/// No description provided for @userDiscoveryEnabledChangeSettings.
|
||||
|
|
@ -2837,7 +2813,7 @@ abstract class AppLocalizations {
|
|||
/// No description provided for @userDiscoveryEnabledFaq.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'In our FAQ we explain how the \"Share your friends\" feature works.'**
|
||||
/// **'In our FAQ we explain how the \"Mutual Friends\" feature works.'**
|
||||
String get userDiscoveryEnabledFaq;
|
||||
|
||||
/// No description provided for @userDiscoveryDisabledIntro.
|
||||
|
|
@ -2846,36 +2822,12 @@ abstract class AppLocalizations {
|
|||
/// **'twonly does *not* collect your phone number or needs access to your contacts. Instead, twonly can *find your friends through mutual friends*.'**
|
||||
String get userDiscoveryDisabledIntro;
|
||||
|
||||
/// No description provided for @userDiscoveryDisabledDecide.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Decide for yourself who can see your friends. You can change your mind at *any time* or *hide specific people*.'**
|
||||
String get userDiscoveryDisabledDecide;
|
||||
|
||||
/// No description provided for @userDiscoverySettingsTitle.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Share your friends'**
|
||||
/// **'Mutual Friends'**
|
||||
String get userDiscoverySettingsTitle;
|
||||
|
||||
/// No description provided for @userDiscoverySettingsMinImagesTitle.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Number of images send'**
|
||||
String get userDiscoverySettingsMinImagesTitle;
|
||||
|
||||
/// No description provided for @userDiscoverySettingsMutualFriendsTitle.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Number of mutual friends'**
|
||||
String get userDiscoverySettingsMutualFriendsTitle;
|
||||
|
||||
/// No description provided for @userDiscoveryDisabledYouHaveControl.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'You are in control'**
|
||||
String get userDiscoveryDisabledYouHaveControl;
|
||||
|
||||
/// No description provided for @userDiscoveryDisabledLearnMore.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
|
|
@ -2903,7 +2855,7 @@ abstract class AppLocalizations {
|
|||
/// No description provided for @userDiscoverySettingsCurrentlyDisabled.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'The feature \"Share your friends\" is currently disabled.'**
|
||||
/// **'The feature \"Mutual Friends\" is currently disabled.'**
|
||||
String get userDiscoverySettingsCurrentlyDisabled;
|
||||
|
||||
/// No description provided for @userDiscoveryEnabledNoFriendsShared.
|
||||
|
|
|
|||
|
|
@ -1304,9 +1304,6 @@ class AppLocalizationsDe extends AppLocalizations {
|
|||
@override
|
||||
String get onboardingUserDiscoveryShareFriends => 'Freunde teilen';
|
||||
|
||||
@override
|
||||
String get onboardingUserDiscoveryIncreaseTrust => 'Erhöhe Vertrauen';
|
||||
|
||||
@override
|
||||
String get onboardingUserDiscoveryShareFriendsDesc =>
|
||||
'Teile deinen Freunden mit, wen du kennst und wen du verifiziert hast. Freunde können von deiner Freundesliste *nur gemeinsame Freunde sehen*.';
|
||||
|
|
@ -1319,10 +1316,6 @@ class AppLocalizationsDe extends AppLocalizations {
|
|||
String get onboardingUserDiscoveryWhoIsRequesting =>
|
||||
'Erfahre, wer dich anfragt';
|
||||
|
||||
@override
|
||||
String get userDiscoverySettingsEnableAllContacts =>
|
||||
'Für alle Kontakte aktivieren';
|
||||
|
||||
@override
|
||||
String get userDiscoverySettingsManualApproval => 'Manuelle Zustimmung';
|
||||
|
||||
|
|
@ -1334,10 +1327,6 @@ class AppLocalizationsDe extends AppLocalizations {
|
|||
String get onboardingUserDiscoveryLetFriendsFindYou =>
|
||||
'Lass dich von deinen Freunden finden';
|
||||
|
||||
@override
|
||||
String get onboardingUserDiscoveryLetFriendsFindYouDesc =>
|
||||
'Damit deine Freunde dich finden können, kannst du Personen vorgeschlagen werden, die gemeinsame Freunde mit dir haben.';
|
||||
|
||||
@override
|
||||
String get onboardingUserDiscoveryBeRecommended =>
|
||||
'Anderen vorgeschlagen werden';
|
||||
|
|
@ -1568,10 +1557,6 @@ class AppLocalizationsDe extends AppLocalizations {
|
|||
@override
|
||||
String get contactActionAccept => 'Annehmen';
|
||||
|
||||
@override
|
||||
String get userDiscoverySettingsMinImages =>
|
||||
'Wähle die Mindestanzahl an Bildern, die du an eine Person gesendet haben musst, bevor du ihr deine Freunde sicher teilst.';
|
||||
|
||||
@override
|
||||
String get userDiscoverySettingsMutualFriends =>
|
||||
'Wähle aus, wie viele gemeinsame Freunde eine Person haben muss, damit du ihr vorgeschlagen wirst.';
|
||||
|
|
@ -1581,36 +1566,21 @@ class AppLocalizationsDe extends AppLocalizations {
|
|||
|
||||
@override
|
||||
String get userDiscoveryEnabledDisableWarning =>
|
||||
'Wenn du das Feature „Freunde teilen“ deaktivierst, werden dir keine Vorschläge mehr angezeigt. Du teilst neuen Kontakten dann auch nicht mehr deine Freunde.';
|
||||
'Wenn du das Feature „Gemeinsame Freunde“ deaktivierst, werden dir keine Vorschläge mehr angezeigt. Du teilst neuen Kontakten dann auch nicht mehr deine Freunde.';
|
||||
|
||||
@override
|
||||
String get userDiscoveryEnabledChangeSettings => 'Einstellungen ändern';
|
||||
|
||||
@override
|
||||
String get userDiscoveryEnabledFaq =>
|
||||
'In unserem FAQ erklären wir dir wie das Feature \"Freunde teilen\" funktioniert.';
|
||||
'In unserem FAQ erklären wir dir wie das Feature \"Gemeinsame Freunde\" funktioniert.';
|
||||
|
||||
@override
|
||||
String get userDiscoveryDisabledIntro =>
|
||||
'twonly kann *ohne Telefonnummer* oder den Zugriff auf dein Adressbuch verwendet werden. Stattdessen kannst du *deine Freunde über gemeinsame Freunde* finden.';
|
||||
|
||||
@override
|
||||
String get userDiscoveryDisabledDecide =>
|
||||
'Entscheide selbst, wer deine Freunde sehen darf. Du kannst deine Meinung *jederzeit ändern* oder *bestimmte Personen verstecken*.';
|
||||
|
||||
@override
|
||||
String get userDiscoverySettingsTitle => 'Freunde teilen';
|
||||
|
||||
@override
|
||||
String get userDiscoverySettingsMinImagesTitle =>
|
||||
'Anzahl an gesendeten Bildern';
|
||||
|
||||
@override
|
||||
String get userDiscoverySettingsMutualFriendsTitle =>
|
||||
'Anzahl an gemeinsame Freunde';
|
||||
|
||||
@override
|
||||
String get userDiscoveryDisabledYouHaveControl => 'Du hast die Kontrolle';
|
||||
String get userDiscoverySettingsTitle => 'Gemeinsame Freunde';
|
||||
|
||||
@override
|
||||
String get userDiscoveryDisabledLearnMore => 'Mehr erfahren';
|
||||
|
|
@ -1627,7 +1597,7 @@ class AppLocalizationsDe extends AppLocalizations {
|
|||
|
||||
@override
|
||||
String get userDiscoverySettingsCurrentlyDisabled =>
|
||||
'Das Feature \"Freunde teilen\" ist derzeit deaktiviert.';
|
||||
'Das Feature \"Gemeinsame Freunde\" ist derzeit deaktiviert.';
|
||||
|
||||
@override
|
||||
String get userDiscoveryEnabledNoFriendsShared =>
|
||||
|
|
|
|||
|
|
@ -1295,9 +1295,6 @@ class AppLocalizationsEn extends AppLocalizations {
|
|||
@override
|
||||
String get onboardingUserDiscoveryShareFriends => 'Share your friends';
|
||||
|
||||
@override
|
||||
String get onboardingUserDiscoveryIncreaseTrust => 'Increase trust';
|
||||
|
||||
@override
|
||||
String get onboardingUserDiscoveryShareFriendsDesc =>
|
||||
'Share with your friends who you know and who you have verified. Friends can *only see mutual friends* from your friend list. You can change your mind at *any time* or *hide specific people*.';
|
||||
|
|
@ -1310,10 +1307,6 @@ class AppLocalizationsEn extends AppLocalizations {
|
|||
String get onboardingUserDiscoveryWhoIsRequesting =>
|
||||
'Be informed about who is requesting';
|
||||
|
||||
@override
|
||||
String get userDiscoverySettingsEnableAllContacts =>
|
||||
'Enabled for all contacts';
|
||||
|
||||
@override
|
||||
String get userDiscoverySettingsManualApproval => 'Manual approval';
|
||||
|
||||
|
|
@ -1325,10 +1318,6 @@ class AppLocalizationsEn extends AppLocalizations {
|
|||
String get onboardingUserDiscoveryLetFriendsFindYou =>
|
||||
'Let your friends find you';
|
||||
|
||||
@override
|
||||
String get onboardingUserDiscoveryLetFriendsFindYouDesc =>
|
||||
'To help your friends find you, *you can be suggested* to people with whom you have *mutual friends*.';
|
||||
|
||||
@override
|
||||
String get onboardingUserDiscoveryBeRecommended => 'Be recommended to others';
|
||||
|
||||
|
|
@ -1553,10 +1542,6 @@ class AppLocalizationsEn extends AppLocalizations {
|
|||
@override
|
||||
String get contactActionAccept => 'Accept';
|
||||
|
||||
@override
|
||||
String get userDiscoverySettingsMinImages =>
|
||||
'Choose the minimum number of images you must have send to a person before you securely share your friends with them.';
|
||||
|
||||
@override
|
||||
String get userDiscoverySettingsMutualFriends =>
|
||||
'Choose how many mutual friends a person must have for you to be suggested to them.';
|
||||
|
|
@ -1566,35 +1551,21 @@ class AppLocalizationsEn extends AppLocalizations {
|
|||
|
||||
@override
|
||||
String get userDiscoveryEnabledDisableWarning =>
|
||||
'If you disable the \"Share your friends\" feature, you will no longer see suggestions. You will also stop sharing your friends with new contacts.';
|
||||
'If you disable the \"Mutual Friends\" feature, you will no longer see suggestions. You will also stop sharing your friends with new contacts.';
|
||||
|
||||
@override
|
||||
String get userDiscoveryEnabledChangeSettings => 'Change settings';
|
||||
|
||||
@override
|
||||
String get userDiscoveryEnabledFaq =>
|
||||
'In our FAQ we explain how the \"Share your friends\" feature works.';
|
||||
'In our FAQ we explain how the \"Mutual Friends\" feature works.';
|
||||
|
||||
@override
|
||||
String get userDiscoveryDisabledIntro =>
|
||||
'twonly does *not* collect your phone number or needs access to your contacts. Instead, twonly can *find your friends through mutual friends*.';
|
||||
|
||||
@override
|
||||
String get userDiscoveryDisabledDecide =>
|
||||
'Decide for yourself who can see your friends. You can change your mind at *any time* or *hide specific people*.';
|
||||
|
||||
@override
|
||||
String get userDiscoverySettingsTitle => 'Share your friends';
|
||||
|
||||
@override
|
||||
String get userDiscoverySettingsMinImagesTitle => 'Number of images send';
|
||||
|
||||
@override
|
||||
String get userDiscoverySettingsMutualFriendsTitle =>
|
||||
'Number of mutual friends';
|
||||
|
||||
@override
|
||||
String get userDiscoveryDisabledYouHaveControl => 'You are in control';
|
||||
String get userDiscoverySettingsTitle => 'Mutual Friends';
|
||||
|
||||
@override
|
||||
String get userDiscoveryDisabledLearnMore => 'Learn more';
|
||||
|
|
@ -1611,7 +1582,7 @@ class AppLocalizationsEn extends AppLocalizations {
|
|||
|
||||
@override
|
||||
String get userDiscoverySettingsCurrentlyDisabled =>
|
||||
'The feature \"Share your friends\" is currently disabled.';
|
||||
'The feature \"Mutual Friends\" is currently disabled.';
|
||||
|
||||
@override
|
||||
String get userDiscoveryEnabledNoFriendsShared =>
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit 96fc996e06f96a7a26438bba0421cb26eb721427
|
||||
Subproject commit b556f4b332d9df274ff07c606d4db3ab0353cc9a
|
||||
|
|
@ -172,6 +172,18 @@ class UserDiscoveryService {
|
|||
}
|
||||
}
|
||||
|
||||
static Future<void> removeDeletedContacts() async {
|
||||
final subquery = twonlyDB.selectOnly(twonlyDB.contacts)
|
||||
..addColumns([twonlyDB.contacts.userId])
|
||||
..where(twonlyDB.contacts.accountDeleted.equals(true));
|
||||
|
||||
await (twonlyDB.update(
|
||||
twonlyDB.userDiscoveryOwnPromotions,
|
||||
)..where((t) => t.contactId.isInQuery(subquery))).write(
|
||||
UserDiscoveryOwnPromotionsCompanion(promotion: Value(Uint8List(0))),
|
||||
);
|
||||
}
|
||||
|
||||
static Future<void> changeExclusionForContact(
|
||||
int contactId,
|
||||
bool exclude,
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ import 'package:twonly/src/visual/components/verification_badge.comp.dart';
|
|||
import 'package:twonly/src/visual/elements/better_list_title.element.dart';
|
||||
import 'package:twonly/src/visual/views/contact/contact_components/restore_flame.comp.dart';
|
||||
import 'package:twonly/src/visual/views/groups/group.view.dart';
|
||||
import 'package:twonly/src/visual/views/settings/privacy/user_discovery.view.dart';
|
||||
|
||||
class ContactView extends StatefulWidget {
|
||||
const ContactView(this.userId, {super.key});
|
||||
|
|
@ -337,6 +338,7 @@ class _ContactViewState extends State<ContactView> {
|
|||
BetterListTile(
|
||||
icon: FontAwesomeIcons.usersViewfinder,
|
||||
text: context.lang.userDiscoverySettingsTitle,
|
||||
onTap: () => context.navPush(const UserDiscoverySettingsView()),
|
||||
subtitle:
|
||||
!contact.userDiscoveryExcluded &&
|
||||
contact.mediaSendCounter <
|
||||
|
|
|
|||
|
|
@ -158,7 +158,7 @@ class _UserDiscoveryEnabledCompState extends State<UserDiscoveryEnabledComp> {
|
|||
context.lang.userDiscoveryEnabledFaq,
|
||||
),
|
||||
onTap: () => context.navPush(
|
||||
const FaqView(questionId: 'user-discovery'),
|
||||
const FaqView(questionId: 'mutual-friends'),
|
||||
),
|
||||
),
|
||||
const Divider(),
|
||||
|
|
|
|||
Loading…
Reference in a new issue