diff --git a/GMERemittance/Module/SplashScreen/User Interface/View/SplashScreen.storyboard b/GMERemittance/Module/SplashScreen/User Interface/View/SplashScreen.storyboard
index e42f3543..91b89e84 100644
--- a/GMERemittance/Module/SplashScreen/User Interface/View/SplashScreen.storyboard
+++ b/GMERemittance/Module/SplashScreen/User Interface/View/SplashScreen.storyboard
@@ -10,6 +10,9 @@
+
+ SanFranciscoDisplay-Regular
+
SanFranciscoDisplay-Semibold
@@ -36,28 +39,60 @@
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
@@ -65,20 +100,20 @@
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
-
-
+
+
@@ -199,6 +234,7 @@
+
@@ -218,6 +254,7 @@
+
@@ -234,6 +271,7 @@
+
diff --git a/GMERemittance/Module/SplashScreen/User Interface/View/SplashScreenViewController.swift b/GMERemittance/Module/SplashScreen/User Interface/View/SplashScreenViewController.swift
index 13a42059..388866a6 100644
--- a/GMERemittance/Module/SplashScreen/User Interface/View/SplashScreenViewController.swift
+++ b/GMERemittance/Module/SplashScreen/User Interface/View/SplashScreenViewController.swift
@@ -33,6 +33,7 @@ class SplashScreenViewController: UIViewController {
@IBOutlet private weak var languageBackGroundView: UIView!
@IBOutlet private weak var languageLabel: UILabel!
+ @IBOutlet private weak var flagImageView: UIImageView!
private var languageTapGuesture: UITapGestureRecognizer?
// MARK: Properties
@@ -58,6 +59,8 @@ class SplashScreenViewController: UIViewController {
UserDefaults.standard.set(code, forKey: AppConstants.firstTimeLanguageIsSet)
setText()
+
+ flagImageView.image = CountryInfo().getFlag(for: selectedLanguage?.code ?? "")
}
}
@@ -69,49 +72,49 @@ class SplashScreenViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
checkJailBreak()
- self.setup()
+ setup()
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
self.navigationItem.title = ""
- self.hideNavBar()
- self.setupTimer()
+ hideNavBar()
+ setupTimer()
}
override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
- self.navigationItem.title = ""
- self.timer?.invalidate()
+ navigationItem.title = ""
+ timer?.invalidate()
}
// MARK: IBActions
private func checkJailBreak() {
- if (DTTJailbreakDetection.isJailbroken()) {
- self.alert(message: "Your device is jail broken.", title: "Alert!") {
+ if DTTJailbreakDetection.isJailbroken() {
+ alert(message: "Your device is jail broken.", title: "Alert!") {
exit(0)
}
}
}
@IBAction private func login(_ sender: UIButton) {
- self.presenter?.login()
+ presenter?.login()
}
@IBAction private func register(_ sender: UIButton) {
- self.presenter?.register()
+ presenter?.register()
}
// MARK: Other Functions
private func hideNavBar() {
- self.navigationController?.isNavigationBarHidden = true
- self.navigationController?.navigationBar.barTintColor = AppConstants.themeRedColor
- self.navigationController?.navigationBar.isTranslucent = false
- self.navigationController?.navigationBar.setBackgroundImage(UIImage(), for: .default)
- self.navigationController?.navigationBar.shadowImage = UIImage()
+ navigationController?.isNavigationBarHidden = true
+ navigationController?.navigationBar.barTintColor = AppConstants.themeRedColor
+ navigationController?.navigationBar.isTranslucent = false
+ navigationController?.navigationBar.setBackgroundImage(UIImage(), for: .default)
+ navigationController?.navigationBar.shadowImage = UIImage()
}
private func setup() {
@@ -119,7 +122,9 @@ class SplashScreenViewController: UIViewController {
hideNavBar()
setUpButtons()
imageViewDotLeft.image = UIImage(named: "dotSelected")
+
let leftSwipe = UISwipeGestureRecognizer(target: self, action: #selector(_SplashScreenViewController.handleSwipes(_:)))
+
let rightSwipe = UISwipeGestureRecognizer(target: self, action: #selector(_SplashScreenViewController.handleSwipes(_:)))
leftSwipe.direction = .left
@@ -132,12 +137,12 @@ class SplashScreenViewController: UIViewController {
}
private func setLanguageBackgroundView() {
- let languageSelectionGuesture = UITapGestureRecognizer(target: self, action: #selector(self.showCountryPickerview))
- self.languageBackGroundView.addGestureRecognizer(languageSelectionGuesture)
+ let languageSelectionGuesture = UITapGestureRecognizer(target: self, action: #selector(showCountryPickerview))
+ languageBackGroundView.addGestureRecognizer(languageSelectionGuesture)
- self.languageBackGroundView.layer.cornerRadius = 10
- self.languageBackGroundView.clipsToBounds = true
- self.languageBackGroundView.layer.addShadow(offset: CGSize.init(width: 2, height: 2))
+ languageBackGroundView.layer.cornerRadius = 10
+ languageBackGroundView.clipsToBounds = true
+ languageBackGroundView.layer.addShadow(offset: CGSize.init(width: 2, height: 2))
NotificationCenter.default.addObserver(self, selector: #selector(setText), name: NSNotification.Name(LCLLanguageChangeNotification), object: nil)
setupLanguages()
@@ -145,7 +150,13 @@ class SplashScreenViewController: UIViewController {
// if exist a selected language then don't animate, and put in the selected language into languageLabel
if let language = UserDefaults.standard.string(forKey: AppConstants.firstTimeLanguageIsSet){
- self.selectedLanguage = self.languages.filter{$0.code?.languageCode == language.languageCode}.first
+ selectedLanguage = languages
+ .filter{
+ $0.code?.languageCode == language.languageCode
+ }
+ .first
+
+ flagImageView.image = CountryInfo().getFlag(for: selectedLanguage?.code ?? "")
} else {
configureTimer()
}
@@ -153,41 +164,49 @@ class SplashScreenViewController: UIViewController {
@objc private func setText() {
timer?.invalidate()
- self.buttonLogin.setTitle("login_text".localized(), for: .normal)
- self.buttonSignUp.setTitle("new_user_text".localized(), for: .normal)
- self.languageLabel.text = self.selectedLanguage?.title
+ buttonLogin.setTitle("login_text".localized(), for: .normal)
+ buttonSignUp.setTitle("new_user_text".localized(), for: .normal)
+ languageLabel.text = selectedLanguage?.title
setImageandLabels()
}
private func setupLanguages() {
- self.languages = Utility.getLanguages()
+ languages = Utility.getLanguages()
}
private func configureTimer() {
- let timer = Timer.scheduledTimer(timeInterval: 2, target: self, selector: #selector(self.updateLanguage), userInfo: nil, repeats: true)
- self.timer = timer
+ timer = Timer.scheduledTimer(
+ timeInterval: 2,
+ target: self,
+ selector: #selector(updateLanguage),
+ userInfo: nil,
+ repeats: true
+ )
}
private func configureLanguage() {
- self.buttonLogin.setTitle(StringConstants().loginText, for: .normal)
- self.buttonSignUp.setTitle(StringConstants().newUserText, for: .normal)
+ buttonLogin.setTitle(StringConstants().loginText, for: .normal)
+ buttonSignUp.setTitle(StringConstants().newUserText, for: .normal)
}
@objc private func handleSwipes(_ sender: UISwipeGestureRecognizer) {
- if (sender.direction == .right) {
+ switch sender.direction {
+ case .right:
counter = counter - 1
if counter < 0 {
counter = 2
}
- }
-
- if (sender.direction == .left) {
+ case .left:
counter = counter + 1
if counter > 2 {
counter = 0
}
+
+ default:
+ break
}
+
setImageandLabels()
}
@@ -226,66 +245,74 @@ class SplashScreenViewController: UIViewController {
}
private func setUpButtons() {
- buttonSignUp.layer.cornerRadius = 25
buttonLogin.backgroundColor = .clear
buttonLogin.layer.cornerRadius = 25
buttonLogin.layer.borderWidth = 1
buttonLogin.layer.borderColor = UIColor.white.cgColor
-// buttonSignUp.layer.borderWidth = 1
-// buttonSignUp.layer.borderColor = UIColor.white.cgColor
- self.view.backgroundColor = AppConstants.themeRedColor
-// self.buttonSignUp.backgroundColor = AppConstants.themeDarkRedColor
- self.buttonLogin.backgroundColor = AppConstants.themeBlueColor
- // self.buttonSignUp.backgroundColor = AppConstants.themeBlueColor
+ buttonLogin.backgroundColor = AppConstants.themeBlueColor
+
+ view.backgroundColor = AppConstants.themeRedColor
+
+ buttonSignUp.layer.cornerRadius = 25
}
private func setupTimer() {
- self.timer?.fire()
+ timer?.fire()
}
@objc private func updateLanguage() {
+ guard let element = languages.elementAt(index: languageIndex)
+ else {
+ return
+ }
- self.changeText(text: self.languages.elementAt(index: self.languageIndex)?.name ?? "")
- if (self.languageIndex + 1) >= (self.languages.count) {
- self.languageIndex = 0
+ changeLanguageInfo(
+ text: element.name ?? "",
+ flag: CountryInfo().getFlag(for: element.code ?? "")
+ )
+
+ if (languageIndex + 1) >= languages.count {
+ languageIndex = 0
}else {
- self.languageIndex += 1
+ languageIndex += 1
}
}
- private func changeText(text: String) {
- let animation: CATransition = CATransition()
- animation.timingFunction = CAMediaTimingFunction(name:
- kCAMediaTimingFunctionEaseInEaseOut)
+ private func changeLanguageInfo(text: String, flag: UIImage?) {
+ let animation = CATransition()
+ animation.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut)
animation.type = kCATransitionPush
animation.subtype = kCATransitionFromTop
animation.duration = 0.8
- let animation1: CATransition = CATransition()
- animation1.timingFunction = CAMediaTimingFunction(name:
- kCAMediaTimingFunctionEaseInEaseOut)
- animation1.type = kCATransitionFade
- animation1.subtype = kCATransitionReveal
- animation1.duration = 0.8
languageLabel.layer.add(animation, forKey: kCATransitionPush)
+ languageLabel.text = text
+
+ flagImageView.layer.add(animation, forKey: kCATransitionPush)
+ flagImageView.image = flag
- self.languageLabel.text = text
}
@objc private func showCountryPickerview() {
setupLanguages()
- let viewcontroller = UIStoryboard.init(name: "CountryPicker", bundle: nil).instantiateViewController(withIdentifier: "CountryPickerViewController") as! CountryPickerViewController
- let data: [SendMoneyCountryViewModel] = self.languages
+
+ let viewcontroller = UIStoryboard
+ .init(name: "CountryPicker", bundle: nil)
+ .instantiateViewController(
+ withIdentifier: "CountryPickerViewController"
+ ) as! CountryPickerViewController
+
viewcontroller.isLanguageSelection = true
- viewcontroller.data = data
- viewcontroller.doneAction = self.countrySelected
- viewcontroller.type = PickerTitle.country
- self.present(viewcontroller, animated: true, completion: nil)
+ viewcontroller.data = languages
+ viewcontroller.doneAction = countrySelected
+ viewcontroller.type = .country
+
+ present(viewcontroller, animated: true, completion: nil)
}
private func countrySelected(models: [SendMoneyCountryViewModel]) {
if models.count != 0 {
- self.selectedLanguage = models.first
+ selectedLanguage = models.first
}
}