confirmation dialog added

This commit is contained in:
Gautier Pelloux-Prayer 2015-09-14 12:18:11 +02:00
parent a64137cf9d
commit 77fdfe6afa
5 changed files with 149 additions and 0 deletions

View file

@ -0,0 +1,25 @@
//
// UIConfirmationDialog.h
// linphone
//
// Created by Gautier Pelloux-Prayer on 11/09/15.
//
//
typedef void (^UIConfirmationBlock)(void);
@interface UIConfirmationDialog : UIViewController {
UIConfirmationBlock onCancelCb;
UIConfirmationBlock onConfirmCb;
}
+ (void)ShowWithMessage:(NSString *)message
onCancelClick:(UIConfirmationBlock)onCancel
onConfirmationClick:(UIConfirmationBlock)onConfirm;
@property(weak, nonatomic) IBOutlet UILabel *titleLabel;
- (IBAction)onCancelClick:(id)sender;
- (IBAction)onConfirmationClick:(id)sender;
@end

View file

@ -0,0 +1,44 @@
//
// UIConfirmationDialog.m
// linphone
//
// Created by Gautier Pelloux-Prayer on 11/09/15.
//
//
#import "UIConfirmationDialog.h"
#import "PhoneMainView.h"
@implementation UIConfirmationDialog
+ (void)ShowWithMessage:(NSString *)message
onCancelClick:(UIConfirmationBlock)onCancel
onConfirmationClick:(UIConfirmationBlock)onConfirm {
UIConfirmationDialog *dialog =
[[UIConfirmationDialog alloc] initWithNibName:NSStringFromClass(self.class) bundle:NSBundle.mainBundle];
[PhoneMainView.instance.mainViewController.view addSubview:dialog.view];
[PhoneMainView.instance.mainViewController addChildViewController:dialog];
dialog->onCancelCb = onCancel;
dialog->onConfirmCb = onConfirm;
[dialog.titleLabel setText:message];
}
- (IBAction)onCancelClick:(id)sender {
[self.view removeFromSuperview];
[self removeFromParentViewController];
if (onCancelCb) {
onCancelCb();
}
}
- (IBAction)onConfirmationClick:(id)sender {
[self.view removeFromSuperview];
[self removeFromParentViewController];
if (onConfirmCb) {
onConfirmCb();
}
}
@end

View file

@ -0,0 +1,69 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="7706" systemVersion="14D136" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7703"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="UIConfirmationDialog">
<connections>
<outlet property="titleLabel" destination="jLz-g1-cTe" id="qaj-OB-2r1"/>
<outlet property="view" destination="2Vb-Xy-rci" id="nNw-EJ-AY3"/>
</connections>
</placeholder>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view contentMode="scaleToFill" id="2Vb-Xy-rci" userLabel="view">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<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"/>
<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">
<rect key="frame" x="28" y="168" width="319" height="118"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<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"/>
<state key="normal" title="CANCEL" backgroundImage="color_F.png">
<color key="titleColor" white="0.0" alpha="1" colorSpace="calibratedWhite"/>
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
<connections>
<action selector="onCancelClick:" destination="-1" eventType="touchUpInside" id="LvF-N2-56g"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<nil key="simulatedStatusBarMetrics"/>
<simulatedScreenMetrics key="simulatedDestinationMetrics" type="retina47"/>
<point key="canvasLocation" x="545.5" y="291.5"/>
</view>
</objects>
<resources>
<image name="color_A.png" width="1" height="1"/>
<image name="color_C.png" width="1" height="1"/>
<image name="color_F.png" width="1" height="1"/>
</resources>
<simulatedMetricsContainer key="defaultSimulatedMetrics">
<simulatedStatusBarMetrics key="statusBar"/>
<simulatedOrientationMetrics key="orientation"/>
<simulatedScreenMetrics key="destination" type="retina4"/>
</simulatedMetricsContainer>
</document>

View file

@ -40,6 +40,7 @@
#import "SideMenuView.h"
#import "AssistantView.h"
#import "UIConfirmationDialog.h"
#import "DTAlertView.h"
#import "DTActionSheet.h"
#import "Utils.h"

View file

@ -243,6 +243,8 @@
636316D41A1DEC650009B839 /* SettingsView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 636316D61A1DEC650009B839 /* SettingsView.xib */; };
636316D91A1DECC90009B839 /* PhoneMainView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 636316D71A1DECC90009B839 /* PhoneMainView.xib */; };
636BC9971B5F921B00C754CE /* UIIconButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 636BC9961B5F921B00C754CE /* UIIconButton.m */; };
63701DD61BA31DA1006A9AE3 /* UIConfirmationDialog.xib in Resources */ = {isa = PBXBuildFile; fileRef = 63701DD51BA31DA1006A9AE3 /* UIConfirmationDialog.xib */; };
63701DDF1BA32039006A9AE3 /* UIConfirmationDialog.m in Sources */ = {isa = PBXBuildFile; fileRef = 63701DDE1BA32039006A9AE3 /* UIConfirmationDialog.m */; };
637157A11B283FE200C91677 /* FileTransferDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 637157A01B283FE200C91677 /* FileTransferDelegate.m */; };
639CEAFD1A1DF4D9004DE38F /* StatusBarView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 639CEAFF1A1DF4D9004DE38F /* StatusBarView.xib */; };
639CEB001A1DF4E4004DE38F /* UIHistoryCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 639CEB021A1DF4E4004DE38F /* UIHistoryCell.xib */; };
@ -845,6 +847,9 @@
636316DB1A1DEDD80009B839 /* ru */ = {isa = PBXFileReference; fileEncoding = 2483028224; lastKnownFileType = text.plist.strings; name = ru; path = ru.lproj/HistoryDetailsView.strings; sourceTree = "<group>"; };
636BC9951B5F921B00C754CE /* UIIconButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIIconButton.h; sourceTree = "<group>"; };
636BC9961B5F921B00C754CE /* UIIconButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIIconButton.m; sourceTree = "<group>"; };
63701DD51BA31DA1006A9AE3 /* UIConfirmationDialog.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = UIConfirmationDialog.xib; sourceTree = "<group>"; };
63701DDD1BA32039006A9AE3 /* UIConfirmationDialog.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIConfirmationDialog.h; sourceTree = "<group>"; };
63701DDE1BA32039006A9AE3 /* UIConfirmationDialog.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIConfirmationDialog.m; sourceTree = "<group>"; };
6371579F1B283FE200C91677 /* FileTransferDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FileTransferDelegate.h; path = Utils/FileTransferDelegate.h; sourceTree = "<group>"; };
637157A01B283FE200C91677 /* FileTransferDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = FileTransferDelegate.m; path = Utils/FileTransferDelegate.m; sourceTree = "<group>"; };
639CEAFE1A1DF4D9004DE38F /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/StatusBarView.xib; sourceTree = "<group>"; };
@ -1452,6 +1457,9 @@
D32460E5159D9AAD00BA7F3A /* UITransparentView.m */,
340751E5150F38FC00B89C47 /* UIVideoButton.h */,
340751E6150F38FD00B89C47 /* UIVideoButton.m */,
63701DD51BA31DA1006A9AE3 /* UIConfirmationDialog.xib */,
63701DDD1BA32039006A9AE3 /* UIConfirmationDialog.h */,
63701DDE1BA32039006A9AE3 /* UIConfirmationDialog.m */,
);
path = LinphoneUI;
sourceTree = "<group>";
@ -2416,6 +2424,7 @@
634CEDB31B6630DB00D7A921 /* chat_message_delivered.png in Resources */,
63AADBED1B6A0FF200AA16FD /* corner-left-top.png in Resources */,
634CEE131B6630DB00D7A921 /* status_disconnected.png in Resources */,
63701DD61BA31DA1006A9AE3 /* UIConfirmationDialog.xib in Resources */,
634CEDB71B6630DB00D7A921 /* chat_picture_over.png in Resources */,
634CEDF91B6630DB00D7A921 /* pause_small_disabled.png in Resources */,
F0C1F8EB1A277ADA009402C9 /* LaunchScreen.xib in Resources */,
@ -2558,6 +2567,7 @@
630CF5571AF7CE1500539F7A /* UITextField+DoneButton.m in Sources */,
2214EBF312F86360002A5394 /* UIMicroButton.m in Sources */,
22968A5F12F875C600588287 /* UISpeakerButton.m in Sources */,
63701DDF1BA32039006A9AE3 /* UIConfirmationDialog.m in Sources */,
22C755601317E59C007BC101 /* UIBluetoothButton.m in Sources */,
22AA8B0113D83F6300B30535 /* UICamSwitch.m in Sources */,
636BC9971B5F921B00C754CE /* UIIconButton.m in Sources */,