Skip to content

Commit

Permalink
fix build when metrics disabled (#989)
Browse files Browse the repository at this point in the history
**Background**

Android Project can't be build with disabled metrics due to it's inject
in SingleActivity #988

**Changes**

- Add NoOp for AndroiMetricsApi

**Test plan**

- Assemble project with disabled metrics
  • Loading branch information
makeevrserg authored Nov 12, 2024
1 parent ee075be commit c879b21
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

# 1.8.1 - In Progress

- [FIX] Fix build when no metrics enabled

# 1.8.0
Attention: don't forget to add the flag for F-Droid before release

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.flipperdevices.metric.noop

import com.flipperdevices.core.di.AppGraph
import com.flipperdevices.metric.api.MetricAndroidApi
import com.flipperdevices.metric.api.MetricApi
import com.flipperdevices.metric.api.events.ComplexEvent
import com.flipperdevices.metric.api.events.SessionState
import com.flipperdevices.metric.api.events.SimpleEvent
import com.squareup.anvil.annotations.ContributesBinding
import javax.inject.Inject

@ContributesBinding(AppGraph::class, MetricAndroidApi::class)
class NoopMetricAndroidApiImpl @Inject constructor() : MetricApi, MetricAndroidApi {
override fun reportSessionState(state: SessionState) = Unit

override fun reportSimpleEvent(simpleEvent: SimpleEvent, arg: String?) = Unit

override fun reportComplexEvent(complexEvent: ComplexEvent) = Unit
}

0 comments on commit c879b21

Please sign in to comment.