Browse Source

login complete

pull/1/head
gme_2 6 years ago
parent
commit
23aa98f88f
  1. 19
      GMERemittance/Module/Login/Application Logic/Interactor/LoginInteractor.swift
  2. 7
      GMERemittance/Module/Login/User Interface/Presenter/LoginPresenter.swift
  3. 4
      GMERemittance/Module/Login/User Interface/View/Login.storyboard
  4. 14
      GMERemittance/Module/Login/User Interface/Wireframe/LoginWireframe.swift
  5. 4
      GMERemittance/Module/Login/User Interface/Wireframe/LoginWireframeInput.swift
  6. 6
      GMERemittance/Module/Main/User Interface/Wireframe/MainWireframe.swift
  7. 28
      GMERemittance/Module/SplashScreen/User Interface/View/SplashScreen.storyboard
  8. 11
      GMERemittance/Module/SplashScreen/User Interface/View/SplashScreenViewController.swift
  9. 1
      GMERemittance/SideMenu/SideMenuViewController.swift
  10. 28
      GMERemittance/Splash/_SplashScreenViewController.swift

19
GMERemittance/Module/Login/Application Logic/Interactor/LoginInteractor.swift

@ -26,6 +26,15 @@ class LoginInteractor {
defaults.set(value, forKey: forKey)
}
func toBase64(text: String) -> String? {
guard let data = text.data(using: String.Encoding.utf8) else {
return nil
}
return data.base64EncodedString(options: Data.Base64EncodingOptions(rawValue: 0))
}
// MARK: Converting entities
}
@ -33,10 +42,14 @@ class LoginInteractor {
extension LoginInteractor: LoginInteractorInput {
func login(username: String, password: String) {
self.service._login(userId: username, password: password, success: { (user) in
let passwordBase64Data = Data(base64Encoded: password)!
let password = String(data: passwordBase64Data, encoding: .utf8)!
guard let passwordBase64Data = self.toBase64(text: password) else {
return
}
print("password converted is")
print(passwordBase64Data)
self.service._login(userId: username, password: password, success: { (user) in
let accessCode = user?.accessCode ?? ""
let uuid = RestApiMananger.sharedInstance.getUUID()
let accessCodeBase64 = accessCode + ":" + uuid.toBase64()

7
GMERemittance/Module/Login/User Interface/Presenter/LoginPresenter.swift

@ -29,11 +29,11 @@ extension LoginPresenter: LoginModuleInterface {
func register() {
self.wireframe?.register()
}
func forgotPassword() {
self.wireframe?.forgotPassword()
}
}
@ -46,6 +46,7 @@ extension LoginPresenter: LoginInteractorOutput {
}
func loggedIn() {
self.view?.hideLoading()
self.wireframe?.dashBoard()
}
}

4
GMERemittance/Module/Login/User Interface/View/Login.storyboard

@ -278,6 +278,10 @@
<viewLayoutGuide key="safeArea" id="mwG-gr-gUP"/>
</view>
<navigationItem key="navigationItem" id="J8O-o1-aen"/>
<connections>
<outlet property="passwordTextField" destination="QK2-zk-MJD" id="T4q-gs-lt0"/>
<outlet property="userNameTextField" destination="VQh-fp-vLH" id="3eA-oq-xs5"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="8je-5K-XuW" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>

14
GMERemittance/Module/Login/User Interface/Wireframe/LoginWireframe.swift

@ -10,6 +10,8 @@ import UIKit
class LoginWireframe {
weak var view: UIViewController!
lazy var mainWireframe = MainWireframe.shared
}
extension LoginWireframe: LoginWireframeInput {
@ -31,4 +33,16 @@ extension LoginWireframe: LoginWireframeInput {
self.view = viewController
return viewController
}
func dashBoard() {
self.window?.rootViewController = mainWireframe?.getMainView()
}
func register() {
}
func forgotPassword() {
}
}

4
GMERemittance/Module/Login/User Interface/Wireframe/LoginWireframeInput.swift

@ -9,5 +9,7 @@
import Foundation
protocol LoginWireframeInput: WireframeInput {
func dashBoard()
func register()
func forgotPassword()
}

6
GMERemittance/Module/Main/User Interface/Wireframe/MainWireframe.swift

@ -65,9 +65,9 @@ extension MainWireframe: MainWireframeInput {
static func logout() {
guard let window = MainWireframe.shared?.window else {return}
MainWireframe.shared = nil
let storyboard = UIStoryboard.init(name: "Main", bundle: Bundle.main)
let splashScreenViewController = storyboard.instantiateViewController(withIdentifier: "SplashScreenViewController") as! SplashScreenViewController
window.rootViewController = splashScreenViewController
let splaseWireframe = SplashScreenWireframe()
let nav = UINavigationController.init(rootViewController: splaseWireframe.getMainView())
window.rootViewController = nav
window.makeKeyAndVisible()
}

28
GMERemittance/Module/SplashScreen/User Interface/View/SplashScreen.storyboard

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14113" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="yZK-T1-LDL">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14113" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
@ -68,6 +68,7 @@
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Hassle free money transfer to your loved ones" textAlignment="center" lineBreakMode="wordWrap" numberOfLines="2" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="xIR-gr-Rkn">
<rect key="frame" x="34" y="355" width="308" height="43"/>
<constraints>
<constraint firstAttribute="width" constant="308" id="1c1-24-b1q"/>
<constraint firstAttribute="height" constant="43" id="6ZP-PP-o5T"/>
</constraints>
<fontDescription key="fontDescription" name="SanFranciscoDisplay-Semibold" family="San Francisco Display" pointSize="18"/>
@ -132,15 +133,14 @@
<constraint firstItem="196-Q3-KMs" firstAttribute="centerX" secondItem="rya-vW-oho" secondAttribute="centerX" id="H3c-u4-j6s"/>
<constraint firstItem="DFQ-aB-MeN" firstAttribute="top" secondItem="BNn-h6-EZr" secondAttribute="bottom" constant="50" id="IQq-bO-qSK"/>
<constraint firstAttribute="bottom" secondItem="xXT-1Y-c8Y" secondAttribute="bottom" constant="80" id="OHt-O2-fQE"/>
<constraint firstAttribute="trailing" secondItem="xIR-gr-Rkn" secondAttribute="trailing" constant="33" id="PwQ-gh-uD4"/>
<constraint firstItem="G73-dq-xvs" firstAttribute="top" secondItem="196-Q3-KMs" secondAttribute="bottom" constant="40" id="VS5-fH-uca"/>
<constraint firstItem="G73-dq-xvs" firstAttribute="leading" secondItem="rya-vW-oho" secondAttribute="leading" constant="88" id="Yeb-0M-kUj"/>
<constraint firstItem="xIR-gr-Rkn" firstAttribute="leading" secondItem="rya-vW-oho" secondAttribute="leading" constant="34" id="cDX-Tb-Zs2"/>
<constraint firstAttribute="trailing" secondItem="G73-dq-xvs" secondAttribute="trailing" constant="87" id="cgt-7L-nox"/>
<constraint firstItem="xIR-gr-Rkn" firstAttribute="top" secondItem="DFQ-aB-MeN" secondAttribute="bottom" constant="35" id="clM-cf-ScL"/>
<constraint firstItem="DFQ-aB-MeN" firstAttribute="centerX" secondItem="rya-vW-oho" secondAttribute="centerX" id="hqp-u1-2tp"/>
<constraint firstAttribute="trailing" secondItem="xXT-1Y-c8Y" secondAttribute="trailing" constant="87" id="mgM-K0-LCa"/>
<constraint firstItem="BNn-h6-EZr" firstAttribute="top" secondItem="rya-vW-oho" secondAttribute="top" constant="30" id="qME-Af-FLX"/>
<constraint firstItem="xIR-gr-Rkn" firstAttribute="centerX" secondItem="rya-vW-oho" secondAttribute="centerX" id="ucz-qp-50S"/>
<constraint firstItem="196-Q3-KMs" firstAttribute="top" secondItem="xIR-gr-Rkn" secondAttribute="bottom" constant="50" id="whr-N1-J6a"/>
</constraints>
</view>
@ -168,8 +168,6 @@
<connections>
<outlet property="buttonLogin" destination="G73-dq-xvs" id="JbA-re-pVh"/>
<outlet property="buttonSignUp" destination="xXT-1Y-c8Y" id="699-2r-8l6"/>
<outlet property="constraintLeft" destination="cDX-Tb-Zs2" id="Uo2-4H-ALq"/>
<outlet property="constraintRight" destination="PwQ-gh-uD4" id="2i7-GS-Sxa"/>
<outlet property="imageViewDotCenter" destination="YH4-j7-ASu" id="zcu-n5-9q8"/>
<outlet property="imageViewDotLeft" destination="XaM-Bb-cbb" id="OZK-A6-a4p"/>
<outlet property="imageViewDotRight" destination="zwr-Vy-PYs" id="Snz-cG-hIV"/>
@ -181,26 +179,6 @@
</objects>
<point key="canvasLocation" x="847.20000000000005" y="232.53373313343329"/>
</scene>
<!--Navigation Controller-->
<scene sceneID="lQo-vW-khk">
<objects>
<navigationController automaticallyAdjustsScrollViewInsets="NO" id="yZK-T1-LDL" sceneMemberID="viewController">
<toolbarItems/>
<navigationBar key="navigationBar" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" id="WbL-gs-fRo">
<rect key="frame" x="0.0" y="20" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<color key="backgroundColor" red="0.92941176469999998" green="0.10980392160000001" blue="0.14117647059999999" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color key="tintColor" red="0.92941176469999998" green="0.10980392160000001" blue="0.14117647059999999" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</navigationBar>
<nil name="viewControllers"/>
<connections>
<segue destination="HSb-ou-7T5" kind="relationship" relationship="rootViewController" id="lKG-yL-CoX"/>
</connections>
</navigationController>
<placeholder placeholderIdentifier="IBFirstResponder" id="Phu-qK-OWr" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="-92" y="232.53373313343329"/>
</scene>
</scenes>
<resources>
<image name="dotUnselected" width="7" height="7"/>

11
GMERemittance/Module/SplashScreen/User Interface/View/SplashScreenViewController.swift

@ -55,7 +55,7 @@ class SplashScreenViewController: UIViewController {
override func viewWillAppear(_ animated: Bool) {
super.viewWillDisappear(animated)
self.navigationItem.title = ""
hideNavBar()
self.hideNavBar()
}
override func viewWillDisappear(_ animated: Bool) {
@ -130,20 +130,17 @@ class SplashScreenViewController: UIViewController {
switch counter {
case 0:
constraintLeft.constant = 34
constraintRight.constant = 33
imageViewDotLeft.image = imageDotSelected
imageViewHomeLogo.image = imageFirst
labelHomeDescription.text = descriptionFirst
case 1:
constraintLeft.constant = 34
constraintRight.constant = 33
imageViewDotCenter.image = imageDotSelected
imageViewHomeLogo.image = imageSecond
labelHomeDescription.text = descriptionSecond
case 2:
constraintLeft.constant = 61
constraintRight.constant = 60
imageViewDotRight.image = imageDotSelected
imageViewHomeLogo.image = imageThird
labelHomeDescription.text = descriptionThird

1
GMERemittance/SideMenu/SideMenuViewController.swift

@ -87,6 +87,7 @@ class SideMenuViewController: UIViewController {
UserDefaults.standard.removeObject(forKey: "com.gmeremit.mobileNumber")
UserDefaults.standard.removeObject(forKey: "com.gmeremit.password")
UserDefaults.standard.removeObject(forKey: " com.gmeremit.isReferred")
UserDefaults.standard.setValue(nil, forKey: UserKeys.accessCode)
MainWireframe.logout()
})

28
GMERemittance/Splash/_SplashScreenViewController.swift

@ -17,9 +17,7 @@ class _SplashScreenViewController: UIViewController {
@IBOutlet weak var imageViewHomeLogo: UIImageView!
@IBOutlet weak var labelHomeDescription: UILabel!
@IBOutlet weak var constraintLeft: NSLayoutConstraint!
@IBOutlet weak var constraintRight: NSLayoutConstraint!
@IBOutlet weak var buttonLogin: UIButton!
@IBOutlet weak var buttonSignUp: UIButton!
@ -29,9 +27,9 @@ class _SplashScreenViewController: UIViewController {
var counter: Int = 0
let imageDotSelected = UIImage(named: "dotSelected")
let imageDotUnselected = UIImage(named: "dotUnselected")
// let imageDotSelected = UIImage(named: "dotSelected")
// let imageDotUnselected = UIImage(named: "dotUnselected")
//
let imageFirst = UIImage(named: "ic_splashFirstScreen")
let imageSecond = UIImage(named: "ic_splashSecondScreen")
let imageThird = UIImage(named: "ic_splashThirdScreen")
@ -124,27 +122,21 @@ class _SplashScreenViewController: UIViewController {
func setImageandLabels() {
imageViewDotLeft.image = imageDotUnselected
imageViewDotCenter.image = imageDotUnselected
imageViewDotRight.image = imageDotUnselected
// imageViewDotLeft.image = imageDotUnselected
// imageViewDotCenter.image = imageDotUnselected
// imageViewDotRight.image = imageDotUnselected
switch counter {
case 0:
constraintLeft.constant = 34
constraintRight.constant = 33
imageViewDotLeft.image = imageDotSelected
// imageViewDotLeft.image = imageDotSelected
imageViewHomeLogo.image = imageFirst
labelHomeDescription.text = descriptionFirst
case 1:
constraintLeft.constant = 34
constraintRight.constant = 33
imageViewDotCenter.image = imageDotSelected
// imageViewDotCenter.image = imageDotSelected
imageViewHomeLogo.image = imageSecond
labelHomeDescription.text = descriptionSecond
case 2:
constraintLeft.constant = 61
constraintRight.constant = 60
imageViewDotRight.image = imageDotSelected
// imageViewDotRight.image = imageDotSelected
imageViewHomeLogo.image = imageThird
labelHomeDescription.text = descriptionThird
default:

Loading…
Cancel
Save