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

feat: v2-android level code changes #227

Open
wants to merge 224 commits into
base: develop-v2
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
224 commits
Select commit Hold shift + click to select a range
323415a
State for holding the application state
itsdebs Nov 1, 2021
ecb1ae2
synchronized state
itsdebs Nov 1, 2021
a88623e
State for holding the application state
itsdebs Nov 1, 2021
24114a5
synchronized state
itsdebs Nov 1, 2021
5cfa7db
fixed web test cases
itsdebs Nov 5, 2021
17e3a1f
fixed web test cases
itsdebs Nov 5, 2021
3250ca8
Merge remote-tracking branch 'origin/feat/core' into feat/core
itsdebs Nov 5, 2021
9dfa69d
rudder server config model file added with test case
itsdebs Nov 5, 2021
4458c52
creating models and their test cases
itsdebs Dec 21, 2021
baf4cad
fixed jackson and moshi
itsdebs Dec 22, 2021
66a2028
jackson, gson, moshi passed. Need to test with server
itsdebs Dec 23, 2021
e39c5e1
enhanced test case with channel change.
itsdebs Dec 23, 2021
1d740f4
base structure.
itsdebs Dec 30, 2021
6271920
plugins structure fix
itsdebs Jan 3, 2022
99c5fa9
plugins structure fix
itsdebs Jan 6, 2022
7644192
Adding Storage plugin
itsdebs Jan 11, 2022
875f6b3
data upload with test suite
itsdebs Jan 12, 2022
8c130a6
rudder option plugin
itsdebs Jan 17, 2022
cfccbd4
features added
itsdebs Feb 1, 2022
6f20efe
server config updated in plugins
itsdebs Feb 1, 2022
c67f243
added few mwthods in analytics
itsdebs Mar 22, 2022
f8ad075
plugin work ready, basic storage to be done.
itsdebs Mar 29, 2022
399a1b4
core complete
itsdebs Mar 30, 2022
144d9c4
plugins fix
itsdebs Mar 30, 2022
6275110
alias functionality
itsdebs Mar 31, 2022
43d070d
test cases
itsdebs Apr 7, 2022
a9f78e0
fill defaults tested
itsdebs Apr 8, 2022
86d66b1
gdpr plugin tested
itsdebs Apr 8, 2022
719f509
rudder option plugin test done
itsdebs Apr 9, 2022
7b976db
wakeup action plugin test
itsdebs Apr 10, 2022
054df24
flush/force flush api provided
itsdebs Apr 13, 2022
c7c42ca
message callback done
itsdebs Apr 13, 2022
6bd7db0
fixed threads, test cases
itsdebs Apr 19, 2022
ce8d8f4
multiple access checked
itsdebs Apr 23, 2022
d94f532
refactored package name. test cases running good
itsdebs Apr 25, 2022
d6bb9a7
fixed test cases and few issues
itsdebs Apr 26, 2022
920fd09
base structure
itsdebs Apr 26, 2022
936dea0
refactoring to suite
itsdebs Apr 26, 2022
b24036e
base structure
itsdebs Apr 26, 2022
cdfc6c4
rudder database can handle enclosing entity
itsdebs Apr 27, 2022
6b8856b
Merge remote-tracking branch 'origin/feat/android' into feat/android
itsdebs Apr 27, 2022
acad7bf
removed redundant get or default.
itsdebs May 5, 2022
6509480
added content provider as an option to Dao.
itsdebs May 13, 2022
59437f3
insertion working
itsdebs May 17, 2022
7e180e9
working on android part
itsdebs Jul 8, 2022
a8ef498
adding context plugin and required changes
itsdebs Jul 19, 2022
e779c6f
add shutdown hook
itsdebs Jul 19, 2022
51d047a
lifecycle observer and startup
itsdebs Jul 20, 2022
5151b58
fixes for android
itsdebs Jul 27, 2022
01f44db
sample app
itsdebs Aug 4, 2022
a08ab77
minor fixes
itsdebs Aug 5, 2022
d124dce
minor fixes
itsdebs Aug 6, 2022
c852498
fixed multiple issues over future
itsdebs Aug 8, 2022
a15c8ff
event filtering based on source config
itsdebs Aug 15, 2022
32ea89e
work manager code done, not tested yet
itsdebs Aug 31, 2022
bbf610d
work manager working
itsdebs Sep 7, 2022
be27a1c
added flush, reset to plugins
itsdebs Sep 15, 2022
4e98853
fix issues
itsdebs Sep 22, 2022
fcd6833
added logs
itsdebs Sep 29, 2022
0fb59b9
minor fix
itsdebs Sep 29, 2022
c2bb254
compatibility fix with java
itsdebs Oct 20, 2022
b000551
compatibility fix with java
itsdebs Oct 20, 2022
f591835
fix: fix general issues
itsdebs May 31, 2023
0ff559c
feat: metrics
itsdebs May 31, 2023
51c9363
feat: added metrics (#228)
itsdebs Jul 13, 2023
f8dc8c2
fix: sychronize transaction
itsdebs Jul 18, 2023
35f06f0
chore: fix versions
itsdebs Jul 26, 2023
f7b9a33
Merge branch 'develop-v2' into feat/android
itsdebs Jul 27, 2023
282f75c
feat: updated java version
itsdebs Jul 27, 2023
ee84e76
feat: buggy core
itsdebs Jul 27, 2023
ff0e249
chore: merge develop-v2
itsdebs Nov 16, 2023
ec621de
feat: middle of fixes
itsdebs Nov 30, 2023
d8f400c
chore: fix issues
itsdebs Dec 5, 2023
5057acd
fix: code fixed, test cases not yet.
itsdebs Dec 6, 2023
3e09114
chore : test-common
itsdebs Dec 6, 2023
abdb256
chore : fix tests update code
itsdebs Dec 19, 2023
4ed6571
chore : fix test common
itsdebs Dec 19, 2023
833aee4
fix: fixed plugins not being added and lifecycle listeners
itsdebs Dec 20, 2023
1d69e0f
chore, change channel to "android"
itsdebs Dec 21, 2023
056b59c
fix: fixed test cases, now gh actions will test core too
itsdebs Dec 26, 2023
dfed0a3
fix: sync worker test
itsdebs Dec 26, 2023
1305ecf
fix: linting and ci
itsdebs Jan 3, 2024
2162e3e
fix: temp-v2
itsdebs Jan 4, 2024
35439a3
fix: fixed test cases and minor fixes
itsdebs Jan 4, 2024
d4a1ac8
feat: creates new build.gradle.kts for kotlin sample app
ChryssaAliferi Jan 5, 2024
b09c5e2
feat: updates MyApplication application class
ChryssaAliferi Jan 5, 2024
9fe5291
feat: minor changes in ui.theme
ChryssaAliferi Jan 5, 2024
931ab58
feat: removes unused tests
ChryssaAliferi Jan 5, 2024
86677f6
feat: creates Values.kt file
ChryssaAliferi Jan 5, 2024
3397501
feat: creates RudderAnalyticsUtils.kt object for analytics init
ChryssaAliferi Jan 5, 2024
899ccfa
feat: creates MainViewModelState data class
ChryssaAliferi Jan 5, 2024
4c1c8a0
feat: deletes LogData.kt as it is included in MainViewModelState
ChryssaAliferi Jan 5, 2024
007c039
refactor: Refactors MainViewModel.kt with the new state logic
ChryssaAliferi Jan 5, 2024
6455f73
refactor: minor change in MainActivity.kt
ChryssaAliferi Jan 5, 2024
5fa909d
feat: reset api implementation and test
itsdebs Jan 8, 2024
b610ca8
feat: reset api implementation and test
itsdebs Jan 11, 2024
545830f
chore: add test cases for Android context plugin (#379)
itsdebs Jan 17, 2024
b22b6b6
fix: remove timestamp from message ids (#377)
itsdebs Jan 17, 2024
46cc7f6
fix: fix display info issue with application context. (#376)
itsdebs Jan 17, 2024
262bc08
Merge pull request #371 from rudderlabs/feature/sdk-1109-update-examp…
ChryssaAliferi Jan 18, 2024
5de72fb
feat: added session implementation (#374)
itsdebs Feb 12, 2024
e2118c9
feat: refactored AndroidContextPlugin to PlatformInputsPlugin (#380)
itsdebs Feb 12, 2024
43c70ce
feat: sdk 1204 support multiple instances for states (#393)
itsdebs Feb 14, 2024
890e4a4
feat!: BREAKING CHANGE \n\n sdk 692 repository support multiple insta…
itsdebs Feb 14, 2024
d170eab
feat: assert size of message and batch (#396)
1abhishekpandey Feb 26, 2024
7290b40
fix: fix test cases on android
itsdebs Feb 28, 2024
a5aa171
feat: sdk 1333 migration of context user id session id opt out status…
itsdebs Feb 29, 2024
ff1f8e0
chore: fix test cases
itsdebs Feb 29, 2024
269088a
feat: flush events on sent to background (#398)
1abhishekpandey Mar 1, 2024
388593c
fix: adding session utils to storage.
itsdebs Mar 6, 2024
d8f3e6a
feat: move optOut out of configuration (#399)
1abhishekpandey Mar 14, 2024
faa2dd5
feat: replace instanceName field with the writeKey wherever applicabl…
1abhishekpandey Mar 15, 2024
546069b
chore: updated sample to use local.properties. (#405)
itsdebs Mar 21, 2024
76edd58
fix: Application Opened event not being fired (#409)
1abhishekpandey Mar 28, 2024
a48e4a7
fix: creates rudderstack.properties file
ChryssaAliferi Apr 1, 2024
296f932
fix: removes unused instanceName
ChryssaAliferi Apr 1, 2024
a678333
fix: removes unused override fun setup
ChryssaAliferi Apr 1, 2024
0c831c9
feature: updates agp to 8.2.2
ChryssaAliferi Apr 1, 2024
6a510a8
feat: creates logsName for logging
ChryssaAliferi Apr 2, 2024
bc33213
Merge pull request #415 from rudderlabs/feature/sdk-1513-android-samp…
ChryssaAliferi Apr 3, 2024
d4628da
feat: creates logsName for logging
ChryssaAliferi Apr 2, 2024
952e48b
Merge pull request #416 from rudderlabs/feature/sdk-1514-update-andro…
ChryssaAliferi Apr 3, 2024
c4a99b1
feat: add Application Installed and Application Updated events (#412)
1abhishekpandey Apr 12, 2024
84c252f
feat: add support for multiple sdk initialisation (#408)
1abhishekpandey Apr 16, 2024
253990e
fix: update the SDK initialisation method
1abhishekpandey Apr 16, 2024
eb95e32
Merge pull request #420 from rudderlabs/fix/sdk-1654-fix-android-v2-s…
ChryssaAliferi Apr 16, 2024
b42e718
fix: unit test cases (#418)
1abhishekpandey Apr 22, 2024
79095c3
feat: sdk 1351 refresh sourceconfig on set to foreground (#421)
itsdebs May 6, 2024
b6802bb
feat: sdk 1162 migration of database from v1 to v2 (#400)
itsdebs May 7, 2024
5e67042
feat: sdk 712 work manager support (#414)
itsdebs May 9, 2024
7d71bd5
feat: cleans up app module
ChryssaAliferi May 22, 2024
c568817
feat: creates buildSrc module
ChryssaAliferi May 23, 2024
c7361f2
feat: creates RudderstackBuildConfig with default values
ChryssaAliferi May 23, 2024
3d49a81
feat: creates libs.versions.toml file
ChryssaAliferi May 23, 2024
56101fb
feat: converts android module build.gradle file to kts
ChryssaAliferi May 23, 2024
7a2a6d9
feat: converts core module build.gradle file to kts
ChryssaAliferi May 23, 2024
7b909ab
feat: converts gsonrudderadapter module build.gradle file to kts
ChryssaAliferi May 23, 2024
4141c91
feat: converts jacksonrudderadapter module build.gradle file to kts
ChryssaAliferi May 23, 2024
480ad1e
feat: converts models module build.gradle file to kts
ChryssaAliferi May 23, 2024
2d3915b
feat: converts moshirudderadapter module build.gradle file to kts
ChryssaAliferi May 23, 2024
81ea247
feat: converts repository module build.gradle file to kts
ChryssaAliferi May 23, 2024
f388fe6
feat: converts rudderjsonadapter module build.gradle file to kts
ChryssaAliferi May 23, 2024
1f07770
feat: converts rudderreporter module build.gradle file to kts
ChryssaAliferi May 23, 2024
612885a
feat: converts web module build.gradle file to kts
ChryssaAliferi May 23, 2024
6d9cd88
feat: converts project build.gradle file to kts
ChryssaAliferi May 23, 2024
b8ff341
feat: converts settings.gradle file to kts
ChryssaAliferi May 23, 2024
097cd1e
feat: minor changes to build.gradle.kts of navigationplugin
ChryssaAliferi May 23, 2024
c3144d6
feat: minor changes to build.gradle.kts of test-common
ChryssaAliferi May 23, 2024
17d887c
feat: minor changes to build.gradle.kts of sample kotlin
ChryssaAliferi May 23, 2024
a768c89
Merge pull request #433 from rudderlabs/feature/sdk-1859-clean-up-fol…
ChryssaAliferi May 28, 2024
99bed42
feat: implement the analytics SDK as a singleton (#424)
1abhishekpandey May 28, 2024
1a34f61
fix: serialization uid missing issue and repository all data as callb…
itsdebs May 31, 2024
0a3fc95
fix: activity is now broadcasted even if recordScreenView or trackLif…
itsdebs Jun 10, 2024
fc8e1dc
feat: adding back the versionCode and versionName of the sample app
ChryssaAliferi Jun 10, 2024
6781895
fix: add sentAt field to each event (#438)
itsdebs Jun 10, 2024
cb3b826
feat: sdk 1954 misc issues remove external ids and collect ad (#442)
itsdebs Jun 18, 2024
b091a9a
Merge branch 'feat/android' into feature/sdk-1891-convert-groovy-buil…
ChryssaAliferi Jun 18, 2024
54014d5
feat: merge commit tackling conflicts
ChryssaAliferi Jun 18, 2024
828d2f9
Merge pull request #434 from rudderlabs/feature/sdk-1891-convert-groo…
ChryssaAliferi Jun 18, 2024
410095a
feat: sdk 1800 migration code refactor (#437)
itsdebs Jun 18, 2024
a661748
feat: replace custom logger with logLevel (#444)
1abhishekpandey Jun 19, 2024
c1aa1ec
fix: remove userId from the configurationAndroid class (#448)
1abhishekpandey Jun 30, 2024
df81123
fix: screen event (#450)
1abhishekpandey Jun 30, 2024
213a584
fix: prevent setting duplicate externalId types (#446)
1abhishekpandey Jun 30, 2024
d65b980
fix: decouple automatic lifecycle event from screen event (#422)
1abhishekpandey Jul 1, 2024
4624e84
feat: remove useless android instrumentation tests
ChryssaAliferi Jul 2, 2024
f8f35c8
feat: revert naming from RudderLogger to Logger.kt
ChryssaAliferi Jul 2, 2024
502ec97
feat: add typealias RudderLogLevel to Logger.LogLevel
ChryssaAliferi Jul 2, 2024
88211ac
Merge pull request #458 from rudderlabs/feature/sdk-2085-rename-back-…
ChryssaAliferi Jul 2, 2024
b393f41
feat: moves model classes to android module
ChryssaAliferi Jul 2, 2024
882b03d
feat: moves model classes to core module
ChryssaAliferi Jul 2, 2024
5b2d13b
feat: moves model classes to core test module
ChryssaAliferi Jul 2, 2024
6b8e706
feat: moves Extensions.kt classes to core module
ChryssaAliferi Jul 2, 2024
ac80acb
feat: package changes on source code
ChryssaAliferi Jul 2, 2024
8b7f193
feat: package changes on test code
ChryssaAliferi Jul 2, 2024
36a1606
feat: move files to correct packages
ChryssaAliferi Jul 2, 2024
e52f3eb
feat: deletes useless files from old module
ChryssaAliferi Jul 2, 2024
e2703e1
feat: removes models module
ChryssaAliferi Jul 2, 2024
62c8af5
feat: minor changes in build.gradle.kts files
ChryssaAliferi Jul 2, 2024
e3dfa31
feat: removes commented out code
ChryssaAliferi Jul 2, 2024
be6c36e
feat: minor fix in Properties.kt file
ChryssaAliferi Jul 2, 2024
4207d2c
feat: removes commented out code
ChryssaAliferi Jul 2, 2024
04e17e7
feat: formats serializable properties
ChryssaAliferi Jul 2, 2024
827499e
feat: removes commented out code
ChryssaAliferi Jul 2, 2024
09cfda2
Merge pull request #459 from rudderlabs/feature/sdk-2095-remove-model…
ChryssaAliferi Jul 2, 2024
8e9ed09
feat: add kotlin sample app with sample events (#462)
1abhishekpandey Jul 12, 2024
44726b2
feat: simplify configuration objects (#461)
1abhishekpandey Jul 12, 2024
c069afc
feat: turns Plugin to interface and applies setup method implementation
ChryssaAliferi Jul 18, 2024
7213ba3
feat: applies setup method implementation to InfrastructurePlugin int…
ChryssaAliferi Jul 18, 2024
fea4a2f
feat: applies changes in AppInstallUpdateTrackerPlugin
ChryssaAliferi Jul 18, 2024
e28ec9d
feat: applies changes to ActivityBroadcasterPlugin
ChryssaAliferi Jul 18, 2024
14c6393
feat: applies changes to AndroidStorageImpl
ChryssaAliferi Jul 18, 2024
e8150bd
feat: applies changes to AnonymousIdHeaderPlugin
ChryssaAliferi Jul 18, 2024
f48b079
feat: applies changes to ConfigDownloadServiceImpl
ChryssaAliferi Jul 18, 2024
c744a03
feat: applies changes to CountBasedFlushPolicy
ChryssaAliferi Jul 18, 2024
85a03bc
feat: applies changes to DataUploadServiceImpl
ChryssaAliferi Jul 18, 2024
6bd6f3d
feat: applies changes to DestinationConfigurationPlugin
ChryssaAliferi Jul 18, 2024
f9d08f1
feat: applies changes to EventFilteringPlugin
ChryssaAliferi Jul 18, 2024
94e512d
feat: applies changes to EventSizeFilterPlugin
ChryssaAliferi Jul 18, 2024
de54610
feat: applies changes to FillDefaultsPlugin
ChryssaAliferi Jul 18, 2024
cfcf26f
feat: applies changes to GDPRPlugin
ChryssaAliferi Jul 18, 2024
32e5dd5
feat: applies changes to IntervalBasedFlushPolicy
ChryssaAliferi Jul 18, 2024
07689e7
feat: applies changes to ExtractStatePlugin
ChryssaAliferi Jul 18, 2024
aebf45f
feat: applies changes to WorkerManagerPlugin
ChryssaAliferi Jul 18, 2024
2030003
feat: applies changes to WakeupActionPlugin
ChryssaAliferi Jul 18, 2024
4a06bf9
feat: applies changes to VerificationStorage
ChryssaAliferi Jul 18, 2024
14a1781
feat: applies changes to StoragePlugin
ChryssaAliferi Jul 18, 2024
f5b0db1
feat: applies changes to SessionPlugin
ChryssaAliferi Jul 18, 2024
d70e577
feat: applies changes to SampleWorkManagerPlugin
ChryssaAliferi Jul 18, 2024
ad41f50
feat: applies changes to RudderOptionPlugin
ChryssaAliferi Jul 18, 2024
b8eb76e
feat: applies changes to ResetImplementationPlugin
ChryssaAliferi Jul 18, 2024
222ee1d
feat: applies changes to ReinstatePlugin
ChryssaAliferi Jul 18, 2024
2a60dca
feat: applies changes to PlatformInputsPlugin
ChryssaAliferi Jul 18, 2024
c531a47
feat: applies changes to NavigationPlugin
ChryssaAliferi Jul 18, 2024
dbb7056
feat: applies changes to LifecycleObserverPlugin
ChryssaAliferi Jul 18, 2024
5f26410
feat: applies changes to BasicStorageImpl
ChryssaAliferi Jul 18, 2024
77e98ab
feat: applies changes to CoreInputsPlugin
ChryssaAliferi Jul 18, 2024
c87e3b2
feat: applies changes to DestinationPlugin
ChryssaAliferi Jul 18, 2024
226b6d7
feat: applies changes to BaseDestinationPluginCompat
ChryssaAliferi Jul 18, 2024
f61648d
feat: applies formatting changes
ChryssaAliferi Jul 18, 2024
3e2ce25
feat: applies changes in test classes
ChryssaAliferi Jul 18, 2024
2c1ca71
feat: applies change in custom logging plugin in the sample app
ChryssaAliferi Jul 18, 2024
547585d
chore: update codeowners and reviewer (#465)
1abhishekpandey Jul 18, 2024
5784365
Merge pull request #466 from rudderlabs/feature/sdk-2156-small-refact…
ChryssaAliferi Jul 19, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
17 changes: 8 additions & 9 deletions .github/workflows/build-v2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@ name: CI for v2

on:
push:
branches: [ 'master-v2' ]
branches: ["master-v2"]
pull_request:
branches: [ 'master-v2', 'develop-v2' ]
types: [ 'opened', 'reopened', 'edited', 'synchronize' ]
branches: ["master-v2", "develop-v2"]
types: ["opened", "reopened", "edited", "synchronize"]
workflow_dispatch:

jobs:
cancel_previous-v2:

runs-on: ubuntu-latest
steps:
- uses: styfle/[email protected]
Expand All @@ -29,17 +28,17 @@ jobs:
- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '11'
distribution: "temurin"
java-version: "17"

- name: Setup Ruby
uses: ruby/setup-ruby@v1

- name: Set Node 16
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
cache: 'npm'
node-version-file: ".nvmrc"
cache: "npm"

- name: Install node_modules
run: |
Expand Down Expand Up @@ -69,4 +68,4 @@ jobs:
npm run test
- name: Android Test Report
uses: asadmansr/[email protected]
if: ${{ always() }}
if: ${{ always() }}
2 changes: 1 addition & 1 deletion .github/workflows/draft_new_release-v2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,4 +92,4 @@ jobs:
github_token: ${{ secrets.PAT }}
pr_title: 'chore(release): pulling ${{ steps.create-release.outputs.branch_name }} into master-v2'
pr_body: ':crown: *An automated PR*'
pr_reviewer: 'itsdebs'
pr_reviewer: '@rudderlabs/sdk-android'
2 changes: 1 addition & 1 deletion .github/workflows/publish-new-github-release-v2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ jobs:
github_token: ${{ secrets.PAT }}
pr_title: 'chore(release): pulling master-v2 into develop-v2 post release v${{ steps.extract-version-v2.outputs.release_version }}'
pr_body: ':crown: *An automated PR*'
pr_reviewer: 'itsdebs'
pr_reviewer: '@rudderlabs/sdk-android'

- name: Delete hotfix release branch v2
uses: koj-co/delete-merged-action@master
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,6 @@ local.properties
node_modules
/.idea/
*/build

# Local Rudderstack file properties
rudderstack.properties
2 changes: 1 addition & 1 deletion CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1 +1 @@
* @pallabmaiti @itsdebs
* @rudderlabs/sdk-android
File renamed without changes.
88 changes: 88 additions & 0 deletions android/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
plugins {
id("com.android.library")
id("kotlin-android")
}

android {

namespace = "com.rudderstack.android"

compileSdk = RudderstackBuildConfig.Android.COMPILE_SDK

buildFeatures {
buildFeatures {
buildConfig = true
}
}
defaultConfig {
minSdk = RudderstackBuildConfig.Android.MIN_SDK
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles("consumer-rules.pro")
buildConfigField(
"String",
"LIBRARY_VERSION_NAME",
RudderstackBuildConfig.Version.VERSION_NAME
)
}

buildTypes {
named("release") {
isMinifyEnabled = false
setProguardFiles(
listOf(
getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro"
)
)
}
}
compileOptions {
sourceCompatibility = RudderstackBuildConfig.Build.JAVA_VERSION
targetCompatibility = RudderstackBuildConfig.Build.JAVA_VERSION
}
kotlinOptions {
jvmTarget = RudderstackBuildConfig.Build.JVM_TARGET
javaParameters = true
}
testOptions {
unitTests {
this.isIncludeAndroidResources = true
}
}
}

dependencies {
implementation(libs.android.core.ktx)
api(project(":core"))
api(project(":repository"))

compileOnly(project(":jacksonrudderadapter"))
compileOnly(project(":gsonrudderadapter"))
compileOnly(project(":moshirudderadapter"))
compileOnly(project(":rudderjsonadapter"))
compileOnly(libs.work)
compileOnly(libs.work.multiprocess)

testImplementation(project(":jacksonrudderadapter"))
testImplementation(project(":gsonrudderadapter"))
testImplementation(project(":moshirudderadapter"))
testImplementation(project(":rudderjsonadapter"))
testImplementation(project(":libs:test-common"))
testImplementation(libs.android.x.test)
testImplementation(libs.android.x.testrules)
testImplementation(libs.android.x.test.ext.junitktx)
testImplementation(libs.awaitility)
testImplementation(libs.hamcrest)
testImplementation(libs.junit)
testImplementation(libs.mockito.core)
testImplementation(libs.mockito.kotlin)
testImplementation(libs.mockk)
testImplementation(libs.mockk.agent)
testImplementation(libs.robolectric)
testImplementation(libs.work.test)

androidTestImplementation(libs.android.x.test.ext.junitktx)
}

apply(from = "${project.projectDir.parentFile}/gradle/artifacts-aar.gradle")
apply(from = "${project.projectDir.parentFile}/gradle/mvn-publish.gradle")
apply(from = "${project.projectDir.parentFile}/gradle/codecov.gradle")
Empty file added android/consumer-rules.pro
Empty file.
1 change: 1 addition & 0 deletions android/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
POM_ARTIFACT_ID=android
GROUP=com.rudderstack.android.sdk
POM_PACKAGING=aar
android.useAndroidX=true
android.enableJetifier=true
Expand Down
File renamed without changes.
10 changes: 10 additions & 0 deletions android/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,16 @@
"targets": {
"build": {
"executor": "@jnxplus/nx-gradle:build",
"dependsOn": [
{
"projects": [
"core",
"repository",
"rudderreporter"
],
"target": "build"
}
],
"outputs": [
"{projectRoot}/android/build"
]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Creator: Debanjan Chatterjee on 30/09/21, 11:41 PM Last modified: 30/09/21, 11:39 PM
~ Creator: Debanjan Chatterjee on 28/10/21, 7:56 PM Last modified: 28/10/21, 7:56 PM
~ Copyright: All rights reserved Ⓒ 2021 http://rudderstack.com
~
~ Licensed under the Apache License, Version 2.0 (the "License"); you may
Expand All @@ -14,13 +14,4 @@
-->

<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.RudderAndroidLibs" />

</manifest>
59 changes: 59 additions & 0 deletions android/src/main/java/com/rudderstack/android/AnalyticsRegistry.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
package com.rudderstack.android

import androidx.annotation.VisibleForTesting
import com.rudderstack.core.utilities.FutureUse
import com.rudderstack.core.Analytics
import java.util.concurrent.ConcurrentHashMap

/**
* AnalyticsRegistry is a singleton object responsible for managing and providing instances of the Analytics class.
* It maintains a mapping between write keys and Analytics instances using concurrent hash maps.
*
* The class provides methods for registering new Analytics instances with unique write keys,
* as well as retrieving instances based on write keys.
*
* Usage:
* - To register a new Analytics instance, use the [register] method, providing a write key and the Analytics instance.
* - To retrieve an Analytics instance, use the [getInstance] method, passing the write key.
*
* Note: The class is marked as internal, indicating that it is intended for use within the same module and should not be accessed
* from outside the module.
*/

@FutureUse("This class will be utilized when multiple instances are implemented.")
internal object AnalyticsRegistry {

private val writeKeyToInstance: ConcurrentHashMap<String, Analytics> = ConcurrentHashMap()

/**
* Registers a new Analytics instance with the provided write key and Analytics instance.
* If an instance with the same write key already exists, it will not be overwritten.
*
* @param writeKey The unique identifier associated with the Analytics instance.
* @param analytics The Analytics instance to be registered.
*/
@JvmStatic
fun register(writeKey: String, analytics: Analytics) {
writeKeyToInstance.putIfAbsent(writeKey, analytics)
}

/**
* Retrieves an Analytics instance based on the provided write key.
*
* @param writeKey The write key associated with the desired Analytics instance.
* @return The Analytics instance if found, otherwise null.
*/
@JvmStatic
fun getInstance(writeKey: String): Analytics? {
return writeKeyToInstance[writeKey]
}

/**
* Clears the mapping of write keys to Analytics instances.
* Note: This method is intended for use in testing scenarios only.
*/
@VisibleForTesting
fun clear() {
writeKeyToInstance.clear()
}
}
Loading
Loading