fix: use versionName instead of versionCode for app version reporting#2569
fix: use versionName instead of versionCode for app version reporting#2569fadi-george wants to merge 1 commit into5.7-mainfrom
Conversation
Aligns Android with iOS, which reports CFBundleShortVersionString (display version). Previously Android reported versionCode (integer build number), causing inconsistency for cross-platform frameworks like .NET MAUI. Falls back to versionCode if versionName is null. Made-with: Cursor
bbef266 to
67022c8
Compare
|
Is there any impact to this on the backend? maybe some reporting? |
nan-li
left a comment
There was a problem hiding this comment.
Blocking while I review, we're technically making an API change and clients may already be using the previous versioning style
📊 Diff Coverage ReportDiff Coverage Report (Changed Lines Only)Threshold: 80% Changed Files Coverage
Overall Coverage (Changed Lines Only)274/1211 changed lines covered (22.6%) ❌ Coverage Check FailedFiles below 80% threshold:
|
Could mark it as a breaking change I suppose, but developers should at the release notes and make according changes if it. |
App version is used beyond the SDK for things like segmentation, we just need to think about this carefully before release |
Description
One Line Summary
Use
versionNameinstead ofversionCodeinAndroidUtils.getAppVersion()to align with iOS behavior.Details
Motivation
Android reports
versionCode(integer build number) as the app version while iOS reportsCFBundleShortVersionString(display version string). This causes inconsistentapp_versionvalues across platforms, especially for cross-platform frameworks like .NET MAUI whereApplicationVersion(build number) andApplicationDisplayVersion(display version) are distinct.Fixes OneSignal/OneSignal-DotNet-SDK#82
Scope
Only affects
AndroidUtils.getAppVersion(). All existing call sites (OneSignalImp,SubscriptionOperationExecutor,LoginUserOperationExecutor,SubscriptionManager,CustomEventOperationExecutor,OtelPlatformProvider) will now receive the display version string instead of the build number. Falls back toversionCode.toString()ifversionNameis null.Testing
Unit testing
Existing test in
OtelPlatformProviderTestvalidatesgetAppVersionis non-null and non-empty, which still passes.Manual testing
Not yet tested on device.
Affected code checklist
Checklist
Overview
Testing
Final pass
Made with Cursor