Skip to content

Commit 84dff58

Browse files
committed
Copy description changes based on notifyme card visibility
1 parent 2a7648f commit 84dff58

File tree

2 files changed

+21
-5
lines changed

2 files changed

+21
-5
lines changed

windows/windows-impl/src/main/java/com/duckduckgo/windows/impl/waitlist/ui/WindowsWaitlistActivity.kt

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,15 @@ import android.view.View
2929
import android.widget.Toast
3030
import androidx.core.content.ContextCompat
3131
import androidx.core.text.HtmlCompat
32+
import androidx.core.view.isVisible
3233
import androidx.lifecycle.Lifecycle
3334
import androidx.lifecycle.flowWithLifecycle
3435
import androidx.lifecycle.lifecycleScope
3536
import com.duckduckgo.anvil.annotations.InjectWith
3637
import com.duckduckgo.app.global.DuckDuckGoActivity
3738
import com.duckduckgo.di.scopes.ActivityScope
3839
import com.duckduckgo.macos_api.MacOsNav
40+
import com.duckduckgo.mobile.android.ui.notifyme.NotifyMeView
3941
import com.duckduckgo.mobile.android.ui.spans.DuckDuckGoClickableSpan
4042
import com.duckduckgo.mobile.android.ui.view.addClickableSpan
4143
import com.duckduckgo.mobile.android.ui.view.gone
@@ -123,7 +125,7 @@ class WindowsWaitlistActivity : DuckDuckGoActivity() {
123125
listOf(Pair("beta_link", windowsSpan)),
124126
)
125127
binding.waitListButton.gone()
126-
binding.waitlistNotifyMe.gone()
128+
binding.waitlistNotifyMeContainer.gone()
127129
binding.lookingForMacVersionButton.gone()
128130
binding.footerDescription.gone()
129131
binding.codeFrame.show()
@@ -136,25 +138,38 @@ class WindowsWaitlistActivity : DuckDuckGoActivity() {
136138
binding.waitListButton.gone()
137139
binding.codeFrame.gone()
138140
binding.shareImage.gone()
139-
binding.waitlistNotifyMe.show()
141+
binding.waitlistNotifyMeContainer.show()
140142
binding.lookingForMacVersionButton.show()
141143
binding.footerDescription.gone()
142144
binding.headerImage.setImageResource(com.duckduckgo.mobile.android.R.drawable.ic_list)
143145
binding.statusTitle.text = getString(R.string.windows_waitlist_on_the_list_title)
144-
binding.waitlistDescription.text = getText(R.string.windows_waitlist_on_the_list_notification)
146+
binding.waitlistDescription.text = getJoinedQueueDescriptionText(binding.waitlistNotifyMe.isVisible)
147+
binding.waitlistNotifyMe.setOnVisibilityChange(object : NotifyMeView.OnVisibilityChangedListener {
148+
override fun onVisibilityChange(v: View?, isVisible: Boolean) {
149+
binding.waitlistDescription.text = getJoinedQueueDescriptionText(isVisible)
150+
}
151+
})
145152
}
146153

147154
private fun renderNotJoinedQueue() {
148155
binding.headerImage.setImageResource(com.duckduckgo.mobile.android.R.drawable.ic_computer_win)
149156
binding.waitListButton.show()
150-
binding.waitlistNotifyMe.gone()
157+
binding.waitlistNotifyMeContainer.gone()
151158
binding.lookingForMacVersionButton.show()
152159
binding.footerDescription.show()
153160
binding.codeFrame.gone()
154161
binding.shareImage.gone()
155162
binding.waitlistDescription.text = getText(R.string.windows_waitlist_description)
156163
}
157164

165+
private fun getJoinedQueueDescriptionText(notifyMeVisible: Boolean): String {
166+
return if (notifyMeVisible) {
167+
getString(R.string.windows_waitlist_on_the_list_notification_disabled)
168+
} else {
169+
getString(R.string.windows_waitlist_on_the_list_notification_enabled)
170+
}
171+
}
172+
158173
private fun renderErrorMessage() {
159174
binding.waitListButton.isEnabled = true
160175
Toast.makeText(this, R.string.windows_join_waitlist_error, Toast.LENGTH_LONG).show()

windows/windows-impl/src/main/res/layout/activity_windows_waitlist.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@
9292
app:layout_constraintTop_toBottomOf="@+id/statusTitle" />
9393

9494
<FrameLayout
95-
android:id="@+id/waitlistNotifyMe"
95+
android:id="@+id/waitlistNotifyMeContainer"
9696
android:layout_width="match_parent"
9797
android:layout_height="wrap_content"
9898
app:layout_constraintEnd_toEndOf="parent"
@@ -101,6 +101,7 @@
101101
android:visibility="gone">
102102

103103
<com.duckduckgo.mobile.android.ui.notifyme.NotifyMeView
104+
android:id="@+id/waitlistNotifyMe"
104105
android:layout_width="match_parent"
105106
android:layout_height="wrap_content"
106107
app:primaryText="@string/waitlistNotifyMeTitle"

0 commit comments

Comments
 (0)