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.api.ApiCredentials
import com.nextcloud.common.NextcloudClient
import com.owncloud.android.lib.common.OwnCloudClient
import com.owncloud.android.lib.common.OwnCloudClientFactory
Expand All @@ -27,3 +28,6 @@ fun OwnCloudClient.getPreviewEndpoint(remoteId: String, x: Int, y: Int): String
remoteId +
"&x=" + (x / 2) + "&y=" + (y / 2) +
"&a=1&mode=cover&forceIcon=0"

fun OwnCloudClient.toApiCredentials(baseURL: String): ApiCredentials =
ApiCredentials(baseURL, userIdPlain, credentials.authToken)
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,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,45 @@ 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 apiCredentials = OwnCloudClientExtensionsKt.toApiCredentials(client, baseURL);
final var activity = getActivity();
if (activity != null) {
activity.runOnUiThread(() -> ShareViewKt.setupUnifiedShare(binding.unifiedShare,
viewThemeUtils.files.getColorScheme(requireContext()),
apiCredentials));

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

private void fetchSharees() {
final var activity = fileActivity;
if (activity == null) {
Expand Down
7 changes: 7 additions & 0 deletions app/src/main/res/layout/file_details_sharing_fragment.xml
Original file line number Diff line number Diff line change
Expand Up @@ -231,10 +231,17 @@
android:text="@string/show_all" />
</LinearLayout>

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

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

</FrameLayout>


</androidx.core.widget.NestedScrollView>
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 = "e45466a08a"
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
24 changes: 24 additions & 0 deletions gradle/verification-metadata.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22291,6 +22291,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 @@ -22535,6 +22543,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 @@ -22775,6 +22791,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