FIRIAMMessageContentData.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /*
  2. * Copyright 2017 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. NS_ASSUME_NONNULL_BEGIN
  18. /**
  19. * This protocol models the message content (non-ui related) data for an in-app message.
  20. */
  21. @protocol FIRIAMMessageContentData
  22. @property(nonatomic, readonly, nonnull) NSString *titleText;
  23. @property(nonatomic, readonly, nonnull) NSString *bodyText;
  24. @property(nonatomic, readonly, nullable) NSString *actionButtonText;
  25. @property(nonatomic, readonly, nullable) NSString *secondaryActionButtonText;
  26. @property(nonatomic, readonly, nullable) NSURL *actionURL;
  27. @property(nonatomic, readonly, nullable) NSURL *secondaryActionURL;
  28. @property(nonatomic, readonly, nullable) NSURL *imageURL;
  29. @property(nonatomic, readonly, nullable) NSURL *landscapeImageURL;
  30. // Load image data, which can potentially have two images (one for landscape display). If only
  31. // one image URL exists, that image is loaded and its data is passed in the callback block.
  32. //
  33. // If both standard and landscape URLs exist, then both images are fetched asynchronously. If the
  34. // standard image fails to load, an error will be returned in the callback block and both image data
  35. // slots will be empty.
  36. // If only the landscape image fails to load, the standard image will be returned in the callback
  37. // block and the error will be nil.
  38. // If no error happens and the imageData parameter is nil, it indicates the case that there is no
  39. // image associated with the message.
  40. - (void)loadImageDataWithBlock:(void (^)(NSData *_Nullable imageData,
  41. NSData *_Nullable landscapeImageData,
  42. NSError *_Nullable error))block;
  43. // convert to a description string of the content
  44. - (NSString *)description;
  45. @end
  46. NS_ASSUME_NONNULL_END