Commit 1e073fe5 authored by Muhammad Suryono's avatar Muhammad Suryono

Update

parent 5b656e25
......@@ -75,7 +75,7 @@ public class LoginActivity extends AppCompatActivity {
public void onChanged(DataResponse<UsersModels> usersModelsDataResponse) {
Log.d("Status", usersModelsDataResponse.getMessageData());
if (!usersModelsDataResponse.getMessageData().equals("Login Failed")){
if (usersModelsDataResponse.getStatusData()){
SharedPreferences.Editor editor = sharedPreferences.edit();
editor.putBoolean(SplashScreen.SESSION, true);
editor.commit();
......
......@@ -116,7 +116,7 @@ public class MainActivity extends AppCompatActivity {
toolbar = findViewById(R.id.topAppBar);
mainViewModels = ViewModelProviders.of(this).get(MainViewModels.class);
if (orderId.isEmpty())
if (sharedPreferences.getString(ORDER_ID,"").isEmpty())
{
SharedPreferences.Editor editor = sharedPreferences.edit();
editor.putString(ORDER_ID,"MES-ORDER"+utils.timeStamp());
......@@ -307,13 +307,13 @@ public class MainActivity extends AppCompatActivity {
@Override
public void onAddCart(ProductModels product) {
mainViewModelsCart.checkOrderProduct(product.getIdProduct(), orderId).observe(MainActivity.this, new Observer<List<ProductCartModels>>() {
mainViewModelsCart.checkOrderProduct(product.getIdProduct(), sharedPreferences.getString(ORDER_ID,"")).observe(MainActivity.this, new Observer<List<ProductCartModels>>() {
@RequiresApi(api = Build.VERSION_CODES.N)
@Override
public void onChanged(List<ProductCartModels> productCartModels) {
if (productCartModels.isEmpty() && cartIsEmpty){
mainViewModelsCart.insertCart(new ProductCartModels(
orderId,
sharedPreferences.getString(ORDER_ID,""),
1,
product.getIdProduct(),
product.getProductName(),
......
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 to comment