Commit d478fe8
authored
IAM Handlers refactoring (#503)
* Refactoring initial commit
* Improvements:
- fix several TODOs in the code
- remove messageDisplayedHandlers
- remove onAction listeners
* Run push open action with priority also other improvements and fixes
* Remove actionNamedHandler
* Fix dismiss of inapps when activity is changed. Add localCaps check. More details:
- Queue is paused during activity switching, i.e. when activity is paused and resumed the queue will also gets paused or resumed.
- When activity is switched (notification click) the current presented in-app dialog must be closed to avoid leaking of Window objects.
- Android OS works like that:
* If you have activity A1 and user is switching to another activity A2 then A1.onPause is invoked first, then A2.onResume and finally A1.stop will be called.
* If you have activity A1 shown and you bring app to background it will call A1.onPause and A1.onStop freeing our LeanplumActivityHelper.currentActivity reference, but we need to somehow keep reference to the last activity to free any Window objects.
- For the above reasons there is a change in LeanplumActivityHelper.onResume calling avoidWindowLeaks method. It works with lastForegroundActivity reference, that keeps the previous activity instance. It will be freed when onDestroy is called for the same activity (check LeanplumActivityHelper.onDestroy).
- Changes are tested with both Legacy messaging push and Campaign push, both containing "open app", "deeplink" or "iam" payload. Tested with Android 11 and Android 12, because of the notification trampolines.
- There is only one issue, or a feature, however you like it - If you have inapp M1 presented, M2 waiting in the queue, and a push P1 comes with payload M3. What will happen on a P1 click is first M1 dismisses, because activity changes (depends on implementation), next M2 is presented, but the M3 from payload is added with higher priority so M2 is dismissed too and only M3 is presented. If you have a third inapp it will remain in the queue and will present after M3.
* Change orderMessages to prioritizeMessages. Pause action queue on dev device message.
* Remove redundant deprecations
* Guard against user exception
* Fix some TODOs and improve javadoc
* Remove resolved TODOs
* Move some of the files to .internal package
* Add javadoc and convert java to kotlin
* Fix unit tests. Remove couple unnecessary
* Fix merge error
* Add setPaused and setEnabled to LeanplumActions. Fix a pause bug.
* Add MessageDisplayChoice.delayIndefinitely()
* Fix some of the review comments
* Remove functionality for ignored activites. Replaced by MessageDisplayController.shouldDisplayMessage.
* Remove the deprecated jcenter() repository
* Fix runActionNamed to not call actionDismissed. Tested all in-app templates with legacy messaging and campaigns.
* Add JvmStatic for the new static methods
* Fix review comments about queue paused state
* Allow nullable controller and listener
* IAM Handlers unit tests (#504)
* Add tests for queue and definitions
* Add setPaused and setEnabled to LeanplumActions. Fix a pause bug.
* Add tests for ActionManagerTriggering
* Add MessageDisplayChoice.delayIndefinitely()
* Add tests for ActionManagerExecution
* Add test for MessageDisplayListener. Improve readability.1 parent 6481112 commit d478fe8
File tree
47 files changed
+2131
-854
lines changed- AndroidSDKCore/src/main/java/com/leanplum
- actions
- internal
- internal
- messagetemplates
- actions
- controllers
- options
- models
- AndroidSDKPush/src/main/java/com/leanplum
- internal
- AndroidSDKTests/src/test/java/com/leanplum
- __setup
- _whitebox
- actions/internal
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
47 files changed
+2131
-854
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
116 | 116 | | |
117 | 117 | | |
118 | 118 | | |
119 | | - | |
| 119 | + | |
120 | 120 | | |
121 | 121 | | |
122 | 122 | | |
| |||
Lines changed: 120 additions & 96 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
28 | | - | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
29 | 32 | | |
30 | 33 | | |
31 | 34 | | |
| |||
57 | 60 | | |
58 | 61 | | |
59 | 62 | | |
60 | | - | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
61 | 66 | | |
62 | 67 | | |
63 | 68 | | |
| |||
106 | 111 | | |
107 | 112 | | |
108 | 113 | | |
109 | | - | |
110 | | - | |
111 | | - | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
112 | 117 | | |
113 | 118 | | |
114 | 119 | | |
115 | 120 | | |
116 | 121 | | |
117 | 122 | | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | 123 | | |
123 | | - | |
| 124 | + | |
124 | 125 | | |
125 | 126 | | |
126 | 127 | | |
127 | 128 | | |
128 | 129 | | |
129 | 130 | | |
130 | 131 | | |
131 | | - | |
| 132 | + | |
132 | 133 | | |
133 | 134 | | |
134 | 135 | | |
| |||
352 | 353 | | |
353 | 354 | | |
354 | 355 | | |
355 | | - | |
356 | | - | |
357 | | - | |
358 | | - | |
359 | | - | |
360 | | - | |
361 | | - | |
362 | | - | |
363 | | - | |
364 | | - | |
365 | | - | |
366 | | - | |
367 | 356 | | |
368 | 357 | | |
369 | 358 | | |
370 | 359 | | |
371 | 360 | | |
372 | 361 | | |
373 | 362 | | |
374 | | - | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
375 | 368 | | |
376 | 369 | | |
377 | 370 | | |
378 | 371 | | |
379 | 372 | | |
380 | | - | |
381 | | - | |
382 | | - | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
383 | 397 | | |
384 | 398 | | |
385 | | - | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
386 | 408 | | |
387 | 409 | | |
388 | 410 | | |
389 | 411 | | |
390 | | - | |
391 | | - | |
392 | | - | |
393 | | - | |
394 | | - | |
395 | | - | |
396 | | - | |
397 | | - | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
398 | 419 | | |
399 | 420 | | |
400 | 421 | | |
401 | 422 | | |
402 | | - | |
403 | | - | |
404 | | - | |
405 | | - | |
406 | | - | |
407 | | - | |
408 | | - | |
409 | | - | |
410 | | - | |
411 | | - | |
412 | | - | |
413 | | - | |
414 | | - | |
415 | | - | |
416 | | - | |
417 | | - | |
418 | | - | |
419 | | - | |
420 | | - | |
421 | | - | |
422 | | - | |
423 | | - | |
424 | | - | |
425 | | - | |
426 | | - | |
427 | | - | |
428 | | - | |
429 | | - | |
430 | | - | |
431 | | - | |
| 423 | + | |
| 424 | + | |
432 | 425 | | |
433 | 426 | | |
434 | | - | |
435 | | - | |
436 | | - | |
437 | | - | |
438 | | - | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
439 | 431 | | |
440 | 432 | | |
441 | | - | |
442 | | - | |
443 | | - | |
444 | | - | |
445 | | - | |
446 | | - | |
447 | | - | |
448 | | - | |
449 | | - | |
450 | | - | |
451 | | - | |
452 | | - | |
453 | | - | |
454 | | - | |
| 433 | + | |
| 434 | + | |
455 | 435 | | |
456 | 436 | | |
457 | 437 | | |
458 | 438 | | |
459 | 439 | | |
460 | | - | |
| 440 | + | |
461 | 441 | | |
462 | 442 | | |
463 | 443 | | |
464 | 444 | | |
465 | | - | |
466 | | - | |
467 | | - | |
| 445 | + | |
| 446 | + | |
468 | 447 | | |
469 | | - | |
| 448 | + | |
| 449 | + | |
470 | 450 | | |
471 | 451 | | |
472 | 452 | | |
| |||
482 | 462 | | |
483 | 463 | | |
484 | 464 | | |
485 | | - | |
486 | | - | |
| 465 | + | |
| 466 | + | |
487 | 467 | | |
488 | 468 | | |
489 | 469 | | |
| |||
492 | 472 | | |
493 | 473 | | |
494 | 474 | | |
495 | | - | |
496 | | - | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
497 | 489 | | |
498 | 490 | | |
499 | 491 | | |
| |||
633 | 625 | | |
634 | 626 | | |
635 | 627 | | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
636 | 660 | | |
0 commit comments