mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-17 11:08:06 +00:00
use confirmation popup when deleting a contact
This commit is contained in:
parent
77fdfe6afa
commit
50f8b10623
12 changed files with 77 additions and 73 deletions
|
|
@ -44,21 +44,7 @@
|
|||
<action selector="onBackClick:" destination="-1" eventType="touchUpInside" id="10"/>
|
||||
</connections>
|
||||
</button>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="8" userLabel="editButton" customClass="UIToggleButton">
|
||||
<rect key="frame" x="300" y="0.0" width="75" height="42"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/>
|
||||
<accessibility key="accessibilityConfiguration" label="Edit"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="14"/>
|
||||
<inset key="titleEdgeInsets" minX="0.0" minY="18" maxX="0.0" maxY="0.0"/>
|
||||
<state key="normal" image="edit.png">
|
||||
<color key="titleColor" red="0.35686274509999999" green="0.39607843139999999" blue="0.43529411759999997" alpha="1" colorSpace="deviceRGB"/>
|
||||
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
|
||||
</state>
|
||||
<connections>
|
||||
<action selector="onEditClick:" destination="-1" eventType="touchUpInside" id="30"/>
|
||||
</connections>
|
||||
</button>
|
||||
<button hidden="YES" opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="MuB-yy-R9o" userLabel="deleteButton" customClass="UIToggleButton">
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="MuB-yy-R9o" userLabel="deleteButton" customClass="UIToggleButton">
|
||||
<rect key="frame" x="225" y="0.0" width="75" height="42"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/>
|
||||
<accessibility key="accessibilityConfiguration" label="Edit"/>
|
||||
|
|
@ -69,7 +55,22 @@
|
|||
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
|
||||
</state>
|
||||
<connections>
|
||||
<action selector="onEditClick:" destination="-1" eventType="touchUpInside" id="3ff-r3-2d1"/>
|
||||
<action selector="onDeleteClick:" destination="-1" eventType="touchUpInside" id="vxj-6p-8lE"/>
|
||||
</connections>
|
||||
</button>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="8" userLabel="editButton" customClass="UIToggleButton">
|
||||
<rect key="frame" x="300" y="0.0" width="75" height="42"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/>
|
||||
<accessibility key="accessibilityConfiguration" label="Edit"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="14"/>
|
||||
<inset key="titleEdgeInsets" minX="0.0" minY="18" maxX="0.0" maxY="0.0"/>
|
||||
<state key="normal" image="edit.png">
|
||||
<color key="titleColor" red="0.35686274509999999" green="0.39607843139999999" blue="0.43529411759999997" alpha="1" colorSpace="deviceRGB"/>
|
||||
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
|
||||
</state>
|
||||
<state key="selected" image="valid.png"/>
|
||||
<connections>
|
||||
<action selector="onEditClick:" destination="-1" eventType="touchUpInside" id="30"/>
|
||||
</connections>
|
||||
</button>
|
||||
</subviews>
|
||||
|
|
@ -105,6 +106,7 @@
|
|||
<image name="color_F.png" width="1" height="1"/>
|
||||
<image name="delete.png" width="22" height="28"/>
|
||||
<image name="edit.png" width="30" height="30"/>
|
||||
<image name="valid.png" width="28" height="19"/>
|
||||
</resources>
|
||||
<simulatedMetricsContainer key="defaultSimulatedMetrics">
|
||||
<simulatedStatusBarMetrics key="statusBar"/>
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@
|
|||
|
||||
@protocol ContactDetailsDelegate <NSObject>
|
||||
|
||||
- (void)onRemove:(id)event;
|
||||
- (void)onModification:(id)event;
|
||||
|
||||
@end
|
||||
|
|
@ -38,6 +38,7 @@
|
|||
- (IBAction)onBackClick:(id)event;
|
||||
- (IBAction)onCancelClick:(id)event;
|
||||
- (IBAction)onEditClick:(id)event;
|
||||
- (IBAction)onDeleteClick:(id)sender;
|
||||
|
||||
- (void)newContact;
|
||||
- (void)newContact:(NSString *)address;
|
||||
|
|
|
|||
|
|
@ -266,10 +266,16 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
}
|
||||
}
|
||||
|
||||
- (void)onRemove:(id)event {
|
||||
[self disableEdit:FALSE];
|
||||
[self removeContact];
|
||||
[PhoneMainView.instance popCurrentView];
|
||||
- (IBAction)onDeleteClick:(id)sender {
|
||||
NSString *msg = [NSString
|
||||
stringWithFormat:NSLocalizedString(@"Are you sure that you want to delete your contact %@?", nil), @"toto"];
|
||||
[UIConfirmationDialog ShowWithMessage:msg
|
||||
onCancelClick:nil
|
||||
onConfirmationClick:^() {
|
||||
[self disableEdit:FALSE];
|
||||
[self removeContact];
|
||||
[PhoneMainView.instance popCurrentView];
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)onModification:(id)event {
|
||||
|
|
|
|||
|
|
@ -25,7 +25,6 @@
|
|||
#import "HistoryDetailsTableView.h"
|
||||
@interface HistoryDetailsView : UIViewController <UICompositeViewDelegate> {
|
||||
@private
|
||||
ABRecordRef contact;
|
||||
LinphoneCallLog *callLog;
|
||||
NSDateFormatter *dateFormatter;
|
||||
}
|
||||
|
|
@ -35,7 +34,6 @@
|
|||
@property(nonatomic, strong) IBOutlet UIButton *addContactButton;
|
||||
@property(nonatomic, copy, setter=setCallLogId:) NSString *callLogId;
|
||||
@property(weak, nonatomic) IBOutlet UIView *headerView;
|
||||
@property(weak, nonatomic) IBOutlet UITableView *callsTableView;
|
||||
@property(strong, nonatomic) IBOutlet HistoryDetailsTableView *tableView;
|
||||
|
||||
- (IBAction)onBackClick:(id)event;
|
||||
|
|
|
|||
|
|
@ -159,12 +159,10 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
}
|
||||
|
||||
LinphoneAddress *addr = linphone_call_log_get_remote_address(callLog);
|
||||
// this address should NEVER be NULL: if this assert is broken, the bug is elsewhere.
|
||||
assert(addr != NULL);
|
||||
|
||||
[ContactDisplay setDisplayNameLabel:_contactLabel forAddress:addr];
|
||||
_avatarImage.image =
|
||||
[FastAddressBook getContactImage:[FastAddressBook getContactWithLinphoneAddress:addr] thumbnail:NO];
|
||||
ABRecordRef contact = [FastAddressBook getContactWithLinphoneAddress:addr];
|
||||
_addContactButton.hidden = (contact != nil);
|
||||
[ContactDisplay setDisplayNameLabel:_contactLabel forContact:contact];
|
||||
_avatarImage.image = [FastAddressBook getContactImage:contact thumbnail:NO];
|
||||
char *addrURI = linphone_address_as_string_uri_only(addr);
|
||||
_addressLabel.text = [NSString stringWithUTF8String:addrURI];
|
||||
ms_free(addrURI);
|
||||
|
|
@ -177,30 +175,26 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
}
|
||||
|
||||
- (IBAction)onContactClick:(id)event {
|
||||
if (contact) {
|
||||
ContactDetailsView *view = VIEW(ContactDetailsView);
|
||||
[PhoneMainView.instance changeCurrentView:view.compositeViewDescription push:TRUE];
|
||||
[ContactSelection setSelectionMode:ContactSelectionModeNone];
|
||||
[view setContact:contact];
|
||||
}
|
||||
LinphoneAddress *addr = linphone_call_log_get_remote_address(callLog);
|
||||
ABRecordRef contact = [FastAddressBook getContactWithLinphoneAddress:addr];
|
||||
ContactDetailsView *view = VIEW(ContactDetailsView);
|
||||
[PhoneMainView.instance changeCurrentView:view.compositeViewDescription push:TRUE];
|
||||
[ContactSelection setSelectionMode:ContactSelectionModeNone];
|
||||
[view setContact:contact];
|
||||
}
|
||||
|
||||
- (IBAction)onAddContactClick:(id)event {
|
||||
LinphoneAddress *addr;
|
||||
LinphoneAddress *addr = linphone_call_log_get_remote_address(callLog);
|
||||
char *lAddress = linphone_address_as_string_uri_only(addr);
|
||||
if (lAddress != NULL) {
|
||||
[ContactSelection setAddAddress:[NSString stringWithUTF8String:lAddress]];
|
||||
[ContactSelection setSelectionMode:ContactSelectionModeEdit];
|
||||
|
||||
addr = linphone_call_log_get_remote_address(callLog);
|
||||
if (addr != NULL) {
|
||||
char *lAddress = linphone_address_as_string_uri_only(addr);
|
||||
if (lAddress != NULL) {
|
||||
[ContactSelection setAddAddress:[NSString stringWithUTF8String:lAddress]];
|
||||
[ContactSelection setSelectionMode:ContactSelectionModeEdit];
|
||||
|
||||
[ContactSelection setSipFilter:nil];
|
||||
[ContactSelection enableEmailFilter:FALSE];
|
||||
[ContactSelection setNameOrEmailFilter:nil];
|
||||
[PhoneMainView.instance changeCurrentView:ContactsListView.compositeViewDescription push:TRUE];
|
||||
ms_free(lAddress);
|
||||
}
|
||||
[ContactSelection setSipFilter:nil];
|
||||
[ContactSelection enableEmailFilter:FALSE];
|
||||
[ContactSelection setNameOrEmailFilter:nil];
|
||||
[PhoneMainView.instance changeCurrentView:ContactsListView.compositeViewDescription push:TRUE];
|
||||
ms_free(lAddress);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -6,6 +6,8 @@
|
|||
//
|
||||
//
|
||||
|
||||
#include "UIRoundBorderedButton.h"
|
||||
|
||||
typedef void (^UIConfirmationBlock)(void);
|
||||
|
||||
@interface UIConfirmationDialog : UIViewController {
|
||||
|
|
@ -18,6 +20,8 @@ typedef void (^UIConfirmationBlock)(void);
|
|||
onCancelClick:(UIConfirmationBlock)onCancel
|
||||
onConfirmationClick:(UIConfirmationBlock)onConfirm;
|
||||
|
||||
@property(weak, nonatomic) IBOutlet UIRoundBorderedButton *cancelButton;
|
||||
@property(weak, nonatomic) IBOutlet UIRoundBorderedButton *confirmationButton;
|
||||
@property(weak, nonatomic) IBOutlet UILabel *titleLabel;
|
||||
- (IBAction)onCancelClick:(id)sender;
|
||||
- (IBAction)onConfirmationClick:(id)sender;
|
||||
|
|
|
|||
|
|
@ -24,6 +24,9 @@
|
|||
dialog->onConfirmCb = onConfirm;
|
||||
|
||||
[dialog.titleLabel setText:message];
|
||||
dialog.confirmationButton.layer.borderColor =
|
||||
[[UIColor colorWithPatternImage:[UIImage imageNamed:@"color_A"]] CGColor];
|
||||
dialog.cancelButton.layer.borderColor = [[UIColor colorWithPatternImage:[UIImage imageNamed:@"color_F"]] CGColor];
|
||||
}
|
||||
|
||||
- (IBAction)onCancelClick:(id)sender {
|
||||
|
|
|
|||
|
|
@ -7,6 +7,8 @@
|
|||
<objects>
|
||||
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="UIConfirmationDialog">
|
||||
<connections>
|
||||
<outlet property="cancelButton" destination="B1K-CB-3of" id="KKi-Xc-ldA"/>
|
||||
<outlet property="confirmationButton" destination="SbQ-re-fGQ" id="yiv-a9-o8E"/>
|
||||
<outlet property="titleLabel" destination="jLz-g1-cTe" id="qaj-OB-2r1"/>
|
||||
<outlet property="view" destination="2Vb-Xy-rci" id="nNw-EJ-AY3"/>
|
||||
</connections>
|
||||
|
|
@ -17,7 +19,7 @@
|
|||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<subviews>
|
||||
<imageView userInteractionEnabled="NO" alpha="0.89999999999999991" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="color_C.png" id="cqN-1f-6SE" userLabel="backgroundColor">
|
||||
<rect key="frame" x="0.0" y="0.0" width="376" height="667"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="377" height="667"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/>
|
||||
</imageView>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Are you sure you want to delete all your selection?" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="2" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="jLz-g1-cTe" userLabel="titleLabel">
|
||||
|
|
@ -27,17 +29,6 @@
|
|||
<color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" id="SbQ-re-fGQ" userLabel="confirmationButton" customClass="UIRoundBorderedButton">
|
||||
<rect key="frame" x="206" y="319" width="141" height="40"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<state key="normal" title="DELETE" backgroundImage="color_A.png">
|
||||
<color key="titleColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
|
||||
</state>
|
||||
<connections>
|
||||
<action selector="onConfirmationClick:" destination="-1" eventType="touchUpInside" id="0np-r7-R0W"/>
|
||||
</connections>
|
||||
</button>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" id="B1K-CB-3of" userLabel="cancelButton" customClass="UIRoundBorderedButton">
|
||||
<rect key="frame" x="28" y="319" width="141" height="40"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
|
|
@ -49,6 +40,17 @@
|
|||
<action selector="onCancelClick:" destination="-1" eventType="touchUpInside" id="LvF-N2-56g"/>
|
||||
</connections>
|
||||
</button>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" id="SbQ-re-fGQ" userLabel="confirmationButton" customClass="UIRoundBorderedButton">
|
||||
<rect key="frame" x="206" y="319" width="141" height="40"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<state key="normal" title="DELETE" backgroundImage="color_A.png">
|
||||
<color key="titleColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
|
||||
</state>
|
||||
<connections>
|
||||
<action selector="onConfirmationClick:" destination="-1" eventType="touchUpInside" id="0np-r7-R0W"/>
|
||||
</connections>
|
||||
</button>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<nil key="simulatedStatusBarMetrics"/>
|
||||
|
|
|
|||
|
|
@ -37,7 +37,6 @@
|
|||
if ([arrayOfViews count] >= 1) {
|
||||
[self.contentView addSubview:[arrayOfViews objectAtIndex:0]];
|
||||
}
|
||||
|
||||
callLog = NULL;
|
||||
}
|
||||
return self;
|
||||
|
|
@ -47,6 +46,7 @@
|
|||
|
||||
- (void)setCallLog:(LinphoneCallLog *)acallLog {
|
||||
callLog = acallLog;
|
||||
|
||||
[self update];
|
||||
}
|
||||
|
||||
|
|
@ -74,16 +74,10 @@
|
|||
#pragma mark -
|
||||
|
||||
- (NSString *)accessibilityValue {
|
||||
// TODO: localize?
|
||||
BOOL incoming = linphone_call_log_get_dir(callLog) == LinphoneCallIncoming;
|
||||
BOOL missed = linphone_call_log_get_status(callLog) == LinphoneCallMissed;
|
||||
|
||||
NSString *call_type = @"Outgoing";
|
||||
if (incoming) {
|
||||
call_type = missed ? @"Missed" : @"Incoming";
|
||||
}
|
||||
|
||||
return [NSString stringWithFormat:@"%@ from %@", call_type, displayNameLabel.text];
|
||||
NSString *call_type = incoming ? (missed ? @"Missed" : @"Incoming") : @"Outgoing";
|
||||
return [NSString stringWithFormat:@"%@ call from %@", call_type, displayNameLabel.text];
|
||||
}
|
||||
|
||||
- (void)update {
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@
|
|||
self.layer.borderWidth = .8;
|
||||
self.layer.borderColor = [[UIColor blackColor] CGColor];
|
||||
self.layer.cornerRadius = 4.f;
|
||||
self.layer.masksToBounds = YES;
|
||||
|
||||
// capitalize title (should be already done though)
|
||||
UIControlState states[] = {UIControlStateNormal, UIControlStateHighlighted, UIControlStateSelected,
|
||||
|
|
|
|||
|
|
@ -1415,6 +1415,9 @@
|
|||
D3211BAD159C4EF00098460B /* UIConferenceHeader.h */,
|
||||
D3211BAE159C4EF00098460B /* UIConferenceHeader.m */,
|
||||
D38187F315FE354000C3EDCA /* UIConferenceHeader.xib */,
|
||||
63701DDD1BA32039006A9AE3 /* UIConfirmationDialog.h */,
|
||||
63701DDE1BA32039006A9AE3 /* UIConfirmationDialog.m */,
|
||||
63701DD51BA31DA1006A9AE3 /* UIConfirmationDialog.xib */,
|
||||
D3A55FBA15877E5E003FD403 /* UIContactCell.h */,
|
||||
D3A55FBB15877E5E003FD403 /* UIContactCell.m */,
|
||||
F088488D19FF8C41007FFCF3 /* UIContactCell.xib */,
|
||||
|
|
@ -1457,9 +1460,6 @@
|
|||
D32460E5159D9AAD00BA7F3A /* UITransparentView.m */,
|
||||
340751E5150F38FC00B89C47 /* UIVideoButton.h */,
|
||||
340751E6150F38FD00B89C47 /* UIVideoButton.m */,
|
||||
63701DD51BA31DA1006A9AE3 /* UIConfirmationDialog.xib */,
|
||||
63701DDD1BA32039006A9AE3 /* UIConfirmationDialog.h */,
|
||||
63701DDE1BA32039006A9AE3 /* UIConfirmationDialog.m */,
|
||||
);
|
||||
path = LinphoneUI;
|
||||
sourceTree = "<group>";
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue