-
Notifications
You must be signed in to change notification settings - Fork 7
Prepare Android Header #81
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
Conversation
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.
Thank you for the quick PR! This is a bit more complex than I anticipated, in particular the validation part. I am wondering if we actually need that. Wouldn't it be sufficient to allow setting a string, which then gets appended to the Transloadit-Client header?
The implementation I had in mind when we talked about it, looks a bit like this:
- The Transloadit constructor parses the version.properties file obtain the current version (we can simply move this code from the Request class into Transloadit for that:
java-sdk/src/main/java/com/transloadit/sdk/Request.java
Lines 57 to 66 in 34a6f48
InputStream in = getClass().getClassLoader().getResourceAsStream("version.properties"); try { prop.load(in); version = "java-sdk:" + prop.getProperty("versionNumber").replace("'", ""); in.close(); } catch (IOException e) { throw new RuntimeException(e); } catch (NullPointerException npe) { version = "java-sdk:unknown"; } - The Transloadit class also has an
appendVersionInformation(String)
(or something similar) were the Android SDK can append its version. - The Transloadit class also has a
String getVersionInformation()
method, which is used by the Request class to get the full value for Transloadit-Client. - We can also think about making the last two methods protected, so not everyone but rather the AndroidTransloadit subclass can change that information. It's not fully protected against modifications that way, but this is not important.
Sounds good, I am not done anyway. So I will try to follow your suggestions :) |
We may need to release this in order to use it in the Android-SDK |
Apologies for my delayed response! I just had another idea how we could simplify this version handling even further: What if, instead of having a getter/setter for additionalTransloaditClientHeaderContent, we only have the
Hopefully that approach is understandable for you. The benefit is that we have no getter/setters (no code is the best code) and the version.properties files are only accessed once when the client is initialized and not for every request being sent. In addition, I would remove the version number validation as it could pose a problem in the future. Imagine we want to make a pre-release version What do you think? |
Can do this :) sounds good ! I'll try that by chance |
@Acconut have implemented it according to the proposal. |
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.
Awesome work! Thanks for the quick turnaround! The test is failing. Could you briefly look into that? If we determine it unrelated or you fixed it, we can merge this baby :)
…fix jUnit test, which obtained the version.properties file from the tus library
I am willing to merge this and release it as 0.4.2 :) Than we can add this dependency to the android SDK as well and are done with the headers 👍🏻 @Acconut |
Awesome work! Thank you very much! |
Prepare sending of additional SDK information with the Transloadit Client Header.
e.G. if you are using the Android SDK.
See issue in the Android SDK