Skip to content

Commit 1d59404

Browse files
Merge branch 'master' into feat/chat-ui
Signed-off-by: Alper Öztürk <[email protected]>
2 parents 2e4fdb2 + 3a1b6af commit 1d59404

File tree

22 files changed

+139
-56
lines changed

22 files changed

+139
-56
lines changed

.devcontainer/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM ubuntu:noble@sha256:66460d557b25769b102175144d538d88219c077c678a49af4afca6fbfc1b5252
1+
FROM ubuntu:noble@sha256:e96e81f410a9f9cae717e6cdd88cc2a499700ff0bb5061876ad24377fcc517d7
22

33
ARG DEBIAN_FRONTEND=noninteractive
44
ENV ANDROID_HOME=/usr/lib/android-sdk

.github/workflows/codeql.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343
with:
4444
swap-size-gb: 10
4545
- name: Initialize CodeQL
46-
uses: github/codeql-action/init@0499de31b99561a6d14a36a5f662c2a54f91beee # v4.31.2
46+
uses: github/codeql-action/init@014f16e7ab1402f30e7c3329d33797e7948572db # v4.31.3
4747
with:
4848
languages: ${{ matrix.language }}
4949
- name: Set up JDK 17
@@ -57,4 +57,4 @@ jobs:
5757
echo "org.gradle.jvmargs=-Xmx4g -XX:MaxMetaspaceSize=512m -XX:+HeapDumpOnOutOfMemoryError" > "$HOME/.gradle/gradle.properties"
5858
./gradlew assembleDebug
5959
- name: Perform CodeQL Analysis
60-
uses: github/codeql-action/analyze@0499de31b99561a6d14a36a5f662c2a54f91beee # v4.31.2
60+
uses: github/codeql-action/analyze@014f16e7ab1402f30e7c3329d33797e7948572db # v4.31.3

.github/workflows/scorecard.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,6 @@ jobs:
4242

4343
# Upload the results to GitHub's code scanning dashboard.
4444
- name: "Upload to code-scanning"
45-
uses: github/codeql-action/upload-sarif@0499de31b99561a6d14a36a5f662c2a54f91beee # v4.31.2
45+
uses: github/codeql-action/upload-sarif@014f16e7ab1402f30e7c3329d33797e7948572db # v4.31.3
4646
with:
4747
sarif_file: results.sarif

app/src/androidTest/java/com/nextcloud/client/files/download/TransferManagerConnectionTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ class TransferManagerConnectionTest {
202202
connection.onServiceConnected(componentName, binder)
203203

204204
// WHEN
205-
// is runnign flag accessed
205+
// is running flag accessed
206206
val isRunning = connection.isRunning
207207

208208
// THEN

app/src/main/java/com/nextcloud/utils/extensions/Extensions.kt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
*/
99
package com.nextcloud.utils.extensions
1010

11+
import android.os.Handler
12+
import android.os.Looper
1113
import android.os.SystemClock
1214
import android.text.Selection
1315
import android.text.Spannable
@@ -24,6 +26,12 @@ import java.text.SimpleDateFormat
2426
import java.util.Date
2527
import java.util.Locale
2628

29+
fun mainThread(delay: Long = 1000, action: () -> Unit) {
30+
Handler(Looper.getMainLooper()).postDelayed({
31+
action()
32+
}, delay)
33+
}
34+
2735
fun clickWithDebounce(view: View, debounceTime: Long = 600L, action: () -> Unit) {
2836
view.setOnClickListener(object : View.OnClickListener {
2937
private var lastClickTime: Long = 0

app/src/main/java/com/owncloud/android/ui/activity/ReceiveExternalFilesActivity.java

Lines changed: 19 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,6 @@ public class ReceiveExternalFilesActivity extends FileActivity
148148

149149
private SyncBroadcastReceiver mSyncBroadcastReceiver;
150150
private ReceiveExternalFilesAdapter receiveExternalFilesAdapter;
151-
private boolean mSyncInProgress;
152151

153152
private final static int REQUEST_CODE__SETUP_ACCOUNT = REQUEST_CODE__LAST_SHARED + 1;
154153

@@ -856,7 +855,6 @@ private void startSyncFolderOperation(OCFile folder) {
856855

857856
executorService.execute(() -> {
858857
long currentSyncTime = System.currentTimeMillis();
859-
mSyncInProgress = true;
860858
final var optionalUser = getUser();
861859
if (optionalUser.isEmpty()) {
862860
DisplayUtils.showSnackMessage(this, R.string.user_information_retrieval_error);
@@ -1155,58 +1153,32 @@ public void onReceive(Context context, Intent intent) {
11551153
boolean sameAccount = getAccount() != null && accountName.equals(getAccount().name)
11561154
&& getStorageManager() != null;
11571155

1158-
if (sameAccount) {
1159-
1160-
if (FileSyncAdapter.EVENT_FULL_SYNC_START.equals(event)) {
1161-
mSyncInProgress = true;
1156+
if (sameAccount && !FileSyncAdapter.EVENT_FULL_SYNC_START.equals(event)) {
1157+
OCFile currentFile = (mFile == null) ? null : getStorageManager().getFileByPath(mFile.getRemotePath());
1158+
OCFile currentDir = (getCurrentFolder() == null) ? null : getStorageManager().getFileByPath(getCurrentFolder().getRemotePath());
11621159

1160+
if (currentDir == null) {
1161+
// current folder was removed from the server
1162+
DisplayUtils.showSnackMessage(getActivity(), R.string.sync_current_folder_was_removed, getCurrentFolder().getFileName());
1163+
browseToRoot();
11631164
} else {
1164-
OCFile currentFile = (mFile == null) ? null :
1165-
getStorageManager().getFileByPath(mFile.getRemotePath());
1166-
OCFile currentDir = (getCurrentFolder() == null) ? null :
1167-
getStorageManager().getFileByPath(getCurrentFolder().getRemotePath());
1168-
1169-
if (currentDir == null) {
1170-
// current folder was removed from the server
1171-
DisplayUtils.showSnackMessage(
1172-
getActivity(),
1173-
R.string.sync_current_folder_was_removed,
1174-
getCurrentFolder().getFileName()
1175-
);
1176-
browseToRoot();
1177-
1178-
} else {
1179-
if (currentFile == null && !mFile.isFolder()) {
1180-
// currently selected file was removed in the server, and now we know it
1181-
currentFile = currentDir;
1182-
}
1183-
1184-
if (currentDir.getRemotePath().equals(syncFolderRemotePath)) {
1185-
populateDirectoryList(currentFile);
1186-
}
1165+
if (currentFile == null && !mFile.isFolder()) {
1166+
// currently selected file was removed in the server, and now we know it
1167+
currentFile = currentDir;
11871168
}
11881169

1189-
mSyncInProgress = !FileSyncAdapter.EVENT_FULL_SYNC_END.equals(event) &&
1190-
!RefreshFolderOperation.EVENT_SINGLE_FOLDER_SHARES_SYNCED.equals(event);
1191-
1192-
if (RefreshFolderOperation.EVENT_SINGLE_FOLDER_CONTENTS_SYNCED.equals(event)
1193-
/// TODO refactor and make common
1194-
&& syncResult != null && !syncResult.isSuccess()) {
1195-
1196-
if (syncResult.getCode() == ResultCode.UNAUTHORIZED ||
1197-
(syncResult.isException() && syncResult.getException()
1198-
instanceof AuthenticatorException)) {
1199-
1200-
requestCredentialsUpdate();
1201-
1202-
} else if (ResultCode.SSL_RECOVERABLE_PEER_UNVERIFIED == syncResult.getCode()) {
1203-
1204-
showUntrustedCertDialog(syncResult);
1205-
}
1170+
if (currentDir.getRemotePath().equals(syncFolderRemotePath)) {
1171+
populateDirectoryList(currentFile);
12061172
}
12071173
}
1208-
Log_OC.d(TAG, "Setting progress visibility to " + mSyncInProgress);
12091174

1175+
if (RefreshFolderOperation.EVENT_SINGLE_FOLDER_CONTENTS_SYNCED.equals(event) && syncResult != null && !syncResult.isSuccess()) {
1176+
if (syncResult.getCode() == ResultCode.UNAUTHORIZED || (syncResult.isException() && syncResult.getException() instanceof AuthenticatorException)) {
1177+
requestCredentialsUpdate();
1178+
} else if (ResultCode.SSL_RECOVERABLE_PEER_UNVERIFIED == syncResult.getCode()) {
1179+
showUntrustedCertDialog(syncResult);
1180+
}
1181+
}
12101182
}
12111183
} catch (RuntimeException e) {
12121184
// avoid app crashes after changing the serial id of RemoteOperationResult

app/src/main/java/com/owncloud/android/ui/activity/SettingsActivity.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1177,7 +1177,7 @@ private void loadExternalSettingLinks(PreferenceCategory preferenceCategory) {
11771177

11781178
for (final ExternalLink link : externalLinksProvider.getExternalLink(ExternalLinkType.SETTINGS)) {
11791179

1180-
// only add if it does not exist, in case activity is re-used
1180+
// only add if it does not exist, in case activity is reused
11811181
if (findPreference(String.valueOf(link.getId())) == null) {
11821182
Preference p = new Preference(this);
11831183
p.setTitle(link.getName());

app/src/main/java/com/owncloud/android/ui/fragment/ExtendedListFragment.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ import com.nextcloud.client.di.Injectable
5656
import com.nextcloud.client.preferences.AppPreferences
5757
import com.nextcloud.client.preferences.AppPreferencesImpl
5858
import com.nextcloud.utils.extensions.getTypedActivity
59+
import com.nextcloud.utils.extensions.mainThread
5960
import com.owncloud.android.MainApp
6061
import com.owncloud.android.R
6162
import com.owncloud.android.databinding.ListFragmentBinding
@@ -720,6 +721,10 @@ open class ExtendedListFragment :
720721
true
721722
)
722723
}
724+
}.also {
725+
mainThread {
726+
mRefreshListLayout?.isRefreshing = false
727+
}
723728
}
724729
}
725730

app/src/main/java/com/owncloud/android/ui/fragment/GalleryFragmentBottomSheetDialog.kt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ import android.os.Bundle
1313
import android.view.LayoutInflater
1414
import android.view.View
1515
import android.view.ViewGroup
16+
import com.google.android.material.bottomsheet.BottomSheetBehavior
17+
import com.google.android.material.bottomsheet.BottomSheetDialog
1618
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
1719
import com.nextcloud.android.common.ui.theme.utils.ColorRole
1820
import com.nextcloud.client.di.Injectable
@@ -32,6 +34,11 @@ class GalleryFragmentBottomSheetDialog(private val actions: GalleryFragmentBotto
3234

3335
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
3436
binding = FragmentGalleryBottomSheetBinding.inflate(layoutInflater, container, false)
37+
38+
val bottomSheetDialog = dialog as BottomSheetDialog
39+
bottomSheetDialog.behavior.state = BottomSheetBehavior.STATE_EXPANDED
40+
bottomSheetDialog.behavior.skipCollapsed = true
41+
3542
return binding.root
3643
}
3744

app/src/main/java/com/owncloud/android/ui/fragment/OCFileListBottomSheetDialog.kt

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
*/
88
package com.owncloud.android.ui.fragment
99

10+
import android.os.Build
1011
import android.os.Bundle
1112
import android.view.View
1213
import com.google.android.material.bottomsheet.BottomSheetDialog
@@ -16,7 +17,9 @@ import com.nextcloud.client.account.User
1617
import com.nextcloud.client.device.DeviceInfo
1718
import com.nextcloud.client.di.Injectable
1819
import com.nextcloud.client.documentscan.AppScanOptionalFeature
20+
import com.nextcloud.utils.BuildHelper.isFlavourGPlay
1921
import com.nextcloud.utils.EditorUtils
22+
import com.owncloud.android.MainApp
2023
import com.owncloud.android.R
2124
import com.owncloud.android.databinding.FileListActionsBottomSheetCreatorBinding
2225
import com.owncloud.android.databinding.FileListActionsBottomSheetFragmentBinding
@@ -26,6 +29,7 @@ import com.owncloud.android.datamodel.OCFile
2629
import com.owncloud.android.lib.common.DirectEditing
2730
import com.owncloud.android.ui.activity.FileActivity
2831
import com.owncloud.android.utils.MimeTypeUtil
32+
import com.owncloud.android.utils.PermissionUtil
2933
import com.owncloud.android.utils.theme.ThemeUtils
3034
import com.owncloud.android.utils.theme.ViewThemeUtils
3135

@@ -66,6 +70,20 @@ class OCFileListBottomSheetDialog(
6670
createRichWorkspace()
6771
setupClickListener()
6872
filterActionsForOfflineOperations()
73+
74+
if (MainApp.isClientBranded() && isFlavourGPlay()) {
75+
// this way we can have branded clients with that permission
76+
val hasPermission = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
77+
PermissionUtil.manifestHasAllFilesPermission(context)
78+
} else {
79+
true
80+
}
81+
82+
if (!hasPermission) {
83+
binding.menuUploadFiles.visibility = View.GONE
84+
binding.uploadContentFromOtherApps.text = context.getString(R.string.upload_files)
85+
}
86+
}
6987
}
7088

7189
private fun applyBranding() {

0 commit comments

Comments
 (0)