...
 
Commits (2)
This diff is collapsed.
......@@ -35,7 +35,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
}
IQKeyboardManager.shared.enable = true
setDefaultLanguage()
return true
}
......@@ -80,4 +80,12 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
// If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions.
// Use this method to release any resources that were specific to the discarded scenes, as they will not return.
}
private func setDefaultLanguage() {
if UserDefaultsHelper.getString(for: .locale) == nil {
Settings.changeLanguage(Settings.Languages.Armenian.rawValue, langauge: "Հայերեն")
}
}
}
{
"images" : [
{
"filename" : "icons8-checkmark.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"template-rendering-intent" : "template"
}
}
{
"images" : [
{
"filename" : "settings.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"template-rendering-intent" : "template"
}
}
......@@ -24,3 +24,20 @@ extension Date {
return dateFormatter.string(from: self)
}
}
extension Bundle {
class var applicationVersionNumber: String {
if let version = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String {
return version
}
return "Version Number Not Available"
}
class var applicationBuildNumber: String {
if let build = Bundle.main.infoDictionary?["CFBundleVersion"] as? String {
return build
}
return "Build Number Not Available"
}
}
......@@ -15,6 +15,8 @@ enum UDAliases: String {
case lstName
case middleName
case deviceToken
case locale = "hy"
case langauge = "Հայերեն"
}
class UserDefaultsHelper {
......
/*
Localizable.strings
App16
Created by Grigor Aghabalyan on 3/28/20.
Copyright © 2020 X-TECH. All rights reserved.
*/
"FIRST_NAME" = "Fist name";
"LAST_NAME" = "Last name";
"MIDDLE_NAME" = "Middle name";
"NEXT" = "Next";
"WELCOME" = "Welcome";
"HISTORY" = "History";
"CREATE_FORM" = "Create Form";
"CREATE" = "Create";
"FORM" = "Form";
"FINISH" = "Finish";
"OUT_ADDRESS" = "Out address";
"OUT_DATETIME" = "Out datetime";
"Estimated Return Time" = "Estimated Return Time";
"Address of the place of visit/Title" = "Address of the place of visit/Title";
"Purpose of the visit" = "Purpose of the visit";
"APP_VERSION" = "App version";
"SETTINGS" = "Settings";
"LANGUAGE" = "Language";
"LANGUAGES" = "Languages";
"CANCEL" = "Cancel";
/*
Localizable.strings
App16
Created by Grigor Aghabalyan on 3/28/20.
Copyright © 2020 X-TECH. All rights reserved.
*/
"FIRST_NAME" = "Անուն";
"LAST_NAME" = "Ազգանուն";
"MIDDLE_NAME" = "հայրանուն";
"NEXT" = "Հաջորդը";
"WELCOME" = "Բարի գալուստ";
"HISTORY" = "Պատմություն";
"CREATE_FORM" = "Ստեղծել ձևաթուղթ";
"CREATE" = "Ստեղծել";
"FOMR" = "Ձևաթուղթ";
"FINISH" = "Ավարտել";
"OUT_ADDRESS" = "Ելքի ժամ";
"OUT_DATETIME" = "Ելքի հասցե";
"Estimated Return Time" = "Վերադարձի ակնկալվող ժամը";
"Address of the place of visit/title" = "Այցելության վայրի հասցե/անվանում";
"Purpose of the visit" = "Այցելության նպատակը";
"APP_VERSION" = "Հավելվածի տարբերակ";
"SETTINGS" = "Կարգավորումներ";
"LANGUAGE" = "Լեզու";
"LANGUAGES" = "Լեզուներ";
"CANCEL" = "Չեղարկել";
/*
Localizable.strings
App16
Created by Grigor Aghabalyan on 3/28/20.
Copyright © 2020 X-TECH. All rights reserved.
*/
"FIRST_NAME" = "Имя";
"LAST_NAME" = "Фамилия";
"MIDDLE_NAME" = "Отчество";
"NEXT" = "Следующий";
"WELCOME" = "Добро пожаловать";
"HISTORY" = "История";
"CREATE_FORM" = "Создать форму";
"CREATE" = "Создать";
"FORM" = "Форма";
"FINISH" = "Закончить";
"OUT_ADDRESS" = "Время выхода";
"OUT_DATETIME" = "Адрес выхода";
"Estimated Return Time" = "Ожидаемое время возврата/название";
"Address of the place of visit/Title" = "Адрес места посещения";
"Purpose of the visit" = "Цель визита";
"APP_VERSION" = "Версия приложения";
"SETTINGS" = "Настройки";
"LANGUAGE" = "Язык";
"LANGUAGES" = "Языки";
"CANCEL" = "Отменить";
......@@ -8,6 +8,7 @@
import Foundation
import CoreLocation
import Localize_Swift
struct Settings {
......@@ -15,4 +16,33 @@ struct Settings {
case latitude = 40.178576
case longitude = 44.511739
}
enum Languages: String {
case Armenian = "hy"
case English = "en"
case Russian = "ru"
}
static func changeLanguage(_ code: String, langauge: String) {
Settings.language = code
Localize.setCurrentLanguage(Settings.language)
UserDefaultsHelper.set(alias: .locale, value: code)
UserDefaultsHelper.set(alias: .langauge, value: langauge)
UserDefaults.standard.set(code, forKey: "language")
UserDefaults.standard.synchronize()
}
static var language: String! {
set(token) {
let defaults = Foundation.UserDefaults.standard
defaults.set(token, forKey: "User.Language")
}
get {
let defaults = Foundation.UserDefaults.standard
let lang = defaults.object(forKey: "User.Language") as? String
return lang
}
}
}
......@@ -25,8 +25,8 @@ class FormCreateViewController: UIViewController {
@IBOutlet weak var outAddressTextFiled: UITextField!
@IBOutlet weak var destinationAddressTextField: UITextField!
@IBOutlet weak var planneDateTimeTextField: UITextField!
@IBOutlet weak var destinationTypeTextField: UITextField!
@IBOutlet weak var createButton: UIButton!
@IBOutlet weak var activityIndicator: UIActivityIndicatorView!
......@@ -34,6 +34,12 @@ class FormCreateViewController: UIViewController {
@IBOutlet weak var planneDateTimeButton: UIButton!
@IBOutlet weak var nameLabel: UILabel!
@IBOutlet weak var outDateTimeTextLabel: UILabel!
@IBOutlet weak var outAddressTextLabel: UILabel!
@IBOutlet weak var destinationAddressTextLabel: UILabel!
@IBOutlet weak var planneDateTimeTextLabel: UILabel!
@IBOutlet weak var destinationTypeTextLabel: UILabel!
// MARK: - Variables
var data: FormResponse!
var formViewType: FormViewType = .creta
......@@ -43,20 +49,22 @@ class FormCreateViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
setUI()
switch formViewType {
case .creta:
createButton.isHidden = false
self.title = "Ստեղծել ձևաթուղթ"
self.title = "CREATE_FORM".localized()
curentDate.text = date
case .viewFromList:
self.title = "Ձևաթուղթ"
self.title = "FORM".localized()
createButton.isHidden = true
setData(response: data)
case .viewFromQr:
self.title = "Ձևաթուղթ"
self.title = "FORM".localized()
createButton.isHidden = true
retriveCurentForm()
}
......@@ -68,6 +76,16 @@ class FormCreateViewController: UIViewController {
}
}
private func setUI() {
createButton.setTitle("CREATE".localized(), for: .normal)
outDateTimeTextLabel.text = "OUT_ADDRESS".localized()
outAddressTextLabel.text = "OUT_DATETIME".localized()
destinationAddressTextLabel.text = "Address of the place of visit/Title".localized()
planneDateTimeTextLabel.text = "Estimated Return Time".localized()
destinationTypeTextLabel.text = "Purpose of the visit".localized()
}
// MARK: - Actions
@IBAction func outDateButtonAction(_ sender: UIButton) {
......
<?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">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="16096" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15706"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="16086"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
......@@ -14,13 +14,18 @@
<outlet property="createButton" destination="NyF-FR-xam" id="UmO-AP-uuM"/>
<outlet property="curentDate" destination="Tq2-Oq-lxj" id="Fh8-Zh-rwo"/>
<outlet property="destinationAddressTextField" destination="rPL-7I-ofi" id="TjC-eL-miv"/>
<outlet property="destinationAddressTextLabel" destination="rli-qI-mfE" id="EXq-c4-AS9"/>
<outlet property="destinationTypeTextField" destination="4aW-Ax-Ff0" id="e4d-zH-y4m"/>
<outlet property="destinationTypeTextLabel" destination="ANA-an-vnP" id="dMy-zT-vvq"/>
<outlet property="nameLabel" destination="MpC-Y1-VSJ" id="VF0-A0-eq8"/>
<outlet property="outAddressTextFiled" destination="mYS-bW-6ay" id="cWv-wV-KGV"/>
<outlet property="outAddressTextLabel" destination="JQ1-bo-hyi" id="Gkd-Jx-Z1B"/>
<outlet property="outDateButtonAction" destination="PvO-en-2tn" id="jZ5-9P-rNL"/>
<outlet property="outDateTimeTextFiled" destination="1V6-3e-Iop" id="udW-wX-Bcq"/>
<outlet property="outDateTimeTextLabel" destination="syB-Qv-Joh" id="XPm-B9-8YN"/>
<outlet property="planneDateTimeButton" destination="Je5-zZ-aSZ" id="r1W-uE-hv6"/>
<outlet property="planneDateTimeTextField" destination="suG-e6-CV9" id="z7Q-ns-46L"/>
<outlet property="planneDateTimeTextLabel" destination="XIU-P6-Fzz" id="9yg-67-2Lc"/>
<outlet property="view" destination="i5M-Pr-FkT" id="sfx-zR-JGt"/>
</connections>
</placeholder>
......
......@@ -26,7 +26,7 @@ class FormListViewController: UIViewController {
tableView.dataSource = self
registerCelll()
self.title = "Պատմություն"
self.title = "HISTORY".localized()
if let deviceId = UIDevice.current.identifierForVendor?.uuidString {
retriveCurentForm(deviceToken: deviceId)
......
//
// LanguageCell.swift
// App16
//
// Created by Grigor Aghabalyan on 3/28/20.
// Copyright © 2020 X-TECH. All rights reserved.
//
import UIKit
class LanguageCell: UITableViewCell {
// MARK: - IBOutlets
@IBOutlet weak var titleLabel: UILabel!
@IBOutlet weak var checkMarkImageView: UIImageView!
// MARK: - LifeCycle
override func awakeFromNib() {
super.awakeFromNib()
}
}
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="16096" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="16086"/>
<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"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<tableViewCell contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" reuseIdentifier="LanguageCell" id="KGk-i7-Jjw" customClass="LanguageCell" customModule="App16" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM">
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="lRk-vs-TaX">
<rect key="frame" x="16" y="12" width="255" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<nil key="highlightedColor"/>
</label>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="ycD-Yu-Ols">
<rect key="frame" x="0.0" y="43" width="320" height="1"/>
<color key="backgroundColor" white="0.66666666666666663" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstAttribute="height" constant="1" id="glI-zf-o73"/>
</constraints>
</view>
<imageView hidden="YES" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="checkmark" translatesAutoresizingMaskIntoConstraints="NO" id="7ie-jl-7gW">
<rect key="frame" x="279" y="9.5" width="25" height="25"/>
<color key="tintColor" red="0.023529411760000001" green="0.47058823529999999" blue="0.094117647060000004" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="height" constant="25" id="3hL-bq-stx"/>
<constraint firstAttribute="width" constant="25" id="BlR-IY-60e"/>
</constraints>
</imageView>
</subviews>
<constraints>
<constraint firstItem="7ie-jl-7gW" firstAttribute="leading" secondItem="lRk-vs-TaX" secondAttribute="trailing" constant="8" id="Clu-uc-RdT"/>
<constraint firstItem="ycD-Yu-Ols" firstAttribute="top" secondItem="lRk-vs-TaX" secondAttribute="bottom" constant="10" id="EPO-sJ-TN9"/>
<constraint firstItem="ycD-Yu-Ols" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" id="NXn-Pt-mwA"/>
<constraint firstItem="lRk-vs-TaX" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" constant="12" id="SJp-gQ-Grj"/>
<constraint firstItem="lRk-vs-TaX" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="16" id="VA0-ZZ-lTf"/>
<constraint firstAttribute="bottom" secondItem="ycD-Yu-Ols" secondAttribute="bottom" id="bT1-yr-vwZ"/>
<constraint firstAttribute="trailing" secondItem="ycD-Yu-Ols" secondAttribute="trailing" id="guR-eB-uDP"/>
<constraint firstAttribute="trailing" secondItem="7ie-jl-7gW" secondAttribute="trailing" constant="16" id="kO5-pM-v03"/>
<constraint firstItem="7ie-jl-7gW" firstAttribute="centerY" secondItem="H2p-sc-9uM" secondAttribute="centerY" id="ldy-lT-AHb"/>
</constraints>
</tableViewCellContentView>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<viewLayoutGuide key="safeArea" id="njF-e1-oar"/>
<connections>
<outlet property="checkMarkImageView" destination="7ie-jl-7gW" id="rkH-c6-Fnw"/>
<outlet property="titleLabel" destination="lRk-vs-TaX" id="fZL-1U-65I"/>
</connections>
<point key="canvasLocation" x="137.68115942028987" y="131.91964285714286"/>
</tableViewCell>
</objects>
<resources>
<image name="checkmark" width="40" height="40"/>
</resources>
</document>
//
// LanguageViewController.swift
// App16
//
// Created by Grigor Aghabalyan on 3/28/20.
// Copyright © 2020 X-TECH. All rights reserved.
//
import UIKit
import RxSwift
import RxRelay
class LanguageViewController: UIViewController {
// MARK: - IBOutletS
@IBOutlet weak var tableView: UITableView!
// MARK: - Vriables
private let languageCell = "LanguageCell"
var langauges: [Language] = []
let didRefresh = PublishRelay<Void>()
// MARK: - LifeCycle
override func viewDidLoad() {
super.viewDidLoad()
langauges.append(Language(title: "Հայերեն", code: "hy"))
langauges.append(Language(title: "English", code: "en"))
langauges.append(Language(title: "Русский", code: "ru"))
if let selectedLanguage = UserDefaultsHelper.getString(for: .locale) {
langauges.filter({
$0.code == selectedLanguage
}).first?.isSelected = true
}
self.tableView.delegate = self
self.tableView.dataSource = self
registerCelll()
setRightBarButton()
setUI()
}
// MARK: - Register
private func registerCelll() {
let nib = UINib(nibName: languageCell, bundle: nil)
tableView.register(nib, forCellReuseIdentifier: languageCell)
}
private func setUI() {
self.title = "LANGUAGES".localized()
self.navigationItem.leftBarButtonItem?.title = "CANCEL".localized()
}
private func setRightBarButton() {
let editButton = UIBarButtonItem.init(title: "CANCEL".localized(),
style: .done,
target: self,
action: #selector(closeAction))
editButton.tintColor = .white
self.navigationItem.leftBarButtonItem = editButton
}
// MARK: - Actions
@IBAction func closeAction() {
self.dismiss(animated: true, completion: nil)
}
}
// MARK: - UITableViewDataSource
extension LanguageViewController: UITableViewDataSource {
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return langauges.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: languageCell, for: indexPath) as? LanguageCell
cell?.titleLabel.text = langauges[indexPath.row].title
cell?.checkMarkImageView.isHidden = !langauges[indexPath.row].isSelected
return cell ?? UITableViewCell()
}
}
// MARK: - UITableViewDelegate
extension LanguageViewController: UITableViewDelegate {
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
langauges.forEach({
$0.isSelected = false
})
langauges[indexPath.row].isSelected = true
tableView.reloadData()
setLanguage(index: indexPath.row)
setUI()
didRefresh.accept(Void())
}
private func setLanguage(index: Int) {
Settings.changeLanguage(langauges[index].code, langauge: langauges[index].title)
}
}
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="16096" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="16086"/>
<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="LanguageViewController" customModule="App16" customModuleProvider="target">
<connections>
<outlet property="tableView" destination="kLE-QI-dpJ" id="5Hr-eA-4gw"/>
<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"/>
<subviews>
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" style="plain" separatorStyle="none" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="kLE-QI-dpJ">
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<color key="backgroundColor" red="0.99999600649999998" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</tableView>
</subviews>
<color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
<constraints>
<constraint firstItem="kLE-QI-dpJ" firstAttribute="trailing" secondItem="fnl-2z-Ty3" secondAttribute="trailing" id="9nE-rc-muz"/>
<constraint firstItem="kLE-QI-dpJ" firstAttribute="top" secondItem="i5M-Pr-FkT" secondAttribute="top" id="jPx-Rb-5BM"/>
<constraint firstAttribute="bottom" secondItem="kLE-QI-dpJ" secondAttribute="bottom" id="kRz-yL-uH1"/>
<constraint firstItem="kLE-QI-dpJ" firstAttribute="leading" secondItem="fnl-2z-Ty3" secondAttribute="leading" id="wQN-gf-BkU"/>
</constraints>
<viewLayoutGuide key="safeArea" id="fnl-2z-Ty3"/>
<point key="canvasLocation" x="137.68115942028987" y="131.91964285714286"/>
</view>
</objects>
</document>
//
// Language.swift
// App16
//
// Created by Grigor Aghabalyan on 3/28/20.
// Copyright © 2020 X-TECH. All rights reserved.
//
import Foundation
class Language {
let title: String
let code: String
var isSelected = false
init(title: String, code: String) {
self.title = title
self.code = code
}
}
......@@ -18,15 +18,38 @@ class LoginViewController: UIViewController {
// MARK: - LifeCycle
override func viewDidLoad() {
super.viewDidLoad()
firstNameTextField.attributedPlaceholder = NSAttributedString(string: "Անուն",
setRightBarButton()
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
setUI()
}
private func setUI() {
firstNameTextField.attributedPlaceholder = NSAttributedString(string: "FIRST_NAME".localized(),
attributes: [NSAttributedString.Key.foregroundColor: UIColor.black.withAlphaComponent(0.2)])
lastNameTextFiled.attributedPlaceholder = NSAttributedString(string: "Ազգանուն",
lastNameTextFiled.attributedPlaceholder = NSAttributedString(string: "LAST_NAME".localized(),
attributes: [NSAttributedString.Key.foregroundColor: UIColor.black.withAlphaComponent(0.2)])
middleNameTextField.attributedPlaceholder = NSAttributedString(string: "Հայրանուն",
middleNameTextField.attributedPlaceholder = NSAttributedString(string: "MIDDLE_NAME".localized(),
attributes: [NSAttributedString.Key.foregroundColor: UIColor.black.withAlphaComponent(0.2)])
nextButton.setTitle("NEXT".localized(), for: .normal)
}
private func setRightBarButton() {
let editButton = UIBarButtonItem.init(image: UIImage(named: "settings"),
style: .done,
target: self,
action: #selector(settingsActtions))
editButton.tintColor = .white
self.navigationItem.rightBarButtonItem = editButton
}
// MARK: - Navigation
private func openCreateFormViewController() {
......@@ -64,4 +87,13 @@ class LoginViewController: UIViewController {
}
}
// MARK: - Actions
@IBAction func settingsActtions() {
let controller = SettingsViewController()
self.navigationController?.navigationBar.topItem?.title = " "
self.navigationController?.pushViewController(controller, animated: true)
}
}
<?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">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="16096" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15706"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="16086"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
......@@ -26,10 +26,10 @@
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="pjJ-TP-GZQ">
<rect key="frame" x="0.0" y="0.0" width="414" height="605"/>
<rect key="frame" x="0.0" y="0.0" width="414" height="545"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="v5b-ox-LAJ" customClass="IQPreviousNextView" customModule="IQKeyboardManagerSwift">
<rect key="frame" x="40" y="252" width="334" height="50"/>
<rect key="frame" x="40" y="192" width="334" height="50"/>
<subviews>
<view clipsSubviews="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="UdU-wC-cfP">
<rect key="frame" x="0.0" y="48" width="334" height="2"/>
......@@ -63,7 +63,7 @@
</userDefinedRuntimeAttributes>
</view>
<view clipsSubviews="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="5Jp-lT-hD9" customClass="IQPreviousNextView" customModule="IQKeyboardManagerSwift">
<rect key="frame" x="40" y="337" width="334" height="50"/>
<rect key="frame" x="40" y="277" width="334" height="50"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="OOR-CE-LkM">
<rect key="frame" x="0.0" y="48" width="334" height="2"/>
......@@ -97,7 +97,7 @@
</userDefinedRuntimeAttributes>
</view>
<view clipsSubviews="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="0Fv-DJ-48Q" customClass="IQPreviousNextView" customModule="IQKeyboardManagerSwift">
<rect key="frame" x="40" y="422" width="334" height="50"/>
<rect key="frame" x="40" y="362" width="334" height="50"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="lsx-hK-uHO">
<rect key="frame" x="0.0" y="48" width="334" height="2"/>
......@@ -131,7 +131,7 @@
</userDefinedRuntimeAttributes>
</view>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="XbI-AN-w8C">
<rect key="frame" x="40" y="515" width="334" height="50"/>
<rect key="frame" x="40" y="455" width="334" height="50"/>
<color key="backgroundColor" red="0.0" green="0.53725490196078429" blue="0.15686274509803921" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="height" constant="50" id="zpn-1l-7Dg"/>
......@@ -150,7 +150,7 @@
</connections>
</button>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="logo_green" translatesAutoresizingMaskIntoConstraints="NO" id="rWy-HR-DHL">
<rect key="frame" x="171" y="90" width="72" height="72"/>
<rect key="frame" x="171" y="60" width="72" height="72"/>
<constraints>
<constraint firstAttribute="height" constant="72" id="WTo-iK-2yK"/>
<constraint firstAttribute="width" constant="72" id="dYT-Ka-3DZ"/>
......@@ -164,8 +164,8 @@
<constraint firstItem="XbI-AN-w8C" firstAttribute="top" secondItem="0Fv-DJ-48Q" secondAttribute="bottom" constant="43" id="F7v-ih-Z15"/>
<constraint firstItem="rWy-HR-DHL" firstAttribute="centerX" secondItem="pjJ-TP-GZQ" secondAttribute="centerX" id="GiF-Sd-BmE"/>
<constraint firstItem="0Fv-DJ-48Q" firstAttribute="top" secondItem="5Jp-lT-hD9" secondAttribute="bottom" constant="35" id="H19-ZZ-sea"/>
<constraint firstItem="rWy-HR-DHL" firstAttribute="top" secondItem="pjJ-TP-GZQ" secondAttribute="top" constant="90" id="KyX-fW-l8p"/>
<constraint firstItem="v5b-ox-LAJ" firstAttribute="top" secondItem="rWy-HR-DHL" secondAttribute="bottom" constant="90" id="bMu-zS-JZW"/>
<constraint firstItem="rWy-HR-DHL" firstAttribute="top" secondItem="pjJ-TP-GZQ" secondAttribute="top" constant="60" id="KyX-fW-l8p"/>
<constraint firstItem="v5b-ox-LAJ" firstAttribute="top" secondItem="rWy-HR-DHL" secondAttribute="bottom" constant="60" id="bMu-zS-JZW"/>
<constraint firstItem="5Jp-lT-hD9" firstAttribute="leading" secondItem="pjJ-TP-GZQ" secondAttribute="leading" constant="40" id="cWA-hD-DiI"/>
<constraint firstAttribute="trailing" secondItem="5Jp-lT-hD9" secondAttribute="trailing" constant="40" id="lS7-av-qsj"/>
<constraint firstItem="5Jp-lT-hD9" firstAttribute="top" secondItem="v5b-ox-LAJ" secondAttribute="bottom" constant="35" id="oku-0T-4Q9"/>
......
......@@ -21,7 +21,7 @@ class MainViewController: UIViewController {
private func openLoginViewController() {
let controller = LoginViewController()
changeRoot(controller)
changeRoot(UINavigationController(rootViewController: controller))
}
private func openQRController() {
......
......@@ -22,6 +22,7 @@ class QrViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
setUI()
if let teviceId = UIDevice.current.identifierForVendor?.uuidString {
activityIndicator.isHidden = false
activityIndicator.startAnimating()
......@@ -30,6 +31,12 @@ class QrViewController: UIViewController {
}
}
private func setUI() {
fomrButton.setTitle("FORM".localized(), for: .normal)
finishButton.setTitle("FINISH".localized(), for: .normal)
}
// MARK: - Actions
@IBAction func formButtonAction(_ sender: UIButton) {
openCreateFormView()
......@@ -77,14 +84,10 @@ class QrViewController: UIViewController {
case .base(response: let baseResposne):
CheckBaseHelper.checkBaseResponse(baseResposne, viewController: self)
case .success(_):
self.openWelcomeView()
case .isOffline:
return
case .conflict:
return
}
}
......
//
// SettingsViewController.swift
// App16
//
// Created by Grigor Aghabalyan on 3/28/20.
// Copyright © 2020 X-TECH. All rights reserved.
//
import UIKit
import RxSwift
import RxRelay
import RxCocoa
class SettingsViewController: UIViewController {
// MARK: - IBOutlets
@IBOutlet weak var appVersionLabel: UILabel!
@IBOutlet weak var languageTextLabel: UILabel!
@IBOutlet weak var langaugeLabel: UILabel!
@IBOutlet weak var langaugeButtob: UIButton!
// MARK: - Variables
private let disposeBag = DisposeBag()
// MARK: - LifeCycle
override func viewDidLoad() {
super.viewDidLoad()
setUI()
}
private func setUI() {
self.appVersionLabel.text = "APP_VERSION".localized() + " - " + Bundle.applicationVersionNumber +
" ( " + Bundle.applicationBuildNumber + " ) "
// TODO: - Temporary part.
self.title = "SETTINGS".localized()
self.languageTextLabel.text = "LANGUAGE".localized()
self.langaugeLabel.text = UserDefaultsHelper.getString(for: .langauge)
}
// MARK: - IBAction
@IBAction func langaugeButtonAction(_ sender: UIButton) {
let controller = LanguageViewController()
controller.didRefresh
.bind(onNext: setUI)
.disposed(by: disposeBag)
let navController = UINavigationController(rootViewController: controller)
self.present(navController, animated: true, completion: nil)
}
}
This diff is collapsed.
......@@ -14,11 +14,13 @@ class WelcomeViewController: UIViewController {
@IBOutlet weak var nameLabel: UILabel!
@IBOutlet weak var createFormButton: UIButton!
@IBOutlet weak var historyButton: UIButton!
@IBOutlet weak var nameTextLabel: UILabel!
// MARK: - LifeCycle
override func viewDidLoad() {
super.viewDidLoad()
setUI()
setRightBarButton()
let firstName = UserDefaultsHelper.getString(for: .firstName)
......@@ -27,6 +29,14 @@ class WelcomeViewController: UIViewController {
nameLabel.text = (firstName ?? "-") + " " + (lastName ?? "-")
}
private func setUI() {
nameTextLabel.text = "WELCOME".localized()
createFormButton.setTitle("CREATE_FORM".localized(), for: .normal)
historyButton.setTitle("HISTORY".localized(), for: .normal)
}
private func setRightBarButton() {
let editButton = UIBarButtonItem.init(image: UIImage(named: "edit"),
......
<?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">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="16096" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15706"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="16086"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
......@@ -13,6 +13,7 @@
<outlet property="createFormButton" destination="Jmm-GA-Npp" id="waU-t8-FMw"/>
<outlet property="historyButton" destination="xKX-74-m44" id="MDj-66-ha9"/>
<outlet property="nameLabel" destination="RJu-c4-bw8" id="9gd-MT-hXb"/>
<outlet property="nameTextLabel" destination="tpq-Rn-PFH" id="oqf-de-Spe"/>
<outlet property="view" destination="i5M-Pr-FkT" id="sfx-zR-JGt"/>
</connections>
</placeholder>
......
......@@ -13,7 +13,11 @@ target 'App16' do
pod 'AlamofireObjectMapper', '~> 5.2'
pod 'AlamofireImage', '~> 3.5'
pod 'IQKeyboardManagerSwift'
# Pods for App16
pod 'Localize-Swift', '~> 2.0'
pod 'RxSwift', '~> 5'
pod 'RxRelay', '~> 5'
pod 'RxCocoa', '~> 5'
# Pods for App16
end
......@@ -6,13 +6,24 @@ PODS:
- Alamofire (~> 4.7)
- ObjectMapper (~> 3.4)
- IQKeyboardManagerSwift (6.5.5)
- Localize-Swift (2.0.0)
- ObjectMapper (3.5.1)
- RxCocoa (5.0.1):
- RxRelay (~> 5)
- RxSwift (~> 5)
- RxRelay (5.0.1):
- RxSwift (~> 5)
- RxSwift (5.0.1)
DEPENDENCIES:
- Alamofire (~> 4.3)
- AlamofireImage (~> 3.5)
- AlamofireObjectMapper (~> 5.2)
- IQKeyboardManagerSwift
- Localize-Swift (~> 2.0)
- RxCocoa (~> 5)
- RxRelay (~> 5)
- RxSwift (~> 5)
SPEC REPOS:
trunk:
......@@ -20,15 +31,23 @@ SPEC REPOS:
- AlamofireImage
- AlamofireObjectMapper
- IQKeyboardManagerSwift
- Localize-Swift
- ObjectMapper
- RxCocoa
- RxRelay
- RxSwift
SPEC CHECKSUMS:
Alamofire: 85e8a02c69d6020a0d734f6054870d7ecb75cf18
AlamofireImage: be9963c6582d68b39e89191f64c82a7d7bf40fdd
AlamofireObjectMapper: 1989f690e982b71921b9253f53a4f33a9bc00d88
IQKeyboardManagerSwift: 0fb93310284665245591f50f7a5e38de615960b7
Localize-Swift: c798ec9286494866f7068f85f7c71283ac5bdab4
ObjectMapper: 70187b8941977c62ccfb423caf6b50be405cabf0
RxCocoa: e741b9749968e8a143e2b787f1dfbff2b63d0a5c
RxRelay: 89d54507f4fd4d969e6ec1d4bd7f3673640b4640
RxSwift: e2dc62b366a3adf6a0be44ba9f405efd4c94e0c4
PODFILE CHECKSUM: f7b2a4acba9f80a5f15cdb5a8f564ca06e0d8677
PODFILE CHECKSUM: 4cab2393bcb24f88355b10a74c59e2e6d5d89bfb
COCOAPODS: 1.8.4