Commit 593a6961 authored by Grigor Aghabalyan's avatar Grigor Aghabalyan
Browse files

fix : issues

parent d0f898a0
......@@ -10,6 +10,7 @@
C5D2A725242B077100825031 /* FormsService.swift in Sources */ = {isa = PBXBuildFile; fileRef = C5D2A724242B077100825031 /* FormsService.swift */; };
C5D2A727242B0A2300825031 /* FormsResponse.swift in Sources */ = {isa = PBXBuildFile; fileRef = C5D2A726242B0A2300825031 /* FormsResponse.swift */; };
C5D2A729242B12F200825031 /* FormResponse.swift in Sources */ = {isa = PBXBuildFile; fileRef = C5D2A728242B12F200825031 /* FormResponse.swift */; };
C5D2A72B242B20AC00825031 /* FormFinishService.swift in Sources */ = {isa = PBXBuildFile; fileRef = C5D2A72A242B20AC00825031 /* FormFinishService.swift */; };
C5D6914E242AA091004268C3 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = C5D6914D242AA091004268C3 /* AppDelegate.swift */; };
C5D69150242AA091004268C3 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = C5D6914F242AA091004268C3 /* SceneDelegate.swift */; };
C5D69155242AA091004268C3 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C5D69153242AA091004268C3 /* Main.storyboard */; };
......@@ -29,8 +30,6 @@
C5D69185242AABD2004268C3 /* LoginViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = C5D69183242AABD2004268C3 /* LoginViewController.xib */; };
C5D6918F242AAC86004268C3 /* FormListViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C5D6918D242AAC86004268C3 /* FormListViewController.swift */; };
C5D69190242AAC86004268C3 /* FormListViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = C5D6918E242AAC86004268C3 /* FormListViewController.xib */; };
C5D69194242AAD00004268C3 /* SingleFormViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C5D69192242AAD00004268C3 /* SingleFormViewController.swift */; };
C5D69195242AAD00004268C3 /* SingleFormViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = C5D69193242AAD00004268C3 /* SingleFormViewController.xib */; };
C5D69199242AAD3F004268C3 /* FormCreateViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C5D69197242AAD3F004268C3 /* FormCreateViewController.swift */; };
C5D6919A242AAD3F004268C3 /* FormCreateViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = C5D69198242AAD3F004268C3 /* FormCreateViewController.xib */; };
C5D691A1242AAE12004268C3 /* MainViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C5D691A0242AAE12004268C3 /* MainViewController.swift */; };
......@@ -59,6 +58,7 @@
C5D2A724242B077100825031 /* FormsService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FormsService.swift; sourceTree = "<group>"; };
C5D2A726242B0A2300825031 /* FormsResponse.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FormsResponse.swift; sourceTree = "<group>"; };
C5D2A728242B12F200825031 /* FormResponse.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FormResponse.swift; sourceTree = "<group>"; };
C5D2A72A242B20AC00825031 /* FormFinishService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FormFinishService.swift; sourceTree = "<group>"; };
C5D6914A242AA091004268C3 /* App16.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = App16.app; sourceTree = BUILT_PRODUCTS_DIR; };
C5D6914D242AA091004268C3 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
C5D6914F242AA091004268C3 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = "<group>"; };
......@@ -80,8 +80,6 @@
C5D69183242AABD2004268C3 /* LoginViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = LoginViewController.xib; sourceTree = "<group>"; };
C5D6918D242AAC86004268C3 /* FormListViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FormListViewController.swift; sourceTree = "<group>"; };
C5D6918E242AAC86004268C3 /* FormListViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = FormListViewController.xib; sourceTree = "<group>"; };
C5D69192242AAD00004268C3 /* SingleFormViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SingleFormViewController.swift; sourceTree = "<group>"; };
C5D69193242AAD00004268C3 /* SingleFormViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = SingleFormViewController.xib; sourceTree = "<group>"; };
C5D69197242AAD3F004268C3 /* FormCreateViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FormCreateViewController.swift; sourceTree = "<group>"; };
C5D69198242AAD3F004268C3 /* FormCreateViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = FormCreateViewController.xib; sourceTree = "<group>"; };
C5D691A0242AAE12004268C3 /* MainViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainViewController.swift; sourceTree = "<group>"; };
......@@ -212,6 +210,7 @@
C5D691BD242AE510004268C3 /* FormCreateService.swift */,
C5D691C1242AF07F004268C3 /* CurrentFormService.swift */,
C5D2A724242B077100825031 /* FormsService.swift */,
C5D2A72A242B20AC00825031 /* FormFinishService.swift */,
);
path = Services;
sourceTree = "<group>";
......@@ -260,7 +259,6 @@
isa = PBXGroup;
children = (
C5D69196242AAD2C004268C3 /* Create */,
C5D69191242AACE5004268C3 /* Single */,
C5D6918C242AAC73004268C3 /* FormList */,
);
path = Form;
......@@ -276,15 +274,6 @@
path = FormList;
sourceTree = "<group>";
};
C5D69191242AACE5004268C3 /* Single */ = {
isa = PBXGroup;
children = (
C5D69192242AAD00004268C3 /* SingleFormViewController.swift */,
C5D69193242AAD00004268C3 /* SingleFormViewController.xib */,
);
path = Single;
sourceTree = "<group>";
};
C5D69196242AAD2C004268C3 /* Create */ = {
isa = PBXGroup;
children = (
......@@ -420,7 +409,6 @@
buildActionMask = 2147483647;
files = (
C5D69185242AABD2004268C3 /* LoginViewController.xib in Resources */,
C5D69195242AAD00004268C3 /* SingleFormViewController.xib in Resources */,
C5D6915A242AA094004268C3 /* LaunchScreen.storyboard in Resources */,
C5D6919A242AAD3F004268C3 /* FormCreateViewController.xib in Resources */,
C5D691B5242AD290004268C3 /* QrViewController.xib in Resources */,
......@@ -493,7 +481,6 @@
C5D6918F242AAC86004268C3 /* FormListViewController.swift in Sources */,
C5D69173242AA539004268C3 /* BaseService.swift in Sources */,
C5D691A1242AAE12004268C3 /* MainViewController.swift in Sources */,
C5D69194242AAD00004268C3 /* SingleFormViewController.swift in Sources */,
C5D2A727242B0A2300825031 /* FormsResponse.swift in Sources */,
C5D2A725242B077100825031 /* FormsService.swift in Sources */,
C5D691BE242AE510004268C3 /* FormCreateService.swift in Sources */,
......@@ -506,6 +493,7 @@
C5D691B4242AD290004268C3 /* QrViewController.swift in Sources */,
C5D691AB242AC17D004268C3 /* UIView+Extensions.swift in Sources */,
C5D69177242AA573004268C3 /* ValidationError.swift in Sources */,
C5D2A72B242B20AC00825031 /* FormFinishService.swift in Sources */,
C5D6917D242AA5BE004268C3 /* UserDefaultsHelper.swift in Sources */,
C5D691BC242AE1F8004268C3 /* FormCreateRequestForm.swift in Sources */,
C5D69150242AA091004268C3 /* SceneDelegate.swift in Sources */,
......
//
// FormFinishService.swift
// App16
//
// Created by Grigor Aghabalyan on 3/25/20.
// Copyright © 2020 X-TECH. All rights reserved.
//
import ObjectMapper
import AlamofireObjectMapper
import Alamofire
class FormFinishService {
static let shered = FormFinishService()
func finishForm(data: CurentFormRequestForm, completion: @escaping ((FormCreateResponseData<FormCreateResponse>) -> Void)) {
BaseService.shared.post(endpoint: "/applications/finish", object: data.toJSON(), for: .unsecure)
.responseString { (response) in
print(response.result.value ?? "result value is nil")
if let responseHttp = response.response, let value = response.result.value {
if let baseResponse = BaseService.shared.checkBaseResponse(responseHttp, value) {
return completion(.base(response: baseResponse))
}
} else {
return completion(.isOffline)
}
switch response.response?.statusCode ?? 400 {
case 200...201:
if let value = response.result.value, let data = Mapper<FormCreateResponse>().map(JSONString: value) {
return completion(.success(result: data))
}
return completion(.base(response: .unexpectedError(error: ResponseUnexpectedError.mappingFailed)))
default:
return completion(.base(response: .badRequest))
}
}
}
}
......@@ -34,7 +34,9 @@ class FormCreateViewController: UIViewController {
if isCreateMode {
createButton.isHidden = false
self.title = "Ավելացնել ձևաթուղթ"
}else {
self.title = "Ձևաթուղթ"
createButton.isHidden = true
retriveCurentForm()
}
......@@ -130,8 +132,8 @@ class FormCreateViewController: UIViewController {
let form = CurentFormRequestForm(deviceToken: UIDevice.current.identifierForVendor?.uuidString)
CurrentFormService.shered.retrive(data: form) { (weaterResponseData) in
switch weaterResponseData {
CurrentFormService.shered.retrive(data: form) { (responseData) in
switch responseData {
case .base(response: let baseResposne):
CheckBaseHelper.checkBaseResponse(baseResposne, viewController: self)
case .success(let response):
......
......@@ -308,10 +308,10 @@
</view>
</subviews>
<constraints>
<constraint firstAttribute="bottom" secondItem="Kwt-kc-N2e" secondAttribute="bottom" id="IwO-SM-oBm"/>
<constraint firstItem="Kwt-kc-N2e" firstAttribute="width" secondItem="9XT-9B-ssX" secondAttribute="width" id="EiE-Fg-haM"/>
<constraint firstAttribute="bottom" secondItem="Kwt-kc-N2e" secondAttribute="bottom" constant="254" id="IwO-SM-oBm"/>
<constraint firstAttribute="trailing" secondItem="Kwt-kc-N2e" secondAttribute="trailing" id="Xh8-mZ-LxV"/>
<constraint firstItem="Kwt-kc-N2e" firstAttribute="top" secondItem="9XT-9B-ssX" secondAttribute="top" id="nhk-wF-mqS"/>
<constraint firstItem="Kwt-kc-N2e" firstAttribute="width" secondItem="9XT-9B-ssX" secondAttribute="width" multiplier="0.57971" constant="174" id="yJv-lz-6Li"/>
<constraint firstItem="Kwt-kc-N2e" firstAttribute="leading" secondItem="9XT-9B-ssX" secondAttribute="leading" id="zKM-S9-Uad"/>
</constraints>
</scrollView>
......@@ -321,7 +321,7 @@
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="9XT-9B-ssX" firstAttribute="trailing" secondItem="fnl-2z-Ty3" secondAttribute="trailing" id="5wS-Yt-kTM"/>
<constraint firstItem="9XT-9B-ssX" firstAttribute="trailing" secondItem="i5M-Pr-FkT" secondAttribute="trailing" id="5wS-Yt-kTM"/>
<constraint firstItem="AyJ-6A-jyJ" firstAttribute="centerX" secondItem="i5M-Pr-FkT" secondAttribute="centerX" id="RoB-IV-UgI"/>
<constraint firstItem="9XT-9B-ssX" firstAttribute="leading" secondItem="i5M-Pr-FkT" secondAttribute="leading" id="YtC-LG-tZZ"/>
<constraint firstItem="AyJ-6A-jyJ" firstAttribute="centerY" secondItem="i5M-Pr-FkT" secondAttribute="centerY" id="aa1-uE-r7f"/>
......
//
// SingleFormViewController.swift
// App16
//
// Created by Grigor Aghabalyan on 3/25/20.
// Copyright © 2020 X-TECH. All rights reserved.
//
import UIKit
import AlamofireImage
class SingleFormViewController: UIViewController {
// MARK: - LifeCycle
override func viewDidLoad() {
super.viewDidLoad()
}
private func setImage(_ imageURL: String, imageView: UIImageView) {
if let imageURL = URL(string: imageURL) {
imageView.af_setImage(withURL: imageURL,
placeholderImage: nil,
filter: nil,
progress: nil,
progressQueue: .main,
imageTransition: .crossDissolve(0.1),
runImageTransitionIfCached: true) { (response) in
}
}
}
}
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="15705" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15706"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="SingleFormViewController" customModule="App16" customModuleProvider="target">
<connections>
<outlet property="view" destination="i5M-Pr-FkT" id="sfx-zR-JGt"/>
</connections>
</placeholder>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view clearsContextBeforeDrawing="NO" contentMode="scaleToFill" id="i5M-Pr-FkT">
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<viewLayoutGuide key="safeArea" id="fnl-2z-Ty3"/>
<point key="canvasLocation" x="139" y="150"/>
</view>
</objects>
</document>
......@@ -7,6 +7,7 @@
//
import UIKit
import AlamofireImage
class QrViewController: UIViewController {
......@@ -31,13 +32,12 @@ class QrViewController: UIViewController {
// MARK: - Actions
@IBAction func formButtonAction(_ sender: UIButton) {
openCreateFormView()
}
@IBAction func finshButtonAction(_ sender: UIButton) {
retriveCurentForm()
openWelcomeView()
}
private func openWelcomeView() {
......@@ -68,4 +68,25 @@ class QrViewController: UIViewController {
}
}
}
private func retriveCurentForm() {
let form = CurentFormRequestForm(deviceToken: UIDevice.current.identifierForVendor?.uuidString)
FormFinishService.shered.finishForm(data: form) { (responseData) in
switch responseData {
case .base(response: let baseResposne):
CheckBaseHelper.checkBaseResponse(baseResposne, viewController: self)
case .success(_):
self.openWelcomeView()
case .isOffline:
return
case .conflict:
return
}
}
}
}
......@@ -53,6 +53,7 @@ class WelcomeViewController: UIViewController {
@IBAction func historyButtonAction(_ sender: UIButton) {
let controller = FormListViewController()
self.navigationController?.navigationBar.topItem?.title = " "
self.navigationController?.pushViewController(controller, animated: true)
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment