Skip to content

Commit

Permalink
new pop up urls and text
Browse files Browse the repository at this point in the history
  • Loading branch information
i-kulikov-geniusee committed Jul 3, 2023
1 parent fe6a8ab commit 9801ff7
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,9 @@ class HomeSelectionActivity : BaseActivity() {
viewModel.connectionState.observe(this) {
handleConnectionState(it)
}
viewModel.showNewAppUrl.observe(this) {
viewModel.showNewAppUrl.observe(this) { link ->
val i = Intent(Intent.ACTION_VIEW)
i.data = Uri.parse(getString(R.string.new_pop_up_url))
i.data = Uri.parse(link)
startActivity(i)
}
viewModel.isNewAppPopUpShow.observe(this) { isShow ->
Expand All @@ -123,7 +123,7 @@ class HomeSelectionActivity : BaseActivity() {

private fun bindsAction() {
binding.newAppNotification.setOnClickListener {
viewModel.openNewAppLink(NewAppPopupSource.NOTIFICATION)
viewModel.openNewAppLink(NewAppPopupSource.NOTIFICATION, getString(R.string.new_pop_up_url_download_url))
}
binding.newAppNotificationClose.setOnClickListener {
viewModel.closeNewAppPopups(NewAppPopupSource.NOTIFICATION)
Expand Down Expand Up @@ -315,14 +315,23 @@ class HomeSelectionActivity : BaseActivity() {
private fun showNewAppPopup() {
bindingNewAppPopUp = PopUpDownloadNewApplicationBinding.inflate(layoutInflater)
dialogPasswordPopup = createPopUp(bindingNewAppPopUp.root, true)
dialogPasswordPopup?.setOnDismissListener {
viewModel.closeNewAppPopups(NewAppPopupSource.POP_UP)
}
with(bindingNewAppPopUp) {
acceptButton.setOnClickListener {
dialogPasswordPopup?.dismiss()
viewModel.openNewAppLink(NewAppPopupSource.POP_UP)
viewModel.openNewAppLink(
NewAppPopupSource.POP_UP,
getString(R.string.new_pop_up_url_download_url)
)
}
declineButton.setOnClickListener {
dialogPasswordPopup?.dismiss()
viewModel.closeNewAppPopups(NewAppPopupSource.POP_UP)
viewModel.openNewAppLink(
NewAppPopupSource.POP_UP,
getString(R.string.new_pop_up_learn_more)
)
}
}
dialogPasswordPopup?.show()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class HomeSelectionViewModel(useCaseProvider: UseCaseProvider) : ViewModel() {
get() = _isNewAppNotificationShow
private val _isNewAppNotificationShow = MutableLiveData<Boolean>()

val showNewAppUrl = SingleLiveEvent<Unit>()
val showNewAppUrl = SingleLiveEvent<String>()

private val _connectionState = MutableLiveData<ConnectionState>()
private val connectionUseCase = useCaseProvider.connection()
Expand Down Expand Up @@ -83,8 +83,8 @@ class HomeSelectionViewModel(useCaseProvider: UseCaseProvider) : ViewModel() {
settingsUseCase.getResidentCountry()
}

fun openNewAppLink(popUp: NewAppPopupSource) {
showNewAppUrl.value = Unit
fun openNewAppLink(popUp: NewAppPopupSource, link: String) {
showNewAppUrl.value = link
closeNewAppPopups(popUp)
}

Expand Down
5 changes: 3 additions & 2 deletions android/app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -323,10 +323,11 @@
<string name="pop_up_download_new_application_title">Mysterium VPN 2.0 for\nAndroid is live!</string>
<string name="pop_up_download_new_application_message">Download the new app to use\nMysterium VPN on Android, iOS,\nMac and Windows.</string>
<string name="pop_up_download_new_application_accept_btn">Download</string>
<string name="pop_up_download_new_application_declain_btn">Go to Home</string>
<string name="pop_up_download_new_application_declain_btn">Learn More</string>

<string name="notification_download_new_application_title">Mysterium VPN 2.0 for Android is live!</string>
<string name="notification_download_new_application_message">Download the new app to use Mysterium\nVPN on Android, iOS,Mac and Windows.</string>

<string name="new_pop_up_url" translatable="false">https://mysteriumvpn.com/v2</string>
<string name="new_pop_up_learn_more" translatable="false">https://mysteriumvpn.com/v2</string>
<string name="new_pop_up_url_download_url" translatable="false">https://play.google.com/store/apps/details?id=com.mysteriumvpn.android&amp;hl=en&amp;gl=US</string>
</resources>

0 comments on commit 9801ff7

Please sign in to comment.