Skip to content

Conversation

@sumeruchat
Copy link
Collaborator

@sumeruchat sumeruchat commented Jan 20, 2025

🔹 Jira Ticket(s) if any

✏️ Description

This PR adds mobile framework info support to the Android SDK, enabling tracking of framework usage in apps. The implementation includes:

  1. Core Components:

    • New IterableAPIMobileFrameworkType enum (FLUTTER, REACT_NATIVE, NATIVE)
    • New IterablAPIMobileFrameworkInfo class for framework metadata
    • Configuration option in IterableConfig for setting framework info
    • Automatic framework detection if there is no framework info set
  2. Device Registration:

    • Framework info is now included in device registration data
    • Framework type and SDK version are sent to backend for analytics
  3. Testing:

    • Unit tests for framework info in register device token call

E2E Test

To test this PR just run the sdk with a native android app and then verify if the mobile framework info has been sent to the user device

Screenshot 2025-01-21 at 17 21 20

…le SDK- Implement `IterableMobileFrameworkDetector` for detecting mobile frameworks (Flutter, React Native, Native).- Introduce `IterableMobileFrameworkInfo` to store framework type and SDK version.- Update `IterableConfig` to include mobile framework info.- Enhance device registration to include mobile framework data.- Add unit tests for framework detection and device registration.
…orkDetector• Combine framework class checks for improved detection accuracy.• Use BuildConfig.APPLICATION_ID for reliable package name verification.• Update comments for clarity.
…nd clarity- Introduced thread-safe caching for framework type detection.- Added `initialize` method for context setup and initial cache.- Separated detection logic into `detectFrameworkInternal`.- Enhanced framework class and metadata checks with lists.- Improved error handling and logging for unexpected scenarios.
…erableAPIMobileFrameworkType with IterableMobileFrameworkType.• Add @JvmStatic annotation to detectFramework method.• Use getPackageInfo instead of getApplicationInfo for metadata retrieval.• Update test cases to handle API level differences in PackageManager.• Improve error handling in framework detection logic.
@sumeruchat sumeruchat changed the title [MOB-10592] Add mobile network Info to register token request [MOB-10592] Add mobile network Info to register token request (WIP) Jan 20, 2025
…ed a lambda for class detection to improve flexibility.• Removed redundant hasClass method.• Updated tests to use reflection for modifying class detection.• Enhanced test setup with mock context initialization.• Simplified test cases for framework detection and caching logic.
…erableMobileFramework- Renamed `IterableMobileFrameworkInfo` to `IterableAPIMobileFrameworkInfo`- Renamed `IterableMobileFrameworkType` to `IterableAPIMobileFrameworkType`- Updated constructor and variable names accordingly
@sumeruchat sumeruchat force-pushed the feature/MOB-10592-add-mobile-framework-info branch from 5d686f4 to 8200a6d Compare January 21, 2025 16:00
…PIMobileFrameworkType- Updated class and variable names for consistency across the codebase.- Adjusted method signatures and test cases to reflect the new naming convention.
…ged hardcoded JSON keys to string literals for mobileFrameworkInfo.• Updated assertions to use direct string values for frameworkType and iterableSdkVersion.
…ged JSON key access from constants to string literals for `mobileFrameworkInfo`.- Updated assertions to use string literals for `frameworkType` and `iterableSdkVersion`.
…nfo handling- Updated `populateDeviceDetails` to accept `IterableAPIMobileFrameworkInfo` as an optional parameter.- Adjusted framework detection logic in `IterableApiClient` to handle null `mobileFrameworkInfo`.- Moved notification enabled check after framework info setup.- Renamed and reorganized constants in `IterableConstants`.- Enhanced `DeviceInfoUtils` to include framework info in device details if available.
…Update IterableApiClient to use IterableAPIMobileFrameworkType for framework detection.• Modify DeviceInfoUtils.populateDeviceDetails to include frameworkInfo.• Remove redundant mobile framework JSON construction in IterableApiClient.• Add import for IterableAPIMobileFrameworkInfo in DeviceInfoUtils.
… and DeviceInfoUtils- Cleaned up trailing whitespace in IterableApiClient.java and DeviceInfoUtils.java.- Ensured consistent formatting for better readability and maintainability.
@sumeruchat sumeruchat changed the title [MOB-10592] Add mobile network Info to register token request (WIP) [MOB-10592] Add mobile network Info to register token request Jan 21, 2025
…ace `println` with `IterableLogger.d` for consistent debug logging.- Use `IterableLogger.e` for error logging to improve error tracking.
…- Updated logging calls to use separate arguments for TAG and message.- Improved code readability and consistency in logging format.
Copy link
Member

@Ayyanchira Ayyanchira left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Comment on lines +5 to +9
## Unreleased

### Added
- Added `mobileFrameworkInfo` configuration option to `IterableConfig` to identify the mobile framework (Flutter, React Native, or Native) being used with the SDK.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Appreciating this! It usually was a task to figure out all changes and write it in one go at the end before release. This will definitely make release task lighter 👍🏼

targetSdkVersion 31

buildConfigField "String", "ITERABLE_SDK_VERSION", "\"3.5.7\""
buildConfigField "String", "ITERABLE_SDK_VERSION", "\"3.5.9\""
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be taken care by rebasing to master branch. This version is already out there.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the master branch this is not set correctly @Ayyanchira

@evantk91 evantk91 merged commit 6da9aab into master Jan 21, 2025
3 of 4 checks passed
@evantk91 evantk91 deleted the feature/MOB-10592-add-mobile-framework-info branch January 21, 2025 20:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants