Skip to content

Commit 0d0e813

Browse files
committed
fix allowDownloadAndSync during create
Signed-off-by: alperozturk96 <alper_ozturk@proton.me>
1 parent f7eedb9 commit 0d0e813

4 files changed

Lines changed: 17 additions & 7 deletions

File tree

app/src/main/java/it/niedermann/owncloud/notes/share/NoteShareActivity.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ public void createPublicShareLink() {
398398
requestPasswordForShareViaLink(true, capabilities.getAskForOptionalPassword());
399399
} else {
400400
executorService.submit(() -> {
401-
final var result = repository.addShare(note, ShareType.PUBLIC_LINK, "", "false", "", 0, "");
401+
final var result = repository.addShare(note, ShareType.PUBLIC_LINK, "");
402402
runOnUiThread(() -> {
403403
if (result instanceof ApiResult.Success<OcsResponse<CreateShareResponse>> successResponse && binding.sharesList.getAdapter() instanceof ShareeListAdapter adapter) {
404404
DisplayUtils.showSnackMessage(NoteShareActivity.this, successResponse.getMessage());
@@ -835,8 +835,7 @@ public void shareFileViaPublicShare(@Nullable Note note, @Nullable String passwo
835835
"",
836836
"false",
837837
password,
838-
repository.getCapabilities().getDefaultPermission(),
839-
""
838+
repository.getCapabilities().getDefaultPermission()
840839
);
841840

842841
runOnUiThread(() -> {

app/src/main/java/it/niedermann/owncloud/notes/share/NoteShareDetailActivity.kt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -628,7 +628,12 @@ class NoteShareDetailActivity :
628628
"false", // TODO: Check how to determine it
629629
password,
630630
permission,
631-
noteText
631+
noteText,
632+
UpdateShareRequest.createAttributes(
633+
repository.getCapabilities(),
634+
binding.allowDownloadAndSync.isChecked,
635+
shareType
636+
)
632637
)
633638

634639
if (result.isSuccess()) {

app/src/main/java/it/niedermann/owncloud/notes/share/model/CreateShareRequest.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,8 @@ data class CreateShareRequest(
2828
val permissions: Int?,
2929

3030
@Expose
31-
val note: String?
31+
val note: String?,
32+
33+
@Expose
34+
val attributes: String?
3235
)

app/src/main/java/it/niedermann/owncloud/notes/share/repository/ShareRepository.kt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -291,14 +291,16 @@ class ShareRepository(private val applicationContext: Context, private val accou
291291

292292
fun updateNote(note: Note) = notesRepository.updateNote(note)
293293

294+
@JvmOverloads
294295
fun addShare(
295296
note: Note,
296297
shareType: ShareType,
297298
shareWith: String,
298299
publicUpload: String = "false",
299300
password: String = "",
300301
permissions: Int = 0,
301-
shareNote: String = ""
302+
shareNote: String = "",
303+
attributes: String = "[]"
302304
): ApiResult<OcsResponse<CreateShareResponse>?> {
303305
val defaultErrorMessage =
304306
applicationContext.getString(R.string.note_share_activity_cannot_created)
@@ -316,7 +318,8 @@ class ShareRepository(private val applicationContext: Context, private val accou
316318
publicUpload = publicUpload,
317319
password = password,
318320
permissions = permissions,
319-
note = shareNote
321+
note = shareNote,
322+
attributes = attributes
320323
)
321324

322325
val shareAPI = apiProvider.getShareAPI(applicationContext, account)

0 commit comments

Comments
 (0)