Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move Contact, Tell Friends, Rate Us to Main Settings page #6644

Merged
merged 1 commit into from
Sep 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package io.horizontalsystems.bankwallet.modules.settings.about

import android.content.Context
import android.content.Intent
import androidx.compose.foundation.Image
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
Expand Down Expand Up @@ -31,8 +29,6 @@ import io.horizontalsystems.bankwallet.R
import io.horizontalsystems.bankwallet.core.BaseComposeFragment
import io.horizontalsystems.bankwallet.core.composablePage
import io.horizontalsystems.bankwallet.core.composablePopup
import io.horizontalsystems.bankwallet.core.managers.RateAppManager
import io.horizontalsystems.bankwallet.core.providers.Translator
import io.horizontalsystems.bankwallet.core.slideFromBottom
import io.horizontalsystems.bankwallet.modules.releasenotes.ReleaseNotesScreen
import io.horizontalsystems.bankwallet.modules.settings.appstatus.AppStatusScreen
Expand All @@ -45,6 +41,7 @@ import io.horizontalsystems.bankwallet.ui.compose.components.CellSingleLineLawre
import io.horizontalsystems.bankwallet.ui.compose.components.CellUniversalLawrenceSection
import io.horizontalsystems.bankwallet.ui.compose.components.HsBackButton
import io.horizontalsystems.bankwallet.ui.compose.components.InfoTextBody
import io.horizontalsystems.bankwallet.ui.compose.components.VSpacer
import io.horizontalsystems.bankwallet.ui.compose.components.subhead2_grey
import io.horizontalsystems.bankwallet.ui.helpers.LinkHelper
import io.horizontalsystems.core.findNavController
Expand Down Expand Up @@ -194,36 +191,8 @@ private fun SettingSections(
)
})
)

Spacer(Modifier.height(32.dp))

CellUniversalLawrenceSection(
listOf({
HsSettingCell(
R.string.Settings_RateUs,
R.drawable.ic_star_20,
onClick = { RateAppManager.openPlayMarket(context) }
)
}, {
HsSettingCell(
R.string.Settings_ShareThisWallet,
R.drawable.ic_share_20,
onClick = { shareAppLink(viewModel.appWebPageLink, context) }
)
})
)

Spacer(Modifier.height(32.dp))

CellUniversalLawrenceSection(
listOf {
HsSettingCell(
R.string.SettingsContact_Title,
R.drawable.ic_mail_24,
onClick = showContactOptions
)
}
)

VSpacer(32.dp)
}

@Composable
Expand Down Expand Up @@ -257,19 +226,6 @@ fun AboutHeader(appVersion: String) {
}
}

private fun shareAppLink(appLink: String, context: Context) {
val shareMessage = Translator.getString(R.string.SettingsShare_Text) + "\n" + appLink + "\n"
val shareIntent = Intent(Intent.ACTION_SEND)
shareIntent.type = "text/plain"
shareIntent.putExtra(Intent.EXTRA_TEXT, shareMessage)
context.startActivity(
Intent.createChooser(
shareIntent,
Translator.getString(R.string.SettingsShare_Title)
)
)
}

@Preview
@Composable
private fun previewAboutScreen() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package io.horizontalsystems.bankwallet.modules.settings.main

import android.content.Context
import android.content.Intent
import androidx.annotation.DrawableRes
import androidx.annotation.StringRes
import androidx.compose.foundation.Image
Expand Down Expand Up @@ -30,6 +32,7 @@ import androidx.core.os.bundleOf
import androidx.lifecycle.viewmodel.compose.viewModel
import androidx.navigation.NavController
import io.horizontalsystems.bankwallet.R
import io.horizontalsystems.bankwallet.core.managers.RateAppManager
import io.horizontalsystems.bankwallet.core.providers.Translator
import io.horizontalsystems.bankwallet.core.slideFromBottom
import io.horizontalsystems.bankwallet.core.slideFromRight
Expand Down Expand Up @@ -85,6 +88,7 @@ private fun SettingSections(
val wcCounter by viewModel.wcCounterLiveData.observeAsState()
val baseCurrency by viewModel.baseCurrencyLiveData.observeAsState()
val language by viewModel.languageLiveData.observeAsState()
val context = LocalContext.current

CellUniversalLawrenceSection(
listOf {
Expand Down Expand Up @@ -124,7 +128,7 @@ private fun SettingSections(
})
)

Spacer(Modifier.height(32.dp))
VSpacer(32.dp)

CellUniversalLawrenceSection(
listOf {
Expand Down Expand Up @@ -160,7 +164,7 @@ private fun SettingSections(
}
)

Spacer(Modifier.height(32.dp))
VSpacer(32.dp)

CellUniversalLawrenceSection(
listOf(
Expand Down Expand Up @@ -215,7 +219,7 @@ private fun SettingSections(
)
)

Spacer(Modifier.height(32.dp))
VSpacer(32.dp)

CellUniversalLawrenceSection(
listOf {
Expand All @@ -229,7 +233,7 @@ private fun SettingSections(
}
)

Spacer(Modifier.height(32.dp))
VSpacer(32.dp)

CellUniversalLawrenceSection(
listOf({
Expand All @@ -251,7 +255,7 @@ private fun SettingSections(
})
)

Spacer(Modifier.height(32.dp))
VSpacer(32.dp)

CellUniversalLawrenceSection(
listOf {
Expand All @@ -266,7 +270,31 @@ private fun SettingSections(
}
)

Spacer(Modifier.height(32.dp))
VSpacer(32.dp)

CellUniversalLawrenceSection(
listOf({
HsSettingCell(
R.string.Settings_RateUs,
R.drawable.ic_star_20,
onClick = { RateAppManager.openPlayMarket(context) }
)
}, {
HsSettingCell(
R.string.Settings_ShareThisWallet,
R.drawable.ic_share_20,
onClick = { shareAppLink(viewModel.appWebPageLink, context) }
)
}, {
HsSettingCell(
R.string.SettingsContact_Title,
R.drawable.ic_mail_24,
onClick = { navController.slideFromBottom(R.id.contactOptionsDialog) },
)
})
)

VSpacer(32.dp)
}

@Composable
Expand Down Expand Up @@ -360,6 +388,19 @@ private fun SettingsFooter(appVersion: String, companyWebPage: String) {
}
}

private fun shareAppLink(appLink: String, context: Context) {
val shareMessage = Translator.getString(R.string.SettingsShare_Text) + "\n" + appLink + "\n"
val shareIntent = Intent(Intent.ACTION_SEND)
shareIntent.type = "text/plain"
shareIntent.putExtra(Intent.EXTRA_TEXT, shareMessage)
context.startActivity(
Intent.createChooser(
shareIntent,
Translator.getString(R.string.SettingsShare_Title)
)
)
}

@Preview
@Composable
private fun previewSettingsScreen() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class MainSettingsService(
private val appConfigProvider: AppConfigProvider
) {

val appWebPageLink = appConfigProvider.appWebPageLink
private val backedUpSubject = BehaviorSubject.create<Boolean>()
val backedUpObservable: Observable<Boolean> get() = backedUpSubject

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class MainSettingsViewModel(
val baseCurrencyLiveData = MutableLiveData(service.baseCurrency)
val languageLiveData = MutableLiveData(service.currentLanguageDisplayName)
val appVersion by service::appVersion
val appWebPageLink by service::appWebPageLink

private var wcSessionsCount = service.walletConnectSessionCount
private var wc2PendingRequestCount = 0
Expand Down