Skip to content

Commit

Permalink
fix quest CTA
Browse files Browse the repository at this point in the history
  • Loading branch information
phillipthelen committed Jul 22, 2024
1 parent ea93d09 commit cd3e8ad
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 31 deletions.
37 changes: 21 additions & 16 deletions HabitRPG/TableViewDataSources/ItemsViewDataSource.swift
Original file line number Diff line number Diff line change
Expand Up @@ -226,24 +226,29 @@ class ItemsViewDataSource: BaseReactiveTableViewDataSource<ItemProtocol> {
descriptionView?.textColor = theme.secondaryTextColor
titleView?.text = L10n.noX(self.tableView(tableView, titleForHeaderInSection: indexPath.section) ?? L10n.Titles.items)
let text: String
switch indexPath.section {
case 0:
imageView?.image = Asset.Empty.eggs.image
text = L10n.Items.Empty.eggDescription
case 1:
imageView?.image = Asset.Empty.food.image
text = L10n.Items.Empty.foodDescription
case 2:
imageView?.image = Asset.Empty.hatchingPotions.image
text = L10n.Items.Empty.potionDescription
case 3:
imageView?.image = Asset.Empty.special.image
text = L10n.Items.Empty.specialDescription
case 4:
if itemType == "quests" {
imageView?.image = Asset.Empty.quests.image
text = L10n.Items.Empty.questDescription
default:
return cell
} else {
switch indexPath.section {
case 0:
imageView?.image = Asset.Empty.eggs.image
text = L10n.Items.Empty.eggDescription
case 1:
imageView?.image = Asset.Empty.food.image
text = L10n.Items.Empty.foodDescription
case 2:
imageView?.image = Asset.Empty.hatchingPotions.image
text = L10n.Items.Empty.potionDescription
case 3:
imageView?.image = Asset.Empty.special.image
text = L10n.Items.Empty.specialDescription
case 4:
imageView?.image = Asset.Empty.quests.image
text = L10n.Items.Empty.questDescription
default:
return cell
}
}
let attributedText = NSMutableAttributedString(string: text)
attributedText.highlightWords(words: L10n.Locations.market, L10n.Locations.questShop, L10n.subscribe)
Expand Down
28 changes: 14 additions & 14 deletions HabitRPG/TableviewCells/InAppRewardCell.xib
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="22155" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="32700.99.1234" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<device id="retina6_12" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22131"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22685"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
Expand Down Expand Up @@ -63,21 +63,21 @@
<constraint firstAttribute="width" constant="68" id="vy8-7k-2Yo"/>
</constraints>
</imageView>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="nBh-ef-OBE">
<rect key="frame" x="2" y="2" width="16" height="32"/>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" alignment="top" spacing="4" translatesAutoresizingMaskIntoConstraints="NO" id="nBh-ef-OBE">
<rect key="frame" x="4" y="4" width="13" height="25"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="center" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="SeM-3f-dTN">
<rect key="frame" x="0.0" y="0.0" width="16" height="16"/>
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="My8-ty-4Bs">
<rect key="frame" x="0.0" y="0.0" width="10" height="8"/>
<constraints>
<constraint firstAttribute="height" constant="16" id="U0A-n7-Xhb"/>
<constraint firstAttribute="width" constant="16" id="i3b-c5-fNJ"/>
<constraint firstAttribute="height" constant="8" id="nPa-zW-HA9"/>
<constraint firstAttribute="width" constant="10" id="ufB-SA-Ien"/>
</constraints>
</imageView>
<imageView userInteractionEnabled="NO" contentMode="center" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="My8-ty-4Bs">
<rect key="frame" x="0.0" y="16" width="16" height="16"/>
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="SeM-3f-dTN">
<rect key="frame" x="0.0" y="12" width="13" height="13"/>
<constraints>
<constraint firstAttribute="height" constant="16" id="nPa-zW-HA9"/>
<constraint firstAttribute="width" constant="16" id="ufB-SA-Ien"/>
<constraint firstAttribute="height" constant="13" id="U0A-n7-Xhb"/>
<constraint firstAttribute="width" constant="13" id="i3b-c5-fNJ"/>
</constraints>
</imageView>
</subviews>
Expand All @@ -89,9 +89,9 @@
<constraint firstAttribute="height" constant="108" id="Dua-ju-Hh6"/>
<constraint firstItem="eGb-th-auK" firstAttribute="top" secondItem="WTa-dS-7d1" secondAttribute="top" constant="4" id="GZj-n6-3Sw"/>
<constraint firstItem="eGb-th-auK" firstAttribute="centerX" secondItem="WTa-dS-7d1" secondAttribute="centerX" id="L7A-xv-dhs"/>
<constraint firstItem="nBh-ef-OBE" firstAttribute="top" secondItem="WTa-dS-7d1" secondAttribute="top" constant="2" id="X0l-DW-egj"/>
<constraint firstItem="nBh-ef-OBE" firstAttribute="top" secondItem="WTa-dS-7d1" secondAttribute="top" constant="4" id="X0l-DW-egj"/>
<constraint firstItem="827-G9-ba1" firstAttribute="leading" secondItem="WTa-dS-7d1" secondAttribute="leading" id="hiz-5X-YwV"/>
<constraint firstItem="nBh-ef-OBE" firstAttribute="leading" secondItem="WTa-dS-7d1" secondAttribute="leading" constant="2" id="lay-LX-qxO"/>
<constraint firstItem="nBh-ef-OBE" firstAttribute="leading" secondItem="WTa-dS-7d1" secondAttribute="leading" constant="4" id="lay-LX-qxO"/>
<constraint firstAttribute="trailing" secondItem="827-G9-ba1" secondAttribute="trailing" id="mMb-RH-7hA"/>
<constraint firstAttribute="width" constant="78" id="zFc-Eq-lBw"/>
</constraints>
Expand Down
9 changes: 8 additions & 1 deletion HabitRPG/UI/Inventory/ItemsViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,14 @@ class ItemsViewController: BaseTableViewController {
HabiticaAnalytics.shared.log("Items CTA tap", withEventProperties: ["eventCategory": "behaviour",
"hitType": "event",
"area": "bottom"])
RouterHandler.shared.handle(.market)
if itemType == "quests" {
RouterHandler.shared.handle(.questShop)
} else {
RouterHandler.shared.handle(.market)
}
if isPresentedModally {
dismiss()
}
}

private func showActionSheet(item: ItemProtocol, withSource sourceView: UIView?) {
Expand Down

0 comments on commit cd3e8ad

Please sign in to comment.