From c978d14d09533ce33df351018a4e543f5a7aafb7 Mon Sep 17 00:00:00 2001 From: Pratyush Singh Date: Sun, 21 Jan 2024 12:11:44 +0530 Subject: [PATCH] refactor #1481: migrated core utils and MifosPayApplication to kotlin --- .../mobilewallet/core/utils/Constants.java | 61 ------- .../mobilewallet/core/utils/Constants.kt | 54 ++++++ .../mobilewallet/core/utils/DateHelper.java | 165 ------------------ .../mobilewallet/core/utils/DateHelper.kt | 137 +++++++++++++++ .../core/utils/ErrorJsonMessageHelper.java | 61 ------- .../core/utils/ErrorJsonMessageHelper.kt | 30 ++++ .../mobilewallet/mifospay/MifosPayApp.java | 45 ----- .../mobilewallet/mifospay/MifosPayApp.kt | 41 +++++ .../bank/presenter/DebitCardPresenter.kt | 4 +- .../mifospay/common/ui/SearchActivity.kt | 2 +- .../kyc/presenter/KYCLevel2Presenter.kt | 2 +- .../merchants/ui/MerchantTransferActivity.kt | 4 +- 12 files changed, 268 insertions(+), 338 deletions(-) delete mode 100644 core/src/main/java/org/mifos/mobilewallet/core/utils/Constants.java create mode 100644 core/src/main/java/org/mifos/mobilewallet/core/utils/Constants.kt delete mode 100644 core/src/main/java/org/mifos/mobilewallet/core/utils/DateHelper.java create mode 100644 core/src/main/java/org/mifos/mobilewallet/core/utils/DateHelper.kt delete mode 100644 core/src/main/java/org/mifos/mobilewallet/core/utils/ErrorJsonMessageHelper.java create mode 100644 core/src/main/java/org/mifos/mobilewallet/core/utils/ErrorJsonMessageHelper.kt delete mode 100644 mifospay/src/main/java/org/mifos/mobilewallet/mifospay/MifosPayApp.java create mode 100644 mifospay/src/main/java/org/mifos/mobilewallet/mifospay/MifosPayApp.kt diff --git a/core/src/main/java/org/mifos/mobilewallet/core/utils/Constants.java b/core/src/main/java/org/mifos/mobilewallet/core/utils/Constants.java deleted file mode 100644 index b161cb927..000000000 --- a/core/src/main/java/org/mifos/mobilewallet/core/utils/Constants.java +++ /dev/null @@ -1,61 +0,0 @@ -package org.mifos.mobilewallet.core.utils; - -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; - -/** - * Created by naman on 17/6/17. - */ - -public class Constants { - - public static final String BASIC = "Basic "; - - public static final String SAVINGS = "savingsAccounts"; - public static final String TRANSACTIONS = "transactions"; - - public static final int WALLET_ACCOUNT_SAVINGS_PRODUCT_ID = 1; - - public static final int MIFOS_MERCHANT_SAVINGS_PRODUCT_ID = 165; // 372 - public static final int MIFOS_CONSUMER_SAVINGS_PRODUCT_ID = 165; // 373 - - private static final int MOBILE_WALLET_ROLE_ID = 471; - private static final int SUPER_USER_ROLE_ID = 1; - public static final Collection NEW_USER_ROLE_IDS = Collections.unmodifiableList( - Arrays.asList(MOBILE_WALLET_ROLE_ID, SUPER_USER_ROLE_ID)); - - public static final String ENTITY_TYPE_CLIENTS = "clients"; - - public static final String FETCH_ACCOUNT_TRANSFER_USECASE = "FetchAccountTransfer"; - public static final String NO_SAVED_CARDS = "No saved cards."; - public static final String MIFOS_PASSWORD = "mifos:password"; - public static final String ERROR_VERIFYING_USER = "Error verifying user"; - public static final String ERROR_REGISTERING_USER = "Error registering user"; - public static final String NO_CLIENTS_FOUND = "No clients found"; - public static final String ERROR_SEARCHING_CLIENTS = "Error searching clients"; - public static final String CLIENTS = "clients"; - public static final String NO_ACCOUNTS_FOUND = "No accounts found"; - public static final String ERROR_FETCHING_ACCOUNTS = "Error fetching accounts"; - public static final String ERROR_MAKING_TRANSFER = "Error making transfer"; - public static final String WALLET_TRANSFER = "Wallet transfer"; - public static final String ERROR_ADDING_BENEFICIARY = "Error adding beneficiary"; - public static final String ERROR_FETCHING_BENEFICIARIES = "Error fetching beneficiaries"; - public static final String ERROR_FETCHING_TO_ACCOUNT = "Error fetching to account"; - public static final String NO_WALLET_FOUND = "No wallet found"; - public static final String ERROR_FETCHING_FROM_ACCOUNT = "Error fetching from account"; - public static final String ERROR_FETCHING_CLIENT_DATA = "Error fetching client data"; - public static final String NO_CLIENT_FOUND = "No client found"; - public static final String ERROR_LOGGING_IN = "Error logging in"; - public static final String ERROR_FETCHING_REMOTE_ACCOUNT_TRANSACTIONS = - "Error fetching remote account transactions"; - public static final String PDF = "PDF"; - public static final String ERROR_FETCHING_ACCOUNT = "Error fetching account"; - public static final String NO_ACCOUNT_FOUND = "No account found"; - public static final String INVOICE_DOES_NOT_EXIST = "Invoice does not exist."; - public static final String INVALID_UPL = "Invalid UPL"; - public static final String MERCHANT = "merchant"; - public static final String FETCH_CLIENT_DETAILS_USE_CASE = "Fetch Client Details UseCase"; - public static final String ERROR_FETCHING_NOTIFICATIONS = "Error fetching notifications"; - public static final String UNAUTHORIZED_ERROR = "401 Unauthorized"; -} diff --git a/core/src/main/java/org/mifos/mobilewallet/core/utils/Constants.kt b/core/src/main/java/org/mifos/mobilewallet/core/utils/Constants.kt new file mode 100644 index 000000000..c384aa233 --- /dev/null +++ b/core/src/main/java/org/mifos/mobilewallet/core/utils/Constants.kt @@ -0,0 +1,54 @@ +package org.mifos.mobilewallet.core.utils + +import java.util.Arrays +import java.util.Collections + +/** + * Created by naman on 17/6/17. + */ +object Constants { + const val BASIC = "Basic " + const val SAVINGS = "savingsAccounts" + const val TRANSACTIONS = "transactions" + const val WALLET_ACCOUNT_SAVINGS_PRODUCT_ID = 1 + const val MIFOS_MERCHANT_SAVINGS_PRODUCT_ID = 165 // 372 + const val MIFOS_CONSUMER_SAVINGS_PRODUCT_ID = 165 // 373 + private const val MOBILE_WALLET_ROLE_ID = 471 + private const val SUPER_USER_ROLE_ID = 1 + @JvmField + val NEW_USER_ROLE_IDS: Collection = Collections.unmodifiableList( + Arrays.asList(MOBILE_WALLET_ROLE_ID, SUPER_USER_ROLE_ID) + ) + const val ENTITY_TYPE_CLIENTS = "clients" + const val FETCH_ACCOUNT_TRANSFER_USECASE = "FetchAccountTransfer" + const val NO_SAVED_CARDS = "No saved cards." + const val MIFOS_PASSWORD = "mifos:password" + const val ERROR_VERIFYING_USER = "Error verifying user" + const val ERROR_REGISTERING_USER = "Error registering user" + const val NO_CLIENTS_FOUND = "No clients found" + const val ERROR_SEARCHING_CLIENTS = "Error searching clients" + const val CLIENTS = "clients" + const val NO_ACCOUNTS_FOUND = "No accounts found" + const val ERROR_FETCHING_ACCOUNTS = "Error fetching accounts" + const val ERROR_MAKING_TRANSFER = "Error making transfer" + const val WALLET_TRANSFER = "Wallet transfer" + const val ERROR_ADDING_BENEFICIARY = "Error adding beneficiary" + const val ERROR_FETCHING_BENEFICIARIES = "Error fetching beneficiaries" + const val ERROR_FETCHING_TO_ACCOUNT = "Error fetching to account" + const val NO_WALLET_FOUND = "No wallet found" + const val ERROR_FETCHING_FROM_ACCOUNT = "Error fetching from account" + const val ERROR_FETCHING_CLIENT_DATA = "Error fetching client data" + const val NO_CLIENT_FOUND = "No client found" + const val ERROR_LOGGING_IN = "Error logging in" + const val ERROR_FETCHING_REMOTE_ACCOUNT_TRANSACTIONS = + "Error fetching remote account transactions" + const val PDF = "PDF" + const val ERROR_FETCHING_ACCOUNT = "Error fetching account" + const val NO_ACCOUNT_FOUND = "No account found" + const val INVOICE_DOES_NOT_EXIST = "Invoice does not exist." + const val INVALID_UPL = "Invalid UPL" + const val MERCHANT = "merchant" + const val FETCH_CLIENT_DETAILS_USE_CASE = "Fetch Client Details UseCase" + const val ERROR_FETCHING_NOTIFICATIONS = "Error fetching notifications" + const val UNAUTHORIZED_ERROR = "401 Unauthorized" +} diff --git a/core/src/main/java/org/mifos/mobilewallet/core/utils/DateHelper.java b/core/src/main/java/org/mifos/mobilewallet/core/utils/DateHelper.java deleted file mode 100644 index 44279dbf9..000000000 --- a/core/src/main/java/org/mifos/mobilewallet/core/utils/DateHelper.java +++ /dev/null @@ -1,165 +0,0 @@ -package org.mifos.mobilewallet.core.utils; - -import android.util.Log; - -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.Calendar; -import java.util.Date; -import java.util.List; -import java.util.Locale; - -/** - * Created by ishankhanna on 30/05/14. - *

This is a helper class that will be used to convert List Type Dates - * from MifosX into Simple Strings or Date Formats

- */ -public class DateHelper { - - public static final String LOG_TAG = DateHelper.class.getSimpleName(); - - public static final String FORMAT_dd_MMMM_yyyy = "dd MMMM yyyy"; - public static final String DD_MMM_YYYY = "dd MMM yyyy"; - public static final String DD_MM_YYYY = "dd-MM-yyyy"; - - /** - * the result string uses the list given in a reverse order ([x, y, z] results in "z y x") - * - * @param integersOfDate [year-month-day] (ex [2016, 4, 14]) - * @return date in the format day month year (ex 14 Apr 2016) - */ - public static String getDateAsString(List integersOfDate) { - - StringBuilder stringBuilder = new StringBuilder(); - stringBuilder.append(integersOfDate.get(2)) - .append(' ') - .append(getMonthName(integersOfDate.get(1))) - .append(' ') - .append(integersOfDate.get(0)); - - return stringBuilder.toString(); - - } - - public static String getDateAsString(List integersOfDate, String pattern) { - return DateHelper.getFormatConverter(DD_MMM_YYYY, - pattern, DateHelper.getDateAsString(integersOfDate)); - - } - - /** - * This Method converting the dd-MM-yyyy format type date string into dd MMMM yyyy - * - * @param format Final Format of date string - * @param dateString date string - * @return dd MMMM yyyy format date string. - */ - public static String getSpecificFormat(String format, String dateString) { - SimpleDateFormat pickerFormat = new SimpleDateFormat(DD_MM_YYYY, Locale.ENGLISH); - SimpleDateFormat finalFormat = new SimpleDateFormat(format, Locale.ENGLISH); - Date date = null; - try { - date = pickerFormat.parse(dateString); - } catch (ParseException e) { - Log.d(LOG_TAG, e.getLocalizedMessage()); - } - return finalFormat.format(date); - } - - public static String getFormatConverter(String currentFormat, String requiredFormat, - String dateString) { - SimpleDateFormat pickerFormat = new SimpleDateFormat(currentFormat, Locale.ENGLISH); - SimpleDateFormat finalFormat = new SimpleDateFormat(requiredFormat, Locale.ENGLISH); - Date date = null; - try { - date = pickerFormat.parse(dateString); - } catch (ParseException e) { - Log.d(LOG_TAG, e.getLocalizedMessage()); - } - return finalFormat.format(date); - } - - /** - * @param month an integer from 1 to 12 - * @return string representation of the month like Jan or Feb..etc - */ - public static String getMonthName(int month) { - String monthName = ""; - switch (month) { - case 1: - monthName = "Jan"; - break; - case 2: - monthName = "Feb"; - break; - case 3: - monthName = "Mar"; - break; - case 4: - monthName = "Apr"; - break; - case 5: - monthName = "May"; - break; - case 6: - monthName = "Jun"; - break; - case 7: - monthName = "Jul"; - break; - case 8: - monthName = "Aug"; - break; - case 9: - monthName = "Sep"; - break; - case 10: - monthName = "Oct"; - break; - case 11: - monthName = "Nov"; - break; - case 12: - monthName = "Dec"; - break; - } - return monthName; - } - - public static long getDateAsLongFromString(String dateStr, String pattern) { - SimpleDateFormat sdf = new SimpleDateFormat(pattern); - Date date = null; - - try { - date = sdf.parse(dateStr); - } catch (ParseException e) { - Log.d("TAG", e.getMessage()); - } - return date.getTime(); - } - - - public static long getDateAsLongFromList(List integersOfDate) { - String dateStr = getDateAsString(integersOfDate); - return getDateAsLongFromString(dateStr, DD_MMM_YYYY); - } - - public static long subtractWeeks(int number) { - Calendar calendar = Calendar.getInstance(); - calendar.add(Calendar.WEEK_OF_YEAR, -number); - return calendar.getTimeInMillis(); - } - - - public static long subtractMonths(int number) { - Calendar calendar = Calendar.getInstance(); - calendar.add(Calendar.MONTH, -number); - return calendar.getTimeInMillis(); - } - - public static String getDateAsStringFromLong(long timeInMillis) { - SimpleDateFormat sdf = new SimpleDateFormat(DD_MMM_YYYY); - return sdf.format(new Date(timeInMillis)); - } - -} \ No newline at end of file diff --git a/core/src/main/java/org/mifos/mobilewallet/core/utils/DateHelper.kt b/core/src/main/java/org/mifos/mobilewallet/core/utils/DateHelper.kt new file mode 100644 index 000000000..37722ffca --- /dev/null +++ b/core/src/main/java/org/mifos/mobilewallet/core/utils/DateHelper.kt @@ -0,0 +1,137 @@ +package org.mifos.mobilewallet.core.utils + +import android.util.Log +import java.text.ParseException +import java.text.SimpleDateFormat +import java.util.Calendar +import java.util.Date +import java.util.Locale + +/** + * Created by ishankhanna on 30/05/14. + * + * This is a helper class that will be used to convert List Type Dates + * from MifosX into Simple Strings or Date Formats + */ +object DateHelper { + val LOG_TAG = DateHelper::class.java.simpleName + const val FORMAT_dd_MMMM_yyyy = "dd MMMM yyyy" + const val DD_MMM_YYYY = "dd MMM yyyy" + const val DD_MM_YYYY = "dd-MM-yyyy" + + /** + * the result string uses the list given in a reverse order ([x, y, z] results in "z y x") + * + * @param integersOfDate [year-month-day] (ex [2016, 4, 14]) + * @return date in the format day month year (ex 14 Apr 2016) + */ + + @JvmStatic + fun getDateAsString(integersOfDate: List): String { + val stringBuilder = StringBuilder() + stringBuilder.append(integersOfDate[2]) + .append(' ') + .append(getMonthName(integersOfDate[1])) + .append(' ') + .append(integersOfDate[0]) + return stringBuilder.toString() + } + + fun getDateAsString(integersOfDate: List, pattern: String?): String { + return getFormatConverter( + DD_MMM_YYYY, + pattern, getDateAsString(integersOfDate) + ) + } + + /** + * This Method converting the dd-MM-yyyy format type date string into dd MMMM yyyy + * + * @param format Final Format of date string + * @param dateString date string + * @return dd MMMM yyyy format date string. + */ + fun getSpecificFormat(format: String?, dateString: String?): String { + val pickerFormat = SimpleDateFormat(DD_MM_YYYY, Locale.ENGLISH) + val finalFormat = SimpleDateFormat(format, Locale.ENGLISH) + var date: Date? = null + try { + date = pickerFormat.parse(dateString) + } catch (e: ParseException) { + Log.d(LOG_TAG, e.localizedMessage) + } + return finalFormat.format(date) + } + + fun getFormatConverter( + currentFormat: String?, requiredFormat: String?, + dateString: String? + ): String { + val pickerFormat = SimpleDateFormat(currentFormat, Locale.ENGLISH) + val finalFormat = SimpleDateFormat(requiredFormat, Locale.ENGLISH) + var date: Date? = null + try { + date = pickerFormat.parse(dateString) + } catch (e: ParseException) { + Log.d(LOG_TAG, e.localizedMessage) + } + return finalFormat.format(date) + } + + /** + * @param month an integer from 1 to 12 + * @return string representation of the month like Jan or Feb..etc + */ + fun getMonthName(month: Int): String { + var monthName = "" + when (month) { + 1 -> monthName = "Jan" + 2 -> monthName = "Feb" + 3 -> monthName = "Mar" + 4 -> monthName = "Apr" + 5 -> monthName = "May" + 6 -> monthName = "Jun" + 7 -> monthName = "Jul" + 8 -> monthName = "Aug" + 9 -> monthName = "Sep" + 10 -> monthName = "Oct" + 11 -> monthName = "Nov" + 12 -> monthName = "Dec" + } + return monthName + } + + fun getDateAsLongFromString(dateStr: String?, pattern: String?): Long { + val sdf = SimpleDateFormat(pattern) + var date: Date? = null + try { + date = sdf.parse(dateStr) + } catch (e: ParseException) { + Log.d("TAG", e.message!!) + } + return date!!.time + } + + fun getDateAsLongFromList(integersOfDate: List): Long { + val dateStr = getDateAsString(integersOfDate) + return getDateAsLongFromString(dateStr, DD_MMM_YYYY) + } + + fun subtractWeeks(number: Int): Long { + val calendar = Calendar.getInstance() + calendar.add(Calendar.WEEK_OF_YEAR, -number) + return calendar.timeInMillis + } + + fun subtractMonths(number: Int): Long { + val calendar = Calendar.getInstance() + calendar.add(Calendar.MONTH, -number) + return calendar.timeInMillis + } + + @JvmStatic + fun getDateAsStringFromLong(timeInMillis: Long): String { + val sdf = SimpleDateFormat(DD_MMM_YYYY) + return sdf.format(Date(timeInMillis)) + } +} \ No newline at end of file diff --git a/core/src/main/java/org/mifos/mobilewallet/core/utils/ErrorJsonMessageHelper.java b/core/src/main/java/org/mifos/mobilewallet/core/utils/ErrorJsonMessageHelper.java deleted file mode 100644 index 76bdaf87c..000000000 --- a/core/src/main/java/org/mifos/mobilewallet/core/utils/ErrorJsonMessageHelper.java +++ /dev/null @@ -1,61 +0,0 @@ -package org.mifos.mobilewallet.core.utils; - -import org.json.JSONException; -import org.json.JSONObject; - -import retrofit2.HttpException; - -/** - * Created by ankur on 26/June/2018 - */ - -public class ErrorJsonMessageHelper { - - public static String getUserMessage(String message) throws JSONException { - - JSONObject jsonObject = new JSONObject(message); - String userErrorMessage = jsonObject.getJSONArray("errors") - .getJSONObject(0).getString("defaultUserMessage"); - return userErrorMessage; - } - - public static String getUserMessage(Throwable e) { - String message = "Error"; - try { - message = ((HttpException) e).response().errorBody().string(); - message = getUserMessage(message); - } catch (Exception e1) { - message = "Error"; - } - return message; - } -} - - -/* - -{ - "developerMessage":"The request was invalid. This typically will happen due to validation - errors which are provided.", - "httpStatusCode":"400", - "defaultUserMessage":"Validation errors exist.", - "userMessageGlobalisationCode":"validation.msg.validation.errors.exist", - - "errors":[ - { - "developerMessage":"Password must be at least 6 characters, no more than 50 - characters long, must include at least one upper case letter, one lower case letter, - one numeric digit and no space", - "defaultUserMessage":"Password must be at least 6 characters, no more than 50 - characters long, must include at least one upper case letter, one lower case letter, - one numeric digit and no space", - "userMessageGlobalisationCode":"validation.msg.user.password.does.not.match.regexp", - "parameterName":"password", - "value":null, - "args":[{"value":"p"},{"value":"^(?=.*\\d)(?=.*[a-z])(?=.*[A-Z])(?!.*\\s).{6,50}$"}] - } - ] - -} - -*/ \ No newline at end of file diff --git a/core/src/main/java/org/mifos/mobilewallet/core/utils/ErrorJsonMessageHelper.kt b/core/src/main/java/org/mifos/mobilewallet/core/utils/ErrorJsonMessageHelper.kt new file mode 100644 index 000000000..94160a56f --- /dev/null +++ b/core/src/main/java/org/mifos/mobilewallet/core/utils/ErrorJsonMessageHelper.kt @@ -0,0 +1,30 @@ +package org.mifos.mobilewallet.core.utils + +import org.json.JSONException +import org.json.JSONObject +import retrofit2.HttpException + +/** + * Created by ankur on 26/June/2018 + */ +object ErrorJsonMessageHelper { + @JvmStatic + @Throws(JSONException::class) + fun getUserMessage(message: String?): String { + val jsonObject = JSONObject(message) + return jsonObject.getJSONArray("errors") + .getJSONObject(0).getString("defaultUserMessage") + } + + @JvmStatic + fun getUserMessage(e: Throwable): String? { + var message: String? = "Error" + try { + message = (e as HttpException).response().errorBody().string() + message = getUserMessage(message) + } catch (e1: Exception) { + message = "Error" + } + return message + } +} diff --git a/mifospay/src/main/java/org/mifos/mobilewallet/mifospay/MifosPayApp.java b/mifospay/src/main/java/org/mifos/mobilewallet/mifospay/MifosPayApp.java deleted file mode 100644 index 91d903930..000000000 --- a/mifospay/src/main/java/org/mifos/mobilewallet/mifospay/MifosPayApp.java +++ /dev/null @@ -1,45 +0,0 @@ -package org.mifos.mobilewallet.mifospay; - -import android.app.Application; -import android.content.Context; -import androidx.appcompat.app.AppCompatDelegate; - -import com.mifos.mobile.passcode.utils.ForegroundChecker; - -import butterknife.ButterKnife; -import dagger.hilt.android.HiltAndroidApp; - -/** - * Created by naman on 17/8/17. - */ - -@HiltAndroidApp -public class MifosPayApp extends Application { - - private static MifosPayApp instance; - - static { - AppCompatDelegate.setCompatVectorFromResourcesEnabled(true); - } - - public static MifosPayApp get(Context context) { - return (MifosPayApp) context.getApplicationContext(); - } - - public static Context getContext() { - return instance; - } - - @Override - public void onCreate() { - super.onCreate(); - if (MifosPayApp.instance == null) { - MifosPayApp.instance = this; - } - ButterKnife.setDebug(true); - - //Initialize ForegroundChecker - ForegroundChecker.init(this); - } -} - diff --git a/mifospay/src/main/java/org/mifos/mobilewallet/mifospay/MifosPayApp.kt b/mifospay/src/main/java/org/mifos/mobilewallet/mifospay/MifosPayApp.kt new file mode 100644 index 000000000..51e6b43ab --- /dev/null +++ b/mifospay/src/main/java/org/mifos/mobilewallet/mifospay/MifosPayApp.kt @@ -0,0 +1,41 @@ +package org.mifos.mobilewallet.mifospay + +import android.app.Application +import android.content.Context +import androidx.appcompat.app.AppCompatDelegate +import butterknife.ButterKnife +import com.mifos.mobile.passcode.utils.ForegroundChecker +import dagger.hilt.android.HiltAndroidApp + +/** + * Created by naman on 17/8/17. + */ +@HiltAndroidApp +class MifosPayApp : Application() { + override fun onCreate() { + super.onCreate() + if (instance == null) { + instance = this + } + ButterKnife.setDebug(true) + + //Initialize ForegroundChecker + ForegroundChecker.init(this) + } + + companion object { + private var instance: MifosPayApp? = null + + init { + AppCompatDelegate.setCompatVectorFromResourcesEnabled(true) + } + + operator fun get(context: Context): MifosPayApp { + return context.applicationContext as MifosPayApp + } + + @JvmStatic + val context: Context? + get() = instance + } +} diff --git a/mifospay/src/main/java/org/mifos/mobilewallet/mifospay/bank/presenter/DebitCardPresenter.kt b/mifospay/src/main/java/org/mifos/mobilewallet/mifospay/bank/presenter/DebitCardPresenter.kt index 5841bc724..4408013e5 100644 --- a/mifospay/src/main/java/org/mifos/mobilewallet/mifospay/bank/presenter/DebitCardPresenter.kt +++ b/mifospay/src/main/java/org/mifos/mobilewallet/mifospay/bank/presenter/DebitCardPresenter.kt @@ -21,8 +21,8 @@ class DebitCardPresenter @Inject constructor() : BankContract.DebitCardPresenter val otp = "0000" if (s!!.length < 12 || s.length > 19) { mDebitCardView!!.verifyDebitCardError( - MifosPayApp.getContext() - .getString(R.string.debit_card_error_message) + MifosPayApp.context + ?.getString(R.string.debit_card_error_message) ) } else { mDebitCardView!!.verifyDebitCardSuccess(otp) diff --git a/mifospay/src/main/java/org/mifos/mobilewallet/mifospay/common/ui/SearchActivity.kt b/mifospay/src/main/java/org/mifos/mobilewallet/mifospay/common/ui/SearchActivity.kt index d35b87f27..bd8ebf54d 100644 --- a/mifospay/src/main/java/org/mifos/mobilewallet/mifospay/common/ui/SearchActivity.kt +++ b/mifospay/src/main/java/org/mifos/mobilewallet/mifospay/common/ui/SearchActivity.kt @@ -79,7 +79,7 @@ class SearchActivity : BaseActivity(), SearchContract.SearchView { } override fun showToast(message: String?) { - Toaster.showToast(MifosPayApp.getContext(), message) + Toaster.showToast(MifosPayApp.context, message) } override fun showSnackbar(message: String?) { diff --git a/mifospay/src/main/java/org/mifos/mobilewallet/mifospay/kyc/presenter/KYCLevel2Presenter.kt b/mifospay/src/main/java/org/mifos/mobilewallet/mifospay/kyc/presenter/KYCLevel2Presenter.kt index 9267b12cb..3220cd1ff 100644 --- a/mifospay/src/main/java/org/mifos/mobilewallet/mifospay/kyc/presenter/KYCLevel2Presenter.kt +++ b/mifospay/src/main/java/org/mifos/mobilewallet/mifospay/kyc/presenter/KYCLevel2Presenter.kt @@ -28,7 +28,7 @@ class KYCLevel2Presenter @Inject constructor( private val preferencesHelper: PreferencesHelper, ) : KYCContract.KYCLevel2Presenter { - override val context: Context = MifosPayApp.getContext() + override val context: Context = MifosPayApp.context!! @JvmField @Inject diff --git a/mifospay/src/main/java/org/mifos/mobilewallet/mifospay/merchants/ui/MerchantTransferActivity.kt b/mifospay/src/main/java/org/mifos/mobilewallet/mifospay/merchants/ui/MerchantTransferActivity.kt index 4ff520bdd..31c43e38f 100644 --- a/mifospay/src/main/java/org/mifos/mobilewallet/mifospay/merchants/ui/MerchantTransferActivity.kt +++ b/mifospay/src/main/java/org/mifos/mobilewallet/mifospay/merchants/ui/MerchantTransferActivity.kt @@ -120,7 +120,7 @@ class MerchantTransferActivity : BaseActivity(), MerchantTransferView { private fun setUpRecycleView() { mMerchantHistoryAdapter?.setContext(this) rvMerchantHistory?.layoutManager = - LinearLayoutManager(MifosPayApp.getContext()) + LinearLayoutManager(MifosPayApp.context) rvMerchantHistory?.adapter = mMerchantHistoryAdapter } @@ -165,7 +165,7 @@ class MerchantTransferActivity : BaseActivity(), MerchantTransferView { } override fun showToast(message: String?) { - Toaster.showToast(MifosPayApp.getContext(), message) + Toaster.showToast(MifosPayApp.context, message) } override fun showPaymentDetails(externalId: String?, amount: Double) {