FileMessagePreviewUnsupportedTypeView.m 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. // _____ _
  2. // |_ _| |_ _ _ ___ ___ _ __ __ _
  3. // | | | ' \| '_/ -_) -_) ' \/ _` |_
  4. // |_| |_||_|_| \___\___|_|_|_\__,_(_)
  5. //
  6. // Threema iOS Client
  7. // Copyright (c) 2015-2020 Threema GmbH
  8. //
  9. // This program is free software: you can redistribute it and/or modify
  10. // it under the terms of the GNU Affero General Public License, version 3,
  11. // as published by the Free Software Foundation.
  12. //
  13. // This program is distributed in the hope that it will be useful,
  14. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. // GNU Affero General Public License for more details.
  17. //
  18. // You should have received a copy of the GNU Affero General Public License
  19. // along with this program. If not, see <https://www.gnu.org/licenses/>.
  20. #import "FileMessagePreviewUnsupportedTypeView.h"
  21. #import "BundleUtil.h"
  22. #import "Utils.h"
  23. #import "FileMessagePreview.h"
  24. @implementation FileMessagePreviewUnsupportedTypeView
  25. + (instancetype)fileMessagePreviewUnsupportedTypeView {
  26. FileMessagePreviewUnsupportedTypeView *view = (FileMessagePreviewUnsupportedTypeView *)[BundleUtil loadXibNamed:@"FileMessagePreviewUnsupportedTypeView"];
  27. return view;
  28. }
  29. - (void)setupColors {
  30. _noPreviewLabel.textColor = [Colors fontNormal];
  31. _fileNameLabel.textColor = [Colors fontNormal];
  32. _fileSizeLabel.textColor = [Colors fontNormal];
  33. self.backgroundColor = [Colors background];
  34. }
  35. - (void)setFileMessage:(FileMessage *)message {
  36. [_noPreviewLabel setText:[BundleUtil localizedStringForKey:@"no_preview_available"]];
  37. [_fileNameLabel setText:message.fileName];
  38. [_fileSizeLabel setText: [Utils formatDataLength:message.fileSize.floatValue]];
  39. _thumbnailImage.image = [FileMessagePreview thumbnailForFileMessage:message];
  40. [self setupColors];
  41. }
  42. @end