Skip to content

Commit 9ebf34c

Browse files
authored
PIR: Remove testing code (#6475)
Task/Issue URL: https://app.asana.com/1/137249556945/project/72649045549333/task/1210886091660756?focus=true ### Description Removes tester code. ### Steps to test this PR No tests required ### UI changes No UI changes
1 parent ffe9b5a commit 9ebf34c

File tree

5 files changed

+1
-103
lines changed

5 files changed

+1
-103
lines changed

pir/pir-internal/src/main/java/com/duckduckgo/pir/internal/brokers/PirDataUpdateObserver.kt

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,8 @@ import com.duckduckgo.app.lifecycle.MainProcessLifecycleObserver
2222
import com.duckduckgo.common.utils.DispatcherProvider
2323
import com.duckduckgo.di.scopes.AppScope
2424
import com.duckduckgo.pir.impl.PirRemoteFeatures
25-
import com.duckduckgo.pir.internal.store.PitTestingStore
2625
import com.duckduckgo.subscriptions.api.Subscriptions
2726
import com.squareup.anvil.annotations.ContributesMultibinding
28-
import java.util.UUID
2927
import javax.inject.Inject
3028
import kotlinx.coroutines.CoroutineScope
3129
import kotlinx.coroutines.launch
@@ -41,14 +39,10 @@ class PirDataUpdateObserver @Inject constructor(
4139
private val brokerJsonUpdater: BrokerJsonUpdater,
4240
private val subscriptions: Subscriptions,
4341
private val pirRemoteFeatures: PirRemoteFeatures,
44-
private val testingStore: PitTestingStore,
4542
) : MainProcessLifecycleObserver {
4643
override fun onCreate(owner: LifecycleOwner) {
4744
coroutineScope.launch(dispatcherProvider.io()) {
4845
if (pirRemoteFeatures.pirBeta().isEnabled() && subscriptions.getAccessToken() != null) {
49-
if (testingStore.testerId == null) {
50-
testingStore.testerId = UUID.randomUUID().toString()
51-
}
5246
logcat { "PIR-update: Attempting to update all broker data" }
5347
if (brokerJsonUpdater.update()) {
5448
logcat { "PIR-update: Update successfully completed." }

pir/pir-internal/src/main/java/com/duckduckgo/pir/internal/pixels/PirPixelInterceptor.kt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import android.util.Base64
2222
import com.duckduckgo.appbuildconfig.api.AppBuildConfig
2323
import com.duckduckgo.common.utils.plugins.pixel.PixelInterceptorPlugin
2424
import com.duckduckgo.di.scopes.AppScope
25-
import com.duckduckgo.pir.internal.store.PitTestingStore
2625
import com.squareup.anvil.annotations.ContributesMultibinding
2726
import javax.inject.Inject
2827
import okhttp3.Interceptor
@@ -37,7 +36,6 @@ class PirPixelInterceptor @Inject constructor(
3736
private val context: Context,
3837
private val appBuildConfig: AppBuildConfig,
3938
private val networkInfoProvider: NetworkInfoProvider,
40-
private val testingStore: PitTestingStore,
4139
) : PixelInterceptorPlugin, Interceptor {
4240
override fun intercept(chain: Interceptor.Chain): Response {
4341
val request = chain.request().newBuilder()
@@ -52,7 +50,6 @@ class PirPixelInterceptor @Inject constructor(
5250
.put("batteryOptimizations", (!isIgnoringBatteryOptimizations()).toString())
5351
.put("man", appBuildConfig.manufacturer)
5452
.put("networkInfo", networkInfoProvider.getCurrentNetworkInfo())
55-
.put("testerId", testingStore.testerId ?: "UNKNOWN")
5653
.toString().toByteArray().run {
5754
Base64.encodeToString(this, Base64.NO_WRAP or Base64.NO_PADDING or Base64.URL_SAFE)
5855
},

pir/pir-internal/src/main/java/com/duckduckgo/pir/internal/settings/PirDevSettingsActivity.kt

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,7 @@ package com.duckduckgo.pir.internal.settings
1818

1919
import android.app.NotificationChannel
2020
import android.app.NotificationManager
21-
import android.content.ClipData
22-
import android.content.ClipboardManager
2321
import android.os.Bundle
24-
import android.widget.Toast
2522
import androidx.lifecycle.lifecycleScope
2623
import com.duckduckgo.anvil.annotations.ContributeToActivityStarter
2724
import com.duckduckgo.anvil.annotations.InjectWith
@@ -34,10 +31,8 @@ import com.duckduckgo.navigation.api.GlobalActivityStarter.ActivityParams
3431
import com.duckduckgo.pir.internal.databinding.ActivityPirInternalSettingsBinding
3532
import com.duckduckgo.pir.internal.settings.PirResultsScreenParams.PirEventsResultsScreen
3633
import com.duckduckgo.pir.internal.store.PirRepository
37-
import com.duckduckgo.pir.internal.store.PitTestingStore
3834
import javax.inject.Inject
3935
import kotlinx.coroutines.launch
40-
import kotlinx.coroutines.withContext
4136

4237
@InjectWith(ActivityScope::class)
4338
@ContributeToActivityStarter(PirSettingsScreenNoParams::class)
@@ -48,9 +43,6 @@ class PirDevSettingsActivity : DuckDuckGoActivity() {
4843
@Inject
4944
lateinit var repository: PirRepository
5045

51-
@Inject
52-
lateinit var testingStore: PitTestingStore
53-
5446
@Inject
5547
lateinit var dispatcherProvider: DispatcherProvider
5648

@@ -77,25 +69,6 @@ class PirDevSettingsActivity : DuckDuckGoActivity() {
7769
binding.viewRunEvents.setOnClickListener {
7870
globalActivityStarter.start(this, PirEventsResultsScreen)
7971
}
80-
81-
binding.testerInfo.setSecondaryText(testingStore.testerId)
82-
if (testingStore.testerId != null) {
83-
binding.testerInfo.setLongClickListener {
84-
copyDataToClipboard()
85-
}
86-
}
87-
}
88-
89-
private fun copyDataToClipboard() {
90-
val clipboardManager = getSystemService(ClipboardManager::class.java)
91-
92-
lifecycleScope.launch(dispatcherProvider.io()) {
93-
clipboardManager.setPrimaryClip(ClipData.newPlainText("", testingStore.testerId))
94-
95-
withContext(dispatcherProvider.main()) {
96-
Toast.makeText(this@PirDevSettingsActivity, "Testing ID copied to clipboard", Toast.LENGTH_SHORT).show()
97-
}
98-
}
9972
}
10073

10174
private fun bindViews() {

pir/pir-internal/src/main/java/com/duckduckgo/pir/internal/store/PitTestingStore.kt

Lines changed: 0 additions & 59 deletions
This file was deleted.

pir/pir-internal/src/main/res/layout/activity_pir_internal_settings.xml

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,6 @@
3838
app:popupTheme="@style/Widget.DuckDuckGo.PopUpOverflowMenu" />
3939
</com.google.android.material.appbar.AppBarLayout>
4040

41-
<com.duckduckgo.common.ui.view.listitem.TwoLineListItem
42-
android:id="@+id/testerInfo"
43-
android:layout_width="match_parent"
44-
android:layout_height="wrap_content"
45-
android:layout_marginTop="@dimen/keyline_4"
46-
app:primaryText="Tester ID" />
47-
4841
<ScrollView
4942
android:layout_width="match_parent"
5043
android:layout_height="match_parent"
@@ -77,4 +70,4 @@
7770
android:text="@string/pirDevViewRunEvents" />
7871
</LinearLayout>
7972
</ScrollView>
80-
</LinearLayout>
73+
</LinearLayout>

0 commit comments

Comments
 (0)