File tree Expand file tree Collapse file tree 6 files changed +48
-20
lines changed
main/kotlin/com/google/firebase/sessions
test/kotlin/com/google/firebase/sessions Expand file tree Collapse file tree 6 files changed +48
-20
lines changed Original file line number Diff line number Diff line change @@ -42,11 +42,11 @@ android {
42
42
}
43
43
44
44
dependencies {
45
+ implementation(" com.google.firebase:firebase-common-ktx:20.3.2" )
46
+ implementation(" com.google.firebase:firebase-components:17.1.0" )
47
+ implementation(" com.google.firebase:firebase-encoders-json:18.0.1" )
45
48
implementation(" com.google.firebase:firebase-encoders:17.0.0" )
46
- implementation(project(" :encoders:firebase-encoders-json" ))
47
49
implementation(" com.google.firebase:firebase-installations-interop:17.1.0" )
48
- implementation(" com.google.firebase:firebase-common-ktx:20.3.1" )
49
- implementation(" com.google.firebase:firebase-components:17.1.0" )
50
50
implementation(libs.androidx.annotation)
51
51
52
52
runtimeOnly(" com.google.firebase:firebase-installations:17.1.3" )
Original file line number Diff line number Diff line change
1
+ <!--
2
+ ~ Copyright 2023 Google LLC
3
+ ~
4
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
5
+ ~ you may not use this file except in compliance with the License.
6
+ ~ You may obtain a copy of the License at
7
+ ~
8
+ ~ http://www.apache.org/licenses/LICENSE-2.0
9
+ ~
10
+ ~ Unless required by applicable law or agreed to in writing, software
11
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
12
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ ~ See the License for the specific language governing permissions and
14
+ ~ limitations under the License.
15
+ -->
16
+
17
+ <manifest xmlns : android =" http://schemas.android.com/apk/res/android"
18
+ package =" com.google.firebase.sessions.test"
19
+ android : versionCode =" 1"
20
+ android : versionName =" 1.0.0" >
21
+
22
+ <application >
23
+
24
+ </application >
25
+
26
+ </manifest >
Original file line number Diff line number Diff line change 16
16
17
17
package com.google.firebase.sessions
18
18
19
- import com.google.firebase.FirebaseApp
20
19
import com.google.firebase.encoders.json.NumberedEnum
21
20
22
21
/* * Enum denoting different development environments. */
@@ -58,17 +57,3 @@ internal data class ApplicationInfo(
58
57
/* * The android application information for the app. */
59
58
val androidAppInfo : AndroidApplicationInfo ,
60
59
)
61
-
62
- internal fun getApplicationInfo (firebaseApp : FirebaseApp ): ApplicationInfo {
63
- val packageName = firebaseApp.applicationContext.packageName
64
- val packageInfo = firebaseApp.applicationContext.packageManager.getPackageInfo(packageName, 0 )
65
-
66
- return ApplicationInfo (
67
- appId = firebaseApp.options.applicationId,
68
- deviceModel = " " ,
69
- sessionSdkVersion = BuildConfig .VERSION_NAME ,
70
- logEnvironment = LogEnvironment .LOG_ENVIRONMENT_PROD ,
71
- androidAppInfo =
72
- AndroidApplicationInfo (packageName = packageName, versionName = packageInfo.versionName)
73
- )
74
- }
Original file line number Diff line number Diff line change @@ -74,4 +74,19 @@ internal object SessionEvents {
74
74
),
75
75
applicationInfo = getApplicationInfo(firebaseApp)
76
76
)
77
+
78
+ fun getApplicationInfo (firebaseApp : FirebaseApp ): ApplicationInfo {
79
+ val context = firebaseApp.applicationContext
80
+ val packageName = context.packageName
81
+ val packageInfo = context.packageManager.getPackageInfo(packageName, 0 )
82
+
83
+ return ApplicationInfo (
84
+ appId = firebaseApp.options.applicationId,
85
+ deviceModel = " " ,
86
+ sessionSdkVersion = BuildConfig .VERSION_NAME ,
87
+ logEnvironment = LogEnvironment .LOG_ENVIRONMENT_PROD ,
88
+ androidAppInfo =
89
+ AndroidApplicationInfo (packageName = packageName, versionName = packageInfo.versionName)
90
+ )
91
+ }
77
92
}
Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ class ApplicationInfoTest {
31
31
32
32
@Test
33
33
fun applicationInfo_populatesInfoCorrectly () {
34
- val applicationInfo = getApplicationInfo(FakeFirebaseApp .fakeFirebaseApp())
34
+ val applicationInfo = SessionEvents . getApplicationInfo(FakeFirebaseApp .fakeFirebaseApp())
35
35
assertThat(applicationInfo)
36
36
.isEqualTo(
37
37
ApplicationInfo (
Original file line number Diff line number Diff line change 17
17
plugins {
18
18
id(" com.android.application" )
19
19
id(" org.jetbrains.kotlin.android" )
20
- id(" com.google.gms.google-services" )
21
20
}
22
21
23
22
android {
@@ -47,3 +46,6 @@ dependencies {
47
46
implementation(" androidx.core:core-ktx:1.9.0" )
48
47
implementation(" com.google.android.material:material:1.8.0" )
49
48
}
49
+
50
+ extra[" packageName" ] = " com.google.firebase.testing.sessions"
51
+ apply (from = " ../../gradle/googleServices.gradle" )
You can’t perform that action at this time.
0 commit comments