Skip to content

Commit 0b613fe

Browse files
tobiasKaminskyalperozturk96
authored andcommitted
wip
Signed-off-by: tobiasKaminsky <[email protected]> # Conflicts: # gradle/libs.versions.toml
1 parent bebdaa7 commit 0b613fe

File tree

7 files changed

+1358
-51
lines changed

7 files changed

+1358
-51
lines changed

app/schemas/com.nextcloud.client.database.NextcloudDatabase/97.json

Lines changed: 1298 additions & 0 deletions
Large diffs are not rendered by default.

app/src/main/java/com/nextcloud/client/database/NextcloudDatabase.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ import com.owncloud.android.db.ProviderMeta
9191
AutoMigration(from = 92, to = 93, spec = DatabaseMigrationUtil.ResetCapabilitiesPostMigration::class),
9292
AutoMigration(from = 93, to = 94, spec = DatabaseMigrationUtil.ResetCapabilitiesPostMigration::class),
9393
AutoMigration(from = 94, to = 95, spec = DatabaseMigrationUtil.ResetCapabilitiesPostMigration::class),
94-
AutoMigration(from = 95, to = 96),
94+
AutoMigration(from = 95, to = 96),
9595
AutoMigration(from = 96, to = 97, spec = DatabaseMigrationUtil.ResetCapabilitiesPostMigration::class)
9696
],
9797
exportSchema = true

app/src/main/java/com/nextcloud/ui/ClientIntegrationScreen.kt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import com.nextcloud.android.lib.resources.clientintegration.Orientation
2525
import com.nextcloud.android.lib.resources.clientintegration.Text
2626
import com.nextcloud.android.lib.resources.clientintegration.URL
2727
import com.nextcloud.utils.extensions.getActivity
28+
import com.owncloud.android.lib.resources.status.OCCapability
2829
import com.owncloud.android.utils.DisplayUtils
2930

3031
@Composable
@@ -93,7 +94,7 @@ private fun close(activity: Activity?) {
9394
@Preview
9495
private fun ClientIntegrationScreenPreviewVertical() {
9596
val clientIntegrationUI = ClientIntegrationUI(
96-
0.1,
97+
OCCapability.CLIENT_INTEGRATION_VERSION,
9798
Layout(
9899
Orientation.VERTICAL,
99100
mutableListOf(
@@ -120,7 +121,7 @@ private fun ClientIntegrationScreenPreviewVertical() {
120121
@Preview
121122
private fun ClientIntegrationScreenPreviewHorizontal() {
122123
val clientIntegrationUI = ClientIntegrationUI(
123-
0.1,
124+
OCCapability.CLIENT_INTEGRATION_VERSION,
124125
Layout(
125126
Orientation.HORIZONTAL,
126127
mutableListOf(
@@ -144,7 +145,7 @@ private fun ClientIntegrationScreenPreviewHorizontal() {
144145
@Preview
145146
private fun ClientIntegrationScreenPreviewEmpty() {
146147
val clientIntegrationUI = ClientIntegrationUI(
147-
0.1,
148+
OCCapability.CLIENT_INTEGRATION_VERSION,
148149
Layout(
149150
Orientation.HORIZONTAL,
150151
emptyList()

app/src/main/java/com/nextcloud/ui/composeActivity/ComposeActivity.kt

Lines changed: 22 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
package com.nextcloud.ui.composeActivity
99

1010
import android.annotation.SuppressLint
11-
import android.content.Intent
1211
import android.os.Bundle
1312
import android.view.MenuItem
1413
import android.view.View
@@ -30,7 +29,6 @@ import com.nextcloud.client.assistant.repository.remote.AssistantRemoteRepositor
3029
import com.nextcloud.client.database.NextcloudDatabase
3130
import com.nextcloud.common.NextcloudClient
3231
import com.nextcloud.ui.ClientIntegrationScreen
33-
import com.nextcloud.utils.extensions.getSerializableArgument
3432
import com.owncloud.android.R
3533
import com.owncloud.android.databinding.ActivityComposeBinding
3634
import com.owncloud.android.ui.activity.DrawerActivity
@@ -52,41 +50,23 @@ class ComposeActivity : DrawerActivity() {
5250
setContentView(binding.root)
5351

5452
val destinationId = intent.getIntExtra(DESTINATION, -1)
55-
val titleId = intent.getIntExtra(TITLE, R.string.empty)
53+
var title = intent.getStringExtra(TITLE_STRING)
5654

5755
if (title == null || title.isEmpty()) {
5856
title = getString(intent.getIntExtra(TITLE, R.string.empty))
5957
}
60-
61-
if (destination == ComposeDestination.AssistantScreen) {
62-
setupDrawer()
63-
64-
setupToolbarShowOnlyMenuButtonAndTitle(title) {
65-
openDrawer()
66-
}
67-
} else {
68-
setSupportActionBar(null)
69-
if (findViewById<View?>(R.id.appbar) != null) {
70-
findViewById<View?>(R.id.appbar)?.visibility = View.GONE
71-
}
72-
}
73-
74-
// if (false) {
75-
// val actionBar = getDelegate().supportActionBar
76-
// actionBar?.setDisplayHomeAsUpEnabled(true)
77-
// actionBar?.setDisplayShowTitleEnabled(true)
7858
//
79-
// val menuIcon = ResourcesCompat.getDrawable(
80-
// getResources(),
81-
// R.drawable.ic_arrow_back,
82-
// null
83-
// )
84-
// viewThemeUtils.androidx.themeActionBar(
85-
// this,
86-
// actionBar!!,
87-
// title!!,
88-
// menuIcon!!
89-
// )
59+
// if (destination == ComposeDestination.AssistantScreen) {
60+
// setupDrawer()
61+
//
62+
// setupToolbarShowOnlyMenuButtonAndTitle(title) {
63+
// openDrawer()
64+
// }
65+
// } else {
66+
// setSupportActionBar(null)
67+
// if (findViewById<View?>(R.id.appbar) != null) {
68+
// findViewById<View?>(R.id.appbar)?.visibility = View.GONE
69+
// }
9070
// }
9171

9272
binding.composeView.setContent {
@@ -104,7 +84,6 @@ class ComposeActivity : DrawerActivity() {
10484
super.onBackPressed()
10585
true
10686
}
107-
10887
else -> super.onOptionsItemSelected(item)
10988
}
11089

@@ -143,15 +122,18 @@ class ComposeActivity : DrawerActivity() {
143122
capability = capabilities
144123
)
145124
}
146-
} else if (destination == ComposeDestination.ClientIntegrationScreen) {
147-
binding.bottomNavigation.visibility = View.GONE
148125

149-
val clientIntegrationUI: ClientIntegrationUI? = intent.getParcelableExtra(ARGS_CLIENT_INTEGRATION_UI)
126+
is ComposeDestination.ClientIntegrationScreen -> {
127+
binding.bottomNavigation.visibility = View.GONE
128+
129+
val clientIntegrationUI: ClientIntegrationUI? = intent.getParcelableExtra(ARGS_CLIENT_INTEGRATION_UI)
130+
131+
clientIntegrationUI?.let {
132+
ClientIntegrationScreen(clientIntegrationUI, nextcloudClient?.baseUri.toString())
133+
}
134+
}
150135

151-
clientIntegrationUI?.let { ClientIntegrationScreen(it, nextcloudClient?.baseUri.toString()) }
152-
153-
} else {
154-
Unit
136+
else -> Unit
155137
}
156138
}
157139
}

app/src/main/java/com/nextcloud/ui/composeActivity/ComposeDestination.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,12 @@ package com.nextcloud.ui.composeActivity
99

1010
sealed class ComposeDestination(val id: Int) {
1111
data class AssistantScreen(val sessionId: Long?) : ComposeDestination(0)
12+
data class ClientIntegrationScreen(val sessionId: Long?) : ComposeDestination(1)
1213

1314
companion object {
1415
fun fromId(id: Int): ComposeDestination = when (id) {
1516
0 -> AssistantScreen(null)
16-
1 -> ClientIntegrationScreen()
17+
1 -> ClientIntegrationScreen(null)
1718
else -> throw IllegalArgumentException("Unknown destination: $id")
1819
}
1920
}

app/src/main/java/com/nextcloud/ui/fileactions/FileActionsBottomSheet.kt

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ import com.google.gson.Gson
4141
import com.google.gson.GsonBuilder
4242
import com.google.gson.JsonElement
4343
import com.google.gson.JsonParser
44+
import com.google.gson.JsonSyntaxException
4445
import com.google.gson.reflect.TypeToken
4546
import com.nextcloud.android.common.ui.theme.utils.ColorRole
4647
import com.nextcloud.android.lib.resources.clientintegration.ClientIntegrationUI
@@ -81,6 +82,8 @@ import kotlinx.coroutines.Dispatchers
8182
import kotlinx.coroutines.launch
8283
import kotlinx.coroutines.withContext
8384
import okhttp3.RequestBody
85+
import org.apache.commons.httpclient.HttpStatus
86+
import java.io.IOException
8487
import javax.inject.Inject
8588

8689
class FileActionsBottomSheet :
@@ -385,7 +388,7 @@ class FileActionsBottomSheet :
385388
val canvas = Canvas(returnedBitmap)
386389
canvas.drawPicture((drawable as PictureDrawable).picture)
387390

388-
val d = returnedBitmap.toDrawable(requireContext().resources);
391+
val d = returnedBitmap.toDrawable(requireContext().resources)
389392

390393
val tintedDrawable = viewThemeUtils.platform.tintDrawable(
391394
requireContext(),
@@ -423,7 +426,7 @@ class FileActionsBottomSheet :
423426
// Always replace known placeholder in url
424427
url = url.replace("{filePath}", filePath, false)
425428
url = url.replace("{fileId}", fileId, false)
426-
429+
427430
val method = when (endpoint.method) {
428431
Method.POST -> {
429432
val requestBody = if (endpoint.params?.isNotEmpty() == true) {
@@ -448,7 +451,7 @@ class FileActionsBottomSheet :
448451

449452
val result = try {
450453
client.execute(method)
451-
} catch (exception: Exception) {
454+
} catch (exception: IOException) {
452455
activity?.showToast(getString(R.string.failed_to_start_action))
453456
}
454457
val response = method.getResponseBodyAsString()
@@ -463,8 +466,8 @@ class FileActionsBottomSheet :
463466

464467
activity?.showToast(tooltipResponse.tooltip)
465468
}
466-
} catch (e: Exception) {
467-
if (result == 200) {
469+
} catch (e: JsonSyntaxException) {
470+
if (result == HttpStatus.SC_OK) {
468471
activity?.showToast(getString(R.string.action_triggered))
469472
} else {
470473
activity?.showToast(getString(R.string.failed_to_start_action))
@@ -477,7 +480,7 @@ class FileActionsBottomSheet :
477480
private fun startClientIntegration(endpoint: Endpoint, clientIntegrationUI: ClientIntegrationUI) {
478481
CoroutineScope(Dispatchers.IO).launch {
479482
val composeActivity = Intent(context, ComposeActivity::class.java)
480-
composeActivity.putExtra(ComposeActivity.DESTINATION, ComposeDestination.ClientIntegrationScreen)
483+
composeActivity.putExtra(ComposeActivity.DESTINATION, ComposeDestination.ClientIntegrationScreen(null).id)
481484
composeActivity.putExtra(ComposeActivity.ARGS_CLIENT_INTEGRATION_UI, clientIntegrationUI)
482485

483486
composeActivity.putExtra(ComposeActivity.TITLE, endpoint.name)

gradle/verification-metadata.xml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18939,6 +18939,17 @@
1893918939
<sha256 value="b659a4cb8faccf6b025cc138694e6fd927f317a1579f77e37e9672169d2d5333" origin="Generated by Gradle" reason="Artifact is not signed"/>
1894018940
</artifact>
1894118941
</component>
18942+
<component group="com.github.nextcloud" name="android-library"
18943+
version="12510b09e3e2de60b3c8a235fc5f13cc582f5ce4">
18944+
<artifact name="android-library-12510b09e3e2de60b3c8a235fc5f13cc582f5ce4.aar">
18945+
<sha256 value="954c2990beeb5d5f69160d575b053d6da5cedf1ab14a7ec64a661f0e424d39ff"
18946+
origin="Generated by Gradle" reason="Artifact is not signed" />
18947+
</artifact>
18948+
<artifact name="android-library-12510b09e3e2de60b3c8a235fc5f13cc582f5ce4.module">
18949+
<sha256 value="4a20c9d0fc5e3f541bd918d78907ab87d1fff0db4317ec37c70816c8df490441"
18950+
origin="Generated by Gradle" reason="Artifact is not signed" />
18951+
</artifact>
18952+
</component>
1894218953
<component group="com.github.nextcloud" name="android-library" version="12a0ff15a0aa2b99d604a3e6122b4841edeae7b5">
1894318954
<artifact name="android-library-12a0ff15a0aa2b99d604a3e6122b4841edeae7b5.aar">
1894418955
<sha256 value="605a88fa37c998c8464ed6111bbf3a8ee7dc04be58bf93e2e5d046ca3276fd1a" origin="Generated by Gradle" reason="Artifact is not signed"/>
@@ -19530,6 +19541,17 @@
1953019541
<artifact name="android-library-b8f77935157e44c1d7a71f81271b412b0dbe8c76.module">
1953119542
<sha256 value="786e3a79886d9ac3d203f7020d2176204a424b3b93ab63d81042c28db76d3473" origin="Generated by Gradle" reason="Artifact is not signed"/>
1953219543
</artifact>
19544+
</component>
19545+
<component group="com.github.nextcloud" name="android-library"
19546+
version="be1621e659afd0f2a768688e0259e3be3bf57013">
19547+
<artifact name="android-library-be1621e659afd0f2a768688e0259e3be3bf57013.aar">
19548+
<sha256 value="3aa71a0b7076035870bcb26253fbdc5c8325bfbb8a797a162f9fc0242fe3cd6c"
19549+
origin="Generated by Gradle" reason="Artifact is not signed" />
19550+
</artifact>
19551+
<artifact name="android-library-be1621e659afd0f2a768688e0259e3be3bf57013.module">
19552+
<sha256 value="39cfb7a6956162ca3e1251b7e7502959c90bd8953f99cc1b0f95a4d38789f903"
19553+
origin="Generated by Gradle" reason="Artifact is not signed" />
19554+
</artifact>
1953319555
</component>
1953419556
<component group="com.github.nextcloud" name="android-library" version="be43184f87164bd5ec4f1d2ed912665203433321">
1953519557
<artifact name="android-library-be43184f87164bd5ec4f1d2ed912665203433321.aar">

0 commit comments

Comments
 (0)