-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: tobiasKaminsky <[email protected]>
- Loading branch information
1 parent
7634548
commit 2374f29
Showing
7 changed files
with
121 additions
and
56 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
library/src/main/java/com/owncloud/android/lib/resources/files/webdav/NCGetLastModified.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/* | ||
* | ||
* Nextcloud Android client application | ||
* | ||
* @author Tobias Kaminsky | ||
* Copyright (C) 2023 Tobias Kaminsky | ||
* Copyright (C) 2023 Nextcloud GmbH | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package com.owncloud.android.lib.resources.files.webdav | ||
|
||
import at.bitfire.dav4jvm.Property | ||
import at.bitfire.dav4jvm.PropertyFactory | ||
import at.bitfire.dav4jvm.XmlUtils | ||
import com.owncloud.android.lib.common.network.WebdavUtils | ||
import org.xmlpull.v1.XmlPullParser | ||
|
||
class NCGetLastModified internal constructor(var lastModified: Long) : Property { | ||
|
||
class Factory : PropertyFactory { | ||
|
||
override fun getName() = NAME | ||
|
||
override fun create(parser: XmlPullParser): NCGetLastModified? { | ||
// <!ELEMENT getlastmodified (#PCDATA) > | ||
XmlUtils.readText(parser)?.let { rawDate -> | ||
val date = WebdavUtils.parseResponseDate(rawDate) | ||
if (date != null) { | ||
return NCGetLastModified(date.time) | ||
} else { | ||
0 | ||
} | ||
} | ||
return null | ||
} | ||
} | ||
|
||
companion object { | ||
@JvmField | ||
val NAME = Property.Name(XmlUtils.NS_WEBDAV, "getlastmodified") | ||
} | ||
} |