Proyectos de Subversion Android Microlearning - Inconcert

Rev

Rev 14 | Ir a la última revisión | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 14 Rev 18
Línea 71... Línea 71...
71
import com.cesams.twogetskills.inconcert.fragment.ProgressFragment;
71
import com.cesams.twogetskills.inconcert.fragment.ProgressFragment;
72
import com.cesams.twogetskills.inconcert.fragment.SlideFragment;
72
import com.cesams.twogetskills.inconcert.fragment.SlideFragment;
73
import com.cesams.twogetskills.inconcert.fragment.TimelineFragment;
73
import com.cesams.twogetskills.inconcert.fragment.TimelineFragment;
74
import com.cesams.twogetskills.inconcert.fragment.TopicFragment;
74
import com.cesams.twogetskills.inconcert.fragment.TopicFragment;
75
import com.cesams.twogetskills.inconcert.fragment.UserProfileFragment;
75
import com.cesams.twogetskills.inconcert.fragment.UserProfileFragment;
76
import com.cesams.twogetskills.inconcert.fragment.WelcomeFragment;
76
import com.cesams.twogetskills.inconcert.fragment.MyCapsulesFragment;
77
import com.cesams.twogetskills.inconcert.library.Http;
77
import com.cesams.twogetskills.inconcert.library.Http;
78
import com.cesams.twogetskills.inconcert.library.MD5;
78
import com.cesams.twogetskills.inconcert.library.MD5;
79
import com.cesams.twogetskills.inconcert.library.UniqueID;
79
import com.cesams.twogetskills.inconcert.library.UniqueID;
80
import com.cesams.twogetskills.inconcert.entity.Answer;
80
import com.cesams.twogetskills.inconcert.entity.Answer;
81
import com.cesams.twogetskills.inconcert.entity.Capsule;
81
import com.cesams.twogetskills.inconcert.entity.Capsule;
Línea 253... Línea 253...
253
                    hideKeyboard(mNavigationView);
253
                    hideKeyboard(mNavigationView);
Línea 254... Línea 254...
254
 
254
 
Línea 255... Línea 255...
255
                  if(item.getItemId()==R.id.action_home){
255
                  if(item.getItemId()==R.id.action_home){
256
 
256
 
257
                      setTitleActionBar(getString(R.string.app_name));
257
                      setTitleActionBar(getString(R.string.app_name));
Línea 258... Línea 258...
258
                      invokeFragment(Constants.IDX_FRAGMENT_WELCOME);
258
                      invokeFragment(Constants.IDX_FRAGMENT_MY_CAPSULES);
Línea 259... Línea 259...
259
                      mNavigationView.getMenu().getItem(0).setChecked(true);
259
                      mNavigationView.getMenu().getItem(0).setChecked(true);
260
 
-
 
261
 
260
 
262
                  }
-
 
263
 
261
 
264
                    if(item.getItemId()==R.id.action_topicos){
262
                  }
Línea 265... Línea 263...
265
 
263
 
Línea 456... Línea 454...
456
            }
454
            }
Línea 457... Línea 455...
457
 
455
 
458
 
456
 
459
        } else {
-
 
460
            if(preference.getFragmentIdxActive() == 0) {
-
 
461
                if(preference.getBiometricLogin())
-
 
462
                {
-
 
463
                    hideNavigationAndtoolbar();
-
 
464
                    invokeFragment(Constants.IDX_FRAGMENT_BIOMETRIC);
-
 
465
                }
457
        } else {
466
                else{
-
 
467
                invokeFragment(Constants.IDX_FRAGMENT_WELCOME); //La pantalla principal ahora es Welcome, no Topic
-
 
468
                }
458
            if(preference.getFragmentIdxActive() == 0) {
469
 
459
                invokeFragment(Constants.IDX_FRAGMENT_MY_CAPSULES); //La pantalla principal ahora es Welcome, no Topic
470
            } else {
-
 
471
                if(preference.getBiometricLogin())
-
 
472
                {
-
 
473
                    hideNavigationAndtoolbar();
-
 
474
                    invokeFragment(Constants.IDX_FRAGMENT_BIOMETRIC);
460
            } else {
-
 
461
                switch (preference.getFragmentIdxActive())
-
 
462
                {
-
 
463
                    case Constants.IDX_FRAGMENT_GALLERY:
-
 
464
                    case Constants.IDX_FRAGMENT_SLIDES:
475
                }else
465
 
-
 
466
                        if (preference.getCapsuleUuidActive().isEmpty() || preference.getSlideUuidActive().isEmpty()) {
-
 
467
                            invokeFragment(Constants.IDX_FRAGMENT_MY_CAPSULES);
-
 
468
                        } else {
-
 
469
                            invokeFragment(preference.getFragmentIdxActive());
-
 
470
                        }
-
 
471
                        break;
-
 
472
 
476
                {
473
                    case Constants.IDX_FRAGMENT_CAPSULES:
-
 
474
                        if (preference.getTopicUuidActive().isEmpty()) {
-
 
475
                            invokeFragment(Constants.IDX_FRAGMENT_MY_CAPSULES);
477
                    if(preference.getFragmentIdxActive()==Constants.IDX_FRAGMENT_BIOMETRIC){
476
                        } else {
-
 
477
                            invokeFragment(preference.getFragmentIdxActive());
-
 
478
                        }
478
                        invokeFragment(Constants.IDX_FRAGMENT_WELCOME);
479
                        break;
479
                    }
480
 
480
                    else{
481
                    default :
481
                        invokeFragment(preference.getFragmentIdxActive());
482
                        invokeFragment(preference.getFragmentIdxActive());
-
 
483
                        break;
-
 
484
                }
-
 
485
 
482
                    }
486
 
483
                }
487
 
Línea 484... Línea 488...
484
            }
488
            }
Línea 615... Línea 619...
615
        }
619
        }
616
        if(!registrada)
620
        if(!registrada)
617
        {
621
        {
618
            notificacionDao.insert(notificacionueva);
622
            notificacionDao.insert(notificacionueva);
Línea 619... Línea -...
619
 
-
 
620
            // region - Datos de prueba
-
 
621
            /*
-
 
622
            notificacionueva.setTitle("Otra cosa");
-
 
623
            notificacionueva.setDate("2022-07-19");
-
 
624
            notificacionueva.setDescription("Esto es prueba");
623
 
625
            notificacionDao.insert(notificacionueva);
-
 
626
 
-
 
627
            notificacionueva.setTitle("Alguna cosa");
-
 
628
            notificacionueva.setDate("2022-07-05");
-
 
629
            notificacionueva.setDescription("Otro nitificacion");
-
 
630
            notificacionDao.insert(notificacionueva);
-
 
631
 
-
 
632
            notificacionueva.setTitle("Alguna cosa");
-
 
633
            notificacionueva.setDate("2022-07-05");
-
 
634
            notificacionueva.setDescription("Otro de ese dia");
-
 
635
            notificacionDao.insert(notificacionueva);
-
 
636
*/
-
 
637
            // endregion
-
 
638
 
624
            Log.e("No existe", "agregando.. "+ notificacionueva.getDescription());
Línea 639... Línea 625...
639
        }
625
        }
Línea 640... Línea 626...
640
 
626
 
Línea 738... Línea 724...
738
               break;
724
               break;
Línea 739... Línea 725...
739
 
725
 
740
            case Constants.IDX_FRAGMENT_COMPANIES:
726
            case Constants.IDX_FRAGMENT_COMPANIES:
741
            case Constants.IDX_FRAGMENT_TIMELINE  :
727
            case Constants.IDX_FRAGMENT_TIMELINE  :
742
                break;
-
 
743
            case Constants.IDX_FRAGMENT_CAPSULES :
-
 
744
 
-
 
745
                if(preference.getOrigenNavigation().equals(""))
-
 
746
                {
-
 
747
                    preference.setOrigennavigation("");
-
 
748
                    setTitleActionBar(getString(R.string.app_name));
-
 
749
                    invokeFragment(Constants.IDX_FRAGMENT_TOPICS);
-
 
750
 
-
 
751
                }
-
 
752
                else {
-
 
753
                    invokeFragment(Constants.IDX_FRAGMENT_CAPSULES);
-
 
Línea -... Línea 728...
-
 
728
                break;
-
 
729
 
754
                }
730
            case Constants.IDX_FRAGMENT_CAPSULES :
-
 
731
                invokeFragment(Constants.IDX_FRAGMENT_TOPICS);
755
 
732
                break;
Línea 756... Línea 733...
756
                break;
733
 
757
            case Constants.IDX_FRAGMENT_FINISH_TOPIC :
734
            case Constants.IDX_FRAGMENT_FINISH_TOPIC :
758
 
-
 
759
                preference.setTopicUuidActive("");
735
 
760
               // preference.setCapsuleUuidActive("");
736
                preference.setTopicUuidActive("");
Línea -... Línea 737...
-
 
737
                preference.setCapsuleUuidActive("");
-
 
738
                preference.setSlideUuidActive("");
-
 
739
                preference.save();
-
 
740
 
761
                setNoCapsuleActive();
741
                if(preference.getSourceNavigation() == Constants.SOURCE_NAVIGATION_MY_CAPSULES) {
-
 
742
                    setTitleActionBar(getString(R.string.app_name));
762
                preference.setSlideUuidActive("");
743
                    invokeFragment(Constants.IDX_FRAGMENT_MY_CAPSULES);
Línea 763... Línea 744...
763
                preference.save();
744
                } else {
Línea 764... Línea 745...
764
 
745
                    invokeFragment(Constants.IDX_FRAGMENT_TOPICS);
765
                invokeFragment(Constants.IDX_FRAGMENT_TOPICS);
-
 
766
                return;
746
                }
767
 
-
 
768
            case Constants.IDX_FRAGMENT_SLIDES :
-
 
Línea -... Línea 747...
-
 
747
                return;
769
 
748
 
-
 
749
            case Constants.IDX_FRAGMENT_SLIDES :
770
                if(preference.getOrigenNavigation().equals("welcome"))
750
 
771
                {
751
                preference.setSlideUuidActive("");
772
                    preference.setOrigennavigation("");
752
                preference.save();
Línea 773... Línea -...
773
                    setTitleActionBar(getString(R.string.app_name));
-
 
774
                    invokeFragment(Constants.IDX_FRAGMENT_WELCOME);
-
 
775
 
753
 
Línea 776... Línea -...
776
                }
-
 
777
                else {
-
 
778
                    invokeFragment(Constants.IDX_FRAGMENT_CAPSULES);
-
 
779
                }
-
 
780
 
-
 
781
 
-
 
782
 
-
 
783
                return;
-
 
784
 
-
 
785
            case Constants.IDX_FRAGMENT_GALLERY :
-
 
786
 
-
 
787
                if(preference.getOrigenNavigation().equals("welcome"))
-
 
788
                {
-
 
Línea 789... Línea 754...
789
                    preference.setOrigennavigation("");
754
                if(preference.getSourceNavigation() == Constants.SOURCE_NAVIGATION_MY_CAPSULES) {
790
                    setTitleActionBar(getString(R.string.app_name));
-
 
791
                    invokeFragment(Constants.IDX_FRAGMENT_WELCOME);
-
 
792
 
755
                    setTitleActionBar(getString(R.string.app_name));
793
                }
756
                    invokeFragment(Constants.IDX_FRAGMENT_MY_CAPSULES);
Línea -... Línea 757...
-
 
757
                } else {
-
 
758
                    invokeFragment(Constants.IDX_FRAGMENT_CAPSULES);
-
 
759
                }
-
 
760
 
794
                else {
761
                return;
-
 
762
 
-
 
763
 
795
                    invokeFragment(Constants.IDX_FRAGMENT_SLIDES);
764
            case Constants.IDX_FRAGMENT_FINISH_CAPSULE :
Línea -... Línea 765...
-
 
765
                preference.setSlideUuidActive("");
-
 
766
                preference.save();
-
 
767
 
796
                }
768
                if(preference.getSourceNavigation() == Constants.SOURCE_NAVIGATION_MY_CAPSULES) {
797
                return;
769
                    setTitleActionBar(getString(R.string.app_name));
Línea 1279... Línea 1251...
1279
                    add = true;
1251
                    add = true;
1280
                    fragment = new UserProfileFragment();
1252
                    fragment = new UserProfileFragment();
1281
                }
1253
                }
1282
                break;
1254
                break;
Línea 1283... Línea 1255...
1283
 
1255
 
1284
            case Constants.IDX_FRAGMENT_WELCOME:
1256
            case Constants.IDX_FRAGMENT_MY_CAPSULES:
1285
               // badgenotification.setVisibility(View.VISIBLE);
1257
               // badgenotification.setVisibility(View.VISIBLE);
1286
                // getSupportActionBar().show();
1258
                // getSupportActionBar().show();
1287
                //  mDrawerToggle.setDrawerIndicatorEnabled(true);
1259
                //  mDrawerToggle.setDrawerIndicatorEnabled(true);
1288
                if(fragmentHashMap.containsKey(fragmentKeyNuevo)) {
1260
                if(fragmentHashMap.containsKey(fragmentKeyNuevo)) {
1289
                    fragment = fragmentHashMap.get(fragmentKeyNuevo);
1261
                    fragment = fragmentHashMap.get(fragmentKeyNuevo);
1290
                } else {
1262
                } else {
1291
                    add = true;
1263
                    add = true;
1292
                    fragment = new WelcomeFragment();
1264
                    fragment = new MyCapsulesFragment();
1293
                  //  Log.e("Vete"," a welcome");
1265
                  //  Log.e("Vete"," a welcome");
1294
                }
1266
                }
Línea 1295... Línea 1267...
1295
                break;
1267
                break;
Línea 1339... Línea 1311...
1339
    }
1311
    }
Línea 1340... Línea 1312...
1340
 
1312
 
1341
    @Override
1313
    @Override
1342
    public void changeTopicActive(String topicUuid)
1314
    public void changeTopicActive(String topicUuid)
1343
    {
1315
    {
1344
        Log.d(TAG, "changeTopicActive : " + topicUuid);
-
 
1345
       // Log.e("Guardo", "Topico en Main");
-
 
1346
 
1316
        preference.setSourceNavigation(Constants.SOURCE_NAVIGATION_MY_CAPSULES);
1347
        preference.setTopicUuidActive(topicUuid);
-
 
1348
       // preference.setCapsuleUuidActive("");
-
 
1349
        setNoCapsuleActive();
1317
        preference.setTopicUuidActive(topicUuid);
1350
        preference.setSlideUuidActive("");
1318
        preference.setSlideUuidActive("");
Línea 1351... Línea 1319...
1351
        preference.save();
1319
        preference.save();
1352
 
1320
 
Línea 1353... Línea 1321...
1353
        invokeFragment(Constants.IDX_FRAGMENT_CAPSULES);
1321
        invokeFragment(Constants.IDX_FRAGMENT_CAPSULES);
1354
    }
1322
    }
1355
 
1323
 
-
 
1324
    @Override
1356
    @Override
1325
    public void changeCapsuleActiveSourceNavigationMyCapsules(String topicUuid, String capsuleUuid)
-
 
1326
    {
-
 
1327
        preference.setTopicUuidActive(topicUuid);
-
 
1328
        preference.setCapsuleUuidActive(capsuleUuid);
-
 
1329
        preference.setSlideUuidActive("");
-
 
1330
        preference.setSourceNavigation(Constants.SOURCE_NAVIGATION_MY_CAPSULES);
Línea -... Línea 1331...
-
 
1331
        preference.save();
-
 
1332
 
Línea -... Línea 1333...
-
 
1333
        invokeFragment(Constants.IDX_FRAGMENT_SLIDES);
-
 
1334
 
-
 
1335
        ProgressDao progressDao = getDatabase().getProgressDao();
1357
    public void changeCapsuleActive(String capsuleUuid)
1336
        Progress progress = progressDao.selectByCapsuleUuid(capsuleUuid);
-
 
1337
 
-
 
1338
        if (progress != null && progress.getCompleted() == 1) {
-
 
1339
            invokeFragment(Constants.IDX_FRAGMENT_DETAIL_CAPSULE);
-
 
1340
        } else {
-
 
1341
            invokeFragment(Constants.IDX_FRAGMENT_SLIDES);
-
 
1342
        }
-
 
1343
    }
-
 
1344
 
1358
    {
1345
    @Override
1359
        Log.d(TAG, "changeCapsuleActive : " + capsuleUuid);
1346
    public void changeCapsuleActiveSourceNavigationTopics(String capsuleUuid)
-
 
1347
    {
1360
 
1348
        Log.d(TAG, "changeCapsuleActiveSourceNavigationTopics capsuleUuid : " + capsuleUuid );
Línea 1361... Línea 1349...
1361
 
1349
 
1362
     //   preference.setCapsuleUuidActive(capsuleUuid);
1350
        preference.setCapsuleUuidActive(capsuleUuid);
Línea 1363... Línea -...
1363
        setCapsulaActiva(capsuleUuid);
-
 
1364
        preference.setSlideUuidActive("");
1351
        preference.setSlideUuidActive("");
1365
        preference.save();
1352
        preference.setSourceNavigation(Constants.SOURCE_NAVIGATION_TOPICS);
1366
 
1353
        preference.save();
1367
        Progress progress; ProgressDao progressDao = getDatabase().getProgressDao();
1354
 
1368
        progress = progressDao.selectByCapsuleUuid(capsuleUuid);
-
 
1369
 
1355
        ProgressDao progressDao = getDatabase().getProgressDao();
-
 
1356
        Progress progress = progressDao.selectByCapsuleUuid(capsuleUuid);
-
 
1357
 
1370
        if(progress != null) {
1358
        if (progress != null && progress.getCompleted() == 1) {
-
 
1359
            invokeFragment(Constants.IDX_FRAGMENT_DETAIL_CAPSULE);
1371
            if (progress.getProgress() >= 100 && progress.getCompleted() == 1) {
1360
        } else {
-
 
1361
            invokeFragment(Constants.IDX_FRAGMENT_SLIDES);
-
 
1362
        }
-
 
1363
    }
-
 
1364
 
-
 
1365
    @Override
-
 
1366
    public void changeCapsuleActive(String capsuleUuid)
-
 
1367
    {
-
 
1368
        Log.d(TAG, "changeCapsuleActive capsuleUuid : " + capsuleUuid );
-
 
1369
 
-
 
1370
        preference.setCapsuleUuidActive(capsuleUuid);
-
 
1371
        preference.setSlideUuidActive("");
-
 
1372
        preference.save();
1372
                invokeFragment(Constants.IDX_FRAGMENT_DETAIL_CAPSULE);
1373
 
Línea 1373... Línea 1374...
1373
            } else {
1374
        ProgressDao progressDao = getDatabase().getProgressDao();
1374
                invokeFragment(Constants.IDX_FRAGMENT_SLIDES);
1375
        Progress progress = progressDao.selectByCapsuleUuid(capsuleUuid);
Línea -... Línea 1376...
-
 
1376
 
1375
            }
1377
        if (progress != null && progress.getCompleted() == 1) {
Línea 1376... Línea 1378...
1376
        }
1378
            invokeFragment(Constants.IDX_FRAGMENT_DETAIL_CAPSULE);
Línea 1377... Línea 1379...
1377
        else
1379
        } else {
1378
        {
1380
            invokeFragment(Constants.IDX_FRAGMENT_SLIDES);
Línea 1379... Línea 1381...
1379
            invokeFragment(Constants.IDX_FRAGMENT_SLIDES);
1381
 
1380
 
1382
        }
1381
        }
1383
    }
1382
    }
1384
 
Línea 1383... Línea 1385...
1383
 
1385
    /*
1384
    public void setCapsulaActiva(String capsuleUuid) {
1386
    public void setCapsulaActiva(String capsuleUuid) {
Línea -... Línea 1387...
-
 
1387
 
-
 
1388
        ConfigDao configuracion =  mAppDatabase.getConfigDao();
1385
 
1389
 
1386
        ConfigDao configuracion =  mAppDatabase.getConfigDao();
1390
        Config actual = configuracion.selectConfigByTitle("act_capsule");
1387
 
1391
        com.cesams.twogetskills.entity.Config confignueva;
1388
        Config actual = configuracion.selectConfigByTitle("act_capsule");
1392
 
Línea 1425... Línea 1429...
1425
 
1429
 
1426
        }
1430
        }
Línea 1427... Línea 1431...
1427
    }
1431
    }
-
 
1432
 
-
 
1433
    @Override
-
 
1434
    public int getSourceNavigation() {
-
 
1435
        return preference.getSourceNavigation();
-
 
1436
    }
-
 
1437
 
-
 
1438
    @Override
-
 
1439
    public
-
 
1440
    void setSourceNavigation(int sourceNavigation) {
-
 
1441
        preference.setSourceNavigation(sourceNavigation);
-
 
1442
    }
-
 
1443
 
-
 
1444
    @Override
-
 
1445
    public void setTopicUuidActive(String topicUuid) {
-
 
1446
        preference.setTopicUuidActive(topicUuid);
-
 
1447
    }
-
 
1448
 
-
 
1449
    @Override
-
 
1450
    public void setCapsuleUuidActive(String capsuleUuid) {
-
 
1451
        preference.setCapsuleUuidActive(capsuleUuid);
-
 
1452
    }
-
 
1453
 
-
 
1454
    @Override
-
 
1455
    public void setSlideUuidActive(String slideUuid) {
-
 
1456
        preference.setSlideUuidActive(slideUuid);
-
 
1457
    }
1428
 
1458
 
1429
    @Override
1459
    @Override
1430
    public String getTopicUuidActive()
1460
    public String getTopicUuidActive()
1431
    {
1461
    {
Línea 1432... Línea 1462...
1432
        return preference.getTopicUuidActive();
1462
        return preference.getTopicUuidActive();
1433
    }
1463
    }
1434
 
1464
 
1435
    @Override
1465
    @Override
1436
    public String getCapsuleUuidActive()
-
 
1437
    {
-
 
1438
       // return preference.getCapsuleUuidActive();
-
 
1439
 
-
 
1440
        ConfigDao configuracion =  mAppDatabase.getConfigDao();
-
 
1441
        Config config = configuracion.selectConfigByTitle("act_capsule");
1466
    public String getCapsuleUuidActive()
Línea 1442... Línea 1467...
1442
        Log.e("algo","aqui"+config.getNow());
1467
    {
1443
        return config.getNow();
1468
        return preference.getCapsuleUuidActive();
1444
    }
1469
    }
Línea 1641... Línea 1666...
1641
        } else {
1666
        } else {
1642
            newRecord = false;
1667
            newRecord = false;
1643
            progressCapsule.setViewSlides(viewSlides);
1668
            progressCapsule.setViewSlides(viewSlides);
1644
            progressCapsule.setTotalSlides(totalSlides);
1669
            progressCapsule.setTotalSlides(totalSlides);
1645
            progressCapsule.setProgress(percentaje);
1670
            progressCapsule.setProgress(percentaje);
-
 
1671
            progressCapsule.setUpdatedOn(dateOn);
Línea 1646... Línea 1672...
1646
 
1672
 
1647
            Log.d(TAG, "Progress Capsule : getLastCapsuleActive : " + preference.getLastCapsuleUuidActive());
1673
            Log.d(TAG, "Progress Capsule : getLastCapsuleActive : " + preference.getLastCapsuleUuidActive());
Línea 1648... Línea 1674...
1648
            Log.d(TAG, "Progress Capsule : CapsuleActive : " + preference.getCapsuleUuidActive());
1674
           // Log.d(TAG, "Progress Capsule : CapsuleActive : " + preference.getCapsuleUuidActive());
Línea 1649... Línea 1675...
1649
 
1675
 
1650
            if (!preference.getLastCapsuleUuidActive().equals(getCapsuleUuidActive())) {
1676
            if (!preference.getLastCapsuleUuidActive().equals(getCapsuleUuidActive())) {
Línea 2007... Línea 2033...
2007
 
2033
 
Línea 2008... Línea 2034...
2008
                //Log.d("requestCheckChanges", "secret = " + secret);
2034
                //Log.d("requestCheckChanges", "secret = " + secret);
-
 
2035
 
-
 
2036
 
2009
 
2037
                FormBody.Builder formBodyCheckChangeBuilder = new FormBody.Builder();
2010
 
2038
                formBodyCheckChangeBuilder.add(Constants.POST_MICROLEARNING_CHECK_CHANGES_FIELD_APPLICATION_ID, String.valueOf(Configuration.APPLICATION_ID));
2011
                FormBody.Builder formBodyCheckChangeBuilder = new FormBody.Builder();
2039
                formBodyCheckChangeBuilder.add(Constants.POST_MICROLEARNING_CHECK_CHANGES_FIELD_VARIANT_ID, String.valueOf(Configuration.VARIANT_ID));
2012
                formBodyCheckChangeBuilder.add(Constants.POST_MICROLEARNING_CHECK_CHANGES_DEVICE_UUID, preference.getDeviceUuid());
2040
                formBodyCheckChangeBuilder.add(Constants.POST_MICROLEARNING_CHECK_CHANGES_FIELD_DEVICE_UUID, preference.getDeviceUuid());
2013
                formBodyCheckChangeBuilder.add(Constants.POST_MICROLEARNING_CHECK_CHANGES_MAX_DATE_CHANGES, preference.getMaxDateChanges());
2041
                formBodyCheckChangeBuilder.add(Constants.POST_MICROLEARNING_CHECK_CHANGES_FIELD_MAX_DATE_CHANGES, preference.getMaxDateChanges());
Línea 2014... Línea 2042...
2014
                formBodyCheckChangeBuilder.add(Constants.POST_MICROLEARNING_CHECK_CHANGES_IS_FOREGROUND, String.valueOf(isForeground ? 1 : 0));
2042
                formBodyCheckChangeBuilder.add(Constants.POST_MICROLEARNING_CHECK_CHANGES_FIELD_IS_FOREGROUND, String.valueOf(isForeground ? 1 : 0));
2015
                Http http = new Http(this.getCacheDir(), preference.getDeviceUuid(), secret, created, rand);
2043
                Http http = new Http(this.getCacheDir(), preference.getDeviceUuid(), secret, created, rand);
Línea 2016... Línea 2044...
2016
                OkHttpClient client = http.getHttpClient(false);
2044
                OkHttpClient client = http.getHttpClient(false);
2017
 
2045
 
2018
 
2046
 
2019
 
2047
 
Línea 2020... Línea 2048...
2020
                formBodyCheckChangeBuilder.add(Constants.POST_MICROLEARNING_CHECK_CHANGES_MAX_IDS, String.valueOf(capsules.size()));
2048
                formBodyCheckChangeBuilder.add(Constants.POST_MICROLEARNING_CHECK_CHANGES_FIELD_MAX_IDS, String.valueOf(capsules.size()));
2021
                //formBodyCheckChangeBuilder.add(Constants.POST_MICROLEARNING_CHECK_CHANGES_MAX_IDS, String.valueOf(0));
2049
                //formBodyCheckChangeBuilder.add(Constants.POST_MICROLEARNING_CHECK_CHANGES_MAX_IDS, String.valueOf(0));
2022
 
2050
 
Línea 2039... Línea 2067...
2039
                        .url(Configuration.URL_CHECK_CHANGES)
2067
                        .url(Configuration.URL_CHECK_CHANGES)
2040
                        .post(formBody)
2068
                        .post(formBody)
2041
                        .build();
2069
                        .build();
Línea 2042... Línea 2070...
2042
 
2070
 
2043
                Call call = client.newCall(request);
2071
                Call call = client.newCall(request);
2044
                call.enqueue(new Callback() {
2072
                call.enqueue(new okhttp3.Callback() {
2045
                    public void onResponse(Call call, Response response)
2073
                    public void onResponse(Call call, Response response)
Línea 2347... Línea 2375...
2347
                    arrayCapsules = objTopic.getJSONArray("capsules");
2375
                    arrayCapsules = objTopic.getJSONArray("capsules");
2348
                  //  Log.e("Objeto:",""+objTopic.getJSONArray("capsules"));
2376
                  //  Log.e("Objeto:",""+objTopic.getJSONArray("capsules"));
Línea 2349... Línea 2377...
2349
 
2377
 
2350
                    for (j = 0; j < arrayCapsules.length(); j++) {
2378
                    for (j = 0; j < arrayCapsules.length(); j++) {
-
 
2379
                        objCapsule = arrayCapsules.getJSONObject(j);
2351
                        objCapsule = arrayCapsules.getJSONObject(j);
2380
                        Log.e("Capsula:",""+objCapsule.toString());
2352
                        uuid = objCapsule.getString("uuid");
2381
                        uuid = objCapsule.getString("uuid");
2353
                        capsule = capsuleDao.selectByUuid(uuid);
2382
                        capsule = capsuleDao.selectByUuid(uuid);
2354
                        if(capsule == null) {
2383
                        if(capsule == null) {
2355
                            capsule = new Capsule();
2384
                            capsule = new Capsule();
Línea 2359... Línea 2388...
2359
                            capsule.setDescription(objCapsule.getString("description"));
2388
                            capsule.setDescription(objCapsule.getString("description"));
2360
                            capsule.setImage(objCapsule.getString("image"));
2389
                            capsule.setImage(objCapsule.getString("image"));
2361
                            capsule.setPosition(objCapsule.getInt("position"));
2390
                            capsule.setPosition(objCapsule.getInt("position"));
2362
                            capsule.setAddedOn(objCapsule.getString("added_on"));
2391
                            capsule.setAddedOn(objCapsule.getString("added_on"));
2363
                            capsule.setUpdatedOn(objCapsule.getString("updated_on"));
2392
                            capsule.setUpdatedOn(objCapsule.getString("updated_on"));
2364
                            capsule.setLink_comments(objCapsule.getString("link_comments"));
2393
                            capsule.setLinkComments(objCapsule.getString("link_comments"));
2365
                            capsule.setLink_comment_add(objCapsule.getString("link_comment_add"));
2394
                            capsule.setLinkCommentAdd(objCapsule.getString("link_comment_add"));
2366
                            capsule.setTotal_comments(objCapsule.getInt("total_comments"));
2395
                            capsule.setTotalComments(objCapsule.getInt("total_comments"));
2367
                            capsule.setTotal_rating(objCapsule.getInt("total_rating"));
2396
                            capsule.setTotalRating(objCapsule.getInt("total_rating"));
2368
 
-
 
2369
                            Log.e("link1",""+objCapsule.getString("link_comments"));
-
 
2370
                            Log.e("link2",""+objCapsule.getString("link_comment_add"));
-
 
2371
                            Log.e("totalcom",""+objCapsule.getInt("total_comments"));
-
 
2372
                            Log.e("totalta",""+objCapsule.getInt("total_rating"));
-
 
Línea 2373... Línea 2397...
2373
 
2397
 
2374
                            // Log.e("Capsula ","added on"+objCapsule.getString("added_on"));
2398
                            // Log.e("Capsula ","added on"+objCapsule.getString("added_on"));
-
 
2399
                            capsuleDao.insert(capsule);
2375
                            capsuleDao.insert(capsule);
2400
 
2376
                        } else {
2401
                        } else {
2377
                            capsule = new Capsule();
2402
                            capsule = new Capsule();
2378
                            capsule.setTopicUuid(topic.getUuid());
2403
                            capsule.setTopicUuid(topic.getUuid());
2379
                            capsule.setName(objCapsule.getString("name"));
2404
                            capsule.setName(objCapsule.getString("name"));
2380
                            capsule.setDescription(objCapsule.getString("description"));
2405
                            capsule.setDescription(objCapsule.getString("description"));
2381
                            capsule.setImage(objCapsule.getString("image"));
2406
                            capsule.setImage(objCapsule.getString("image"));
2382
                            capsule.setPosition(objCapsule.getInt("position"));
2407
                            capsule.setPosition(objCapsule.getInt("position"));
2383
                            capsule.setAddedOn(objCapsule.getString("added_on"));
2408
                            capsule.setAddedOn(objCapsule.getString("added_on"));
2384
                            capsule.setUpdatedOn(objCapsule.getString("updated_on"));
2409
                            capsule.setUpdatedOn(objCapsule.getString("updated_on"));
2385
                            capsule.setLink_comments(objCapsule.getString("link_comments"));
2410
                            capsule.setLinkComments(objCapsule.getString("link_comments"));
2386
                            capsule.setLink_comment_add(objCapsule.getString("link_comment_add"));
2411
                            capsule.setLinkCommentAdd(objCapsule.getString("link_comment_add"));
2387
                            capsule.setTotal_comments(objCapsule.getInt("total_comments"));
2412
                            capsule.setTotalComments(objCapsule.getInt("total_comments"));
2388
                            capsule.setTotal_rating(objCapsule.getInt("total_rating"));
2413
                            capsule.setTotalRating(objCapsule.getInt("total_rating"));
2389
                           // Log.e("Capsula ","added on"+objCapsule.getString("added_on"));
2414
                           // Log.e("Capsula ","added on"+objCapsule.getString("added_on"));
2390
                            capsuleDao.update(capsule);
2415
                            capsuleDao.update(capsule);
Línea 2794... Línea 2819...
2794
                    RequestBody formBody = new FormBody.Builder()
2819
                    RequestBody formBody = new FormBody.Builder()
2795
                            .add(Constants.POST_DEVICE_FIELD_APPLICATION_ID,  String.valueOf(Configuration.APPLICATION_ID))
2820
                            .add(Constants.POST_DEVICE_FIELD_APPLICATION_ID,  String.valueOf(Configuration.APPLICATION_ID))
2796
                            .add(Constants.POST_DEVICE_FIELD_DEVICE_UUID, preference.getDeviceUuid())
2821
                            .add(Constants.POST_DEVICE_FIELD_DEVICE_UUID, preference.getDeviceUuid())
2797
                            .add(Constants.POST_DEVICE_FIELD_MANUFACTURER, Build.MANUFACTURER)
2822
                            .add(Constants.POST_DEVICE_FIELD_MANUFACTURER, Build.MANUFACTURER)
2798
                            .add(Constants.POST_DEVICE_FIELD_BRAND, Build.BRAND)
2823
                            .add(Constants.POST_DEVICE_FIELD_BRAND, Build.BRAND)
2799
                            .add(Constants.POST_DEVICE_FIELD_VERSION, Build.VERSION.RELEASE  + " " + Build.VERSION_CODES.class.getFields()[Build.VERSION.SDK_INT].getName())
2824
                            .add(Constants.POST_DEVICE_FIELD_VERSION, Build.VERSION.RELEASE  + " " + Build.VERSION_CODES.class.getFields()[android.os.Build.VERSION.SDK_INT].getName())
2800
                            .add(Constants.POST_DEVICE_FIELD_MODEL, Build.MODEL)
2825
                            .add(Constants.POST_DEVICE_FIELD_MODEL, Build.MODEL)
2801
                            .add(Constants.POST_DEVICE_FIELD_PLATFORM, "android")
2826
                            .add(Constants.POST_DEVICE_FIELD_PLATFORM, "android")
2802
                            .add(Constants.POST_DEVICE_FIELD_SYNC_ID, String.valueOf(record.getId()))
2827
                            .add(Constants.POST_DEVICE_FIELD_SYNC_ID, String.valueOf(record.getId()))
2803
                            .build();
2828
                            .build();
Línea 2809... Línea 2834...
2809
                            .build();
2834
                            .build();
Línea 2810... Línea 2835...
2810
 
2835
 
Línea 2811... Línea 2836...
2811
                    isSyncDevice = true;
2836
                    isSyncDevice = true;
2812
 
2837
 
2813
                    Call call = client.newCall(request);
2838
                    Call call = client.newCall(request);
2814
                    call.enqueue(new Callback() {
2839
                    call.enqueue(new okhttp3.Callback() {
2815
                        public void onResponse(Call call, Response response)
2840
                        public void onResponse(Call call, Response response)
2816
                                throws IOException {
2841
                                throws IOException {
Línea 2837... Línea 2862...
2837
                try {
2862
                try {
2838
                    Http http = new Http(this.getCacheDir());
2863
                    Http http = new Http(this.getCacheDir());
2839
                    OkHttpClient client = http.getHttpClient(false);
2864
                    OkHttpClient client = http.getHttpClient(false);
Línea 2840... Línea 2865...
2840
 
2865
 
-
 
2866
                    RequestBody formBody = new FormBody.Builder()
-
 
2867
                            .add(Constants.POST_FCM_FIELD_APPLICATION_ID,String.valueOf(Configuration.APPLICATION_ID))
2841
                    RequestBody formBody = new FormBody.Builder()
2868
                            .add(Constants.POST_FCM_FIELD_VARIANT_ID,String.valueOf(Configuration.VARIANT_ID))
2842
                            .add(Constants.POST_FCM_FIELD_DEVICE_UUID,preference.getDeviceUuid())
2869
                            .add(Constants.POST_FCM_FIELD_DEVICE_UUID,preference.getDeviceUuid())
2843
                            .add(Constants.POST_FCM_FIELD_TOKEN, record.getData())
2870
                            .add(Constants.POST_FCM_FIELD_TOKEN, record.getData())
2844
                            .add(Constants.POST_FCM_FIELD_SYNC_ID, String.valueOf(record.getId()))
2871
                            .add(Constants.POST_FCM_FIELD_SYNC_ID, String.valueOf(record.getId()))
Línea 2849... Línea 2876...
2849
                            .url(Configuration.URL_FCM)
2876
                            .url(Configuration.URL_FCM)
2850
                            .post(formBody)
2877
                            .post(formBody)
2851
                            .build();
2878
                            .build();
Línea 2852... Línea 2879...
2852
 
2879
 
2853
                    Call call = client.newCall(request);
2880
                    Call call = client.newCall(request);
2854
                    call.enqueue(new Callback() {
2881
                    call.enqueue(new okhttp3.Callback() {
2855
                        public void onResponse(Call call, Response response)
2882
                        public void onResponse(Call call, Response response)
2856
                                throws IOException {
2883
                                throws IOException {
2857
                            isSyncToken = false;
2884
                            isSyncToken = false;
2858
                            Log.e("Se envio", "Procesando respuesta");
2885
                            Log.e("Se envio", "Procesando respuesta");
Línea 2885... Línea 2912...
2885
 
2912
 
2886
            try {
2913
            try {
2887
                Http http = new Http(this.getCacheDir());
2914
                Http http = new Http(this.getCacheDir());
Línea -... Línea 2915...
-
 
2915
                OkHttpClient client = http.getHttpClient(false);
-
 
2916
 
2888
                OkHttpClient client = http.getHttpClient(false);
2917
                formBodyBatchBuilder.add(Constants.POST_SYNC_BATCH_FIELD_APPLICATION_ID, String.valueOf(Configuration.APPLICATION_ID));
2889
 
2918
                formBodyBatchBuilder.add(Constants.POST_SYNC_BATCH_FIELD_VARIANT_ID, String.valueOf(Configuration.VARIANT_ID));
Línea 2890... Línea 2919...
2890
                formBodyBatchBuilder.add(Constants.POST_SYNC_BATCH_FIELD_MAX_RECORDS, String.valueOf(maxRecordsSyncBatch));
2919
                formBodyBatchBuilder.add(Constants.POST_SYNC_BATCH_FIELD_MAX_RECORDS, String.valueOf(maxRecordsSyncBatch));
2891
                RequestBody formBody = formBodyBatchBuilder.build();
2920
                RequestBody formBody = formBodyBatchBuilder.build();
2892
 
2921
 
2893
                Log.d(TAG, "URL = " + Configuration.URL_SYNC_BATCH);
2922
                Log.d(TAG, "URL = " + Configuration.URL_SYNC_BATCH);
2894
                Request request = new Request.Builder()
2923
                Request request = new Request.Builder()
Línea 2895... Línea 2924...
2895
                    .url(Configuration.URL_SYNC_BATCH)
2924
                    .url(Configuration.URL_SYNC_BATCH)
2896
                    .post(formBody)
2925
                    .post(formBody)
2897
                    .build();
2926
                    .build();
2898
 
2927
 
2899
                Call call = client.newCall(request);
2928
                Call call = client.newCall(request);
2900
                call.enqueue(new Callback() {
2929
                call.enqueue(new okhttp3.Callback() {