FIRIAMMessageContentData.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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) NSURL *actionURL;
  26. @property(nonatomic, readonly, nullable) NSURL *imageURL;
  27. // Load image data and report the result in the callback block.
  28. // Expect these cases in the callback block
  29. // If error happens, error parameter will be non-nil.
  30. // If no error happens and imageData parameter is nil, it indicates the case that there
  31. // is no image assoicated with the message.
  32. // If error is nil and imageData is not nil, then the image data is loaded successfully
  33. - (void)loadImageDataWithBlock:(void (^)(NSData *_Nullable imageData,
  34. NSError *_Nullable error))block;
  35. // convert to a description string of the content
  36. - (NSString *)description;
  37. @end
  38. NS_ASSUME_NONNULL_END