Showing
6 changed files
with
106 additions
and
74 deletions
| ... | @@ -3,7 +3,7 @@ | ... | @@ -3,7 +3,7 @@ |
| 3 | # The app uuid the warply sdk need to connect to the engage server | 3 | # The app uuid the warply sdk need to connect to the engage server |
| 4 | # dev f83dfde1145e4c2da69793abb2f579af | 4 | # dev f83dfde1145e4c2da69793abb2f579af |
| 5 | # prod 0086a2088301440792091b9f814c2267 | 5 | # prod 0086a2088301440792091b9f814c2267 |
| 6 | -Uuid=f83dfde1145e4c2da69793abb2f579af | 6 | +Uuid=0086a2088301440792091b9f814c2267 |
| 7 | 7 | ||
| 8 | # If we need to see logs in Logcat | 8 | # If we need to see logs in Logcat |
| 9 | Debug=true | 9 | Debug=true |
| ... | @@ -11,7 +11,7 @@ Debug=true | ... | @@ -11,7 +11,7 @@ Debug=true |
| 11 | # Production or Development environment of the engage server | 11 | # Production or Development environment of the engage server |
| 12 | # Production: https://engage.warp.ly | 12 | # Production: https://engage.warp.ly |
| 13 | # Development: https://engage-stage.warp.ly | 13 | # Development: https://engage-stage.warp.ly |
| 14 | -BaseURL=https://engage-stage.warp.ly | 14 | +BaseURL=https://engage.warp.ly |
| 15 | 15 | ||
| 16 | # For Verify Ticket request | 16 | # For Verify Ticket request |
| 17 | VerifyURL=/partners/cosmote/verify | 17 | VerifyURL=/partners/cosmote/verify | ... | ... |
| ... | @@ -36,7 +36,7 @@ public class SplashActivity extends BaseActivity { | ... | @@ -36,7 +36,7 @@ public class SplashActivity extends BaseActivity { |
| 36 | public void onWarplyReady() { | 36 | public void onWarplyReady() { |
| 37 | if (!WarplyDBHelper.getInstance(SplashActivity.this).isTableNotEmpty("auth")) { | 37 | if (!WarplyDBHelper.getInstance(SplashActivity.this).isTableNotEmpty("auth")) { |
| 38 | WarplyManager.getCosmoteUser(new WarplyCosmoteUserRequest() | 38 | WarplyManager.getCosmoteUser(new WarplyCosmoteUserRequest() |
| 39 | - .setGuid("7000000831"), //6012049321, 6012049322, 6012049323, 7000000831 history, 7000000826, 7000000831 shared coupons, prod 6006552990, live 3000184910 | 39 | + .setGuid("6010139202"), //6012049321, 6012049322, 6012049323, 7000000831 history, 7000000826, 7000000831 shared coupons, prod 6006552990, live 3000184910 |
| 40 | mLoginReceiver); | 40 | mLoginReceiver); |
| 41 | } else { | 41 | } else { |
| 42 | startNextActivity(); | 42 | startNextActivity(); | ... | ... |
| ... | @@ -2,7 +2,7 @@ apply plugin: 'com.android.library' | ... | @@ -2,7 +2,7 @@ apply plugin: 'com.android.library' |
| 2 | 2 | ||
| 3 | ext { | 3 | ext { |
| 4 | PUBLISH_GROUP_ID = 'ly.warp' | 4 | PUBLISH_GROUP_ID = 'ly.warp' |
| 5 | - PUBLISH_VERSION = '4.5.4.6rc11' | 5 | + PUBLISH_VERSION = '4.5.4.6rc12' |
| 6 | PUBLISH_ARTIFACT_ID = 'warply-android-sdk' | 6 | PUBLISH_ARTIFACT_ID = 'warply-android-sdk' |
| 7 | } | 7 | } |
| 8 | 8 | ... | ... |
| ... | @@ -250,6 +250,7 @@ public class CouponsetInfoActivity extends Activity implements View.OnClickListe | ... | @@ -250,6 +250,7 @@ public class CouponsetInfoActivity extends Activity implements View.OnClickListe |
| 250 | onBackPressed(); | 250 | onBackPressed(); |
| 251 | } | 251 | } |
| 252 | }) | 252 | }) |
| 253 | + .setCancelable(false) | ||
| 253 | .show(); | 254 | .show(); |
| 254 | } | 255 | } |
| 255 | } else { | 256 | } else { | ... | ... |
| ... | @@ -35,7 +35,7 @@ public class WarplyDBHelper extends SQLiteOpenHelper { | ... | @@ -35,7 +35,7 @@ public class WarplyDBHelper extends SQLiteOpenHelper { |
| 35 | } | 35 | } |
| 36 | 36 | ||
| 37 | private static final String DB_NAME = "warply.db"; | 37 | private static final String DB_NAME = "warply.db"; |
| 38 | - private static final int DB_VERSION = 5; | 38 | + private static final int DB_VERSION = 6; |
| 39 | private static final String KEY_CIPHER = "tn#mpOl3v3Dy1pr@W"; | 39 | private static final String KEY_CIPHER = "tn#mpOl3v3Dy1pr@W"; |
| 40 | 40 | ||
| 41 | //------------------------------ Fields -----------------------------// | 41 | //------------------------------ Fields -----------------------------// |
| ... | @@ -222,10 +222,15 @@ public class WarplyDBHelper extends SQLiteOpenHelper { | ... | @@ -222,10 +222,15 @@ public class WarplyDBHelper extends SQLiteOpenHelper { |
| 222 | values.put(KEY_CLIENT_ID, clientId); | 222 | values.put(KEY_CLIENT_ID, clientId); |
| 223 | if (!TextUtils.isEmpty(clientSecret)) | 223 | if (!TextUtils.isEmpty(clientSecret)) |
| 224 | values.put(KEY_CLIENT_SECRET, clientSecret); | 224 | values.put(KEY_CLIENT_SECRET, clientSecret); |
| 225 | - if (isTableNotEmpty(TABLE_CLIENT)) | 225 | + if (isTableNotEmpty(TABLE_CLIENT)) { |
| 226 | - update(TABLE_CLIENT, values); | 226 | + new Thread(() -> { |
| 227 | - else | 227 | + update(TABLE_CLIENT, values); |
| 228 | - insert(TABLE_CLIENT, values); | 228 | + }).start(); |
| 229 | + } else { | ||
| 230 | + new Thread(() -> { | ||
| 231 | + insert(TABLE_CLIENT, values); | ||
| 232 | + }).start(); | ||
| 233 | + } | ||
| 229 | } | 234 | } |
| 230 | 235 | ||
| 231 | public synchronized void saveAuthAccess(String accessToken, String refreshToken) { | 236 | public synchronized void saveAuthAccess(String accessToken, String refreshToken) { |
| ... | @@ -234,10 +239,15 @@ public class WarplyDBHelper extends SQLiteOpenHelper { | ... | @@ -234,10 +239,15 @@ public class WarplyDBHelper extends SQLiteOpenHelper { |
| 234 | values.put(KEY_ACCESS_TOKEN, accessToken); | 239 | values.put(KEY_ACCESS_TOKEN, accessToken); |
| 235 | if (!TextUtils.isEmpty(refreshToken)) | 240 | if (!TextUtils.isEmpty(refreshToken)) |
| 236 | values.put(KEY_REFRESH_TOKEN, refreshToken); | 241 | values.put(KEY_REFRESH_TOKEN, refreshToken); |
| 237 | - if (isTableNotEmpty(TABLE_AUTH)) | 242 | + if (isTableNotEmpty(TABLE_AUTH)) { |
| 238 | - update(TABLE_AUTH, values); | 243 | + new Thread(() -> { |
| 239 | - else | 244 | + update(TABLE_AUTH, values); |
| 240 | - insert(TABLE_AUTH, values); | 245 | + }).start(); |
| 246 | + } else { | ||
| 247 | + new Thread(() -> { | ||
| 248 | + insert(TABLE_AUTH, values); | ||
| 249 | + }).start(); | ||
| 250 | + } | ||
| 241 | } | 251 | } |
| 242 | 252 | ||
| 243 | @Nullable | 253 | @Nullable |
| ... | @@ -265,11 +275,15 @@ public class WarplyDBHelper extends SQLiteOpenHelper { | ... | @@ -265,11 +275,15 @@ public class WarplyDBHelper extends SQLiteOpenHelper { |
| 265 | } | 275 | } |
| 266 | 276 | ||
| 267 | public synchronized void deleteClient() { | 277 | public synchronized void deleteClient() { |
| 268 | - clearTable(TABLE_CLIENT); | 278 | + new Thread(() -> { |
| 279 | + clearTable(TABLE_CLIENT); | ||
| 280 | + }).start(); | ||
| 269 | } | 281 | } |
| 270 | 282 | ||
| 271 | public synchronized void deleteAuth() { | 283 | public synchronized void deleteAuth() { |
| 272 | - clearTable(TABLE_AUTH); | 284 | + new Thread(() -> { |
| 285 | + clearTable(TABLE_AUTH); | ||
| 286 | + }).start(); | ||
| 273 | } | 287 | } |
| 274 | 288 | ||
| 275 | //------------------------------ Api requests -----------------------------// | 289 | //------------------------------ Api requests -----------------------------// |
| ... | @@ -298,47 +312,56 @@ public class WarplyDBHelper extends SQLiteOpenHelper { | ... | @@ -298,47 +312,56 @@ public class WarplyDBHelper extends SQLiteOpenHelper { |
| 298 | } | 312 | } |
| 299 | 313 | ||
| 300 | public synchronized void deleteAllRequests() { | 314 | public synchronized void deleteAllRequests() { |
| 301 | - clearTable(TABLE_REQUESTS); | 315 | + new Thread(() -> { |
| 316 | + clearTable(TABLE_REQUESTS); | ||
| 317 | + }).start(); | ||
| 302 | } | 318 | } |
| 303 | 319 | ||
| 304 | public synchronized void deleteAllPushRequests() { | 320 | public synchronized void deleteAllPushRequests() { |
| 305 | - clearTable(TABLE_PUSH_REQUESTS); | 321 | + new Thread(() -> { |
| 322 | + clearTable(TABLE_PUSH_REQUESTS); | ||
| 323 | + }).start(); | ||
| 306 | } | 324 | } |
| 307 | 325 | ||
| 308 | public synchronized void deleteAllPushAckRequests() { | 326 | public synchronized void deleteAllPushAckRequests() { |
| 309 | - clearTable(TABLE_PUSH_ACK_REQUESTS); | 327 | + new Thread(() -> { |
| 328 | + clearTable(TABLE_PUSH_ACK_REQUESTS); | ||
| 329 | + }).start(); | ||
| 310 | } | 330 | } |
| 311 | 331 | ||
| 312 | public synchronized long addRequest(String microapp, String entity, boolean force) { | 332 | public synchronized long addRequest(String microapp, String entity, boolean force) { |
| 313 | - | 333 | + new Thread(() -> { |
| 314 | - ContentValues values = new ContentValues(); | 334 | + ContentValues values = new ContentValues(); |
| 315 | - values.put(KEY_REQUESTS_MICROAPP, microapp); | 335 | + values.put(KEY_REQUESTS_MICROAPP, microapp); |
| 316 | - values.put(KEY_REQUESTS_ENTITY, entity); | 336 | + values.put(KEY_REQUESTS_ENTITY, entity); |
| 317 | - values.put(KEY_REQUESTS_FORCE, force ? 1 : 0); | 337 | + values.put(KEY_REQUESTS_FORCE, force ? 1 : 0); |
| 318 | - values.put(KEY_REQUESTS_DATE_ADDED, System.currentTimeMillis()); | 338 | + values.put(KEY_REQUESTS_DATE_ADDED, System.currentTimeMillis()); |
| 319 | - insert(TABLE_REQUESTS, values); | 339 | + insert(TABLE_REQUESTS, values); |
| 340 | + }).start(); | ||
| 320 | return getRequestsInQueueCount(); | 341 | return getRequestsInQueueCount(); |
| 321 | } | 342 | } |
| 322 | 343 | ||
| 323 | public synchronized long addPushRequest(String microapp, String entity, boolean force) { | 344 | public synchronized long addPushRequest(String microapp, String entity, boolean force) { |
| 324 | - | 345 | + new Thread(() -> { |
| 325 | - ContentValues values = new ContentValues(); | 346 | + ContentValues values = new ContentValues(); |
| 326 | - values.put(KEY_REQUESTS_MICROAPP, microapp); | 347 | + values.put(KEY_REQUESTS_MICROAPP, microapp); |
| 327 | - values.put(KEY_REQUESTS_ENTITY, entity); | 348 | + values.put(KEY_REQUESTS_ENTITY, entity); |
| 328 | - values.put(KEY_REQUESTS_FORCE, force ? 1 : 0); | 349 | + values.put(KEY_REQUESTS_FORCE, force ? 1 : 0); |
| 329 | - values.put(KEY_REQUESTS_DATE_ADDED, System.currentTimeMillis()); | 350 | + values.put(KEY_REQUESTS_DATE_ADDED, System.currentTimeMillis()); |
| 330 | - insert(TABLE_PUSH_REQUESTS, values); | 351 | + insert(TABLE_PUSH_REQUESTS, values); |
| 352 | + }).start(); | ||
| 331 | return getPushRequestsInQueueCount(); | 353 | return getPushRequestsInQueueCount(); |
| 332 | } | 354 | } |
| 333 | 355 | ||
| 334 | public synchronized long addPushAckRequest(String microapp, String entity, boolean force) { | 356 | public synchronized long addPushAckRequest(String microapp, String entity, boolean force) { |
| 335 | - | 357 | + new Thread(() -> { |
| 336 | - ContentValues values = new ContentValues(); | 358 | + ContentValues values = new ContentValues(); |
| 337 | - values.put(KEY_REQUESTS_MICROAPP, microapp); | 359 | + values.put(KEY_REQUESTS_MICROAPP, microapp); |
| 338 | - values.put(KEY_REQUESTS_ENTITY, entity); | 360 | + values.put(KEY_REQUESTS_ENTITY, entity); |
| 339 | - values.put(KEY_REQUESTS_FORCE, force ? 1 : 0); | 361 | + values.put(KEY_REQUESTS_FORCE, force ? 1 : 0); |
| 340 | - values.put(KEY_REQUESTS_DATE_ADDED, System.currentTimeMillis()); | 362 | + values.put(KEY_REQUESTS_DATE_ADDED, System.currentTimeMillis()); |
| 341 | - insert(TABLE_PUSH_ACK_REQUESTS, values); | 363 | + insert(TABLE_PUSH_ACK_REQUESTS, values); |
| 364 | + }).start(); | ||
| 342 | return getPushAckRequestsInQueueCount(); | 365 | return getPushAckRequestsInQueueCount(); |
| 343 | } | 366 | } |
| 344 | 367 | ||
| ... | @@ -365,7 +388,9 @@ public class WarplyDBHelper extends SQLiteOpenHelper { | ... | @@ -365,7 +388,9 @@ public class WarplyDBHelper extends SQLiteOpenHelper { |
| 365 | strFilter.append("="); | 388 | strFilter.append("="); |
| 366 | strFilter.append(ids[i]); | 389 | strFilter.append(ids[i]); |
| 367 | } | 390 | } |
| 368 | - getDb().delete(TABLE_REQUESTS, strFilter.toString(), null); | 391 | + new Thread(() -> { |
| 392 | + getDb().delete(TABLE_REQUESTS, strFilter.toString(), null); | ||
| 393 | + }).start(); | ||
| 369 | } | 394 | } |
| 370 | 395 | ||
| 371 | public synchronized void deletePushRequests(Long... ids) { | 396 | public synchronized void deletePushRequests(Long... ids) { |
| ... | @@ -379,7 +404,9 @@ public class WarplyDBHelper extends SQLiteOpenHelper { | ... | @@ -379,7 +404,9 @@ public class WarplyDBHelper extends SQLiteOpenHelper { |
| 379 | strFilter.append("="); | 404 | strFilter.append("="); |
| 380 | strFilter.append(ids[i]); | 405 | strFilter.append(ids[i]); |
| 381 | } | 406 | } |
| 382 | - getDb().delete(TABLE_PUSH_REQUESTS, strFilter.toString(), null); | 407 | + new Thread(() -> { |
| 408 | + getDb().delete(TABLE_PUSH_REQUESTS, strFilter.toString(), null); | ||
| 409 | + }).start(); | ||
| 383 | } | 410 | } |
| 384 | 411 | ||
| 385 | public synchronized void deletePushAckRequests(Long... ids) { | 412 | public synchronized void deletePushAckRequests(Long... ids) { |
| ... | @@ -393,7 +420,9 @@ public class WarplyDBHelper extends SQLiteOpenHelper { | ... | @@ -393,7 +420,9 @@ public class WarplyDBHelper extends SQLiteOpenHelper { |
| 393 | strFilter.append("="); | 420 | strFilter.append("="); |
| 394 | strFilter.append(ids[i]); | 421 | strFilter.append(ids[i]); |
| 395 | } | 422 | } |
| 396 | - getDb().delete(TABLE_PUSH_ACK_REQUESTS, strFilter.toString(), null); | 423 | + new Thread(() -> { |
| 424 | + getDb().delete(TABLE_PUSH_ACK_REQUESTS, strFilter.toString(), null); | ||
| 425 | + }).start(); | ||
| 397 | } | 426 | } |
| 398 | 427 | ||
| 399 | public synchronized boolean isForceRequestsExist() { | 428 | public synchronized boolean isForceRequestsExist() { |
| ... | @@ -431,43 +460,45 @@ public class WarplyDBHelper extends SQLiteOpenHelper { | ... | @@ -431,43 +460,45 @@ public class WarplyDBHelper extends SQLiteOpenHelper { |
| 431 | 460 | ||
| 432 | //------------------------------ Tags -----------------------------// | 461 | //------------------------------ Tags -----------------------------// |
| 433 | public synchronized void saveTags(String[] tags) { | 462 | public synchronized void saveTags(String[] tags) { |
| 434 | - | 463 | + new Thread(() -> { |
| 435 | - if (tags != null && tags.length > 0) { | 464 | + if (tags != null && tags.length > 0) { |
| 436 | - | 465 | + |
| 437 | - try { | 466 | + try { |
| 438 | - getDb().beginTransaction(); | 467 | + getDb().beginTransaction(); |
| 439 | - ContentValues values = new ContentValues(); | 468 | + ContentValues values = new ContentValues(); |
| 440 | - for (String tag : tags) { | 469 | + for (String tag : tags) { |
| 441 | - values.put(KEY_TAG, tag); | 470 | + values.put(KEY_TAG, tag); |
| 442 | - values.put(KEY_TAG_LAST_ADD_DATE, System.currentTimeMillis()); | 471 | + values.put(KEY_TAG_LAST_ADD_DATE, System.currentTimeMillis()); |
| 443 | - insert(TABLE_TAGS, values); | 472 | + insert(TABLE_TAGS, values); |
| 473 | + } | ||
| 474 | + getDb().setTransactionSuccessful(); | ||
| 475 | + | ||
| 476 | + } catch (SQLException e) { | ||
| 477 | + if (WarpConstants.DEBUG) { | ||
| 478 | + e.printStackTrace(); | ||
| 479 | + } | ||
| 480 | + } finally { | ||
| 481 | + getDb().endTransaction(); | ||
| 444 | } | 482 | } |
| 445 | - getDb().setTransactionSuccessful(); | ||
| 446 | - | ||
| 447 | - } catch (SQLException e) { | ||
| 448 | - if (WarpConstants.DEBUG) { | ||
| 449 | - e.printStackTrace(); | ||
| 450 | - } | ||
| 451 | - } finally { | ||
| 452 | - getDb().endTransaction(); | ||
| 453 | } | 483 | } |
| 454 | - } | 484 | + }).start(); |
| 455 | } | 485 | } |
| 456 | 486 | ||
| 457 | public synchronized void removeTags(String[] tags) { | 487 | public synchronized void removeTags(String[] tags) { |
| 458 | - | 488 | + new Thread(() -> { |
| 459 | - StringBuilder strFilter = new StringBuilder(); | 489 | + StringBuilder strFilter = new StringBuilder(); |
| 460 | - for (int i = 0; i < tags.length; i++) { | 490 | + for (int i = 0; i < tags.length; i++) { |
| 461 | - if (i > 0) { | 491 | + if (i > 0) { |
| 462 | - strFilter.append(" OR "); | 492 | + strFilter.append(" OR "); |
| 493 | + } | ||
| 494 | + strFilter.append(KEY_TAG); | ||
| 495 | + strFilter.append("="); | ||
| 496 | + strFilter.append("'"); | ||
| 497 | + strFilter.append(tags[i]); | ||
| 498 | + strFilter.append("'"); | ||
| 463 | } | 499 | } |
| 464 | - strFilter.append(KEY_TAG); | 500 | + getDb().delete(TABLE_TAGS, strFilter.toString(), null); |
| 465 | - strFilter.append("="); | 501 | + }).start(); |
| 466 | - strFilter.append("'"); | ||
| 467 | - strFilter.append(tags[i]); | ||
| 468 | - strFilter.append("'"); | ||
| 469 | - } | ||
| 470 | - getDb().delete(TABLE_TAGS, strFilter.toString(), null); | ||
| 471 | } | 502 | } |
| 472 | 503 | ||
| 473 | public synchronized void removeAllTags() { | 504 | public synchronized void removeAllTags() { | ... | ... |
| ... | @@ -88,7 +88,7 @@ | ... | @@ -88,7 +88,7 @@ |
| 88 | android:layout_width="240dp" | 88 | android:layout_width="240dp" |
| 89 | android:layout_height="50dp" | 89 | android:layout_height="50dp" |
| 90 | android:layout_marginHorizontal="32dp" | 90 | android:layout_marginHorizontal="32dp" |
| 91 | - android:layout_marginTop="@dimen/marginTop" | 91 | + android:layout_marginTop="88dp" |
| 92 | android:background="@drawable/selector_button_green" | 92 | android:background="@drawable/selector_button_green" |
| 93 | android:gravity="center" | 93 | android:gravity="center" |
| 94 | android:orientation="horizontal"> | 94 | android:orientation="horizontal"> | ... | ... |
-
Please register or login to post a comment