-
Notifications
You must be signed in to change notification settings - Fork 645
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FileUpload] allow to sub class FileUpload #2569
Conversation
@@ -1,19 +1,37 @@ | |||
package com.apollographql.apollo.api | |||
|
|||
class FileUpload(val mimetype: String, val filePath: String) { | |||
override fun equals(other: Any?): Boolean { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't find a need to implement equals/hashCode on this class. Am I missing something?
@darjke can you take a look and let me know if it works for you? I didn't explicitely use |
* The fileName to send to the server. Might be null | ||
*/ | ||
open fun fileName(): String? { | ||
throw UnsupportedOperationException("ApolloGraphQL: if you're not passing a `filePath` parameter, you must override `FileUpload.fileName`") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we just remove filePath
field and make this class abstract? Also make filename
to be non null abstrac property?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That would be much nicer but also a breaking change which I'd like to avoid if possible. I'll do it in dev-3x but given Android 11 is just out, I think it makes sense to release this before 3.0.0
.
198bdde
to
a852527
Compare
This allows callers to use the
okio.Source
they want to upload files. With Android11 removing filestorage access, this will become mandatory.Also took this opportunity to move some files to Kotlin.
fixes #2392