Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

task(SDK-3887) - Fixes inapp image not showing when phone is rotated #624

Merged

Conversation

Anush-Shand
Copy link
Contributor

https://wizrocket.atlassian.net/browse/SDK-3887

InApp will not be shown if either of image download failed to keep behaviour consistent with iOS

Base automatically changed from feature/file_type_support to feature/custom_inapp_templates July 8, 2024 12:51
@CTLalit CTLalit merged commit 4468891 into feature/custom_inapp_templates Jul 8, 2024
3 checks passed
@CTLalit CTLalit deleted the task/SDK-3887/inapp_rotate_issue branch July 8, 2024 20:16
CTLalit added a commit that referenced this pull request Jul 9, 2024
* feat(MC-1457): Create custom in-app templates definitions

* Mock CleverTapInstanceConfig within TemplatesManagerTest

* feat(MC-1459): Implement templates sync

* task(MC-1458): Add custom code templates data in CTInAppNotification

* task(MC-1460): Implement template presenting

Add TemplatePresenter to the template definitions
Add TemplateContext API for handling template invocations. Merge template args overrides
with default values and provide access to the values.
Integrate template presentation in the current in-app display flow

* task(SDK-3814) - Adds initial implementation for caching userProfiles

- Migrates userProfiles DB by changing schema
- Adds logic for new user login
- Adds support to store multiple users
- Passes deviceInfo to LocalDataStore

* task(SDK-3814) - Adds support for multi instances for userProfiles db

- Migrates userProfiles DB for multiple instances
- Fixes single row issue when stoing in table

* task(MC-1462): Implement in-app function execution

Insert visual functions to front of inAppQueue when triggered
Refactor InAppController inAppNotificationDidClick to inAppNotificationActionTriggered
Move common notification handling logic to InAppController from InAppNotificationActivity
and CTInAppBaseFragment

* task(MC-1464): Custom code templates support for html in-apps

Add triggerAction to the JS API

* task(MC-1648): Allow map arguments and argument nesting in template functions

Move map argument methods to the base classes CustomTemplateContext and
CustomTemplate.Builder

* task(MC-1646): Store active template contexts in TemplatesManager

Add access to active template contexts in CleverTapAPI

* task(SDK-3814) - Enhances DB migration

- Shifts backfilling of deviceID to onUpgrade
- Removes logic for backfilling from DBAdapter

* task(SDK-3814) - Enhances DB migration

- Changes logic to fit the idea that userProfiles table will always have only one entry before migration

* Add stand-alone in-app function templates handling

* task(SDK-3814) - Updates encryption migration for userProfiles table

- All profiles specific to the accountId will be migrated together

* Add define method for custom in-app templates CleverTapAPI

* task(SDK-3806) - Adds fix for incorrectly stored data in userProfiles table (#614)

- Fixes the same during migration
- Removes the "$D_" prefix from date related property values
- Removes the "$set" and "$add" key from incorrectly stored multi-valued properties

* task(SDK-3814) - Moves persistence after inapp evaluation (#613)

* task(SDK-3814) - Moves persistence after inapp evaluation

- Delays the persistence to after inapp evaluation
- Constructs a map of userAtttibutes to be used for evaluation

* task(SDK-3817) - Adds date related parsing

* task(SDK-3817) - Adds evaluation and triggering for userattributes (#612)

* task(SDK-3817) - Adds evaluation and triggering for userattributes

* task(SDK-3817) - Fixes indentation

* task(SDK-3817) - Fixes logic for evaluation

* task(SDK-3817) - Cleanup
 - Fixes variable names
 - Adds comments
 - Adds formatting

* task(SDK-3817) - Cleanup

- Kotlin specific improvements

* task(SDK-3814) - Cleanup

- Removes unusued function

* task(SDK-3814) - Fixes evaluation condition for normal inapps

* test(SDK-3815) - Updates Unit Tests

- Adds new unit tests for CryptUtils when multiple profiles need to be migrated
- Passes required objects in other unit tests
- Fixes test for EventQueueManager
- Fixes test for EvaluationManager by fixing args to list of EventAdapters

* test(SDK-3815) - Updates Unit Tests

- Fixes unit tests in AnalyticsManager.java by removing calls to LocalDataStore as that logic has been moved

* test(SDK-3815) - Updates Unit Tests

- Fixes and adds unit tests in EventQueueManger to acomodate profile event check
- Adds unit test for TriggerAdapter
- Adds unit tests for EventAdapter

* test(SDK-3815) - Updates Unit Tests

- Fixes ValidatorTest to use Date prefix constant

* test(SDK-3815) - Updates Unit Tests

- Adds Unit Tests for TriggersMatcher

* test(SDK-3815) - Updates Unit Tests

- Adds test for ClevertapFactory

* test(SDK-3814) - Cleanup

- Changes Code formatting
- Changes function names

* test(SDK-3814) - Fixes oldValue-newValue condition

* feat(file_type_download_support-v1) : add file download and caching logic with callback support SDK-3845

* test(SDK-3815) - Updates UnitTests

- Fixes older unit test
- Adds unit tests for fetchUserProfileByAccIdAndDeviceId

* test(SDK-3815) - Updates UnitTests
- Adds unit tests for AnalyticsManager

* test(SDK-3815) - Cleanup

* test(SDK-3815) - Corrects test in AnalyticsManager.java

* task(SDK-3814) - Cleanup and comments

* task(SDK-3814) - Refactors LocalDataStore.java

- Passes only newValues to updateProfileFields

* task(SDK-3852) - Refactors to remove syncWithUpstream unused feature

- Removes syncWithUpstream and related functions in LocalDataStore.java
- Simplifies setting and removing functions in LocalDataStore.java
- Removes response class and it's associated callers from NetworkManager

* task(SDK-3852) - Refactors to remove syncWithUpstream unused feature

- Deletes SyncUpstreamResponse.kt

* task(SDK-3814) - Adds logic for skipping multivalued user attributes

* task(SDK-3814) - Adds logic for adding app fields to eventProperties for EventAdapter

* task(SDK-3814) - Enhancements

- Fixes date related parsing
- Increases efficiency
- Improves function names

* tests(SDK-3815) - Adds tests for EventMediator

* task(SDK-3814) - Fixes date related parsing

* tests(SDK-3815) - Adds tests for EvaluationManager

* task(SDK-3814) - Cleanup for ProfileValueHandler

* tests(SDK-3815) - Tests for ProfileValueHandles

* feat(file_type_download_support-v2) : encapsulate file operation logic, types of files storage and add file cleanup logic SDK-3856

* feat(file_type_download_support-v2) : code cleanup and formatting SDK-3856

* feat(file_type_download_support-v2) : add preloadFiles implementation in FilePreloaderCoroutine SDK-3856

* feat(file_type_download_support-v2) : create FileResourcesRepoFactory and replace existing  FileResourcesRepo instance creation with factory SDK-3856

* tests(SDK-3815) - Tests for LoginController

* feat(file_type_download_support-v2) : add public API clearFileResources(bool) SDK-3869

* feat(file_type_download_support-v2) : add public API isFileExistsForUrl(String) SDK-3872

* feat(file_type_download_support-v2) : add public API getFilePathForUrl(String) SDK-3873

* feat(file_type_download_support-v2) : add comments for isFileExistsForUrl(String) SDK-3872

* tests(SDK-3815) - Enhances test in CleverTapFactoryTest

* task(SDK-3814) - Cleanup

- Comments
- Logs
- Formatting

* feat(file_type_download_support-v2) : fix build error temporarily for file preloading tests SDK-3856

* Bug(MC-1719): App function not working with OTB templates

- sets correct type to copied inapp notification
- reformatting

* feat(file_type_download_support-v2) : complete TODO: in CustomTemplateContext, add getFile(name: String) method for retrieving file arguments SDK-3876

* feat(file_type_download_support-v2) : complete TODO: in InAppResponse, for CustomTemplates, download all file arguments before presenting SDK-3876

* feat(file_type_download_support-v2) : complete TODO: in InAppController showInApp(), for CustomTemplates, download all file arguments before presenting SDK-3876

* feat(file_type_download_support-v2) : rename isFileExistsForUrl() to doesFileExistForUrl() SDK-3872

* feat(file_type_download_support-v2) : format and add names to call args SDK-3856

* feat(file_type_download_support-v2) : use getConfigLogger() to retrieve Logger SDK-3869

* feat(file_type_download_support-v2) : use getConfigLogger() to retrieve Logger in doesFileExistForUrl SDK-3872

* feat(file_type_download_support-v2) : use getConfigLogger() to retrieve Logger in getFilePathForUrl SDK-3873

* feat(file_type_download_support-v2) : move transformation constants to enum SDK-3856

* task(SDK-3852) - More refactoring

* feat(file_type_download_support-v2) : rename lock identifiers to be more specific SDK-3856

* tests(SDK-3852) - Updates test due to LocalDataStore refactoring

* feat(file_type_download_support-v2) : rename classes, methods and cleanup code SDK-3856

* task(SDK-3852) - Refactors to remove syncWithUpstream unused feature (#618)

* task(SDK-3852) - Refactors to remove syncWithUpstream unused feature

- Removes syncWithUpstream and related functions in LocalDataStore.java
- Simplifies setting and removing functions in LocalDataStore.java
- Removes response class and it's associated callers from NetworkManager

* task(SDK-3852) - Refactors to remove syncWithUpstream unused feature

- Deletes SyncUpstreamResponse.kt

* task(SDK-3852) - More refactoring

* tests(SDK-3852) - Updates NetworkManager object creation from ClevertapFactory

* Chore(SDK-3856): Names to call args

- also adds comments.

* Feat(SDK-3856): Store registry init

- creates file registry at correct point.

* Feat(SDK-3856): Nullables in StoreRegistry

- handles nulls gracefully
- eager init for prefs handles

* Feat(SDK-3856): Fils urls parsing in adapter

- moves parsing of file urls list to in app response adapter
- minor optimisations and cleanup
- makes class internal

* Chore(SDK-3856): elegant null handling

* Feat(SDK-3882): elegant null handling

- SDK-3882
- SDK-3883
- SDK-3884
- common impl of method to fetch assets (file, image, gif)
- preloader change to expose cache type
- meta passed to save data to correct cache
- plugs methods
- todo : need to have completion handler

* Feat(SDK-3885): cleanup strategy

- removes code duplication
- changes both impl and plugging class

* Chore(SDK-3885): formatting

* Chore(SDK-3885): renaming method params.

* Chore(SDK-3885): names to call args

* Chore(SDK-3885): imports optimised

* Chore(SDK-3885): made class internal

* Chore(SDK-3885): made class internal

* Chore(SDK-3885): delete unused function

* Feat(SDK-3886): fold delete* methods

- folds deleteimage, deletegif, deletefile into a single deleteAsset method
- changes invocation
- deletes unused method

* task(SDK-3853) - Fixes Stopped/Deleted campaign is not cleared in the SDK in ClientSide mode (#620)

* task(SDK-3814) - Cleanup

- Comments
- Logs
- Formatting

* task(SDK-3853) - Fixes and adds tests

* feat(file_type_download_support-v2) : add success callback to preloadFilesAndCache caller and complete preloadFilesAndCache implementation SDK-3856

* tests(SDK-3814) - Adds NO-OP for profilePush if deviceId is null

* tests(SDK-3815) - Adds tests for NO-OP for profilePush if deviceId is null

* feat(file_type_download_support-v2) : fix download failed issue for non-image files SDK-3856

* Feat(SDK-3881): Button text not visible in inapps

- corrects the parcelize implementation which was dropping the text

* tests(SDK-3815) - Fixes tests for NO-OP for profilePush if deviceId is null

* feat(file_type_download_support-v2) : move TODO: from InAppController showInApp() to CTInAppNotification prepareForDisplay() for CustomTemplates, download all file arguments before presenting SDK-3876

* Feat(SDK-3780): Prepare for display for files

- handles inapp custom code download in sync fashion

* Feat(SDK-3856): Fixed compilation error

* Chore(SDK-3856): optimise imports

* feat(file_type_download_support-v2) : comment out tests temporarily to fix build errors SDK-3856

* feat(file_type_download_support-v2) : refactor FileResourceProvider to remove duplicate code for cached related methods SDK-3856

* feat(file_type_download_support-v2) : refactor FileFetchApiContract to remove duplicate code for api call related methods SDK-3856

* feat(file_type_download_support-v2) : refactor FileResourceProvider to remove duplicate code for saving call related methods SDK-3856

* feat(file_type_download_support-v2) : refactor FileResourceProvider to remove duplicate code for fetching call related methods SDK-3856

* feat(file_type_download_support-v2) : refactor FileResourceProvider to remove duplicate code for delete method SDK-3856

* feat(file_type_download_support-v2) : refactor FileResourceProvider to remove duplicate code for isFileCached method SDK-3856

* Chore(SDK-3891): Refactored for download listener

- adds list which contains progress status for urls in downloads
- started callback and completion callback implemented for download start/all finish

* Feat(SDK-3891): Public method defined to define file type var

* Feat(SDK-3891): Adds public CleverTapApi methods to register callbacks

- vars sync and downloads finished
- vars sync and download finish once
- adds code to register listeners
- todo : invoke callbacks properly

* Feat(SDK-3891): Adds file ready callback in Var.java

* Feat(SDK-3891): Integrates files download code in VarCache

- adds method to download all files with callbacks
- vars and global callbacks are triggered as per callback from download managers
- java-kotlin interop support for interface method
- minor code cleanup
- tests compilation fixed (incorrectly)

* Chore(SDK-3891): Null check

* fix(file_type_download_support) : fix count down logic of CountDownLatch SDK-3893

* fix(file_type_download_support) : fix cache miss for in-memory SDK-3893

* fix(file_type_download_support) : call executor success and fail listeners on current thread SDK-3893

* fix(file_type_download_support) : remove duplicate urls from response before sending to download SDK-3893

* fix(file_type_download_support) : fix error message when file download fails for custom code template SDK-3893

* fix(file_type_download_support) : fix null pointer when in-app type is unknown for CTInAppType SDK-3893

* fix(file_type_download_support) : fix, url and expiry was not stored for server side in-app assets in prepareForDisplay(), as a result cleanup was also not performed. SDK-3893

* chore(file_type_download_support) : add logging for assets cleanup SDK-3893

* fix(file_type_download_support) : fix, inapp_assets and ct_files preference were not created based on accountId SDK-3893

* fix(file_type_download_support) : fix, clearFileResources(false), clearInAppResources(false) does not clear all urls independent of expiry SDK-3893

* chore(file_type_download_support) : add logs in deleteData() SDK-3893

* chore(file_type_download_support) : simplify expiry offset value SDK-3893

* Fix copying of in-app before displaying of custom code template

* chore(file_type_download_support) : update download timeout and disk file size limits SDK-3893

* Chore(SDK-3894): Import fix

* Fix visual templates triggered as actions are not dismissed

* Feat(SDK-3891): Passed the correct url to the download manager

- passed the url, accidentally had passed the cache key.

* Chore(SDK-3903): Update Sample app in Repo

- adds define vars definitions
- adds callbacks to listen

* Chore(SDK-3894): Indentations

* Feat(SDK-3902): Correct return values for file path

- returns correct values of filepaths when file var values are accessed
- adds todos in test to fix them
- passes dep to varcache class so it can return the correct filepath for url

* Chore(SDK-3902): Correct logging

* Bug(SDK-3902): getter for Var of file

- the values were returned based on kind check and it messed with initial conditions as well.
- exposes getter for getting raw url value

* Feat(SDK-3903): adds file vars feature to sample app

* Bug(SDK-3908): Sync api problem

- fixes flatten function which would deduce kind of variable from its value type (eg: String, Number etc → all java types)
- fixes this in code to add special handling for file.

* Revert "feat(file_type_download_support-v2) : comment out tests temporarily to fix build errors SDK-3856"

This reverts commit f48c456.

* test(file_type_download_support) : fix broken tests for CustomTemplateInAppDataTest SDK-3913

* test(file_type_download_support) : fix broken tests for ImpressionManagerTest SDK-3913

* test(file_type_download_support) : fix broken tests for InAppQueueTest SDK-3913

* Bug(SDK-3914): Solves null urls

- solves null url and removes them from passing to downloader block
- happens when registered file vars do not have urls fetched yet

* test(file_type_download_support) : add tests for FileMemoryAccessObject SDK-3913

* Bug(SDK-3903): Sample app changes for file vars

- accomodates a new row to test certain cases for file type vars feature

* Bug(SDK-3903): Sample app variables update

- registers basic varibles under correct values setup on dashboard
- changes printing logic to make it cleaner

* Feat(SDK-3891): Condition fix for shouldMerge

- adds correct condition as we check the kind first and then evaluate

* Include action file arguments in CustomTemplateInAppData::getFileArgsUrls

* Feat(SDK-3891): Trigger file download for late registered vars

- variables registered after the sdk and api calls are done are downloaded once user registers them
- changes to coroutines impl cause executors latch impl is broken and blocks main thread

* Feat(SDK-3903): updates sample app for vars

- fetch calls are removed from vars test items

* Chore(SDK-3891): Removed redundant non null

* Feat(SDK-3891): avoids downloads when empty list is passed

* test(file_type_download_support) : add tests for InAppGifMemoryAccessObjectV1 SDK-3913

* test(file_type_download_support) : add tests for InAppImageMemoryAccessObjectV1 SDK-3913

* test(file_type_download_support) : add tests for FileMemoryV2 SDK-3913

* test(file_type_download_support) : add tests for InAppGifMemoryV1 SDK-3913

* test(file_type_download_support) : add tests for InAppImageMemoryV1 SDK-3913

* test(file_type_download_support) : add tests for MemoryCreator SDK-3913

* test(file_type_download_support) : fix broken tests for FileCleanupStrategyCoroutine SDK-3913

* test(file_type_download_support) : fix broken tests for FileCleanupStrategyExecutors SDK-3913

* test(file_type_download_support) : improve tests for FileMemoryAccessObject SDK-3913

* test(file_type_download_support) : fix broken tests for FilePreloaderExecutors SDK-3913

* test(file_type_download_support) : add missing tests for FilePreloaderExecutors SDK-3913

* test(file_type_download_support) : fix broken tests for FilePreloaderCoroutine SDK-3913

* test(file_type_download_support) : add missing tests for FilePreloaderCoroutine SDK-3913

* test(file_type_download_support) : fix broken tests and add missing tests for FileResourcesRepoImpl SDK-3913

* Feat(SDK-3891): PE file vars logic

- adds better mechanism in FileResourcesRepoImpl.kt to register for file download callbacks
- removes unnescessary runnable
- moves global callback for files in CTVariables which is the right class
- adds flag for first file fetch completed
- breaks down applyVariableDiffs() which is longer method
- adds method to startFilesDownload which gets called after first api call (app_launch/wzrk_fetch)
- ignores urls which are in cache to prefetch load -> only pending urls are sent forward to listen to their completion callback.

* Task/mc 1790/headers inapps eval incorrectly attached t (#629)

* task(MC-1790) - Fixes incorrectly attached inapps_eval and inapps_suppressed

- Separates the eval and suppressed for profile and normal events and attaches based on the type of queue

* task(MC-1790) - Updates tests

* task(MC-1790) - Increases readability

---------

Co-authored-by: CTLalit <144685420+CTLalit@users.noreply.github.com>

* task(SDK-3887) - Fixes inapp image not showing when phone is rotated (#624)

Co-authored-by: CTLalit <144685420+CTLalit@users.noreply.github.com>

---------

Co-authored-by: Vassil Angelov <vassil@clevertap.com>
Co-authored-by: Vassil Angelov <148857285+vasct@users.noreply.github.com>
Co-authored-by: anush <anush@clevertap.com>
Co-authored-by: Anush-Shand <127097095+Anush-Shand@users.noreply.github.com>
Co-authored-by: piyush.kukadiya <piyush.kukadiya@clevertap.com>
Co-authored-by: Piyush Kukadiya <piyush.kukadiya@piyush-kukadiya-macbook-pro.localdomain>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants