fix click of floating action buttons

This commit is contained in:
greenart7c3
2024-04-15 16:32:32 -03:00
parent 7b46840539
commit 6bf69658c0
14 changed files with 61 additions and 51 deletions
+1 -1
View File
@@ -14,7 +14,7 @@ android {
applicationId "com.greenart7c3.nostrsigner"
minSdk 26
targetSdk 34
versionCode 50
versionCode 51
versionName "1.0.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
+25 -25
View File
@@ -11,23 +11,10 @@
"type": "UNIVERSAL",
"filters": [],
"attributes": [],
"versionCode": 50,
"versionCode": 51,
"versionName": "1.0.0",
"outputFile": "app-play-universal-release.apk"
},
{
"type": "ONE_OF_MANY",
"filters": [
{
"filterType": "ABI",
"value": "armeabi-v7a"
}
],
"attributes": [],
"versionCode": 50,
"versionName": "1.0.0",
"outputFile": "app-play-armeabi-v7a-release.apk"
},
{
"type": "ONE_OF_MANY",
"filters": [
@@ -37,7 +24,7 @@
}
],
"attributes": [],
"versionCode": 50,
"versionCode": 51,
"versionName": "1.0.0",
"outputFile": "app-play-x86_64-release.apk"
},
@@ -46,13 +33,13 @@
"filters": [
{
"filterType": "ABI",
"value": "arm64-v8a"
"value": "armeabi-v7a"
}
],
"attributes": [],
"versionCode": 50,
"versionCode": 51,
"versionName": "1.0.0",
"outputFile": "app-play-arm64-v8a-release.apk"
"outputFile": "app-play-armeabi-v7a-release.apk"
},
{
"type": "ONE_OF_MANY",
@@ -63,9 +50,22 @@
}
],
"attributes": [],
"versionCode": 50,
"versionCode": 51,
"versionName": "1.0.0",
"outputFile": "app-play-x86-release.apk"
},
{
"type": "ONE_OF_MANY",
"filters": [
{
"filterType": "ABI",
"value": "arm64-v8a"
}
],
"attributes": [],
"versionCode": 51,
"versionName": "1.0.0",
"outputFile": "app-play-arm64-v8a-release.apk"
}
],
"elementType": "File",
@@ -75,10 +75,10 @@
"maxApi": 30,
"baselineProfiles": [
"baselineProfiles/1/app-play-universal-release.dm",
"baselineProfiles/1/app-play-armeabi-v7a-release.dm",
"baselineProfiles/1/app-play-x86_64-release.dm",
"baselineProfiles/1/app-play-arm64-v8a-release.dm",
"baselineProfiles/1/app-play-x86-release.dm"
"baselineProfiles/1/app-play-armeabi-v7a-release.dm",
"baselineProfiles/1/app-play-x86-release.dm",
"baselineProfiles/1/app-play-arm64-v8a-release.dm"
]
},
{
@@ -86,10 +86,10 @@
"maxApi": 2147483647,
"baselineProfiles": [
"baselineProfiles/0/app-play-universal-release.dm",
"baselineProfiles/0/app-play-armeabi-v7a-release.dm",
"baselineProfiles/0/app-play-x86_64-release.dm",
"baselineProfiles/0/app-play-arm64-v8a-release.dm",
"baselineProfiles/0/app-play-x86-release.dm"
"baselineProfiles/0/app-play-armeabi-v7a-release.dm",
"baselineProfiles/0/app-play-x86-release.dm",
"baselineProfiles/0/app-play-arm64-v8a-release.dm"
]
}
],
@@ -256,7 +256,7 @@ object LocalPreferences {
}
fun loadFromEncryptedStorage(npub: String?): Account? {
if (accountCache.get(npub) != null) {
if (npub != null && accountCache.get(npub) != null) {
return accountCache.get(npub)
}
encryptedPreferences(npub).apply {
@@ -283,7 +283,7 @@ fun sendResult(
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun GoToTop(
fun PermissionsFloatingActionButton(
accountStateViewModel: AccountStateViewModel,
account: Account,
goToTop: () -> Unit
@@ -313,7 +313,12 @@ fun GoToTop(
horizontalAlignment = Alignment.End
) {
Row(
Modifier.padding(end = 10.dp),
Modifier
.padding(end = 10.dp)
.clickable {
dialogOpen = true
expanded = false
},
verticalAlignment = Alignment.CenterVertically
) {
RichTooltip {
@@ -339,7 +344,12 @@ fun GoToTop(
Spacer(modifier = Modifier.height(20.dp))
Row(
Modifier.padding(end = 10.dp),
Modifier
.padding(end = 10.dp)
.clickable {
goToTop()
expanded = false
},
verticalAlignment = Alignment.CenterVertically
) {
RichTooltip {
@@ -348,7 +358,7 @@ fun GoToTop(
Spacer(modifier = Modifier.size(4.dp))
FloatingActionButton(
onClick = {
dialogOpen = true
goToTop()
expanded = false
},
modifier = Modifier.size(35.dp),
@@ -513,33 +523,33 @@ fun MainScreen(
Scaffold(
floatingActionButton = {
if (destinationRoute == "Permissions" && BuildConfig.FLAVOR != "offline") {
GoToTop(
PermissionsFloatingActionButton(
accountStateViewModel,
account
) {
val secret = UUID.randomUUID().toString().substring(0, 6)
val application = ApplicationEntity(
secret,
"",
listOf("wss://relay.nsec.app"),
"",
"",
"",
account.keyPair.pubKey.toHexKey(),
false,
secret
)
scope.launch(Dispatchers.IO) {
val secret = UUID.randomUUID().toString().substring(0, 6)
val application = ApplicationEntity(
secret,
"",
listOf("wss://relay.nsec.app"),
"",
"",
"",
account.keyPair.pubKey.toHexKey(),
false,
secret
)
database.applicationDao().insertApplication(
application
)
}
val bunkerUrl = "bunker://${account.keyPair.pubKey.toHexKey()}?relay=wss://relay.nsec.app&secret=${application.secret}"
clipboardManager.setText(AnnotatedString(bunkerUrl))
scope.launch(Dispatchers.Main) {
navController.popBackStack()
accountStateViewModel.switchUser(account.keyPair.pubKey.toNpub(), Route.Permissions.route)
val bunkerUrl = "bunker://${account.keyPair.pubKey.toHexKey()}?relay=wss://relay.nsec.app&secret=${application.secret}"
clipboardManager.setText(AnnotatedString(bunkerUrl))
scope.launch(Dispatchers.Main) {
navController.popBackStack()
accountStateViewModel.switchUser(account.keyPair.pubKey.toNpub(), Route.Permissions.route)
}
}
}
}