Skip to content
Draft
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
1 change: 1 addition & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,7 @@ dependencies {
implementation(libs.compose.activity)
implementation(libs.compose.ui.tooling.preview)
implementation(libs.foundation)
implementation(libs.material3)
debugImplementation(libs.compose.ui.tooling)
// endregion

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
package com.nextcloud.utils.extensions

import android.content.Context
import com.nextcloud.android.common.ui.network.auth.ServerCredentials
import com.nextcloud.common.NextcloudClient
import com.owncloud.android.lib.common.OwnCloudClient
import com.owncloud.android.lib.common.OwnCloudClientFactory
Expand All @@ -27,3 +28,9 @@ fun OwnCloudClient.getPreviewEndpoint(remoteId: String, x: Int, y: Int): String
remoteId +
"&x=" + (x / 2) + "&y=" + (y / 2) +
"&a=1&mode=cover&forceIcon=0"

/**
* Used in Android Common
*/
fun OwnCloudClient.toServerCredentials(baseURL: String): ServerCredentials =
ServerCredentials(baseURL, userIdPlain, credentials.authToken)
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,30 @@ class FileDisplayActivity :
startMetadataSyncForRoot()
handleBackPress()
setupDrawer(menuItemId)
logOcsCredentials()
}

@Suppress("DEPRECATION")
private fun logOcsCredentials() {

lifecycleScope.launch(Dispatchers.IO) {
val user = accountManager.user
val serverUrl = user.server.uri.toString()
val accountName = user.accountName

try {
val client = clientFactory.create(user)
val username = client.userIdPlain
val authToken = client.credentials.authToken
Log_OC.d(TAG, "OCS credentials — serverUrl=$serverUrl")
Log_OC.d(TAG, "OCS credentials — accountName=$accountName username=$username authToken=$authToken")


} catch (e: CreationException) {
Log_OC.e(TAG, "OCS credentials — serverUrl=$serverUrl accountName=$accountName (client creation failed)", e)
}
}

}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import android.view.animation.AnimationUtils;
import android.widget.LinearLayout;

import com.nextcloud.android.common.ui.share.ShareViewKt;
import com.nextcloud.android.common.ui.theme.utils.ColorRole;
import com.nextcloud.client.account.User;
import com.nextcloud.client.account.UserAccountManager;
Expand All @@ -43,6 +44,7 @@
import com.nextcloud.client.utils.IntentUtil;
import com.nextcloud.utils.extensions.BundleExtensionsKt;
import com.nextcloud.utils.extensions.OCShareExtensionsKt;
import com.nextcloud.utils.extensions.OwnCloudClientExtensionsKt;
import com.nextcloud.utils.extensions.ViewExtensionsKt;
import com.nextcloud.utils.mdm.MDMConfig;
import com.owncloud.android.R;
Expand Down Expand Up @@ -208,11 +210,47 @@ public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceStat
binding.pickContactEmailBtn.setOnClickListener(v -> checkContactPermission());

// start loading process
fetchSharees();

// TODO: REPLACE FAKE CONDITION
if (user.getServer().getVersion().isNewerOrEqual(NextcloudVersion.nextcloud_34) || 2 < 4) {
showUnifiedShare();
} else {
fetchSharees();
}
setupView();
}

private void showUnifiedShare() {
if (binding == null) {
return;
}

binding.shareContainer.setVisibility(View.GONE);
binding.unifiedShare.setVisibility(View.VISIBLE);

final LinearLayout shimmerLayout = binding.shimmerLayout.getRoot();
shimmerLayout.clearAnimation();
shimmerLayout.setVisibility(View.GONE);

new Thread(() -> {{
try {
final var baseURL = user.getServer().getUri().toString();
final var client = clientFactory.create(user);
final var serverCredentials = OwnCloudClientExtensionsKt.toServerCredentials(client, baseURL);
final var activity = getActivity();
if (activity != null) {
activity.runOnUiThread(() -> ShareViewKt.setupUnifiedShare(
binding.unifiedShare,
viewThemeUtils.files.getColorScheme(activity),
serverCredentials)
);

}
} catch (ClientFactory.CreationException e) {
Log_OC.e(TAG, "client creation failed");
}
}}).start();
}

private void fetchSharees() {
final var activity = fileActivity;
if (activity == null) {
Expand Down
60 changes: 33 additions & 27 deletions app/src/main/res/layout/file_details_sharing_fragment.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,25 @@
~ SPDX-FileCopyrightText: 2018 Andy Scherzinger <info@andy-scherzinger.de>
~ SPDX-License-Identifier: AGPL-3.0-or-later OR GPL-2.0-only
-->
<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingTop="@dimen/standard_eight_padding">
android:layout_below="@id/appbar">

<FrameLayout
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@id/appbar">
android:paddingTop="@dimen/standard_eight_padding">

<LinearLayout
android:id="@+id/shareContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:visibility="gone"
tools:visibility="visible"
android:orientation="vertical">
tools:visibility="visible">

<LinearLayout
android:id="@+id/shared_with_you_container"
Expand Down Expand Up @@ -139,33 +139,33 @@
android:layout_marginHorizontal="@dimen/standard_margin"
android:layout_marginTop="@dimen/standard_half_padding"
android:layout_marginBottom="@dimen/standard_half_padding"
android:text="@string/send_copy_to"
app:icon="@drawable/file_link"
app:iconGravity="textStart"
android:text="@string/send_copy_to" />
app:iconGravity="textStart" />

<TextView
android:id="@+id/internal_share_headline"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingStart="@dimen/standard_padding"
android:paddingEnd="@dimen/zero"
android:paddingTop="@dimen/standard_half_padding"
android:paddingEnd="@dimen/zero"
android:paddingBottom="@dimen/standard_half_padding"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/internal_shares"
android:textAppearance="?android:attr/textAppearanceMedium" />

<TextView
android:id="@+id/internal_share_description"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingStart="@dimen/standard_padding"
android:visibility="gone"
tools:visibility="visible"
android:paddingEnd="@dimen/zero"
android:paddingTop="@dimen/standard_half_padding"
android:paddingEnd="@dimen/zero"
android:paddingBottom="@dimen/standard_half_padding"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/internal_share_description_end_to_end_encrypted"
android:textAppearance="?android:attr/textAppearanceMedium" />
android:textAppearance="?android:attr/textAppearanceMedium"
android:visibility="gone"
tools:visibility="visible" />


<androidx.recyclerview.widget.RecyclerView
Expand Down Expand Up @@ -193,12 +193,12 @@

<TextView
android:id="@+id/external_shares_headline"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingStart="@dimen/standard_padding"
android:paddingEnd="@dimen/zero"
android:paddingTop="@dimen/standard_half_padding"
android:paddingEnd="@dimen/zero"
android:paddingBottom="@dimen/standard_half_padding"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/external_shares"
android:textAppearance="?android:attr/textAppearanceMedium" />

Expand All @@ -209,9 +209,9 @@
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/standard_margin"
android:layout_marginEnd="@dimen/standard_margin"
android:text="@string/create_link"
app:icon="@drawable/file_link"
app:iconGravity="textStart"
android:text="@string/create_link" />
app:iconGravity="textStart" />

<androidx.recyclerview.widget.RecyclerView
android:id="@+id/sharesList_external"
Expand All @@ -231,10 +231,16 @@
android:text="@string/show_all" />
</LinearLayout>

<include
layout="@layout/file_details_sharing_shimmer"
android:id="@+id/shimmer_layout"/>
</androidx.core.widget.NestedScrollView>

<androidx.compose.ui.platform.ComposeView
android:id="@+id/unifiedShare"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone" />

</FrameLayout>
<include
android:id="@+id/shimmer_layout"
layout="@layout/file_details_sharing_shimmer" />

</androidx.core.widget.NestedScrollView>
</FrameLayout>
4 changes: 3 additions & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# SPDX-License-Identifier: AGPL-3.0-or-later

[versions]
androidCommonLibraryVersion = "0.33.2"
androidCommonLibraryVersion = "38fffa4a03"
androidGifDrawableVersion = "1.2.31"
androidImageCropperVersion = "4.7.0"
androidLibraryVersion ="20e8cd17191f337d34b2ed97e0ac61e84a0bfc39"
Expand Down Expand Up @@ -85,6 +85,7 @@ stateless4jVersion = "2.6.0"
webkitVersion = "1.15.0"
workRuntime = "2.11.2"
foundationVersion = "1.10.6"
material3Version = "1.4.0"

[libraries]
# Crypto
Expand Down Expand Up @@ -240,6 +241,7 @@ qrcodescanner = { module = "com.github.nextcloud-deps:qrcodescanner", version.re
work-runtime = { module = "androidx.work:work-runtime", version.ref = "workRuntime" }
work-runtime-ktx = { module = "androidx.work:work-runtime-ktx", version.ref = "workRuntime" }
foundation = { group = "androidx.compose.foundation", name = "foundation", version.ref = "foundationVersion" }
material3 = { group = "androidx.compose.material3", name = "material3", version.ref = "material3Version" }

[bundles]
media3 = ["media3-ui", "media3-session", "media3-exoplayer", "media3-datasource"]
Expand Down
48 changes: 48 additions & 0 deletions gradle/verification-metadata.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22227,6 +22227,14 @@
<sha256 value="ab20ca819770a732c1da1c21c5cf82550733f2e2995708f53fcc0030f612b5ce" origin="Generated by Gradle" reason="Artifact is not signed"/>
</artifact>
</component>
<component group="com.github.nextcloud.android-common" name="core" version="38fffa4a03">
<artifact name="core-38fffa4a03.aar">
<sha256 value="ed9eb2788c3ae52e49faa571f4834411def2d26a4d41a0a0d898a01972269ac9" origin="Generated by Gradle" reason="Artifact is not signed"/>
</artifact>
<artifact name="core-38fffa4a03.module">
<sha256 value="21126aafab2c65bfb9580ddd3a2527b67cd56537ac21273d1259ff6a8e4035ae" origin="Generated by Gradle" reason="Artifact is not signed"/>
</artifact>
</component>
<component group="com.github.nextcloud.android-common" name="core" version="3babd42636">
<artifact name="core-3babd42636.aar">
<sha256 value="fe5ef0dbfec2fbf82d0e4c8944b5f277215a2d55d264f76e4838b8d99ea2a974" origin="Generated by Gradle" reason="Artifact is not signed"/>
Expand Down Expand Up @@ -22291,6 +22299,14 @@
<sha256 value="bcc1c14bf0c864f1b2cb629eda7968e36bfe654a4f06fcb3a3a573b8a9559e85" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="com.github.nextcloud.android-common" name="core" version="e45466a08a">
<artifact name="core-e45466a08a.aar">
<sha256 value="ed9eb2788c3ae52e49faa571f4834411def2d26a4d41a0a0d898a01972269ac9" origin="Generated by Gradle" reason="Artifact is not signed"/>
</artifact>
<artifact name="core-e45466a08a.module">
<sha256 value="8dbdab005435b5f9aaee5a2c4a6a7af8edc536e1e728f6d489cf61697df25e41" origin="Generated by Gradle" reason="Artifact is not signed"/>
</artifact>
</component>
<component group="com.github.nextcloud.android-common" name="core" version="f96c6fa2c3cdd52fcd70dedc520c77bd3f6b2f7c">
<artifact name="core-f96c6fa2c3cdd52fcd70dedc520c77bd3f6b2f7c.aar">
<sha256 value="933d612d1324b21d2e7e04a890bb2c7afda4ffdbe91b76fdea625976f14ba1fb" origin="Generated by Gradle" reason="Artifact is not signed"/>
Expand Down Expand Up @@ -22471,6 +22487,14 @@
<sha256 value="7f66bf2400608d292b4149f6a6ab8f982a3e15f0abe65487074476d83e6500ab" origin="Generated by Gradle" reason="Artifact is not signed"/>
</artifact>
</component>
<component group="com.github.nextcloud.android-common" name="material-color-utilities" version="38fffa4a03">
<artifact name="material-color-utilities-38fffa4a03.jar">
<sha256 value="61568a8c8f0466aea4fec621653ca8d2c08c9c687ffd6e364f909a2d19185992" origin="Generated by Gradle" reason="Artifact is not signed"/>
</artifact>
<artifact name="material-color-utilities-38fffa4a03.module">
<sha256 value="c5a9ca0698c8dcdba15bf90425b1f75550051af5ccbab192e50948551839fdc7" origin="Generated by Gradle" reason="Artifact is not signed"/>
</artifact>
</component>
<component group="com.github.nextcloud.android-common" name="material-color-utilities" version="3babd42636">
<artifact name="material-color-utilities-3babd42636.jar">
<sha256 value="61568a8c8f0466aea4fec621653ca8d2c08c9c687ffd6e364f909a2d19185992" origin="Generated by Gradle" reason="Artifact is not signed"/>
Expand Down Expand Up @@ -22535,6 +22559,14 @@
<sha256 value="2e616f3703fc52526d2052391cce8131eea0f80a71bb1e9f8f6c6ccd6bb58435" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="com.github.nextcloud.android-common" name="material-color-utilities" version="e45466a08a">
<artifact name="material-color-utilities-e45466a08a.jar">
<sha256 value="61568a8c8f0466aea4fec621653ca8d2c08c9c687ffd6e364f909a2d19185992" origin="Generated by Gradle" reason="Artifact is not signed"/>
</artifact>
<artifact name="material-color-utilities-e45466a08a.module">
<sha256 value="c010347516c0720f81fd3f5fde2aa67d14a195a2a6db6cb1214c4b723d787ece" origin="Generated by Gradle" reason="Artifact is not signed"/>
</artifact>
</component>
<component group="com.github.nextcloud.android-common" name="material-color-utilities" version="f96c6fa2c3cdd52fcd70dedc520c77bd3f6b2f7c">
<artifact name="material-color-utilities-f96c6fa2c3cdd52fcd70dedc520c77bd3f6b2f7c.jar">
<sha256 value="1f507d6cfb8dcbf3ca7cae95f0e825f990d3ea75cfe597cca33be21359398d17" origin="Generated by Gradle" reason="Artifact is not signed"/>
Expand Down Expand Up @@ -22711,6 +22743,14 @@
<sha256 value="635d1eefd4a50cbb2f2461b3ab3cfe53a3e2bcd63f3758093cb3aabea853fa40" origin="Generated by Gradle" reason="Artifact is not signed"/>
</artifact>
</component>
<component group="com.github.nextcloud.android-common" name="ui" version="38fffa4a03">
<artifact name="ui-38fffa4a03.aar">
<sha256 value="7301efcdb73c235021d1311f0bd9f36cec4f2aeaef8a933b5b9b8550c70b27fd" origin="Generated by Gradle" reason="Artifact is not signed"/>
</artifact>
<artifact name="ui-38fffa4a03.module">
<sha256 value="e65a4acb8ec149efbd23e1e3a63ae6f16d211ab2f530f8734ffafdbf5395f0d7" origin="Generated by Gradle" reason="Artifact is not signed"/>
</artifact>
</component>
<component group="com.github.nextcloud.android-common" name="ui" version="3babd42636">
<artifact name="ui-3babd42636.aar">
<sha256 value="041d67ffbb102dfa828719e35f1d416997706793c2674b9da4f135b3667c002c" origin="Generated by Gradle" reason="Artifact is not signed"/>
Expand Down Expand Up @@ -22775,6 +22815,14 @@
<sha256 value="7fd482688552299ef4f50421cd43e49ba97ef9685e1bb6d8c18106563f1cb605" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="com.github.nextcloud.android-common" name="ui" version="e45466a08a">
<artifact name="ui-e45466a08a.aar">
<sha256 value="bca767aa15ed6832ec37e36d9e7b9f3654fe6e6ab81dadd9b819fc145a02f6d3" origin="Generated by Gradle" reason="Artifact is not signed"/>
</artifact>
<artifact name="ui-e45466a08a.module">
<sha256 value="7a4b9d46a703c99fc02efcd3b15ab2551100ce5477f981eec7ef4ee8cef48598" origin="Generated by Gradle" reason="Artifact is not signed"/>
</artifact>
</component>
<component group="com.github.nextcloud.android-common" name="ui" version="f96c6fa2c3cdd52fcd70dedc520c77bd3f6b2f7c">
<artifact name="ui-f96c6fa2c3cdd52fcd70dedc520c77bd3f6b2f7c.aar">
<sha256 value="2c6d44febd77a3620a73b803bb577aed086af280276698736a81c26a4af292af" origin="Generated by Gradle" reason="Artifact is not signed"/>
Expand Down
Loading