Mobile number and otp validation changes

parent f3e89ee8
...@@ -72,7 +72,7 @@ android { ...@@ -72,7 +72,7 @@ android {
vportal { vportal {
applicationId "com.vsoft.vera.vportal" applicationId "com.vsoft.vera.vportal"
versionCode 1 versionCode 1
versionName "0.1.9" versionName "1.1.0"
} }
} }
} }
......
...@@ -170,6 +170,7 @@ public class ADALActivity extends AppCompatActivity { ...@@ -170,6 +170,7 @@ public class ADALActivity extends AppCompatActivity {
}); });
getCountryCode(); getCountryCode();
// CheckLoginValues(); // CheckLoginValues();
callGraphButton = (Button) findViewById(R.id.callGraph); callGraphButton = (Button) findViewById(R.id.callGraph);
signOutButton = (Button) findViewById(R.id.clearCache); signOutButton = (Button) findViewById(R.id.clearCache);
...@@ -190,7 +191,6 @@ public class ADALActivity extends AppCompatActivity { ...@@ -190,7 +191,6 @@ public class ADALActivity extends AppCompatActivity {
}); });
login_with_otp.setOnClickListener(new View.OnClickListener() { login_with_otp.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) { public void onClick(View v) {
// onSignOutClicked(); // onSignOutClicked();
...@@ -237,33 +237,6 @@ public class ADALActivity extends AppCompatActivity { ...@@ -237,33 +237,6 @@ public class ADALActivity extends AppCompatActivity {
} }
} }
/*
* getCountryCode - To get the Country mobile code dynamically.
*
* @return void
* */
public void getCountryCode() {
try {
TelephonyManager telephonyManager =
(TelephonyManager) this.getSystemService(Context.TELEPHONY_SERVICE);
if (telephonyManager != null) {
String countryName = telephonyManager.getNetworkCountryIso();
Log.e(TAG, "countryCode: "+countryName);
if(countryName.equalsIgnoreCase("us")) {
Constants.TWILIO_COUNTRY_CODE = "+1";
}
if(countryName.equalsIgnoreCase("in")) {
Constants.TWILIO_COUNTRY_CODE = "+91";
}
Log.e(TAG, "countryCode: "+Constants.TWILIO_COUNTRY_CODE);
}
} catch (Exception e) {
Constants.TWILIO_COUNTRY_CODE = "+1";
}
}
private void CheckLoginValues() { private void CheckLoginValues() {
String sysId = PrefManager.getSharedPref(ADALActivity.this, PrefManager.PREFERENCE_USER_SYS_ID); String sysId = PrefManager.getSharedPref(ADALActivity.this, PrefManager.PREFERENCE_USER_SYS_ID);
if (!TextUtils.isEmpty(sysId)) { if (!TextUtils.isEmpty(sysId)) {
...@@ -760,4 +733,28 @@ public class ADALActivity extends AppCompatActivity { ...@@ -760,4 +733,28 @@ public class ADALActivity extends AppCompatActivity {
} }
} }
} }
/*
* getCountryCode - To get the Country mobile code dynamically.
*
* @return void
* */
public void getCountryCode() {
try {
TelephonyManager telephonyManager =
(TelephonyManager) this.getSystemService(Context.TELEPHONY_SERVICE);
if (telephonyManager != null) {
String countryName = telephonyManager.getNetworkCountryIso();
if(countryName.equalsIgnoreCase("us")) {
Constants.TWILIO_COUNTRY_CODE = "+1";
}
if(countryName.equalsIgnoreCase("in")) {
Constants.TWILIO_COUNTRY_CODE = "+91";
}
}
} catch (Exception e) {
Constants.TWILIO_COUNTRY_CODE = "+1";
}
}
} }
...@@ -14,7 +14,6 @@ import android.view.View; ...@@ -14,7 +14,6 @@ import android.view.View;
import android.widget.EditText; import android.widget.EditText;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.RelativeLayout; import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
import com.bumptech.glide.Glide; import com.bumptech.glide.Glide;
...@@ -103,15 +102,10 @@ public class OtpValidationActivity extends Activity { ...@@ -103,15 +102,10 @@ public class OtpValidationActivity extends Activity {
if (TextUtils.isEmpty(phoneString)) { if (TextUtils.isEmpty(phoneString)) {
mPhoneEditText.setError(getResources().getString(R.string.phone_error)); mPhoneEditText.setError(getResources().getString(R.string.phone_error));
} } else if (!TextUtils.isEmpty(phoneString) && phoneString.length() >= 10 && phoneString.length() <=20) {
if (!TextUtils.isEmpty(phoneString) && phoneString.length() >= 10) {
KeyboardUtil.hideKeyboard(OtpValidationActivity.this); KeyboardUtil.hideKeyboard(OtpValidationActivity.this);
if (mApplication.isNetConnected()) { if (mApplication.isNetConnected()) {
new generateOtp().execute(phoneString); new generateOtp().execute(phoneString);
} else { } else {
DialogUtils.showNoConnectionDialog(OtpValidationActivity.this); DialogUtils.showNoConnectionDialog(OtpValidationActivity.this);
} }
...@@ -120,21 +114,18 @@ public class OtpValidationActivity extends Activity { ...@@ -120,21 +114,18 @@ public class OtpValidationActivity extends Activity {
private void callValidateOtpAPI() { private void callValidateOtpAPI() {
String optCode = mOTPEditText.getText().toString().trim(); String otpCode = mOTPEditText.getText().toString().trim();
if (TextUtils.isEmpty(optCode)) { if (TextUtils.isEmpty(otpCode)) {
mOTPEditText.setError(getResources().getString(R.string.otp_error)); mOTPEditText.setError(getResources().getString(R.string.otp_error));
}else{ } else if(!TextUtils.isEmpty(otpCode) && otpCode.length() <=8) {
KeyboardUtil.hideKeyboard(OtpValidationActivity.this); KeyboardUtil.hideKeyboard(OtpValidationActivity.this);
if (mApplication.isNetConnected()) {
new validateOtp().execute(phoneString,optCode);
if (mApplication.isNetConnected()) {
new validateOtp().execute(phoneString, otpCode);
} else { } else {
DialogUtils.showNoConnectionDialog(OtpValidationActivity.this); DialogUtils.showNoConnectionDialog(OtpValidationActivity.this);
} }
} }
} }
...@@ -227,12 +218,10 @@ public class OtpValidationActivity extends Activity { ...@@ -227,12 +218,10 @@ public class OtpValidationActivity extends Activity {
String phoneString = params[0]; String phoneString = params[0];
String otpCode = params[1]; String otpCode = params[1];
OtpApiManager.validateOTP(phoneString, otpCode,new GetValidateOtpApiListener() { OtpApiManager.validateOTP(phoneString, otpCode,new GetValidateOtpApiListener() {
@Override @Override
public void onDoneApiCall(String message) { public void onDoneApiCall(String message) {
apiMessage = message; apiMessage = message;
apiStatus = 1; apiStatus = 1;
......
...@@ -144,7 +144,7 @@ ...@@ -144,7 +144,7 @@
<!-- messages --> <!-- messages -->
<string name="message_welcome">Chat with VERA</string> <string name="message_welcome">Chat with VERA</string>
<string name="reset_password">RESET PASSWORD</string> <string name="reset_password">RESET PASSWORD</string>
<string name="view_all_str"><u>View ALL</u></string> <string name="view_all_str"><u>View all</u></string>
<!--Speech Recognizer--> <!--Speech Recognizer-->
<string name="ds_listening">Listening…</string> <string name="ds_listening">Listening…</string>
......
The file could not be displayed because it is too large.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment