You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

43 lines
1018 B

6 years ago
6 years ago
  1. //
  2. // ModelExtension.swift
  3. // GMERemittance
  4. //
  5. // Created by Sujal on 12/26/17.
  6. // Copyright © 2017 Gobal Money Express Co. Ltd. All rights reserved.
  7. //
  8. import Foundation
  9. class ModelExtension {
  10. var errorMessage: String?
  11. var internetConnection: Box<Bool?> = Box(nil)
  12. var anotherLogin: Box<Bool?> = Box(nil)
  13. func setErrorMessage(message: String) {
  14. errorMessage = message
  15. }
  16. func getErrorMessage() -> String {
  17. if errorMessage != nil {
  18. return errorMessage!
  19. } else {
  20. return "Connection timeout. Please try again."
  21. }
  22. }
  23. func getUserId() -> String {
  24. if let userId = UserDefaults.standard.object(forKey: "com.gmeremit.username") as? String {
  25. return userId
  26. } else {
  27. return ""
  28. }
  29. }
  30. func getLoginPassword() -> String {
  31. let password = UserDefaults.standard.string(forKey: "com.gmeremit.password")
  32. return password ?? ""
  33. }
  34. }