GDTCORUploader.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /*
  2. * Copyright 2018 Google
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #import <Foundation/Foundation.h>
  17. #import "GoogleDataTransport/GDTCORLibrary/Internal/GDTCORLifecycle.h"
  18. #import "GoogleDataTransport/GDTCORLibrary/Public/GoogleDataTransport/GDTCORClock.h"
  19. #import "GoogleDataTransport/GDTCORLibrary/Public/GoogleDataTransport/GDTCORTargets.h"
  20. NS_ASSUME_NONNULL_BEGIN
  21. /** Options that define a set of upload conditions. This is used to help minimize end user data
  22. * consumption impact.
  23. */
  24. typedef NS_OPTIONS(NSInteger, GDTCORUploadConditions) {
  25. /** An upload shouldn't be attempted, because there's no network. */
  26. GDTCORUploadConditionNoNetwork = 1 << 0,
  27. /** An upload would likely use mobile data. */
  28. GDTCORUploadConditionMobileData = 1 << 1,
  29. /** An upload would likely use wifi data. */
  30. GDTCORUploadConditionWifiData = 1 << 2,
  31. /** An upload uses some sort of network connection, but it's unclear which. */
  32. GDTCORUploadConditionUnclearConnection = 1 << 3,
  33. /** A high priority event has occurred. */
  34. GDTCORUploadConditionHighPriority = 1 << 4,
  35. };
  36. /** This protocol defines the common interface for uploader implementations. */
  37. @protocol GDTCORUploader <NSObject, GDTCORLifecycleProtocol>
  38. @required
  39. /** Uploads events to the backend using this specific backend's chosen format.
  40. *
  41. * @param conditions The conditions that the upload attempt is likely to occur under.
  42. */
  43. - (void)uploadTarget:(GDTCORTarget)target withConditions:(GDTCORUploadConditions)conditions;
  44. @end
  45. NS_ASSUME_NONNULL_END