creating a build meta abstraction for allowing testing classes with build version checks

This commit is contained in:
Adam Brown 2022-05-12 12:33:23 +01:00
parent ea7df9b673
commit 797e0ee706
3 changed files with 51 additions and 0 deletions

View File

@ -33,6 +33,7 @@ import im.vector.app.config.analyticsConfig
import im.vector.app.core.dispatchers.CoroutineDispatchers
import im.vector.app.core.error.DefaultErrorFormatter
import im.vector.app.core.error.ErrorFormatter
import im.vector.app.core.resources.BuildMeta
import im.vector.app.core.time.Clock
import im.vector.app.core.time.DefaultClock
import im.vector.app.features.analytics.AnalyticsConfig
@ -185,4 +186,9 @@ object VectorStaticModule {
fun providesAnalyticsConfig(): AnalyticsConfig {
return analyticsConfig
}
@Provides
@Singleton
fun providesBuildMeta() = BuildMeta()
}

View File

@ -0,0 +1,23 @@
/*
* Copyright (c) 2022 New Vector Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package im.vector.app.core.resources
import android.os.Build
data class BuildMeta(
val sdkInt: Int = Build.VERSION.SDK_INT
)

View File

@ -0,0 +1,22 @@
/*
* Copyright (c) 2022 New Vector Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package im.vector.app.test.fixtures
import android.os.Build
import im.vector.app.core.resources.BuildMeta
fun aBuildMeta() = BuildMeta(Build.VERSION_CODES.O)