Skip to content

Commit

Permalink
Merge branch 'Reverted_back' of https://github.com/Intelehealth/Andro…
Browse files Browse the repository at this point in the history
…id-Mobile-Client into Reverted_back
  • Loading branch information
kranthi-mahiti committed Oct 9, 2019
2 parents 6ba8106 + df648f1 commit e0f6561
Show file tree
Hide file tree
Showing 4 changed files with 85 additions and 82 deletions.
23 changes: 10 additions & 13 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,9 @@ dependencies {
implementation 'com.android.support:support-v4:28.0.0'
testImplementation 'junit:junit:4.13-beta-2'


androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
// mvvm
//mvvm
implementation 'android.arch.lifecycle:extensions:1.1.1'
implementation "android.arch.lifecycle:viewmodel:1.1.1"
// JSON Converter
Expand All @@ -60,14 +59,14 @@ dependencies {
//Permission libraby
implementation 'gun0912.ted:tedpermission:2.2.2'
//logging and interceptor
// implementation "com.squareup.okhttp3:logging-interceptor:3.14.1"
// implementation "com.squareup.okhttp3:logging-interceptor:3.14.1"

implementation "com.squareup.okhttp3:logging-interceptor:3.8.0"

// debug bridge
debugImplementation 'com.amitshekhar.android:debug-db:1.0.4'
//debug bridge
// debugImplementation 'com.amitshekhar.android:debug-db:1.0.4'
//image loaders
implementation 'com.squareup.picasso:picasso:2.71828'
// implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'com.github.bumptech.glide:glide:3.8.0'
//Uncomment below line to enable multidex support for Kitkat
implementation 'com.android.support:multidex:1.0.3'
Expand All @@ -76,14 +75,8 @@ dependencies {
//Google Guava
implementation 'com.google.guava:guava:27.1-jre'
//Storage librabry
implementation 'com.snatik:storage:2.1.0'
// implementation 'com.snatik:storage:2.1.0'
// dexter permission
// implementation 'com.karumi:dexter:5.0.0'
//Room database
annotationProcessor "android.arch.lifecycle:compiler:1.1.1"
implementation "android.arch.persistence.room:runtime:1.1.1"
annotationProcessor "android.arch.persistence.room:compiler:1.1.1"
implementation "android.arch.persistence.room:rxjava2:1.1.1"
//Parse SDK
implementation 'com.parse:parse-android:1.15.7'
//date and time
Expand All @@ -105,10 +98,14 @@ dependencies {
implementation "com.google.firebase:firebase-core:16.0.7"
implementation "com.google.firebase:firebase-messaging:17.3.4"
implementation 'com.google.firebase:firebase-crash:16.2.1'

implementation('com.github.SandroMachado:restaurant:0.2.0@aar') {
transitive = true
}

implementation 'com.rengwuxian.materialedittext:library:2.1.4'


}
apply plugin: 'com.google.gms.google-services' // Google Play services Gradle plugin

Original file line number Diff line number Diff line change
Expand Up @@ -288,96 +288,96 @@ public void UserLoginTask(String mEmail, String mPassword) {
// Log.d(TAG, "UN: " + USERNAME);
// Log.d(TAG, "PW: " + PASSWORD);
String urlString = urlModifiers.loginUrl(sessionManager.getServerUrl());
Logger.logD(TAG, "usernaem and password" + mEmail + mPassword);
Logger.logD(TAG, "usernaem and password" + mEmail + mPassword);
encoded = base64Utils.encoded(mEmail, mPassword);
sessionManager.setEncoded(encoded);
sessionManager.setEncoded(encoded);
showProgress(true);
StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
StrictMode.setThreadPolicy(policy);
Observable<LoginModel> loginModelObservable = AppConstants.apiInterface.LOGIN_MODEL_OBSERVABLE(urlString, "Basic " + encoded);
loginModelObservable.subscribe(new Observer<LoginModel>() {
@Override
public void onSubscribe(Disposable d) {
Observable<LoginModel> loginModelObservable = AppConstants.apiInterface.LOGIN_MODEL_OBSERVABLE(urlString, "Basic " + encoded);
loginModelObservable.subscribe(new Observer<LoginModel>() {
@Override
public void onSubscribe(Disposable d) {

}
}

@Override
public void onNext(LoginModel loginModel) {
int responsCode = loginModel.hashCode();
Boolean authencated = loginModel.getAuthenticated();
Gson gson = new Gson();
Logger.logD(TAG, "success" + gson.toJson(loginModel));
sessionManager.setChwname(loginModel.getUser().getDisplay());
sessionManager.setCreatorID(loginModel.getUser().getUuid());
sessionManager.setSessionID(loginModel.getSessionId());
sessionManager.setProviderID(loginModel.getUser().getPerson().getUuid());
UrlModifiers urlModifiers = new UrlModifiers();
String url = urlModifiers.loginUrlProvider(sessionManager.getServerUrl(), loginModel.getUser().getUuid());
if (authencated) {
Observable<LoginProviderModel> loginProviderModelObservable = AppConstants.apiInterface.LOGIN_PROVIDER_MODEL_OBSERVABLE(url, "Basic " + encoded);
loginProviderModelObservable
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new DisposableObserver<LoginProviderModel>() {
@Override
public void onNext(LoginProviderModel loginProviderModel) {
if (loginProviderModel.getResults().size() != 0) {
for (int i = 0; i < loginProviderModel.getResults().size(); i++) {
Log.i(TAG, "doInBackground: " + loginProviderModel.getResults().get(i).getUuid());
sessionManager.setProviderID(loginProviderModel.getResults().get(i).getUuid());
@Override
public void onNext(LoginModel loginModel) {
int responsCode = loginModel.hashCode();
Boolean authencated = loginModel.getAuthenticated();
Gson gson = new Gson();
Logger.logD(TAG, "success" + gson.toJson(loginModel));
sessionManager.setChwname(loginModel.getUser().getDisplay());
sessionManager.setCreatorID(loginModel.getUser().getUuid());
sessionManager.setSessionID(loginModel.getSessionId());
sessionManager.setProviderID(loginModel.getUser().getPerson().getUuid());
UrlModifiers urlModifiers = new UrlModifiers();
String url = urlModifiers.loginUrlProvider(sessionManager.getServerUrl(), loginModel.getUser().getUuid());
if (authencated) {
Observable<LoginProviderModel> loginProviderModelObservable = AppConstants.apiInterface.LOGIN_PROVIDER_MODEL_OBSERVABLE(url, "Basic " + encoded);
loginProviderModelObservable
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new DisposableObserver<LoginProviderModel>() {
@Override
public void onNext(LoginProviderModel loginProviderModel) {
if (loginProviderModel.getResults().size() != 0) {
for (int i = 0; i < loginProviderModel.getResults().size(); i++) {
Log.i(TAG, "doInBackground: " + loginProviderModel.getResults().get(i).getUuid());
sessionManager.setProviderID(loginProviderModel.getResults().get(i).getUuid());
// success = true;
final Account account = new Account(mEmail, "io.intelehealth.openmrs");
manager.addAccountExplicitly(account, mPassword, null);
offlineLogin.invalidateLoginCredentials();
offlineLogin.setUpOfflineLogin(mEmail, mPassword);
Intent intent = new Intent(LoginActivity.this, HomeActivity.class);
intent.putExtra("login", true);
final Account account = new Account(mEmail, "io.intelehealth.openmrs");
manager.addAccountExplicitly(account, mPassword, null);
offlineLogin.invalidateLoginCredentials();
offlineLogin.setUpOfflineLogin(mEmail, mPassword);
Intent intent = new Intent(LoginActivity.this, HomeActivity.class);
intent.putExtra("login", true);
// startJobDispatcherService(LoginActivity.this);
startActivity(intent);
finish();
showProgress(false);
startActivity(intent);
finish();
showProgress(false);

sessionManager.setReturningUser(true);
sessionManager.setReturningUser(true);

}
}
}
}

@Override
public void onError(Throwable e) {
Logger.logD(TAG, "handle provider error" + e.getMessage());
@Override
public void onError(Throwable e) {
Logger.logD(TAG, "handle provider error" + e.getMessage());
// success = false;
showProgress(false);
}
showProgress(false);
}

@Override
public void onComplete() {
@Override
public void onComplete() {

}
});
}
}
});
}
}

@Override
public void onError(Throwable e) {
Logger.logD(TAG, "Login Failure" + e.getMessage());
@Override
public void onError(Throwable e) {
Logger.logD(TAG, "Login Failure" + e.getMessage());
// success = false;
showProgress(false);
showProgress(false);
// DialogUtils dialogUtils=new DialogUtils();
// dialogUtils.showerrorDialog(LoginActivity.this,"Error Login",getString(R.string.error_incorrect_password),"ok");
Toast.makeText(LoginActivity.this, getString(R.string.error_incorrect_password), Toast.LENGTH_SHORT).show();
mPasswordView.setError("");
mUsernameView.setError("");
mPasswordView.setText("");
mUsernameView.setText("");
mPasswordView.requestFocus();
}
Toast.makeText(LoginActivity.this, getString(R.string.error_incorrect_password), Toast.LENGTH_SHORT).show();
mPasswordView.setError("");
mUsernameView.setError("");
mPasswordView.setText("");
mUsernameView.setText("");
mPasswordView.requestFocus();
}

@Override
public void onComplete() {
Logger.logD(TAG, "completed");
}
});
@Override
public void onComplete() {
Logger.logD(TAG, "completed");
}
});


// return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import androidx.work.NetworkType;
import androidx.work.PeriodicWorkRequest;


import java.io.File;
import java.util.concurrent.TimeUnit;

Expand Down
7 changes: 6 additions & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
<string name="device_id" translatable="false">Device ID:</string>
<string name="enter_license_key" translatable="false">Enter License Key</string>

<string name="cant_login_user" translatable="false">Can\'t log in ?</string>
<string name="cant_login_user" translatable="false">Can\'t log in?</string>
<string name="email_link" translatable="false">Please contact your System Administrator to reset your password or send an email to [email protected]</string>

//Home Screen (after login)
Expand Down Expand Up @@ -335,6 +335,8 @@

<string name="backup_completed" translatable="false">Backup Completed!</string>

<string name="hide_text">HIDE</string>
<string name="show_text">SHOW</string>

<string name="new_patient" translatable="false">New Patient</string>
<string name="find_patient" translatable="false">Find Patients</string>
Expand Down Expand Up @@ -440,6 +442,9 @@
<string name="temperature_f">Temperature (F)</string>
<string name="sync_now">Sync Now</string>
<string name="lastsync">lastsync</string>
<string name="enter_password">Enter your password</string>
<string name="enter_username">Enter your username</string>



</resources>

0 comments on commit e0f6561

Please sign in to comment.