diff --git a/app/src/main/assets/nativecountrylist.json b/app/src/main/assets/nativecountrylist.json new file mode 100644 index 00000000..f8a5a636 --- /dev/null +++ b/app/src/main/assets/nativecountrylist.json @@ -0,0 +1,1228 @@ +[ + { + "id":"2", + "text":"Afghanistan", + "code":"AF" + }, + { + "id":"75", + "text":"Åland Islands", + "code":"AX" + }, + { + "id":"3", + "text":"Albania", + "code":"AL" + }, + { + "id":"5", + "text":"Algeria", + "code":"DZ" + }, + { + "id":"6", + "text":"American Samoa", + "code":"AS" + }, + { + "id":"7", + "text":"Andorra", + "code":"AD" + }, + { + "id":"8", + "text":"Angola", + "code":"AO" + }, + { + "id":"189", + "text":"Anguilla", + "code":"AI" + }, + { + "id":"4", + "text":"Antarctica", + "code":"AQ" + }, + { + "id":"9", + "text":"Antigua and Barbuda", + "code":"AG" + }, + { + "id":"11", + "text":"Argentina", + "code":"AR" + }, + { + "id":"17", + "text":"Armenia", + "code":"AM" + }, + { + "id":"154", + "text":"Aruba", + "code":"AW" + }, + { + "id":"12", + "text":"Australia", + "code":"AU" + }, + { + "id":"13", + "text":"Austria", + "code":"AT" + }, + { + "id":"10", + "text":"Azerbaijan", + "code":"AZ" + }, + { + "id":"14", + "text":"Bahamas", + "code":"BS" + }, + { + "id":"15", + "text":"Bahrain", + "code":"BH" + }, + { + "id":"16", + "text":"Bangladesh", + "code":"BD" + }, + { + "id":"18", + "text":"Barbados", + "code":"BB" + }, + { + "id":"35", + "text":"Belarus", + "code":"BY" + }, + { + "id":"19", + "text":"Belgium", + "code":"BE" + }, + { + "id":"27", + "text":"Belize", + "code":"BZ" + }, + { + "id":"60", + "text":"Benin", + "code":"BJ" + }, + { + "id":"20", + "text":"Bermuda", + "code":"BM" + }, + { + "id":"21", + "text":"Bhutan", + "code":"BT" + }, + { + "id":"22", + "text":"Bolivia", + "code":"BO" + }, + { + "id":"23", + "text":"Bosnia and Herzegovina", + "code":"BA" + }, + { + "id":"24", + "text":"Botswana", + "code":"BW" + }, + { + "id":"25", + "text":"Bouvet Island", + "code":"BV" + }, + { + "id":"26", + "text":"Brazil", + "code":"BR" + }, + { + "id":"28", + "text":"British Indian Ocean Territory", + "code":"IO" + }, + { + "id":"31", + "text":"Brunei", + "code":"BN" + }, + { + "id":"32", + "text":"Bulgaria", + "code":"BG" + }, + { + "id":"240", + "text":"Burkina Faso", + "code":"BF" + }, + { + "id":"34", + "text":"Burundi", + "code":"BI" + }, + { + "id":"36", + "text":"Cambodia", + "code":"KH" + }, + { + "id":"37", + "text":"Cameroon", + "code":"CM" + }, + { + "id":"38", + "text":"Canada", + "code":"CA" + }, + { + "id":"39", + "text":"Cape Verde", + "code":"CV" + }, + { + "id":"40", + "text":"Cayman Islands", + "code":"KY" + }, + { + "id":"41", + "text":"Central African Republic", + "code":"CF" + }, + { + "id":"43", + "text":"Chad", + "code":"TD" + }, + { + "id":"44", + "text":"Chile", + "code":"CL" + }, + { + "id":"45", + "text":"China", + "code":"CN" + }, + { + "id":"47", + "text":"Christmas Island", + "code":"CX" + }, + { + "id":"48", + "text":"Cocos (Keeling) Islands", + "code":"CC" + }, + { + "id":"49", + "text":"Colombia", + "code":"CO" + }, + { + "id":"50", + "text":"Comoros", + "code":"KM" + }, + { + "id":"52", + "text":"Congo", + "code":"CG" + }, + { + "id":"53", + "text":"Congo, Democratic Republic of the", + "code":"CD" + }, + { + "id":"54", + "text":"Cook Islands", + "code":"CK" + }, + { + "id":"55", + "text":"Costa Rica", + "code":"CR" + }, + { + "id":"111", + "text":"Côte d'Ivoire", + "code":"CI" + }, + { + "id":"56", + "text":"Croatia", + "code":"HR" + }, + { + "id":"57", + "text":"Cuba", + "code":"CU" + }, + { + "id":"58", + "text":"Cyprus", + "code":"CY" + }, + { + "id":"59", + "text":"Czech Republic", + "code":"CZ" + }, + { + "id":"61", + "text":"Denmark", + "code":"DK" + }, + { + "id":"80", + "text":"Djibouti", + "code":"DJ" + }, + { + "id":"62", + "text":"Dominica", + "code":"DM" + }, + { + "id":"63", + "text":"Dominican Republic", + "code":"DO" + }, + { + "id":"64", + "text":"Ecuador", + "code":"EC" + }, + { + "id":"232", + "text":"Egypt", + "code":"EG" + }, + { + "id":"65", + "text":"El Salvador", + "code":"SV" + }, + { + "id":"66", + "text":"Equatorial Guinea", + "code":"GQ" + }, + { + "id":"68", + "text":"Eritrea", + "code":"ER" + }, + { + "id":"69", + "text":"Estonia", + "code":"EE" + }, + { + "id":"67", + "text":"Ethiopia", + "code":"ET" + }, + { + "id":"71", + "text":"Falkland Islands (Malvinas)", + "code":"FK" + }, + { + "id":"70", + "text":"Faroe Islands", + "code":"FO" + }, + { + "id":"73", + "text":"Fiji", + "code":"FJ" + }, + { + "id":"74", + "text":"Finland", + "code":"FI" + }, + { + "id":"76", + "text":"France", + "code":"FR" + }, + { + "id":"77", + "text":"French Guiana", + "code":"GF" + }, + { + "id":"78", + "text":"French Polynesia", + "code":"PF" + }, + { + "id":"79", + "text":"French Southern Territories", + "code":"TF" + }, + { + "id":"81", + "text":"Gabon", + "code":"GA" + }, + { + "id":"83", + "text":"Gambia", + "code":"GM" + }, + { + "id":"82", + "text":"Georgia", + "code":"GE" + }, + { + "id":"85", + "text":"Germany", + "code":"DE" + }, + { + "id":"86", + "text":"Ghana", + "code":"GH" + }, + { + "id":"87", + "text":"Gibraltar", + "code":"GI" + }, + { + "id":"89", + "text":"Greece", + "code":"GR" + }, + { + "id":"90", + "text":"Greenland", + "code":"GL" + }, + { + "id":"91", + "text":"Grenada", + "code":"GD" + }, + { + "id":"92", + "text":"Guadeloupe", + "code":"GP" + }, + { + "id":"93", + "text":"Guam", + "code":"GU" + }, + { + "id":"94", + "text":"Guatemala", + "code":"GT" + }, + { + "id":"234", + "text":"Guernsey", + "code":"GG" + }, + { + "id":"95", + "text":"Guinea", + "code":"GN" + }, + { + "id":"178", + "text":"Guinea-Bissau", + "code":"GW" + }, + { + "id":"96", + "text":"Guyana", + "code":"GY" + }, + { + "id":"97", + "text":"Haiti", + "code":"HT" + }, + { + "id":"98", + "text":"Heard Island and McDonald Islands", + "code":"HM" + }, + { + "id":"99", + "text":"Holy See (Vatican City State)", + "code":"VA" + }, + { + "id":"100", + "text":"Honduras", + "code":"HN" + }, + { + "id":"101", + "text":"Hong Kong", + "code":"HK" + }, + { + "id":"102", + "text":"Hungary", + "code":"HU" + }, + { + "id":"103", + "text":"Iceland", + "code":"IS" + }, + { + "id":"104", + "text":"India", + "code":"IN" + }, + { + "id":"105", + "text":"Indonesia", + "code":"ID" + }, + { + "id":"107", + "text":"Iraq", + "code":"IQ" + }, + { + "id":"108", + "text":"Ireland", + "code":"IE" + }, + { + "id":"236", + "text":"Isle of Man", + "code":"IM" + }, + { + "id":"109", + "text":"Israel", + "code":"IL" + }, + { + "id":"110", + "text":"Italy", + "code":"IT" + }, + { + "id":"112", + "text":"Jamaica", + "code":"JM" + }, + { + "id":"113", + "text":"Japan", + "code":"JP" + }, + { + "id":"235", + "text":"Jersey", + "code":"JE" + }, + { + "id":"115", + "text":"Jordan", + "code":"JO" + }, + { + "id":"114", + "text":"Kazakhstan", + "code":"KZ" + }, + { + "id":"116", + "text":"Kenya", + "code":"KE" + }, + { + "id":"88", + "text":"Kiribati", + "code":"KI" + }, + { + "id":"119", + "text":"Kuwait", + "code":"KW" + }, + { + "id":"120", + "text":"Kyrgyzstan", + "code":"KG" + }, + { + "id":"121", + "text":"Laos", + "code":"LA" + }, + { + "id":"124", + "text":"Latvia", + "code":"LV" + }, + { + "id":"122", + "text":"Lebanon", + "code":"LB" + }, + { + "id":"123", + "text":"Lesotho", + "code":"LS" + }, + { + "id":"125", + "text":"Liberia", + "code":"LR" + }, + { + "id":"126", + "text":"Libyan Arab Jamahiriya", + "code":"LY" + }, + { + "id":"127", + "text":"Liechtenstein", + "code":"LI" + }, + { + "id":"128", + "text":"Lithuania", + "code":"LT" + }, + { + "id":"129", + "text":"Luxembourg", + "code":"LU" + }, + { + "id":"130", + "text":"Macao", + "code":"MO" + }, + { + "id":"231", + "text":"Macedonia", + "code":"MK" + }, + { + "id":"131", + "text":"Madagascar", + "code":"MG" + }, + { + "id":"132", + "text":"Malawi", + "code":"MW" + }, + { + "id":"133", + "text":"Malaysia", + "code":"MY" + }, + { + "id":"134", + "text":"Maldives", + "code":"MV" + }, + { + "id":"135", + "text":"Mali", + "code":"ML" + }, + { + "id":"136", + "text":"Malta", + "code":"MT" + }, + { + "id":"167", + "text":"Marshall Islands", + "code":"MH" + }, + { + "id":"137", + "text":"Martinique", + "code":"MQ" + }, + { + "id":"138", + "text":"Mauritania", + "code":"MR" + }, + { + "id":"139", + "text":"Mauritius", + "code":"MU" + }, + { + "id":"51", + "text":"Mayotte", + "code":"YT" + }, + { + "id":"140", + "text":"Mexico", + "code":"MX" + }, + { + "id":"166", + "text":"Micronesia", + "code":"FM" + }, + { + "id":"143", + "text":"Moldova", + "code":"MD" + }, + { + "id":"141", + "text":"Monaco", + "code":"MC" + }, + { + "id":"142", + "text":"Mongolia", + "code":"MN" + }, + { + "id":"144", + "text":"Montenegro", + "code":"ME" + }, + { + "id":"145", + "text":"Montserrat", + "code":"MS" + }, + { + "id":"146", + "text":"Morocco", + "code":"MA" + }, + { + "id":"147", + "text":"Mozambique", + "code":"MZ" + }, + { + "id":"33", + "text":"Myanmar", + "code":"MM" + }, + { + "id":"149", + "text":"Namibia", + "code":"NA" + }, + { + "id":"150", + "text":"Nauru", + "code":"NR" + }, + { + "id":"151", + "text":"Nepal", + "code":"NP" + }, + { + "id":"152", + "text":"Netherlands", + "code":"NL" + }, + { + "id":"153", + "text":"Netherlands Antilles", + "code":"AN" + }, + { + "id":"155", + "text":"New Caledonia", + "code":"NC" + }, + { + "id":"157", + "text":"New Zealand", + "code":"NZ" + }, + { + "id":"158", + "text":"Nicaragua", + "code":"NI" + }, + { + "id":"159", + "text":"Niger", + "code":"NE" + }, + { + "id":"160", + "text":"Nigeria", + "code":"NG" + }, + { + "id":"161", + "text":"Niue", + "code":"NU" + }, + { + "id":"162", + "text":"Norfolk Island", + "code":"NF" + }, + { + "id":"164", + "text":"Northern Mariana Islands", + "code":"MP" + }, + { + "id":"163", + "text":"Norway", + "code":"NO" + }, + { + "id":"148", + "text":"Oman", + "code":"OM" + }, + { + "id":"169", + "text":"Pakistan", + "code":"PK" + }, + { + "id":"168", + "text":"Palau", + "code":"PW" + }, + { + "id":"84", + "text":"Palestinian Territory, Occupied", + "code":"PS" + }, + { + "id":"170", + "text":"Panama", + "code":"PA" + }, + { + "id":"171", + "text":"Papua New Guinea", + "code":"PG" + }, + { + "id":"172", + "text":"Paraguay", + "code":"PY" + }, + { + "id":"173", + "text":"Peru", + "code":"PE" + }, + { + "id":"174", + "text":"Philippines", + "code":"PH" + }, + { + "id":"175", + "text":"Pitcairn", + "code":"PN" + }, + { + "id":"176", + "text":"Poland", + "code":"PL" + }, + { + "id":"177", + "text":"Portugal", + "code":"PT" + }, + { + "id":"180", + "text":"Puerto Rico", + "code":"PR" + }, + { + "id":"181", + "text":"Qatar", + "code":"QA" + }, + { + "id":"182", + "text":"Réunion", + "code":"RE" + }, + { + "id":"183", + "text":"Romania", + "code":"RO" + }, + { + "id":"184", + "text":"Russian Federation", + "code":"RU" + }, + { + "id":"185", + "text":"Rwanda", + "code":"RW" + }, + { + "id":"186", + "text":"Saint Barthélemy", + "code":"BL" + }, + { + "id":"187", + "text":"Saint Helena", + "code":"SH" + }, + { + "id":"188", + "text":"Saint Kitts and Nevis", + "code":"KN" + }, + { + "id":"190", + "text":"Saint Lucia", + "code":"LC" + }, + { + "id":"191", + "text":"Saint Martin (French part)", + "code":"MF" + }, + { + "id":"192", + "text":"Saint Pierre and Miquelon", + "code":"PM" + }, + { + "id":"193", + "text":"Saint Vincent and the Grenadines", + "code":"VC" + }, + { + "id":"245", + "text":"Samoa", + "code":"WS" + }, + { + "id":"194", + "text":"San Marino", + "code":"SM" + }, + { + "id":"195", + "text":"Sao Tome and Principe", + "code":"ST" + }, + { + "id":"196", + "text":"Saudi Arabia", + "code":"SA" + }, + { + "id":"197", + "text":"Senegal", + "code":"SN" + }, + { + "id":"198", + "text":"Serbia", + "code":"RS" + }, + { + "id":"199", + "text":"Seychelles", + "code":"SC" + }, + { + "id":"200", + "text":"Sierra Leone", + "code":"SL" + }, + { + "id":"201", + "text":"Singapore", + "code":"SG" + }, + { + "id":"202", + "text":"Slovakia", + "code":"SK" + }, + { + "id":"204", + "text":"Slovenia", + "code":"SI" + }, + { + "id":"29", + "text":"Solomon Islands", + "code":"SB" + }, + { + "id":"205", + "text":"Somalia", + "code":"SO" + }, + { + "id":"206", + "text":"South Africa", + "code":"ZA" + }, + { + "id":"72", + "text":"South Georgia and the South Sandwich Islands", + "code":"GS" + }, + { + "id":"118", + "text":"South Korea", + "code":"KR" + }, + { + "id":"208", + "text":"Spain", + "code":"ES" + }, + { + "id":"42", + "text":"Sri Lanka", + "code":"LK" + }, + { + "id":"210", + "text":"Sudan", + "code":"SD" + }, + { + "id":"211", + "text":"Suriname", + "code":"SR" + }, + { + "id":"212", + "text":"Svalbard and Jan Mayen", + "code":"SJ" + }, + { + "id":"213", + "text":"Swaziland", + "code":"SZ" + }, + { + "id":"214", + "text":"Sweden", + "code":"SE" + }, + { + "id":"215", + "text":"Switzerland", + "code":"CH" + }, + { + "id":"216", + "text":"Syria", + "code":"SY" + }, + { + "id":"46", + "text":"Taiwan", + "code":"TW" + }, + { + "id":"217", + "text":"Tajikistan", + "code":"TJ" + }, + { + "id":"237", + "text":"Tanzania", + "code":"TZ" + }, + { + "id":"218", + "text":"Thailand", + "code":"TH" + }, + { + "id":"249", + "text":"Third Party", + "code":"TP" + }, + { + "id":"179", + "text":"Timor-Leste", + "code":"TL" + }, + { + "id":"219", + "text":"Togo", + "code":"TG" + }, + { + "id":"220", + "text":"Tokelau", + "code":"TK" + }, + { + "id":"221", + "text":"Tonga", + "code":"TO" + }, + { + "id":"222", + "text":"Trinidad and Tobago", + "code":"TT" + }, + { + "id":"224", + "text":"Tunisia", + "code":"TN" + }, + { + "id":"225", + "text":"Turkey", + "code":"TR" + }, + { + "id":"226", + "text":"Turkmenistan", + "code":"TM" + }, + { + "id":"227", + "text":"Turks and Caicos Islands", + "code":"TC" + }, + { + "id":"228", + "text":"Tuvalu", + "code":"TV" + }, + { + "id":"229", + "text":"Uganda", + "code":"UG" + }, + { + "id":"230", + "text":"Ukraine", + "code":"UA" + }, + { + "id":"223", + "text":"United Arab Emirates", + "code":"AE" + }, + { + "id":"233", + "text":"United Kingdom", + "code":"UK" + }, + { + "id":"238", + "text":"United States", + "code":"US" + }, + { + "id":"165", + "text":"United States Minor Outlying Islands", + "code":"UM" + }, + { + "id":"241", + "text":"Uruguay", + "code":"UY" + }, + { + "id":"242", + "text":"Uzbekistan", + "code":"UZ" + }, + { + "id":"156", + "text":"Vanuatu", + "code":"VU" + }, + { + "id":"243", + "text":"Venezuela", + "code":"VE" + }, + { + "id":"203", + "text":"Vietnam", + "code":"VN" + }, + { + "id":"30", + "text":"Virgin Islands, British", + "code":"VG" + }, + { + "id":"239", + "text":"Virgin Islands, U.S.", + "code":"VI" + }, + { + "id":"244", + "text":"Wallis and Futuna", + "code":"WF" + }, + { + "id":"209", + "text":"Western Sahara", + "code":"EH" + }, + { + "id":"246", + "text":"Yemen", + "code":"YE" + }, + { + "id":"247", + "text":"Zambia", + "code":"ZM" + }, + { + "id":"207", + "text":"Zimbabwe", + "code":"ZW" + } +] + diff --git a/app/src/main/java/com/gmeremit/online/gmeremittance_native/base/BaseGateway.java b/app/src/main/java/com/gmeremit/online/gmeremittance_native/base/BaseGateway.java index 0fba8235..af5f43d1 100644 --- a/app/src/main/java/com/gmeremit/online/gmeremittance_native/base/BaseGateway.java +++ b/app/src/main/java/com/gmeremit/online/gmeremittance_native/base/BaseGateway.java @@ -1,4 +1,25 @@ package com.gmeremit.online.gmeremittance_native.base; +import android.content.Context; + +import java.io.IOException; +import java.io.InputStream; + public class BaseGateway implements BaseGatewayInterface { + + public String loadJSONFromAsset(Context context,String filePath) { + String json = null; + try { + InputStream is = context.getAssets().open(filePath); + int size = is.available(); + byte[] buffer = new byte[size]; + is.read(buffer); + is.close(); + json = new String(buffer, "UTF-8"); + } catch (IOException ex) { + ex.printStackTrace(); + return null; + } + return json; + } } diff --git a/app/src/main/java/com/gmeremit/online/gmeremittance_native/base/PrivilegedGateway.java b/app/src/main/java/com/gmeremit/online/gmeremittance_native/base/PrivilegedGateway.java index a8e8c0a6..4de0b480 100644 --- a/app/src/main/java/com/gmeremit/online/gmeremittance_native/base/PrivilegedGateway.java +++ b/app/src/main/java/com/gmeremit/online/gmeremittance_native/base/PrivilegedGateway.java @@ -12,7 +12,7 @@ import static com.gmeremit.online.gmeremittance_native.base.PrefKeys.USER_PREFER @SuppressWarnings("HardCodedStringLiteral") -public abstract class PrivilegedGateway implements PrivilegedGatewayInterface { +public abstract class PrivilegedGateway extends BaseGateway implements PrivilegedGatewayInterface { private static PrivilegedGatewayDataObserverManager privilegedGatewayDataObserverManager = null; diff --git a/app/src/main/java/com/gmeremit/online/gmeremittance_native/registerV2/gateway/RegisterV2Gateway.java b/app/src/main/java/com/gmeremit/online/gmeremittance_native/registerV2/gateway/RegisterV2Gateway.java index 87b4ef7e..c8924479 100644 --- a/app/src/main/java/com/gmeremit/online/gmeremittance_native/registerV2/gateway/RegisterV2Gateway.java +++ b/app/src/main/java/com/gmeremit/online/gmeremittance_native/registerV2/gateway/RegisterV2Gateway.java @@ -1,56 +1,63 @@ package com.gmeremit.online.gmeremittance_native.registerV2.gateway; +import android.annotation.SuppressLint; +import android.content.Context; + import com.gmeremit.online.gmeremittance_native.GmeApplication; import com.gmeremit.online.gmeremittance_native.base.PrefKeys; import com.gmeremit.online.gmeremittance_native.base.PrivilegedGateway; -import com.gmeremit.online.gmeremittance_native.loginV2.presenter.LoginV2InteractorInterface; -import com.gmeremit.online.gmeremittance_native.recipientV2.model.recipientadd.AddRecipientApiResponse; -import com.gmeremit.online.gmeremittance_native.recipientV2.model.recipientlisting.GetAllRecipientApiResponse; -import com.gmeremit.online.gmeremittance_native.recipientV2.presenter.recipientlisting.RecipientListingV2InteractorInterface; +import com.gmeremit.online.gmeremittance_native.kycV2.model.kyc.NativeCountry; import com.gmeremit.online.gmeremittance_native.registerV2.model.RegisterApiResponse; import com.gmeremit.online.gmeremittance_native.registerV2.presenter.RegisterV2InteractorInterface; import com.gmeremit.online.gmeremittance_native.utils.https.HttpClientV2; import com.google.gson.JsonObject; +import com.google.gson.reflect.TypeToken; + +import java.util.List; import io.reactivex.Observable; -import okhttp3.ResponseBody; public class RegisterV2Gateway extends PrivilegedGateway implements RegisterV2InteractorInterface.Register2GatewayInterface { - - private final RegisterV2InteractorInterface interactor; public RegisterV2Gateway(RegisterV2InteractorInterface agentListV2InteractorInterface) { - this.interactor=agentListV2InteractorInterface; + this.interactor = agentListV2InteractorInterface; } @Override - public Observable registerUser(String auth, String userName, String password,String confirmPassword, String dob, String clientId, String fcmId, String appVersion, String phoneBrand, String phoneOs, String deviceId, String osVersion) { + public Observable registerUser(String auth, String userName, String password, String confirmPassword, String dob, String clientId, String fcmId, String appVersion, String phoneBrand, String phoneOs, String deviceId, String osVersion) { - JsonObject jsonObject=new JsonObject(); - jsonObject.addProperty("username",userName); - jsonObject.addProperty("password",password); - jsonObject.addProperty("confirmPassword",confirmPassword); - jsonObject.addProperty("dob",dob); - jsonObject.addProperty("clientId",clientId); - jsonObject.addProperty("uuid",deviceId); - jsonObject.addProperty("appVersion",appVersion); - jsonObject.addProperty("phoneBrand",phoneBrand); - jsonObject.addProperty("phoneOS",phoneOs); - jsonObject.addProperty("fcmId",fcmId); - jsonObject.addProperty("osVersion",osVersion); + JsonObject jsonObject = new JsonObject(); + jsonObject.addProperty("username", userName); + jsonObject.addProperty("password", password); + jsonObject.addProperty("confirmPassword", confirmPassword); + jsonObject.addProperty("dob", dob); + jsonObject.addProperty("clientId", clientId); + jsonObject.addProperty("uuid", deviceId); + jsonObject.addProperty("appVersion", appVersion); + jsonObject.addProperty("phoneBrand", phoneBrand); + jsonObject.addProperty("phoneOS", phoneOs); + jsonObject.addProperty("fcmId", fcmId); + jsonObject.addProperty("osVersion", osVersion); - return HttpClientV2.getInstance().signUpV2(auth,jsonObject); + return HttpClientV2.getInstance().signUpV2(auth, jsonObject); } + @SuppressLint("ApplySharedPref") @Override public void updateUserId(String userId) { - GmeApplication.getStorage().edit().putString(PrefKeys.USER_ID,userId).commit(); - GmeApplication.getStorage().edit().putString(PrefKeys.USER_LOGGED_IN_STATUS,"HOME").apply(); + GmeApplication.getStorage().edit().putString(PrefKeys.USER_ID, userId).commit(); + GmeApplication.getStorage().edit().putString(PrefKeys.USER_LOGGED_IN_STATUS, "HOME").apply(); } + + @Override + public Observable> getNativeCountryList(Context context) { + return Observable.fromCallable(() -> loadJSONFromAsset(context, "nativecountrylist.json")) + .map(nativeCountryJson -> HttpClientV2.getDeserializer().fromJson(nativeCountryJson, TypeToken.getParameterized(List.class, NativeCountry.class).getType())); + } } diff --git a/app/src/main/java/com/gmeremit/online/gmeremittance_native/registerV2/presenter/RegisterV2InteractorInterface.java b/app/src/main/java/com/gmeremit/online/gmeremittance_native/registerV2/presenter/RegisterV2InteractorInterface.java index 0bb4acac..614b1e33 100644 --- a/app/src/main/java/com/gmeremit/online/gmeremittance_native/registerV2/presenter/RegisterV2InteractorInterface.java +++ b/app/src/main/java/com/gmeremit/online/gmeremittance_native/registerV2/presenter/RegisterV2InteractorInterface.java @@ -1,11 +1,16 @@ package com.gmeremit.online.gmeremittance_native.registerV2.presenter; +import android.content.Context; + import com.gmeremit.online.gmeremittance_native.base.BaseInteractorInterface; import com.gmeremit.online.gmeremittance_native.base.PrivilegedGatewayInterface; +import com.gmeremit.online.gmeremittance_native.kycV2.model.kyc.NativeCountry; import com.gmeremit.online.gmeremittance_native.recipientV2.model.recipientadd.AddRecipientApiResponse; import com.gmeremit.online.gmeremittance_native.recipientV2.model.recipientadd.RecipientRelatedDataApiResponse; import com.gmeremit.online.gmeremittance_native.registerV2.model.RegisterApiResponse; +import java.util.List; + import io.reactivex.Observable; import okhttp3.ResponseBody; @@ -15,8 +20,11 @@ public interface RegisterV2InteractorInterface extends BaseInteractorInterface { interface Register2GatewayInterface extends PrivilegedGatewayInterface { + Observable registerUser(String auth, String userName, String password,String confirmPassword, String dob, String clientId, String fcmId, String appVersion, String phoneBrand, String phoneOs, String deviceId, String osVersion); void updateUserId(String userId); + + Observable> getNativeCountryList(Context context); } } diff --git a/app/src/main/java/com/gmeremit/online/gmeremittance_native/registerV2/presenter/RegisterV2Presenter.java b/app/src/main/java/com/gmeremit/online/gmeremittance_native/registerV2/presenter/RegisterV2Presenter.java index b6f5e49d..2b6d75bb 100644 --- a/app/src/main/java/com/gmeremit/online/gmeremittance_native/registerV2/presenter/RegisterV2Presenter.java +++ b/app/src/main/java/com/gmeremit/online/gmeremittance_native/registerV2/presenter/RegisterV2Presenter.java @@ -4,6 +4,7 @@ import com.gmeremit.online.gmeremittance_native.GmeApplication; import com.gmeremit.online.gmeremittance_native.R; import com.gmeremit.online.gmeremittance_native.base.BasePresenter; import com.gmeremit.online.gmeremittance_native.customwidgets.CustomAlertDialog; +import com.gmeremit.online.gmeremittance_native.kycV2.model.kyc.NativeCountry; import com.gmeremit.online.gmeremittance_native.registerV2.gateway.RegisterV2Gateway; import com.gmeremit.online.gmeremittance_native.registerV2.model.RegisterApiResponse; import com.gmeremit.online.gmeremittance_native.utils.Constants; @@ -11,110 +12,42 @@ import com.gmeremit.online.gmeremittance_native.utils.Utils; import com.gmeremit.online.gmeremittance_native.utils.https.GenericApiObserverResponse; import com.google.firebase.iid.FirebaseInstanceId; +import java.util.List; + import io.reactivex.android.schedulers.AndroidSchedulers; import io.reactivex.disposables.CompositeDisposable; import io.reactivex.schedulers.Schedulers; public class RegisterV2Presenter extends BasePresenter implements RegisterV2PresenterInterface, RegisterV2InteractorInterface { - private final RegisterV2Gateway gateway; + private final Register2GatewayInterface gateway; private final RegisterV2ContractInterface view; private CompositeDisposable compositeDisposable; + private List nativeCountryList; + + private NativeCountry selectedNativeCountry; private String encPassword; - private String encConfirmPassword; + private String selectedUserId; + private String selectedMobileNumber; + + private boolean isSelectedNativeCountryValid; public RegisterV2Presenter(RegisterV2PresenterInterface.RegisterV2ContractInterface view) { this.view = view; compositeDisposable=new CompositeDisposable(); this.gateway = new RegisterV2Gateway(this); encPassword=""; - encConfirmPassword=""; + getDefaultData(); } + private void getDefaultData() { + this.compositeDisposable.add( + this.gateway.getNativeCountryList(view.getContext()).subscribe(nativeCountryList-> this.nativeCountryList=nativeCountryList)); - @Deprecated - @Override - public boolean validatePasswords(String pwdString, String pwdConfrimString) { - boolean pwdValidation=true; - boolean confirmPwdValidation=true; - - - if (!Utils.hasSpecialCharacters(pwdString)) { - this.view.setPasswordError("Password should have at least one symbol"); - pwdValidation= false; - } - if (!Utils.hasNumbers(pwdString)) { - this.view.setPasswordError("Password should have at least one number"); - pwdValidation= false; - } - if (pwdString.length()>1&&pwdString.length()<9) { - this.view.setPasswordError("Password should have at least 9 characters"); - pwdValidation= false; - } - if (!Utils.hasAtleastOnCapitalLetter(pwdString)) { - this.view.setPasswordError("Password should have at least one capital letter"); - pwdValidation= false; - } - if(pwdString.trim().length()<1) - { - this.view.setPasswordError("Password cannot be empty"); - pwdValidation= false; - } - - if (!pwdString.equals(pwdConfrimString)) { - this.view.setConfirmPasswordError("Passwords does not match"); - confirmPwdValidation= false; - } - if(pwdConfrimString==null||pwdConfrimString.trim().length()<1) - { - this.view.setConfirmPasswordError("Confirm password cannot be empty"); - confirmPwdValidation= false; - } - if(pwdValidation) { - view.setPasswordError(null); - } - if(confirmPwdValidation) - { - view.setConfirmPasswordError(null); - - } - return pwdValidation&&confirmPwdValidation; } - /** - * Validation removed after implementing security keypad - * @return - */ - @Override - public boolean validatePasswords() - { - boolean pwdValidation=true; - boolean confirmPwdValidation=true; - - if(encPassword==null||encPassword.trim().length()<1) - { - this.view.setPasswordError(getStringfromStringId(R.string.password_empty_error)); - pwdValidation= false; - } - - if(encConfirmPassword==null||encConfirmPassword.trim().length()<1) - { - this.view.setConfirmPasswordError(getStringfromStringId(R.string.confirm_passowrd_empty_error)); - confirmPwdValidation= false; - } - if(pwdValidation) { - view.setPasswordError(null); - } - if(confirmPwdValidation) - { - view.setConfirmPasswordError(null); - - } - - return pwdValidation&&confirmPwdValidation; - } @Override public void registerUser(String userId, String password, String dob) { @@ -137,7 +70,7 @@ public class RegisterV2Presenter extends BasePresenter implements RegisterV2Pres auth, userId, this.encPassword, - this.encConfirmPassword, + "", dob, "172017F9EC11222E8107142733", fcmID, @@ -154,43 +87,47 @@ public class RegisterV2Presenter extends BasePresenter implements RegisterV2Pres ); } - @Override - public boolean validateDob(String dobString) { - if(dobString==null||dobString.trim().length()<1) - { - this.view.setDobError(getStringfromStringId(R.string.dob_valid_error)); + private boolean returnFalseIfMobileNoIsNotValid(String mobile) { + if (mobile == null || mobile.length() < 1) { + this.view.setMobileError(getStringfromStringId(R.string.kyc_mobile_empty_error)); + return false; + } + if (!Utils.hasNumbersOnly(mobile) || mobile.length() != 11) { + this.view.setMobileError(getStringfromStringId(R.string.kyc_mobile_invalid_number_error)); return false; } - view.setDobError(null); + this.view.setMobileError(null); return true; + + } + + + @Override + public void updateSelectedNativeCountry(NativeCountry seletedNativeCountry) { + this.selectedNativeCountry=seletedNativeCountry; + isSelectedNativeCountryValid=seletedNativeCountry!=null; + if(!isSelectedNativeCountryValid) + view.setNativeCountryError(getStringfromStringId(R.string.kyc_native_country_error)); + else + view.setNativeCountryError(null); + validateAll(); } + + @Override - public boolean validateEmail(String emailId) { - if(!Utils.isValidEmail(emailId)) - { - this.view.setUserIdError(getStringfromStringId(R.string.email_valid_error)); - return false; - } - this.view.setUserIdError(null); - return true; + public void updateMobileNumber(String mobileNumber) { + } - @Deprecated @Override - public boolean validateAll(String emailId, String pwdString, String pwdConfirmString, String dobString) { - boolean emailIdValidation=validateEmail(emailId); - boolean pwdValidation=validatePasswords(pwdString,pwdConfirmString); - boolean dobValidation=validateDob(dobString); - return (emailIdValidation&&pwdValidation&&dobValidation); + public List getNativeCountryList() { + return nativeCountryList; } @Override - public boolean validateAll(String emailId, String dobString) { - boolean emailIdValidation=validateEmail(emailId); - boolean pwdValidation=validatePasswords(); - boolean dobValidation=validateDob(dobString); - return (emailIdValidation&&pwdValidation&&dobValidation); + public void updateId(String id) { + } @Override @@ -198,9 +135,8 @@ public class RegisterV2Presenter extends BasePresenter implements RegisterV2Pres this.encPassword=encUpdatedPassword; } - @Override - public void updateConfirmPassword(String encConfirmPassword) { - this.encConfirmPassword=encConfirmPassword; + private void validateAll() { + } @Override diff --git a/app/src/main/java/com/gmeremit/online/gmeremittance_native/registerV2/presenter/RegisterV2PresenterInterface.java b/app/src/main/java/com/gmeremit/online/gmeremittance_native/registerV2/presenter/RegisterV2PresenterInterface.java index 270e8349..42e9618d 100644 --- a/app/src/main/java/com/gmeremit/online/gmeremittance_native/registerV2/presenter/RegisterV2PresenterInterface.java +++ b/app/src/main/java/com/gmeremit/online/gmeremittance_native/registerV2/presenter/RegisterV2PresenterInterface.java @@ -4,38 +4,47 @@ import android.content.Context; import com.gmeremit.online.gmeremittance_native.base.BaseContractInterface; import com.gmeremit.online.gmeremittance_native.base.BasePresenterInterface; +import com.gmeremit.online.gmeremittance_native.kycV2.model.kyc.NativeCountry; + +import java.util.List; public interface RegisterV2PresenterInterface extends BasePresenterInterface { - boolean validatePasswords(String pwdString, String pwdConfrimString); void registerUser(String userId, String password, String dob); - boolean validateDob(String dobString); - boolean validateEmail(String emailId); - boolean validateAll(String emailId,String pwdString, String pwdConfirmString,String dobString); - boolean validateAll(String emailId,String dobString); + + void updateId(String id); void updatePassword(String encUpdatedPassword); - void updateConfirmPassword(String encConfirmPassword); + void updateSelectedNativeCountry(NativeCountry selectedNativeCountry); + + void updateMobileNumber(String mobileNumber); + + List getNativeCountryList(); + - boolean validatePasswords(); interface RegisterV2ContractInterface extends BaseContractInterface { + void setConfirmPasswordError(String error); void setPasswordError(String error); - void setDobError(String error); + void setNativeCountryError(String error); void setUserIdError(String error); + void setMobileError(String error); + void redirectToLogin(); + void enableSubmitButton(boolean action); + void redirectToDashboard(); Context getContext(); diff --git a/app/src/main/java/com/gmeremit/online/gmeremittance_native/registerV2/view/RegisterV2Activity.java b/app/src/main/java/com/gmeremit/online/gmeremittance_native/registerV2/view/RegisterV2Activity.java index c09e02eb..eb4680c8 100644 --- a/app/src/main/java/com/gmeremit/online/gmeremittance_native/registerV2/view/RegisterV2Activity.java +++ b/app/src/main/java/com/gmeremit/online/gmeremittance_native/registerV2/view/RegisterV2Activity.java @@ -19,21 +19,17 @@ import android.widget.TextView; import com.gmeremit.online.gmeremittance_native.R; import com.gmeremit.online.gmeremittance_native.base.BaseActivity; +import com.gmeremit.online.gmeremittance_native.customwidgets.GenericTextListingDialog; import com.gmeremit.online.gmeremittance_native.customwidgets.GmeErrorTextView; import com.gmeremit.online.gmeremittance_native.homeV2.view.HomeActivityV2; +import com.gmeremit.online.gmeremittance_native.kycV2.model.kyc.NativeCountry; import com.gmeremit.online.gmeremittance_native.loginV2.view.LoginV2Activity; import com.gmeremit.online.gmeremittance_native.registerV2.presenter.RegisterV2Presenter; import com.gmeremit.online.gmeremittance_native.registerV2.presenter.RegisterV2PresenterInterface; -import com.gmeremit.online.gmeremittance_native.utils.Utils; import com.gmeremit.online.gmeremittance_native.utils.security.securitykeypad.SecurityKeyboardManager; import com.gmeremit.online.gmeremittance_native.utils.security.securitykeypad.SecurityKeyboardView; import com.gmeremit.online.gmeremittance_native.utils.security.securitykeypad.SecurityKeypadRequestParamBuilder; import com.softsecurity.transkey.TransKeyActivity; -import com.tsongkha.spinnerdatepicker.SpinnerDatePickerDialogBuilder; - -import java.text.SimpleDateFormat; -import java.util.Calendar; -import java.util.Locale; import butterknife.BindView; import butterknife.ButterKnife; @@ -41,38 +37,39 @@ import butterknife.ButterKnife; public class RegisterV2Activity extends BaseActivity implements RegisterV2PresenterInterface.RegisterV2ContractInterface, View.OnClickListener, View.OnTouchListener { - @BindView(R.id.email_mobile) - EditText emailMobileTextView; + @BindView(R.id.ed_userId) + EditText ed_userId; + + @BindView(R.id.ed_mobile) + EditText ed_mobile; @BindView(R.id.securityKeyboardPassword) SecurityKeyboardView securityKeyboardPasswordView; - @BindView(R.id.securityKeyboardConfirmPassword) - SecurityKeyboardView securityKeyboardConfirmPasswordView; - - @BindView(R.id.ed_dob) - EditText ed_dob; + @BindView(R.id.ed_native_country) + EditText ed_native_country; @BindView(R.id.btn_submit) Button btn_submit; - @BindView(R.id.emailErrorTxt) - GmeErrorTextView emailErrorTxt; + @BindView(R.id.userIdErrorTxt) + GmeErrorTextView userIdErrorTxt; + + @BindView(R.id.mobileErrorTxt) + GmeErrorTextView mobileErrorTxt; @BindView(R.id.passwordErrorTxt) GmeErrorTextView passwordErrorTxt; - @BindView(R.id.confirmPwdErrorTxt) - GmeErrorTextView confirmPwdErrorTxt; - @BindView(R.id.dateErrorTxt) - GmeErrorTextView dateErrorTxt; + @BindView(R.id.nativeCountryErrorTxt) + GmeErrorTextView nativeCountryErrorTxt; @BindView(R.id.tv_login) TextView tv_login; - @BindView(R.id.ed_dob_container) - FrameLayout ed_dob_container; + @BindView(R.id.ed_native_country_container) + FrameLayout ed_native_country_container; @BindView(R.id.keypadContainer) FrameLayout keypadContainer; @@ -86,8 +83,6 @@ public class RegisterV2Activity extends BaseActivity implements RegisterV2Presen @BindView(R.id.passwordText) TextView passwordTextView; - @BindView(R.id.confirmPasswordText) - TextView confirmPasswordTextView; @BindView(R.id.rootViewRegister) View rootView; @@ -99,10 +94,9 @@ public class RegisterV2Activity extends BaseActivity implements RegisterV2Presen private RegisterDobClickGestureDetector dobContainerOnClickGestureDetector; SecurityKeyboardManager securityKeyboardPasswordManager; - SecurityKeyboardManager securityKeyboardConfirmPasswordManager; SecurityKeypadPasswordListener securityKeyboardPasswordListener; - SecurityKeypadConfirmPasswordListener securityKeyboardConfirmPasswordListener; + private GenericTextListingDialog nativeCountrylListDialog; @Override protected void onCreate(Bundle savedInstanceState) { @@ -126,7 +120,7 @@ public class RegisterV2Activity extends BaseActivity implements RegisterV2Presen try { securityKeyboardPasswordManager = new SecurityKeyboardManager(this); SecurityKeypadRequestParamBuilder request = new SecurityKeypadRequestParamBuilder(this); - request.setHintString(getString(R.string.create_password_text)); + request.setHintString(getString(R.string.password_policy_text)); request.disableKeyPadEffect(false); @@ -142,26 +136,7 @@ public class RegisterV2Activity extends BaseActivity implements RegisterV2Presen Log.d("GMESecurityKeyboard", e.getMessage()); } - securityKeyboardConfirmPasswordListener = new SecurityKeypadConfirmPasswordListener(); - securityKeyboardConfirmPasswordView.setKeyboardContainerView(keypadContainer); - securityKeyboardConfirmPasswordView.setKeyboardBallonView(ballonView); - try { - securityKeyboardConfirmPasswordManager = new SecurityKeyboardManager(this); - SecurityKeypadRequestParamBuilder request = new SecurityKeypadRequestParamBuilder(this); - request.setHintString(getString(R.string.confirm_password_text)); - request.disableKeyPadEffect(false); - securityKeyboardConfirmPasswordManager.bindWithSecurityWidgetView(securityKeyboardConfirmPasswordView) - .setBallonView(ballonView) - .setKeyboardContainer(keypadContainer) - .setRequestParams(request) - .setActionListener(securityKeyboardConfirmPasswordListener) - .build(); - - } catch (Exception e) { - e.printStackTrace(); - Log.d("GMESecurityKeyboard", e.getMessage()); - } } private void performDefaultAction(Bundle savedInstanceState) { @@ -175,7 +150,6 @@ public class RegisterV2Activity extends BaseActivity implements RegisterV2Presen tv_login.setOnClickListener(this); btn_submit.setOnClickListener(this); securityKeyboardPasswordView.setSecurityKeyboardFocusStateListener(securityKeyboardPasswordListener); - securityKeyboardConfirmPasswordView.setSecurityKeyboardFocusStateListener(securityKeyboardConfirmPasswordListener); } @@ -186,14 +160,13 @@ public class RegisterV2Activity extends BaseActivity implements RegisterV2Presen tv_login.setOnClickListener(null); btn_submit.setOnClickListener(null); securityKeyboardPasswordView.setSecurityKeyboardFocusStateListener(null); - securityKeyboardConfirmPasswordView.setSecurityKeyboardFocusStateListener(null); } @Override public boolean dispatchTouchEvent(MotionEvent ev) { - return (securityKeyboardPasswordView.checkIfTouchIntersectKeypadLayout(ev) || securityKeyboardConfirmPasswordView.checkIfTouchIntersectKeypadLayout(ev) || dobConatinerClickGestureDetector.onTouchEvent(ev) || super.dispatchTouchEvent(ev)); + return (securityKeyboardPasswordView.checkIfTouchIntersectKeypadLayout(ev) || dobConatinerClickGestureDetector.onTouchEvent(ev) || super.dispatchTouchEvent(ev)); } @@ -205,44 +178,38 @@ public class RegisterV2Activity extends BaseActivity implements RegisterV2Presen break; case R.id.btn_submit: - if (presenter.validateAll(emailMobileTextView.getText().toString().trim(), ed_dob.getText().toString())) { + if (btn_submit.isEnabled()) { hideKeyBoard(); - presenter.registerUser(emailMobileTextView.getText().toString().trim(), null, ed_dob.getText().toString()); + presenter.registerUser(ed_userId.getText().toString().trim(), null, ed_native_country.getText().toString()); } break; } } - public void promptDatePicker() { + public void promptNativeCountrySelection() { hideKeyBoard(); - SpinnerDatePickerDialogBuilder builder = new SpinnerDatePickerDialogBuilder(); - - builder.context(RegisterV2Activity.this) - .spinnerTheme(R.style.NumberPickerStyle) - .showTitle(true) - .showDaySpinner(true) - .dialogTheme(R.style.DatePickerTheme) - .setTitle(getString(R.string.select_dob_text)) - .setPositiveButtonText(getString(R.string.ok_text)) - .setNegativeButtonText(getString(R.string.cancel_text)) - .setCurrentDateAsMaxDate() - .defaultDate(1990, 1, 1) - .callback(new com.tsongkha.spinnerdatepicker.DatePickerDialog.OnDateSetListener() { - @Override - public void onDateSet(com.tsongkha.spinnerdatepicker.DatePicker datePicker, int year, int monthOfYear, int dayOfMonth) { - Calendar newDate = Calendar.getInstance(); - newDate.set(year, monthOfYear, dayOfMonth); - ed_dob.setText(new SimpleDateFormat(Utils.getDefaultDateFormat(), Locale.US).format(newDate.getTime())); - } - }) - .build().show(); + if (nativeCountrylListDialog == null) + nativeCountrylListDialog = new GenericTextListingDialog<>(); + + nativeCountrylListDialog.setData(this.presenter.getNativeCountryList()); + nativeCountrylListDialog.setListener(selectedNativeCountry -> + { + presenter.updateSelectedNativeCountry(selectedNativeCountry); + nativeCountrylListDialog.dismiss(); + + }); + nativeCountrylListDialog.setHintAndTitle(getString(R.string.search_country_text), getString(R.string.select_country_text), getString(R.string.no_country_found_text)); + nativeCountrylListDialog.disableSearch(false); + if (!nativeCountrylListDialog.isAdded()) + nativeCountrylListDialog.show(getSupportFragmentManager(), "NATIVECOUNTRYDIALOG"); + presenter.updateSelectedNativeCountry(null); } @Override public void setConfirmPasswordError(String error) { - confirmPwdErrorTxt.setErrorText(error); + } @Override @@ -251,13 +218,18 @@ public class RegisterV2Activity extends BaseActivity implements RegisterV2Presen } @Override - public void setDobError(String error) { - dateErrorTxt.setErrorText(error); + public void setNativeCountryError(String error) { + nativeCountryErrorTxt.setErrorText(error); } @Override public void setUserIdError(String error) { - emailErrorTxt.setErrorText(error); + userIdErrorTxt.setErrorText(error); + } + + @Override + public void setMobileError(String error) { + } @Override @@ -268,6 +240,11 @@ public class RegisterV2Activity extends BaseActivity implements RegisterV2Presen finish(); } + @Override + public void enableSubmitButton(boolean action) { + btn_submit.setEnabled(action); + } + @Override public void redirectToDashboard() { Intent redirectIntent = new Intent(this, HomeActivityV2.class); @@ -285,7 +262,7 @@ public class RegisterV2Activity extends BaseActivity implements RegisterV2Presen @Override public boolean onTouch(View v, MotionEvent event) { if (v.getId() == R.id.ed_dob_container) { - promptDatePicker(); + promptNativeCountrySelection(); return true; } return false; @@ -295,8 +272,6 @@ public class RegisterV2Activity extends BaseActivity implements RegisterV2Presen public void onBackPressed() { if (securityKeyboardPasswordManager != null && securityKeyboardPasswordManager.isKeyboardVisible()) securityKeyboardPasswordManager.hideKeyboard(); - else if (securityKeyboardConfirmPasswordManager != null && securityKeyboardConfirmPasswordManager.isKeyboardVisible()) - securityKeyboardConfirmPasswordManager.hideKeyboard(); else super.onBackPressed(); } @@ -305,26 +280,26 @@ public class RegisterV2Activity extends BaseActivity implements RegisterV2Presen @Override public boolean onSingleTapUp(MotionEvent e) { if (e.getAction() == MotionEvent.ACTION_UP) { - boolean isDobContainerClicked = checkIfDateContainerIsClicked(e.getX(), e.getY()); - if (isDobContainerClicked) - promptDatePicker(); - return isDobContainerClicked; + boolean isNativeCountryContainerClicked = checkIfNativeContainerIsClicked(e.getX(), e.getY()); + if (isNativeCountryContainerClicked) + promptNativeCountrySelection(); + return isNativeCountryContainerClicked; } return super.onSingleTapUp(e); } - private boolean checkIfDateContainerIsClicked(float x, float y) { + private boolean checkIfNativeContainerIsClicked(float x, float y) { int posX = (int) x; int posY = (int) y; int[] dobConatinerLeftAndTopCoordinates = new int[2]; - ed_dob_container.getLocationOnScreen(dobConatinerLeftAndTopCoordinates); + ed_native_country_container.getLocationOnScreen(dobConatinerLeftAndTopCoordinates); Rect dobContainerBoundRect = new Rect(dobConatinerLeftAndTopCoordinates[0], dobConatinerLeftAndTopCoordinates[1], - dobConatinerLeftAndTopCoordinates[0] + ed_dob_container.getMeasuredWidth(), - dobConatinerLeftAndTopCoordinates[1] + ed_dob_container.getMeasuredHeight()); + dobConatinerLeftAndTopCoordinates[0] + ed_native_country_container.getMeasuredWidth(), + dobConatinerLeftAndTopCoordinates[1] + ed_native_country_container.getMeasuredHeight()); return dobContainerBoundRect.contains(posX, posY); } @@ -362,7 +337,6 @@ public class RegisterV2Activity extends BaseActivity implements RegisterV2Presen @Override public void onSecurityViewRecievedFocus() { - hideKeyboardFromRemainingWidget(); if (securityKeyboardPasswordManager != null && !securityKeyboardPasswordManager.isKeyboardVisible()) { hideKeyBoard(); securityKeyboardPasswordManager.showKeyboard(); @@ -383,69 +357,7 @@ public class RegisterV2Activity extends BaseActivity implements RegisterV2Presen } //In some cases remaining keyboard widget may still be focusable as our layout can be scrolled for which the on screen location of remaining widget may be false - private void hideKeyboardFromRemainingWidget() { - if (securityKeyboardConfirmPasswordManager != null && securityKeyboardConfirmPasswordManager.isKeyboardVisible()) - securityKeyboardConfirmPasswordManager.hideKeyboard(); - } - } - - class SecurityKeypadConfirmPasswordListener implements SecurityKeyboardManager.SecurityKeyboardActionListenerFacade, SecurityKeyboardView.SecurityKeyboardFocusStateListener { - - @Override - public void done(Intent intent) { - String encryptedText = intent.getStringExtra(TransKeyActivity.mTK_PARAM_SECURE_DATA); - presenter.updateConfirmPassword(encryptedText); - } - - @Override - public void cancel(Intent intent) { - String encryptedText = intent.getStringExtra(TransKeyActivity.mTK_PARAM_SECURE_DATA); - presenter.updateConfirmPassword(encryptedText); - } - - - @Override - public void input(int i) { - - } - - @Override - public void minTextSizeCallback() { - - } - - @Override - public void maxTextSizeCallback() { - - } - - @Override - public void onSecurityViewRecievedFocus() { - hideKeyboardFromRemainingWidget(); - if (securityKeyboardConfirmPasswordManager != null && !securityKeyboardConfirmPasswordManager.isKeyboardVisible()) { - - hideKeyBoard(); - securityKeyboardConfirmPasswordManager.showKeyboard(); - scrollView.postDelayed(() -> { - scrollView.smoothScrollTo(0, confirmPasswordTextView.getTop()); - }, 250); - - } - } - - @Override - public void onSecurityViewLostFocus() { - if (securityKeyboardConfirmPasswordManager != null && securityKeyboardConfirmPasswordManager.isKeyboardVisible()) { - securityKeyboardConfirmPasswordManager.hideKeyboard(); - } else - hideKeyBoard(); - } - - //In some cases remaining keyboard widget may still be focusable as our layout can be scrolled for which the on screen location of remaining widget may be false - private void hideKeyboardFromRemainingWidget() { - if (securityKeyboardPasswordManager != null && securityKeyboardPasswordManager.isKeyboardVisible()) - securityKeyboardPasswordManager.hideKeyboard(); - } } + } diff --git a/app/src/main/java/com/gmeremit/online/gmeremittance_native/utils/security/SecurityUtils.java b/app/src/main/java/com/gmeremit/online/gmeremittance_native/utils/security/SecurityUtils.java index c31aa672..4092297e 100644 --- a/app/src/main/java/com/gmeremit/online/gmeremittance_native/utils/security/SecurityUtils.java +++ b/app/src/main/java/com/gmeremit/online/gmeremittance_native/utils/security/SecurityUtils.java @@ -11,9 +11,13 @@ import com.mtramin.rxfingerprint.data.FingerprintEncryptionResult; import io.reactivex.Observable; /** + * @author Preyea R. Regmi + * @version 1.0 + *

Security Utils Helper Class For Biometric Auth

+ *

* Since we are using security keypad with Symmetric Key Encryption, we can only obtain encrypted text as password but not plain text. * So the length of the encrypted text exceeds 256 bit and we cannot use Public/Private Encryption Algorithm i.e. RSA encryption offfered by Android's KeyStore. - * Therefore inorder to persist password and encryption key in same storage using Android's Keystore mechanism, we follow the following steps + * Therefore inorder to persist password and encryption key in same storage using Android's Keystore mechanism, we follow the following steps

* 1) We generate AES key seperately using "AESEncryptionHelper" class if not already generated intially. * 2) Encrypt the confidential content with the AES Algorithm using the generated AES key and persist it. * 3) That AES key is then encrypted using RSA key provided by Keystore and persist it to prevent from being exploited. diff --git a/app/src/main/java/com/gmeremit/online/gmeremittance_native/utils/security/securitykeypad/SecurityKeyboardManager.java b/app/src/main/java/com/gmeremit/online/gmeremittance_native/utils/security/securitykeypad/SecurityKeyboardManager.java index 1d3ee126..428ee9fd 100644 --- a/app/src/main/java/com/gmeremit/online/gmeremittance_native/utils/security/securitykeypad/SecurityKeyboardManager.java +++ b/app/src/main/java/com/gmeremit/online/gmeremittance_native/utils/security/securitykeypad/SecurityKeyboardManager.java @@ -15,8 +15,12 @@ import com.softsecurity.transkey.ITransKeyCallbackListener; import com.softsecurity.transkey.TransKeyCtrl; /** - * Created by Preyea - * Helper class to interact with security virtual keypad. + * @author Preyea R. Regmi + *

Helper class to interact with virtual security keypad SDK.

+ *

+ * The used virtual security keypad is just a view that can be inflated in any ViewGroup. This class provides overall encapsulation of all the related element provided by + * the Virtual Keypad SDK in order to mimick OS like keyboard behavior. This allows us to show/hide keypad in the same Activity from where it is invoked thus providing better UX. + *

*/ public class SecurityKeyboardManager { diff --git a/app/src/main/res/layout/activity_register_v2.xml b/app/src/main/res/layout/activity_register_v2.xml index c4ef1671..b5c2d676 100644 --- a/app/src/main/res/layout/activity_register_v2.xml +++ b/app/src/main/res/layout/activity_register_v2.xml @@ -76,12 +76,12 @@ android:layout_height="wrap_content" android:paddingTop="8dp" android:paddingBottom="2dp" - android:text="@string/email_text" + android:text="@string/login_user_id_text" android:textSize="14sp" app:txtfontName="@string/regular" /> - - - + + + Enter Your New Password Confirm Your Password Save - Password should be At least one sumbol, At least one capital letter, At leset one number and be at least 9 characters + Password should be at least 6 characters Confirm password does not match with new password Success Confirm password cannot be empty