Geen omschrijving

RNFetchBlobConfig.java 1.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. package com.RNFetchBlob;
  2. import com.facebook.react.bridge.ReadableArray;
  3. import com.facebook.react.bridge.ReadableMap;
  4. import java.util.HashMap;
  5. /**
  6. * Created by wkh237 on 2016/5/29.
  7. */
  8. public class RNFetchBlobConfig {
  9. public Boolean fileCache;
  10. public String path;
  11. public String appendExt;
  12. public ReadableMap addAndroidDownloads;
  13. public Boolean trusty;
  14. public String key;
  15. public String mime;
  16. public Boolean auto;
  17. public long timeout = -1;
  18. public ReadableArray binaryContentTypes = null;
  19. RNFetchBlobConfig(ReadableMap options) {
  20. if(options == null)
  21. return;
  22. this.fileCache = options.hasKey("fileCache") ? options.getBoolean("fileCache") : false;
  23. this.path = options.hasKey("path") ? options.getString("path") : null;
  24. this.appendExt = options.hasKey("appendExt") ? options.getString("appendExt") : "";
  25. this.trusty = options.hasKey("trusty") ? options.getBoolean("trusty") : false;
  26. if(options.hasKey("addAndroidDownloads")) {
  27. this.addAndroidDownloads = options.getMap("addAndroidDownloads");
  28. }
  29. if(options.hasKey("binaryContentTypes"))
  30. this.binaryContentTypes = options.getArray("binaryContentTypes");
  31. this.key = options.hasKey("key") ? options.getString("key") : null;
  32. this.mime = options.hasKey("contentType") ? options.getString("contentType") : null;
  33. this.auto = options.hasKey("auto") ? options.getBoolean("auto") : false;
  34. if(options.hasKey("timeout")) {
  35. this.timeout = options.getInt("timeout");
  36. }
  37. }
  38. }