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.
47 lines
1.2 KiB
47 lines
1.2 KiB
//
|
|
// ModelExtension.swift
|
|
// GMERemittance
|
|
//
|
|
// Created by Sujal on 12/26/17.
|
|
// Copyright © 2017 Gobal Money Express Co. Ltd. All rights reserved.
|
|
//
|
|
|
|
import Foundation
|
|
|
|
class ModelExtension {
|
|
|
|
var errorMessage: String?
|
|
var internetConnection: Box<Bool?> = Box(nil)
|
|
var anotherLogin: Box<Bool?> = Box(nil)
|
|
|
|
func setErrorMessage(message: String) {
|
|
errorMessage = message
|
|
}
|
|
|
|
func getErrorMessage() -> String {
|
|
if errorMessage != nil {
|
|
return errorMessage!
|
|
} else {
|
|
return "Connection timeout. Please try again."
|
|
}
|
|
}
|
|
|
|
func getUserId() -> String {
|
|
if let userId = UserDefaults.standard.object(forKey: "com.gmeremit.username") as? String {
|
|
return userId
|
|
} else {
|
|
return ""
|
|
}
|
|
}
|
|
|
|
func getLoginPassword() -> String {
|
|
if let passwordBase64 = UserDefaults.standard.object(forKey: "com.gmeremit.password") as? String{
|
|
let decodedData = Data(base64Encoded: passwordBase64)!
|
|
let password = String(data: decodedData, encoding: .utf8)!
|
|
return password
|
|
} else {
|
|
return ""
|
|
}
|
|
}
|
|
|
|
}
|