Logging:
Dependancy Inhjection:
- Butterknife: https://github.com/JakeWharton/butterknife
| // 1. Basic configuration for creating Alamofire manager | |
| let configuration = URLSessionConfiguration.default | |
| configuration.httpAdditionalHeaders = SessionManager.defaultHTTPHeaders | |
| configuration.timeoutIntervalForRequest = 60 | |
| var serverTrustPolicies: [String: ServerTrustPolicy] = [:] | |
| // 2. Pass your certificate filename, type and directory path to load the cefrtificate | |
| guard let certificatePath = Bundle.main.path(forResource: "CertificateFileName", ofType: "der", inDirectory: "assets/certificate") else{ |
| import java.io.BufferedInputStream; | |
| import java.io.BufferedOutputStream; | |
| import java.io.File; | |
| import java.io.FileInputStream; | |
| import java.io.FileOutputStream; | |
| import java.io.OutputStream; | |
| import com.jcraft.jsch.Channel; | |
| import com.jcraft.jsch.ChannelSftp; | |
| import com.jcraft.jsch.JSch; |
| interface LoginContracts { | |
| interface View { | |
| fun presentHomeScreen(user: User) | |
| fun showError(message: String) | |
| } | |
| interface Presenter { | |
| fun onDestroy() | |
| fun onLoginButtonPressed(username: String, password: String) | |
| } |
| interface LoginContracts { | |
| interface View { | |
| fun showError(message: String) | |
| } | |
| interface Presenter { | |
| fun onDestroy() | |
| fun onLoginButtonPressed(username: String, password: String) | |
| } | |
Logging:
Dependancy Inhjection:
##1. Android:
##2. iOS:
| public class Utils { | |
| /* | |
| * Usage: Check if device have internet connection or not, before communicating with server. | |
| * @param ctx: Context form which this method will be called | |
| * @return Boolean: If internet is available or not. | |
| */ | |
| public static boolean isNetConnected(Context ctx) { | |
| Runtime runtime = Runtime.getRuntime(); | |
| try { |
| import Foundation | |
| import UIKit | |
| class RestService{ | |
| /** | |
| GET respons from REST API. | |
| :param: reqUrl URL of webservice. | |
| :param: completionHandler callback function, this will called once you get response. |