Proyectos de Subversion Android Microlearning - Inconcert

Rev

Rev 18 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 18 Rev 19
Línea 174... Línea 174...
174
 
174
 
175
        if (inProgress) {
175
        if (inProgress) {
176
            return;
176
            return;
Línea -... Línea 177...
-
 
177
        }
-
 
178
 
-
 
179
        String deviceAes = iTwoGetSkills.getPreference().getAes();
-
 
180
        String devicePassword = iTwoGetSkills.getPreference().getPassword();
-
 
181
        if (deviceAes.isEmpty() || devicePassword.isEmpty()) {
-
 
182
 
-
 
183
            iTwoGetSkills.showMessageSnackBar("Dispositivo no registrado, intente nuevamente");
-
 
184
 
-
 
185
            SyncDao syncDao = iTwoGetSkills.getDatabase().getSyncDao();
-
 
186
            Sync sync = syncDao.selectOneByType(Constants.SYNC_ADAPTER_TYPE_DEVICE);
-
 
187
 
-
 
188
            if(sync == null) {
-
 
189
                if (!iTwoGetSkills.getPreference().getDeviceUuid().isEmpty()) {
-
 
190
                    sync = new Sync(Constants.SYNC_ADAPTER_TYPE_DEVICE, iTwoGetSkills.getPreference().getDeviceUuid());
-
 
191
                    syncDao.insert(sync);
-
 
192
                    iTwoGetSkills.registerDevice(sync);
-
 
193
                }
-
 
194
            } else {
-
 
195
                iTwoGetSkills.registerDevice(sync);
-
 
196
            }
-
 
197
 
-
 
198
            return;
-
 
199
        }
177
        }
200
 
178
 
201
 
179
        /*
202
        /*
180
        if(TextUtils.isEmpty(iTwoGetSkills.getPreference().getAes())) {
203
        if(TextUtils.isEmpty(iTwoGetSkills.getPreference().getAes())) {
181
            iTwoGetSkills.reloadPreference();
204
            iTwoGetSkills.reloadPreference();
Línea 226... Línea 249...
226
            mButtonSignIn.setEnabled(false);
249
            mButtonSignIn.setEnabled(false);
227
            iTwoGetSkills.showProgressBar();
250
            iTwoGetSkills.showProgressBar();
Línea 228... Línea 251...
228
 
251
 
Línea 229... Línea 252...
229
            try {
252
            try {
Línea 230... Línea 253...
230
 
253
 
231
                Log.d("AES", aes);
254
                Log.d("AES", deviceAes);
Línea 232... Línea 255...
232
 
255
 
Línea 233... Línea 256...
233
                Http http = new Http(getActivity().getCacheDir());
256
                Http http = new Http(getActivity().getCacheDir());
234
                OkHttpClient client = http.getHttpClient(false);
257
                OkHttpClient client = http.getHttpClient(false);
235
 
258
 
236
                Log.d(TAG, "URL = " + Configuration.URL_SIGNIN);
259
                Log.d(TAG, "URL = " + Configuration.URL_SIGNIN);
237
 
260
 
238
                RequestBody formBody = null;
261
                RequestBody formBody = null;
239
                if(aes.isEmpty()) {
262
              /*  if(aes.isEmpty()) {
240
                    formBody = new FormBody.Builder()
263
                    formBody = new FormBody.Builder()
241
                            .add(Constants.POST_SIGNIN_FIELD_APPLICATION_ID, String.valueOf(Configuration.APPLICATION_ID))
264
                            .add(Constants.POST_SIGNIN_FIELD_APPLICATION_ID, String.valueOf(Configuration.APPLICATION_ID))
242
                            .add(Constants.POST_SIGNIN_FIELD_DEVICE_UUID, iTwoGetSkills.getPreference().getDeviceUuid())
265
                            .add(Constants.POST_SIGNIN_FIELD_DEVICE_UUID, iTwoGetSkills.getPreference().getDeviceUuid())
243
                            .add(Constants.POST_SIGNIN_FIELD_EMAIL, email)
266
                            .add(Constants.POST_SIGNIN_FIELD_EMAIL, email)
244
                            .add(Constants.POST_SIGNIN_FIELD_PASSWORD, password)
267
                            .add(Constants.POST_SIGNIN_FIELD_PASSWORD, password)
Línea 245... Línea 268...
245
                            .add(Constants.POST_SIGNIN_FIELD_DEVICE_ENCRYPTER, "") //Constants.SIGNIN_ENCRYPTER)
268
                            .add(Constants.POST_SIGNIN_FIELD_DEVICE_ENCRYPTER, "") //Constants.SIGNIN_ENCRYPTER)
246
                            .build();
269
                            .build();
247
                } else {
270
                } else {*/
248
                    AesCipher encryptedEmail    = AesCipher.encrypt(aes, email);
271
                    AesCipher encryptedEmail    = AesCipher.encrypt(deviceAes, email);
249
                    AesCipher encryptedPassword = AesCipher.encrypt(aes, password);
272
                    AesCipher encryptedPassword = AesCipher.encrypt(deviceAes, password);
250
 
273
 
251
                    formBody = new FormBody.Builder()
274
                    formBody = new FormBody.Builder()
252
                            .add(Constants.POST_SIGNIN_FIELD_APPLICATION_ID, String.valueOf(Configuration.APPLICATION_ID))
275
                            .add(Constants.POST_SIGNIN_FIELD_APPLICATION_ID, String.valueOf(Configuration.APPLICATION_ID))
253
                            .add(Constants.POST_SIGNIN_FIELD_VARIANT_ID, String.valueOf(Configuration.VARIANT_ID))
276
                            .add(Constants.POST_SIGNIN_FIELD_VARIANT_ID, String.valueOf(Configuration.VARIANT_ID))