FIRIAMModalViewController.m 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470
  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 <UIKit/UIKit.h>
  17. #import "FIRCore+InAppMessagingDisplay.h"
  18. #import "FIRIAMModalViewController.h"
  19. @interface FIRIAMModalViewController ()
  20. @property(nonatomic, readwrite) FIRInAppMessagingModalDisplay *modalDisplayMessage;
  21. @property(weak, nonatomic) IBOutlet UIImageView *imageView;
  22. @property(weak, nonatomic) IBOutlet UILabel *titleLabel;
  23. @property(weak, nonatomic) IBOutlet UIButton *actionButton;
  24. @property(weak, nonatomic) IBOutlet UIView *messageCardView;
  25. @property(weak, nonatomic) IBOutlet UITextView *bodyTextView;
  26. @property(weak, nonatomic) IBOutlet UIButton *closeButton;
  27. // this is only needed for removing the layout errors in interface builder. At runtime
  28. // we determine the height via its content size. So disable this at runtime.
  29. @property(weak, nonatomic) IBOutlet NSLayoutConstraint *fixedMessageCardHeightConstraint;
  30. @property(weak, nonatomic) IBOutlet NSLayoutConstraint *messageCardHeightMaxInTabletCase;
  31. @property(weak, nonatomic) IBOutlet NSLayoutConstraint *maxActionButtonHeight;
  32. @property(weak, nonatomic) IBOutlet NSLayoutConstraint *bodyTextViewHeightConstraint;
  33. @property(weak, nonatomic) IBOutlet NSLayoutConstraint *buttonTopToBodyBottomConstraint;
  34. @property(weak, nonatomic) IBOutlet NSLayoutConstraint *imageActualHeightConstraint;
  35. // constraints manipulated further in portrait mode
  36. @property(weak, nonatomic) IBOutlet NSLayoutConstraint *titleLabelHeightConstraint;
  37. @property(weak, nonatomic) IBOutlet NSLayoutConstraint *buttonBottomToContainerBottomInPortraitMode;
  38. @property(weak, nonatomic) IBOutlet NSLayoutConstraint *imageTopToTitleBottomInPortraitMode;
  39. // constraints manipulated further in landscape mode
  40. @property(weak, nonatomic) IBOutlet NSLayoutConstraint *imageWidthInLandscapeMode;
  41. @property(weak, nonatomic) IBOutlet NSLayoutConstraint *titleTopToCardViewTop;
  42. @property(weak, nonatomic) IBOutlet NSLayoutConstraint *cardLeadingMarginInLandscapeMode;
  43. @property(weak, nonatomic) IBOutlet NSLayoutConstraint *maxCardHeightInLandscapeMode;
  44. @property(weak, nonatomic) IBOutlet NSLayoutConstraint *imageTopToCardTopInLandscapeMode;
  45. @property(weak, nonatomic) IBOutlet NSLayoutConstraint *bodyTopToTitleBottomInLandScapeMode;
  46. @end
  47. static CGFloat VerticalSpacingBetweenTitleAndBody = 24;
  48. static CGFloat VerticalSpacingBetweenBodyAndActionButton = 24;
  49. // the padding between the content and view card's top and bottom edges
  50. static CGFloat TopBottomPaddingAroundContent = 24;
  51. // the minimal padding size between msg card and app window's top and bottom
  52. static CGFloat TopBottomPaddingAroundMsgCard = 30;
  53. // the horizontal spacing between image column and text/button column in landscape mode
  54. static CGFloat LandScapePaddingBetweenImageAndTextColumn = 24;
  55. @implementation FIRIAMModalViewController
  56. + (FIRIAMModalViewController *)
  57. instantiateViewControllerWithResourceBundle:(NSBundle *)resourceBundle
  58. displayMessage:(FIRInAppMessagingModalDisplay *)modalMessage
  59. displayDelegate:
  60. (id<FIRInAppMessagingDisplayDelegate>)displayDelegate
  61. timeFetcher:(id<FIRIAMTimeFetcher>)timeFetcher {
  62. UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"FIRInAppMessageDisplayStoryboard"
  63. bundle:resourceBundle];
  64. if (storyboard == nil) {
  65. FIRLogError(kFIRLoggerInAppMessagingDisplay, @"I-FID300001",
  66. @"Storyboard '"
  67. "FIRInAppMessageDisplayStoryboard' not found in bundle %@",
  68. resourceBundle);
  69. return nil;
  70. }
  71. FIRIAMModalViewController *modalVC = (FIRIAMModalViewController *)[storyboard
  72. instantiateViewControllerWithIdentifier:@"modal-view-vc"];
  73. modalVC.displayDelegate = displayDelegate;
  74. modalVC.modalDisplayMessage = modalMessage;
  75. modalVC.timeFetcher = timeFetcher;
  76. return modalVC;
  77. }
  78. - (FIRInAppMessagingDisplayMessage *)inAppMessage {
  79. return self.modalDisplayMessage;
  80. }
  81. - (IBAction)closeButtonClicked:(id)sender {
  82. [self dismissView:FIRInAppMessagingDismissTypeUserTapClose];
  83. }
  84. - (IBAction)actionButtonTapped:(id)sender {
  85. #pragma clang diagnostic push
  86. #pragma clang diagnostic ignored "-Wdeprecated-declarations"
  87. FIRInAppMessagingAction *action = [[FIRInAppMessagingAction alloc]
  88. initWithActionText:self.modalDisplayMessage.actionButton.buttonText
  89. actionURL:self.modalDisplayMessage.actionURL];
  90. #pragma clang diagnostic pop
  91. [self followAction:action];
  92. }
  93. - (void)viewDidLoad {
  94. [super viewDidLoad];
  95. // make the background half transparent
  96. [self.view setBackgroundColor:[UIColor.grayColor colorWithAlphaComponent:0.5]];
  97. self.messageCardView.layer.cornerRadius = 4;
  98. // populating values for display elements
  99. self.titleLabel.text = self.modalDisplayMessage.title;
  100. self.bodyTextView.text = self.modalDisplayMessage.bodyText;
  101. if (self.modalDisplayMessage.imageData) {
  102. [self.imageView
  103. setImage:[UIImage imageWithData:self.modalDisplayMessage.imageData.imageRawData]];
  104. self.imageView.contentMode = UIViewContentModeScaleAspectFit;
  105. }
  106. self.messageCardView.backgroundColor = self.modalDisplayMessage.displayBackgroundColor;
  107. self.titleLabel.textColor = self.modalDisplayMessage.textColor;
  108. self.bodyTextView.textColor = self.modalDisplayMessage.textColor;
  109. self.bodyTextView.selectable = NO;
  110. if (self.modalDisplayMessage.actionButton.buttonText.length != 0) {
  111. [self.actionButton setTitle:self.modalDisplayMessage.actionButton.buttonText
  112. forState:UIControlStateNormal];
  113. self.actionButton.backgroundColor = self.modalDisplayMessage.actionButton.buttonBackgroundColor;
  114. [self.actionButton setTitleColor:self.modalDisplayMessage.actionButton.buttonTextColor
  115. forState:UIControlStateNormal];
  116. self.actionButton.layer.cornerRadius = 4;
  117. if (self.modalDisplayMessage.bodyText.length == 0) {
  118. self.buttonTopToBodyBottomConstraint.constant = 0;
  119. }
  120. } else {
  121. // either action button text is empty or nil
  122. // hide the action button and reclaim the space below the buttom
  123. FIRLogDebug(kFIRLoggerInAppMessagingDisplay, @"I-FID300002",
  124. @"Modal view to be rendered without action button");
  125. self.maxActionButtonHeight.constant = 0;
  126. self.actionButton.clipsToBounds = YES;
  127. self.buttonTopToBodyBottomConstraint.constant = 0;
  128. }
  129. [self.view addConstraint:self.imageActualHeightConstraint];
  130. self.imageActualHeightConstraint.active = YES;
  131. self.fixedMessageCardHeightConstraint.active = NO;
  132. }
  133. // for text display UIview, which could be a UILabel or UITextView, decide the fit height under a
  134. // given display width
  135. - (CGFloat)determineTextAreaViewFitHeightForView:(UIView *)textView
  136. withWidth:(CGFloat)displayWidth {
  137. CGSize displaySize = CGSizeMake(displayWidth, FLT_MAX);
  138. return [textView sizeThatFits:displaySize].height;
  139. }
  140. // In both landscape or portrait mode, the title, body & button are aligned vertically and they form
  141. // together have an impact on the height for that column. Many times, we need to calculate a
  142. // suitable heights for them to help decide the layout. The height calculation is influced by quite
  143. // a few factors: the text lenght of title and body, the presence/absense of body & button and
  144. // available card/window sizes. So these are wrapped within
  145. // estimateTextButtomColumnHeightWithDisplayWidth which produce a TitleBodyButtonHeightInfo struct
  146. // to give the estimates of the heights of different elements.
  147. struct TitleBodyButtonHeightInfo {
  148. CGFloat titleHeight;
  149. CGFloat bodyHeight;
  150. // this is the total height of title plus body plus the button. Notice that button or body are
  151. // optional and the result totaColumnlHeight factor in these cases correctly
  152. CGFloat totaColumnlHeight;
  153. };
  154. - (struct TitleBodyButtonHeightInfo)estimateTextBtnColumnHeightWithDisplayWidth:
  155. (CGFloat)displayWidth
  156. withMaxColumnHeight:(CGFloat)maxHeight {
  157. struct TitleBodyButtonHeightInfo resultHeightInfo;
  158. CGFloat titleFitHeight = [self determineTextAreaViewFitHeightForView:self.titleLabel
  159. withWidth:displayWidth];
  160. CGFloat bodyFitHeight = self.modalDisplayMessage.bodyText.length == 0
  161. ? 0
  162. : [self determineTextAreaViewFitHeightForView:self.bodyTextView
  163. withWidth:displayWidth];
  164. CGFloat bodyFitHeightWithPadding = self.modalDisplayMessage.bodyText.length == 0
  165. ? 0
  166. : bodyFitHeight + VerticalSpacingBetweenTitleAndBody;
  167. CGFloat buttonHeight =
  168. self.modalDisplayMessage.actionButton == nil
  169. ? 0
  170. : self.actionButton.frame.size.height + VerticalSpacingBetweenBodyAndActionButton;
  171. // we keep the spacing even if body or button is absent.
  172. CGFloat fitColumnHeight = titleFitHeight + bodyFitHeightWithPadding + buttonHeight;
  173. if (fitColumnHeight < maxHeight) {
  174. // every element get space that can fit the content
  175. resultHeightInfo.bodyHeight = bodyFitHeight;
  176. resultHeightInfo.titleHeight = titleFitHeight;
  177. resultHeightInfo.totaColumnlHeight = fitColumnHeight;
  178. } else {
  179. // need to restrict heights of certain elements
  180. resultHeightInfo.totaColumnlHeight = maxHeight;
  181. if (self.modalDisplayMessage.bodyText.length == 0) {
  182. // no message body, title will try to expand to take all the available height
  183. resultHeightInfo.bodyHeight = 0;
  184. if (self.modalDisplayMessage.actionButton == nil) {
  185. resultHeightInfo.titleHeight = maxHeight;
  186. } else {
  187. // button height, if not 0, already accommodates the space above it
  188. resultHeightInfo.titleHeight = maxHeight - buttonHeight;
  189. }
  190. } else {
  191. // first give title up to 40% of available height
  192. resultHeightInfo.titleHeight = fmin(titleFitHeight, maxHeight * 2 / 5);
  193. CGFloat availableBodyHeight = 0;
  194. if (self.modalDisplayMessage.actionButton == nil) {
  195. availableBodyHeight =
  196. maxHeight - resultHeightInfo.titleHeight - VerticalSpacingBetweenTitleAndBody;
  197. } else {
  198. // body takes the rest minus button space
  199. availableBodyHeight = maxHeight - resultHeightInfo.titleHeight - buttonHeight -
  200. VerticalSpacingBetweenTitleAndBody;
  201. }
  202. if (availableBodyHeight > bodyFitHeight) {
  203. resultHeightInfo.bodyHeight = bodyFitHeight;
  204. // give some back to title height since body does not use up all the allocation
  205. resultHeightInfo.titleHeight += (availableBodyHeight - bodyFitHeight);
  206. } else {
  207. resultHeightInfo.bodyHeight = availableBodyHeight;
  208. }
  209. }
  210. }
  211. FIRLogDebug(kFIRLoggerInAppMessagingDisplay, @"I-FID300003",
  212. @"In heights calculation (max-height = %lf, width = %lf), title heights is %lf, "
  213. "body height is %lf, button height is %lf, total column heights are %lf",
  214. maxHeight, displayWidth, resultHeightInfo.titleHeight, resultHeightInfo.bodyHeight,
  215. buttonHeight, resultHeightInfo.totaColumnlHeight);
  216. return resultHeightInfo;
  217. }
  218. // the following two layoutFineTunexx methods make additional adjustments for the view layout
  219. // in portrait and landscape mode respectively. They are supposed to be triggered from
  220. // viewDidLayoutSubviews since certain dimension sizes are only available there
  221. - (void)layoutFineTuneInPortraitMode {
  222. // for tablet case, since we use a fixed card height, the reference would be just the card height
  223. // for non-tablet case, we want to use a dynamic height , so the reference would be the window
  224. // height
  225. CGFloat heightCalcReference = 0;
  226. if (self.messageCardHeightMaxInTabletCase.active) {
  227. heightCalcReference =
  228. self.messageCardView.frame.size.height - TopBottomPaddingAroundContent * 2;
  229. } else {
  230. heightCalcReference = self.view.window.frame.size.height - TopBottomPaddingAroundContent * 2 -
  231. TopBottomPaddingAroundMsgCard * 2;
  232. // Factor in space for the top notch on iPhone X*.
  233. #if defined(__IPHONE_11_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000
  234. if (@available(iOS 11.0, *)) {
  235. heightCalcReference -= self.view.safeAreaInsets.top;
  236. }
  237. #endif // defined(__IPHONE_11_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000
  238. }
  239. FIRLogDebug(kFIRLoggerInAppMessagingDisplay, @"I-FID300004",
  240. @"The height calc reference is %lf "
  241. "with frame height as %lf",
  242. heightCalcReference, self.view.window.frame.size.height);
  243. // this makes sure titleLable gets correct width to be ready for later's height estimate for the
  244. // text & button column
  245. [self.messageCardView layoutIfNeeded];
  246. // we reserve approximately 1/3 vertical space for image
  247. CGFloat textBtnTotalAvailableHeight =
  248. self.modalDisplayMessage.imageData ? heightCalcReference * 2 / 3 : heightCalcReference;
  249. struct TitleBodyButtonHeightInfo heights =
  250. [self estimateTextBtnColumnHeightWithDisplayWidth:self.titleLabel.frame.size.width
  251. withMaxColumnHeight:textBtnTotalAvailableHeight];
  252. self.titleLabelHeightConstraint.constant = heights.titleHeight;
  253. self.bodyTextViewHeightConstraint.constant = heights.bodyHeight;
  254. if (self.modalDisplayMessage.imageData) {
  255. UIImage *image = [UIImage imageWithData:self.modalDisplayMessage.imageData.imageRawData];
  256. CGSize imageAvailableSpace = CGSizeMake(self.titleLabel.frame.size.width,
  257. heightCalcReference - heights.totaColumnlHeight -
  258. self.imageTopToTitleBottomInPortraitMode.constant);
  259. CGSize imageDisplaySize = [self fitImageInRegionSize:imageAvailableSpace
  260. withImageSize:image.size];
  261. FIRLogDebug(kFIRLoggerInAppMessagingDisplay, @"I-FID300005",
  262. @"Given actual image size %@ and available image display size %@, the actual"
  263. "image display size is %@",
  264. NSStringFromCGSize(image.size), NSStringFromCGSize(imageAvailableSpace),
  265. NSStringFromCGSize(imageDisplaySize));
  266. // for portrait mode, no need to change image width since no content is shown side to
  267. // the image
  268. self.imageActualHeightConstraint.constant = imageDisplaySize.height;
  269. } else {
  270. // no image case
  271. self.imageActualHeightConstraint.constant = 0;
  272. self.imageTopToTitleBottomInPortraitMode.constant = 0;
  273. }
  274. }
  275. - (CGSize)fitImageInRegionSize:(CGSize)regionSize withImageSize:(CGSize)imageSize {
  276. if (imageSize.height <= regionSize.height && imageSize.width <= regionSize.width) {
  277. return imageSize; // image can be fully rendered at its original dimension
  278. } else {
  279. CGFloat regionRatio = regionSize.width / regionSize.height;
  280. CGFloat imageRaio = imageSize.width / imageSize.height;
  281. if (regionRatio < imageRaio) {
  282. // bound on the width dimension
  283. return CGSizeMake(regionSize.width, regionSize.width / imageRaio);
  284. } else {
  285. return CGSizeMake(regionSize.height * imageRaio, regionSize.height);
  286. }
  287. }
  288. }
  289. // for devices of 4 inches or below (iphone se, iphone 5/5s and iphone 4s), reduce
  290. // the padding sizes between elements in the text/button column for landscape mode
  291. - (void)applySmallerSpacingForInLandscapeMode {
  292. if (self.modalDisplayMessage.bodyText.length != 0) {
  293. VerticalSpacingBetweenTitleAndBody = self.bodyTopToTitleBottomInLandScapeMode.constant = 12;
  294. }
  295. if (self.modalDisplayMessage.actionButton != nil &&
  296. self.modalDisplayMessage.bodyText.length != 0) {
  297. VerticalSpacingBetweenBodyAndActionButton = self.buttonTopToBodyBottomConstraint.constant = 12;
  298. }
  299. }
  300. - (void)layoutFineTuneInLandscapeMode {
  301. // smaller spacing threshold is applied for screens equal or larger than 4.7 inches
  302. if (self.view.window.frame.size.height <= 321) {
  303. [self applySmallerSpacingForInLandscapeMode];
  304. }
  305. if (self.modalDisplayMessage.imageData) {
  306. UIImage *image = [UIImage imageWithData:self.modalDisplayMessage.imageData.imageRawData];
  307. CGFloat maxImageHeight = self.view.window.frame.size.height -
  308. TopBottomPaddingAroundContent * 2 - TopBottomPaddingAroundMsgCard * 2;
  309. CGFloat maxImageWidth = self.messageCardView.frame.size.width * 2 / 5;
  310. CGSize imageDisplaySize = [self fitImageInRegionSize:CGSizeMake(maxImageWidth, maxImageHeight)
  311. withImageSize:image.size];
  312. FIRLogDebug(kFIRLoggerInAppMessagingDisplay, @"I-FID300008",
  313. @"In landscape mode, image fit size is %@", NSStringFromCGSize(imageDisplaySize));
  314. // resize image per imageSize
  315. self.imageWidthInLandscapeMode.constant = imageDisplaySize.width;
  316. self.imageActualHeightConstraint.constant = imageDisplaySize.height;
  317. // now we can estimate the new card width given the desired image size
  318. // this assumes we use half of the window width for diplaying the text/button column
  319. CGFloat cardFitWidth = imageDisplaySize.width + self.view.window.frame.size.width / 2 +
  320. LandScapePaddingBetweenImageAndTextColumn;
  321. self.cardLeadingMarginInLandscapeMode.constant =
  322. fmax(15, (self.view.window.frame.size.width - cardFitWidth) / 2);
  323. } else {
  324. self.imageWidthInLandscapeMode.constant = 0;
  325. self.imageActualHeightConstraint.constant = 0;
  326. // card would be of 3/5 width of the screen in landscape
  327. self.cardLeadingMarginInLandscapeMode.constant = self.view.window.frame.size.width / 5;
  328. }
  329. // this makes sure titleLable gets correct width to be ready for later's height estimate for the
  330. // text & button column
  331. [self.messageCardView layoutIfNeeded];
  332. struct TitleBodyButtonHeightInfo heights =
  333. [self estimateTextBtnColumnHeightWithDisplayWidth:self.titleLabel.frame.size.width
  334. withMaxColumnHeight:self.view.frame.size.height -
  335. TopBottomPaddingAroundContent * 2 -
  336. TopBottomPaddingAroundMsgCard * 2];
  337. self.titleLabelHeightConstraint.constant = heights.titleHeight;
  338. self.bodyTextViewHeightConstraint.constant = heights.bodyHeight;
  339. // Adjust the height of the card
  340. // are we bound by the text/button column height or image height ?
  341. CGFloat cardHeight = fmax(self.imageActualHeightConstraint.constant, heights.totaColumnlHeight) +
  342. TopBottomPaddingAroundContent * 2;
  343. self.maxCardHeightInLandscapeMode.constant = cardHeight;
  344. // with the new card height, align the image and the text/btn column to center vertically
  345. self.imageTopToCardTopInLandscapeMode.constant =
  346. (cardHeight - self.imageActualHeightConstraint.constant) / 2;
  347. self.titleTopToCardViewTop.constant = (cardHeight - heights.totaColumnlHeight) / 2;
  348. }
  349. - (void)viewDidLayoutSubviews {
  350. [super viewDidLayoutSubviews];
  351. if (self.traitCollection.horizontalSizeClass == UIUserInterfaceSizeClassRegular ||
  352. self.traitCollection.verticalSizeClass == UIUserInterfaceSizeClassCompact) {
  353. FIRLogDebug(kFIRLoggerInAppMessagingDisplay, @"I-FID300010",
  354. @"Modal view rendered in landscape mode");
  355. [self layoutFineTuneInLandscapeMode];
  356. } else {
  357. FIRLogDebug(kFIRLoggerInAppMessagingDisplay, @"I-FID300009",
  358. @"Modal view rendered in portrait mode");
  359. [self layoutFineTuneInPortraitMode];
  360. }
  361. // always scroll to the top in case the body area is scrollable
  362. [self.bodyTextView setContentOffset:CGPointZero];
  363. }
  364. - (void)viewWillAppear:(BOOL)animated {
  365. [super viewWillAppear:animated];
  366. // close any potential keyboard, which would conflict with the modal in-app messagine view
  367. [[UIApplication sharedApplication] sendAction:@selector(resignFirstResponder)
  368. to:nil
  369. from:nil
  370. forEvent:nil];
  371. if (self.modalDisplayMessage.campaignInfo.renderAsTestMessage) {
  372. FIRLogDebug(kFIRLoggerInAppMessagingDisplay, @"I-FID300011",
  373. @"Flushing the close button since this is a test message.");
  374. [self flashCloseButton:self.closeButton];
  375. }
  376. }
  377. - (void)flashCloseButton:(UIButton *)closeButton {
  378. closeButton.alpha = 1.0f;
  379. [UIView animateWithDuration:2.0
  380. delay:0.0
  381. options:UIViewAnimationOptionCurveEaseInOut | UIViewAnimationOptionRepeat |
  382. UIViewAnimationOptionAutoreverse |
  383. UIViewAnimationOptionAllowUserInteraction
  384. animations:^{
  385. closeButton.alpha = 0.1f;
  386. }
  387. completion:^(BOOL finished){
  388. // Do nothing
  389. }];
  390. }
  391. @end