From 12b9bdeb849b823b7260e34018b1b0d3f77c0e9c Mon Sep 17 00:00:00 2001 From: Danmei Chen Date: Tue, 6 Aug 2019 10:49:38 +0200 Subject: [PATCH] add message when delete a contact --- Classes/ContactDetailsView.m | 2 +- Classes/ContactsListTableView.m | 46 +++++++++++++++---------- Classes/ContactsListView.m | 2 +- Resources/ar.lproj/Localizable.strings | Bin 72384 -> 72620 bytes Resources/de.lproj/Localizable.strings | Bin 78128 -> 78360 bytes Resources/en.lproj/Localizable.strings | Bin 74668 -> 75132 bytes Resources/fr.lproj/Localizable.strings | Bin 77972 -> 78194 bytes Resources/ja.lproj/Localizable.strings | Bin 70514 -> 70744 bytes Resources/nl.lproj/Localizable.strings | Bin 75456 -> 75688 bytes Resources/ru.lproj/Localizable.strings | Bin 76246 -> 76478 bytes 10 files changed, 29 insertions(+), 21 deletions(-) diff --git a/Classes/ContactDetailsView.m b/Classes/ContactDetailsView.m index 61f49fcfa..723f0eacc 100644 --- a/Classes/ContactDetailsView.m +++ b/Classes/ContactDetailsView.m @@ -518,7 +518,7 @@ static UICompositeViewDescription *compositeDescription = nil; } - (IBAction)onDeleteClick:(id)sender { - NSString *msg = NSLocalizedString(@"Do you want to delete selected contact?", nil); + NSString *msg = NSLocalizedString(@"Do you want to delete selected contact?\nIt will also be deleted from your phone's address book.", nil); [UIConfirmationDialog ShowWithMessage:msg cancelMessage:nil confirmMessage:nil diff --git a/Classes/ContactsListTableView.m b/Classes/ContactsListTableView.m index c1720b482..c1c209342 100644 --- a/Classes/ContactsListTableView.m +++ b/Classes/ContactsListTableView.m @@ -404,27 +404,35 @@ static int ms_strcmpfuz(const char *fuzzy_word, const char *sentence) { forRowAtIndexPath:(NSIndexPath *)indexPath { if (editingStyle == UITableViewCellEditingStyleDelete) { [NSNotificationCenter.defaultCenter removeObserver:self]; - [tableView beginUpdates]; + + NSString *msg = NSLocalizedString(@"Do you want to delete selected contact?\nIt will also be deleted from your phone's address book.", nil); + [UIConfirmationDialog ShowWithMessage:msg + cancelMessage:nil + confirmMessage:nil + onCancelClick:nil + onConfirmationClick:^() { + [tableView beginUpdates]; - NSString *firstChar = [addressBookMap keyAtIndex:[indexPath section]]; - NSMutableArray *subAr = [addressBookMap objectForKey:firstChar]; - Contact *contact = subAr[indexPath.row]; - [subAr removeObjectAtIndex:indexPath.row]; - if (subAr.count == 0) { - [addressBookMap removeObjectForKey:firstChar]; - [tableView deleteSections:[NSIndexSet indexSetWithIndex:indexPath.section] - withRowAnimation:UITableViewRowAnimationFade]; - } - UIContactCell* cell = [self.tableView cellForRowAtIndexPath:indexPath]; - [cell setContact:NULL]; - [[LinphoneManager.instance fastAddressBook] deleteContact:contact]; - [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade]; - [tableView endUpdates]; + NSString *firstChar = [addressBookMap keyAtIndex:[indexPath section]]; + NSMutableArray *subAr = [addressBookMap objectForKey:firstChar]; + Contact *contact = subAr[indexPath.row]; + [subAr removeObjectAtIndex:indexPath.row]; + if (subAr.count == 0) { + [addressBookMap removeObjectForKey:firstChar]; + [tableView deleteSections:[NSIndexSet indexSetWithIndex:indexPath.section] + withRowAnimation:UITableViewRowAnimationFade]; + } + UIContactCell* cell = [self.tableView cellForRowAtIndexPath:indexPath]; + [cell setContact:NULL]; + [[LinphoneManager.instance fastAddressBook] deleteContact:contact]; + [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade]; + [tableView endUpdates]; - [NSNotificationCenter.defaultCenter addObserver:self selector:@selector(onAddressBookUpdate:) - name:kLinphoneAddressBookUpdate - object:nil]; - [self loadData]; + [NSNotificationCenter.defaultCenter addObserver:self selector:@selector(onAddressBookUpdate:) + name:kLinphoneAddressBookUpdate + object:nil]; + [self loadData]; + }]; } } diff --git a/Classes/ContactsListView.m b/Classes/ContactsListView.m index 56dc3399e..0872a80cb 100644 --- a/Classes/ContactsListView.m +++ b/Classes/ContactsListView.m @@ -205,7 +205,7 @@ static UICompositeViewDescription *compositeDescription = nil; } - (IBAction)onDeleteClick:(id)sender { - NSString *msg = [NSString stringWithFormat:NSLocalizedString(@"Do you want to delete selected contacts?", nil)]; + NSString *msg = [NSString stringWithFormat:NSLocalizedString(@"Do you want to delete selected contacts?\nThey will also be deleted from your phone's address book.", nil)]; [LinphoneManager.instance setContactsUpdated:TRUE]; [UIConfirmationDialog ShowWithMessage:msg cancelMessage:nil diff --git a/Resources/ar.lproj/Localizable.strings b/Resources/ar.lproj/Localizable.strings index e44719c9b1945f4e5c768e59e6f35d7b7dcc064e..3c1330b8f6c85dc84ab36bafcbe02eeb5171e8da 100644 GIT binary patch delta 167 zcmX@Gm1WI#mIV&lF${SOo(v@n3Jm28nG88VsKAg2B#RmHfvhBkR3MoGBy$*2C)-Yv xom?}Ai&>qaczU8JqcCR@P*FZZHiO>ezxE&XK}LlzWB?UcQf{2`WQhVb+P1x5}=y~&QQs*|H!Ug(323Sr0qDz2o!xXq5P?_UD|R^KP8 delta 26 icmbR7gk{4cmJMbulMUQeCZBP6F}cjkWpkd}s@DLd@C=Or diff --git a/Resources/en.lproj/Localizable.strings b/Resources/en.lproj/Localizable.strings index b7f9ddaba9e931040bf16561499cb042d7b759a0..14e2474220ecda35c296d3bd2fe98f2b24157406 100644 GIT binary patch delta 318 zcmZ2;oaN6cmJQP!v|||Z7(5wD7!(-F88R7ifKY)U5l9v@ge1xV&Fq)uKx zS$6Wfd0fou48_wK1sSCo^(G&5HJ^OOL5U(`CU4pkHM!1RZt^}yBYlv2LKrfDHda#P cCPx*DjY7D~L1FR@C!WbO9NjkGaJupU0PUSs>;M1& delta 58 zcmex!ie=4lmJQP!CLi(Cm~7x^F!_sn%Vax8g~>&3R$%&rdk2sfn!Lh=XL5y`35dOU Ih0B!(0Q7Dc`~Uy| diff --git a/Resources/fr.lproj/Localizable.strings b/Resources/fr.lproj/Localizable.strings index 0102c0a47bc7d17a693c196a4940fea0316e4410..6605c8eede80e8b48cdcc8146ff5f0458746c230 100644 GIT binary patch delta 186 zcmbR8kmb`OmJJRr+A$1y44w=n30NMZY;sli81h7Cvld?oqlL$xhlQ2#mlMqBM19JdBld(iqvj|6O>OqJPV*mgE diff --git a/Resources/ja.lproj/Localizable.strings b/Resources/ja.lproj/Localizable.strings index 75c51b4ad097fc8d76789926dc57631c7fe757df..95cc3e4b4b23811bf787145272ce828450f57698 100644 GIT binary patch delta 162 zcmeygjOE4(mJL02+A$1y44w=n3`QfAnW&1McZmjUB`DFXli delta 30 mcmcbyg5}dPmJL02lLH*iOb&2kn|#5ZW3rN?#O4%-FP8z>1PzY> diff --git a/Resources/nl.lproj/Localizable.strings b/Resources/nl.lproj/Localizable.strings index ffb1aa0373259002ad2136482ac740c5fa0c1b5f..961bb0be832fcd1bf82e1a2fe4c51e0ab665c9b2 100644 GIT binary patch delta 184 zcmX?bmSx3xmJKqF+A$1y44w=n3ge1xV&Fq)zsn zCOf&WmWx@Pp?LDdtHRSih%j<6>P@b9wV!;$X^%e0s1Sw>pyEo(jB{Rm&G{Js7Gy0) delta 33 kcmdmYmF3!HmJPF