Never show the empty sticker keyboard.

This commit is contained in:
Matthew Chen 2019-05-29 16:48:02 -04:00
parent 7068b65364
commit abce36b687
2 changed files with 13 additions and 13 deletions

View File

@ -1105,7 +1105,18 @@ const CGFloat kMaxTextViewHeight = 98;
- (void)stickerButtonPressed
{
OWSLogVerbose(@"");
__block BOOL hasInstalledStickerPacks;
[self.databaseStorage readWithBlock:^(SDSAnyReadTransaction *transaction) {
hasInstalledStickerPacks = [StickerManager installedStickerPacksWithTransaction:transaction].count > 0;
}];
if (!hasInstalledStickerPacks) {
// If the keyboard is presented and no stickers are installed,
// show the manage stickers view. Do not show the sticker keyboard.
[self presentManageStickersView];
return;
}
[self activateStickerKeyboard];
}

View File

@ -102,17 +102,6 @@ public class StickerKeyboard: UIStackView {
}
@objc public func wasPresented() {
// If there are no recents, default to showing the first sticker pack.
if currentPageCollectionView.stickerCount < 1 {
selectedStickerPack = stickerPacks.first
if selectedStickerPack == nil {
// If the keyboard is presented and no stickers are
// installed, show the manage stickers view.
delegate?.presentManageStickersView()
}
}
updatePageConstraints()
}
@ -247,7 +236,7 @@ public class StickerKeyboard: UIStackView {
private var stickerPackCollectionViews = [
StickerPackCollectionView(),
StickerPackCollectionView(),
StickerPackCollectionView(),
StickerPackCollectionView()
]
private var stickerPackCollectionViewConstraints = [NSLayoutConstraint]()