Commit 915e7d0c7ae8d56474c852a2d57ed9c9d68a781c
1 parent
a0a95e2012
Exists in
master
and in
1 other branch
update api register
Showing 3 changed files with 122 additions and 0 deletions Inline Diff
LifeLog/LifeLog/ConfirmForgetPassViewController.h
| File was created | 1 | // | |
| 2 | // ConfirmForgetPassViewController.h | ||
| 3 | // LifeLog | ||
| 4 | // | ||
| 5 | // Created by Panasonic R&D Center Vietnam on 8/2/17. | ||
| 6 | // Copyright © 2017 PhongNV. All rights reserved. | ||
| 7 | // | ||
| 8 | |||
| 9 | #import <UIKit/UIKit.h> | ||
| 10 | |||
| 11 | @interface ConfirmForgetPassViewController : UIViewController | ||
| 12 | @property (nonatomic, strong) NSString *email; | ||
| 13 | @end | ||
| 14 |
LifeLog/LifeLog/ConfirmForgetPassViewController.m
| File was created | 1 | // | |
| 2 | // ConfirmForgetPassViewController.m | ||
| 3 | // LifeLog | ||
| 4 | // | ||
| 5 | // Created by Panasonic R&D Center Vietnam on 8/2/17. | ||
| 6 | // Copyright © 2017 PhongNV. All rights reserved. | ||
| 7 | // | ||
| 8 | |||
| 9 | #import "ConfirmForgetPassViewController.h" | ||
| 10 | #import "ServerAPI.h" | ||
| 11 | #import "Utilities.h" | ||
| 12 | |||
| 13 | @interface ConfirmForgetPassViewController () | ||
| 14 | @property (nonatomic, weak) IBOutlet UITextField *tfConfirm; | ||
| 15 | @property (nonatomic, weak) IBOutlet UIButton *btnConfirm; | ||
| 16 | @end | ||
| 17 | |||
| 18 | @implementation ConfirmForgetPassViewController | ||
| 19 | |||
| 20 | - (void)viewDidLoad { | ||
| 21 | [super viewDidLoad]; | ||
| 22 | // Do any additional setup after loading the view from its nib. | ||
| 23 | self.title = @"Confirm Forget Password"; | ||
| 24 | |||
| 25 | [self.view addConstraint:[NSLayoutConstraint constraintWithItem:self.topLayoutGuide attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.tfConfirm attribute:NSLayoutAttributeTop multiplier:1 constant:-30]]; | ||
| 26 | } | ||
| 27 | |||
| 28 | - (void)didReceiveMemoryWarning { | ||
| 29 | [super didReceiveMemoryWarning]; | ||
| 30 | // Dispose of any resources that can be recreated. | ||
| 31 | } | ||
| 32 | |||
| 33 | - (IBAction)buttonConfirmTouchUpInside:(id)sender { | ||
| 34 | if (_tfConfirm.text.length > 0) { | ||
| 35 | ConfirmForgetPassViewController __weak *weakSelf = self; | ||
| 36 | [[ServerAPI server] confirmForgetPass:self.email withConfirm:self.tfConfirm.text CompletionHandler:^(NSError *error) { | ||
| 37 | if (error == nil) { | ||
| 38 | // back screen Login | ||
| 39 | dispatch_async(dispatch_get_main_queue(), ^{ | ||
| 40 | [weakSelf.navigationController popViewControllerAnimated:YES]; | ||
| 41 | }); | ||
| 42 | } | ||
| 43 | else { | ||
| 44 | dispatch_async(dispatch_get_main_queue(), ^{ | ||
| 45 | NSString *message = [error.userInfo objectForKey:@"message"]; | ||
| 46 | [Utilities showErrorMessage:message withViewController:weakSelf]; | ||
| 47 | }); | ||
| 48 | } | ||
| 49 | }]; | ||
| 50 | } | ||
| 51 | else { | ||
| 52 | [Utilities showErrorMessage:@"Please input code confirm" withViewController:self]; | ||
| 53 | } | ||
| 54 | } | ||
| 55 | |||
| 56 | @end | ||
| 57 |
LifeLog/LifeLog/ConfirmForgetPassViewController.xib
| File was created | 1 | <?xml version="1.0" encoding="UTF-8"?> | |
| 2 | <document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="12120" systemVersion="16F73" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES"> | ||
| 3 | <device id="retina4_7" orientation="portrait"> | ||
| 4 | <adaptation id="fullscreen"/> | ||
| 5 | </device> | ||
| 6 | <dependencies> | ||
| 7 | <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12088"/> | ||
| 8 | <capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/> | ||
| 9 | <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> | ||
| 10 | </dependencies> | ||
| 11 | <objects> | ||
| 12 | <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="ConfirmForgetPassViewController"> | ||
| 13 | <connections> | ||
| 14 | <outlet property="btnConfirm" destination="pl4-fa-Poj" id="XyC-QE-8Jn"/> | ||
| 15 | <outlet property="tfConfirm" destination="ham-LV-cWN" id="Zxl-4z-x2u"/> | ||
| 16 | <outlet property="view" destination="i5M-Pr-FkT" id="sfx-zR-JGt"/> | ||
| 17 | </connections> | ||
| 18 | </placeholder> | ||
| 19 | <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/> | ||
| 20 | <view clearsContextBeforeDrawing="NO" contentMode="scaleToFill" id="i5M-Pr-FkT"> | ||
| 21 | <rect key="frame" x="0.0" y="0.0" width="375" height="667"/> | ||
| 22 | <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> | ||
| 23 | <subviews> | ||
| 24 | <textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" textAlignment="center" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="ham-LV-cWN"> | ||
| 25 | <rect key="frame" x="20" y="30" width="335" height="30"/> | ||
| 26 | <nil key="textColor"/> | ||
| 27 | <fontDescription key="fontDescription" type="system" pointSize="14"/> | ||
| 28 | <textInputTraits key="textInputTraits"/> | ||
| 29 | </textField> | ||
| 30 | <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="pl4-fa-Poj"> | ||
| 31 | <rect key="frame" x="104" y="70" width="167.5" height="30"/> | ||
| 32 | <constraints> | ||
| 33 | <constraint firstAttribute="height" constant="30" id="QuE-pa-iyz"/> | ||
| 34 | </constraints> | ||
| 35 | <state key="normal" title="Confirm"/> | ||
| 36 | <connections> | ||
| 37 | <action selector="buttonConfirmTouchUpInside:" destination="-1" eventType="touchUpInside" id="79P-c3-yj5"/> | ||
| 38 | </connections> | ||
| 39 | </button> | ||
| 40 | </subviews> | ||
| 41 | <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> | ||
| 42 | <constraints> | ||
| 43 | <constraint firstItem="ham-LV-cWN" firstAttribute="top" secondItem="i5M-Pr-FkT" secondAttribute="top" constant="30" placeholder="YES" id="M0L-Jj-GBY"/> | ||
| 44 | <constraint firstItem="pl4-fa-Poj" firstAttribute="top" secondItem="ham-LV-cWN" secondAttribute="bottom" constant="10" id="SxH-63-d17"/> | ||
| 45 | <constraint firstItem="pl4-fa-Poj" firstAttribute="centerX" secondItem="ham-LV-cWN" secondAttribute="centerX" id="kYe-pD-TqE"/> | ||
| 46 | <constraint firstItem="pl4-fa-Poj" firstAttribute="width" secondItem="ham-LV-cWN" secondAttribute="width" multiplier="1/2" id="rS8-A5-BwH"/> | ||
| 47 | <constraint firstItem="ham-LV-cWN" firstAttribute="leading" secondItem="i5M-Pr-FkT" secondAttribute="leading" constant="20" id="x3v-m3-6de"/> | ||
| 48 | <constraint firstAttribute="trailing" secondItem="ham-LV-cWN" secondAttribute="trailing" constant="20" id="yUu-GA-PYo"/> | ||
| 49 | </constraints> | ||
| 50 | <point key="canvasLocation" x="32.5" y="67.5"/> | ||
| 51 | </view> | ||
| 52 | </objects> | ||
| 53 | </document> | ||
| 54 |