Skip to content

Commit

Permalink
customization improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
phillipthelen committed May 6, 2024
1 parent 4e1500e commit 979ab64
Show file tree
Hide file tree
Showing 42 changed files with 253 additions and 139 deletions.
1 change: 1 addition & 0 deletions HabitRPG/Extensions/UIColor-Habitica.swift
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ extension UIColor {
@nonobjc static let green500 = UIColor(red: 119.0 / 255.0, green: 244.0 / 255.0, blue: 199.0 / 255.0, alpha: 1.0)

@nonobjc static let black = UIColor(red: 26.0 / 255.0, green: 24.0 / 255.0, blue: 29.0 / 255.0, alpha: 1.0)
@nonobjc static let gray5 = UIColor(red: 35 / 255.0, green: 32 / 255.0, blue: 42 / 255.0, alpha: 1.0)
@nonobjc static let gray10 = UIColor(red: 52.0 / 255.0, green: 49.0 / 255.0, blue: 58.0 / 255.0, alpha: 1.0)
@nonobjc static let gray50 = UIColor(red: 78.0 / 255.0, green: 74.0 / 255.0, blue: 87.0 / 255.0, alpha: 1.0)
@nonobjc static let gray100 = UIColor(red: 104.0 / 255.0, green: 98.0 / 255.0, blue: 116.0 / 255.0, alpha: 1.0)
Expand Down
1 change: 1 addition & 0 deletions HabitRPG/Generated/Assets-Images.swift
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ internal enum Asset {
internal static let birthdayMenuGems = ImageAsset(name: "birthday_menu_gems")
internal static let birthdayMenuText = ImageAsset(name: "birthday_menu_text")
internal static let birthdayTextdeco = ImageAsset(name: "birthday_textdeco")
internal static let blankAvatar = ImageAsset(name: "blank_avatar")
internal static let buttonGrid = ImageAsset(name: "button_grid")
internal static let buttonList = ImageAsset(name: "button_list")
internal static let calendar = ImageAsset(name: "calendar")
Expand Down
20 changes: 15 additions & 5 deletions HabitRPG/Generated/Strings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,8 @@ public enum L10n {
public static var experiencePoints: String { return L10n.tr("Mainstrings", "experience_points") }
/// Failed
public static var failed: String { return L10n.tr("Mainstrings", "failed") }
/// Fall
public static var fall: String { return L10n.tr("Mainstrings", "fall") }
/// Every Pet has a specific food they enjoy! Experiment to find out which will grow your Pet the fastest
public static var fedPetDescription: String { return L10n.tr("Mainstrings", "fedPetDescription") }
/// Fed a Pet
Expand Down Expand Up @@ -628,6 +630,8 @@ public enum L10n {
public static var month: String { return L10n.tr("Mainstrings", "month") }
/// Monthly
public static var monthly: String { return L10n.tr("Mainstrings", "monthly") }
/// Monthly Backgrounds
public static var monthlyBackgrounds: String { return L10n.tr("Mainstrings", "monthly_backgrounds") }
/// Monthly Gem Cap Reached
public static var monthlyGemCapReached: String { return L10n.tr("Mainstrings", "monthly_gem_cap_reached") }
/// months
Expand Down Expand Up @@ -796,7 +800,7 @@ public enum L10n {
public static var photoUrl: String { return L10n.tr("Mainstrings", "photo_url") }
/// Pin
public static var pin: String { return L10n.tr("Mainstrings", "pin") }
/// Plain Backgrounds
/// Standard Backgrounds
public static var plainBackgrounds: String { return L10n.tr("Mainstrings", "plain_backgrounds") }
/// Player
public static var player: String { return L10n.tr("Mainstrings", "player") }
Expand Down Expand Up @@ -986,6 +990,8 @@ public enum L10n {
public static var slim: String { return L10n.tr("Mainstrings", "slim") }
/// Special Items
public static var specialItems: String { return L10n.tr("Mainstrings", "specialItems") }
/// Spring
public static var spring: String { return L10n.tr("Mainstrings", "spring") }
/// Staff
public static var staff: String { return L10n.tr("Mainstrings", "staff") }
/// Start my day
Expand Down Expand Up @@ -1086,9 +1092,11 @@ public enum L10n {
}
/// Summary
public static var summary: String { return L10n.tr("Mainstrings", "summary") }
/// Summer
public static var summer: String { return L10n.tr("Mainstrings", "summer") }
/// Sunday
public static var sunday: String { return L10n.tr("Mainstrings", "sunday") }
/// Swaps in %@
/// Switches in %@
public static func swapsInX(_ p1: String) -> String {
return L10n.tr("Mainstrings", "swaps_in_x", p1)
}
Expand All @@ -1110,7 +1118,7 @@ public enum L10n {
}
/// Thursday
public static var thursday: String { return L10n.tr("Mainstrings", "thursday") }
/// Time Travelers Backgrounds
/// Steampunk Backgrounds
public static var timeTravelBackgrounds: String { return L10n.tr("Mainstrings", "time_travel_backgrounds") }
/// Title
public static var title: String { return L10n.tr("Mainstrings", "title") }
Expand Down Expand Up @@ -1234,6 +1242,8 @@ public enum L10n {
public static var whatsWorldBoss: String { return L10n.tr("Mainstrings", "whats_world_boss") }
/// Wheelchair
public static var wheelchair: String { return L10n.tr("Mainstrings", "wheelchair") }
/// Winter
public static var winter: String { return L10n.tr("Mainstrings", "winter") }
/// Oh dear, pay no heed to the monster below -- this is still a safe haven to chat on your breaks.
public static var worldBossIntroHeader: String { return L10n.tr("Mainstrings", "world_boss_intro_header") }
/// Write a Message
Expand Down Expand Up @@ -1960,13 +1970,13 @@ public enum L10n {
public static var customizations: String { return L10n.tr("Mainstrings", "locations.customizations") }
/// Market
public static var market: String { return L10n.tr("Mainstrings", "locations.market") }
/// Quest Shop
/// Quests
public static var questShop: String { return L10n.tr("Mainstrings", "locations.quest_shop") }
/// Seasonal Shop
public static var seasonalShop: String { return L10n.tr("Mainstrings", "locations.seasonal_shop") }
/// Stable
public static var stable: String { return L10n.tr("Mainstrings", "locations.stable") }
/// Time Travelers Shop
/// Time Travelers
public static var timeTravelersShop: String { return L10n.tr("Mainstrings", "locations.time_travelers_shop") }
}

Expand Down
2 changes: 1 addition & 1 deletion HabitRPG/Habitica-Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>957</string>
<string>960</string>
<key>CustomDomain</key>
<string>${CUSTOM_DOMAIN}</string>
<key>DisableSSL</key>
Expand Down
56 changes: 56 additions & 0 deletions HabitRPG/Images.xcassets/blank_avatar.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{
"images" : [
{
"filename" : "empty_slot.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"filename" : "empty_slot 1.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "empty_slot 4.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"filename" : "empty_slot 2.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "empty_slot 5.png",
"idiom" : "universal",
"scale" : "3x"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"filename" : "empty_slot 3.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,16 @@ class CustomizationRepository: BaseRepository<CustomizationLocalRepository> {
})
}

public func unlock(path: String, value: Float) -> Signal<UserProtocol?, Never> {
public func unlock(path: String, value: Float, text: String) -> Signal<UserProtocol?, Never> {
let call = UnlockCustomizationsCall(path: path)
return call.objectSignal.on(value: {[weak self] newUser in
if let userID = self?.currentUserId, let user = newUser {
self?.userLocalRepository.updateUser(id: userID, balanceDiff: -(value / 4.0))
self?.userLocalRepository.updateUser(id: userID, updateUser: user)
}
DispatchQueue.main.asyncAfter(deadline: DispatchTime.now()+1) {
ToastManager.show(text: L10n.purchased(text), color: .green)
}
})
}

Expand Down
18 changes: 9 additions & 9 deletions HabitRPG/Storyboards/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -489,10 +489,10 @@
<rect key="frame" x="0.0" y="56" width="107" height="735"/>
<subviews>
<view contentMode="scaleToFill" verticalHuggingPriority="1000" verticalCompressionResistancePriority="1000" translatesAutoresizingMaskIntoConstraints="NO" id="foh-Y5-euZ">
<rect key="frame" x="0.0" y="0.0" width="107" height="209.33333333333334"/>
<rect key="frame" x="0.0" y="0.0" width="107" height="460"/>
<subviews>
<stackView opaque="NO" contentMode="scaleToFill" verticalHuggingPriority="1000" verticalCompressionResistancePriority="1000" axis="vertical" spacing="8" translatesAutoresizingMaskIntoConstraints="NO" id="wYP-zx-dbe">
<rect key="frame" x="26" y="0.0" width="55" height="249.33333333333334"/>
<rect key="frame" x="26" y="0.0" width="55" height="500"/>
<subviews>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="center" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="adventureGuideArt" translatesAutoresizingMaskIntoConstraints="NO" id="Eax-S2-1ke">
<rect key="frame" x="0.0" y="0.0" width="55" height="46"/>
Expand All @@ -517,10 +517,10 @@
<nil key="highlightedColor"/>
</label>
<view contentMode="scaleToFill" verticalHuggingPriority="1000" verticalCompressionResistancePriority="1000" translatesAutoresizingMaskIntoConstraints="NO" id="WUa-Qe-rtA">
<rect key="frame" x="0.0" y="91.333333333333343" width="55" height="50"/>
<rect key="frame" x="0.0" y="91.333333333333343" width="55" height="300.66666666666663"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="1000" verticalCompressionResistancePriority="1000" text="Complete these onboarding tasks and you’ll earn 5 Achievements and 100 Gold once you’re done!" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="KXt-8h-VNr">
<rect key="frame" x="12" y="0.0" width="31" height="50"/>
<rect key="frame" x="12" y="0.0" width="31" height="300.66666666666669"/>
<constraints>
<constraint firstAttribute="height" priority="500" constant="22" id="bej-Uf-maR"/>
</constraints>
Expand All @@ -538,14 +538,14 @@
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="YPg-7O-j94">
<rect key="frame" x="0.0" y="149.33333333333334" width="55" height="1"/>
<rect key="frame" x="0.0" y="400" width="55" height="1"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstAttribute="height" constant="1" id="V3u-UV-9kz"/>
</constraints>
</view>
<stackView opaque="NO" contentMode="scaleToFill" distribution="equalSpacing" translatesAutoresizingMaskIntoConstraints="NO" id="ul9-Fj-GrY">
<rect key="frame" x="0.0" y="158.33333333333334" width="55" height="20"/>
<rect key="frame" x="0.0" y="409" width="55" height="20"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" ambiguous="YES" text="Your Progress" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="gGm-VS-bMz">
<rect key="frame" x="0.0" y="0.0" width="55" height="20"/>
Expand All @@ -565,14 +565,14 @@
</constraints>
</stackView>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Hqi-5C-p2F" customClass="ProgressBar" customModule="Habitica" customModuleProvider="target">
<rect key="frame" x="0.0" y="186.33333333333334" width="55" height="5"/>
<rect key="frame" x="0.0" y="437" width="55" height="5"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstAttribute="height" constant="5" id="sHS-eo-snW"/>
</constraints>
</view>
<stackView opaque="NO" contentMode="scaleToFill" verticalHuggingPriority="1000" verticalCompressionResistancePriority="1000" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="eGa-gL-7SD">
<rect key="frame" x="0.0" y="199.33333333333334" width="55" height="50"/>
<rect key="frame" x="0.0" y="450" width="55" height="50"/>
<constraints>
<constraint firstAttribute="height" priority="500" constant="20" id="pmU-Np-CQZ"/>
</constraints>
Expand Down Expand Up @@ -887,7 +887,7 @@
<constraints>
<constraint firstAttribute="height" priority="500" constant="26" id="AXg-RX-7v0"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="12"/>
<fontDescription key="fontDescription" type="system" weight="medium" pointSize="12"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
Expand Down
14 changes: 10 additions & 4 deletions HabitRPG/Strings/Base.lproj/Mainstrings.strings
Original file line number Diff line number Diff line change
Expand Up @@ -630,9 +630,10 @@
"member_group_plan" = "Member of a Group Plan";
"open_website" = "Open Habitica Website";
"open_google_play" = "Open Google Play Store";
"plain_backgrounds" = "Plain Backgrounds";
"time_travel_backgrounds" = "Time Travelers Backgrounds";
"plain_backgrounds" = "Standard Backgrounds";
"time_travel_backgrounds" = "Steampunk Backgrounds";
"event_backgrounds" = "Event Backgrounds";
"monthly_backgrounds" = "Monthly Backgrounds";
"glasses" = "Glasses";
"size" = "Size";
"shirt" = "Shirt";
Expand Down Expand Up @@ -781,9 +782,9 @@
"keep_tasks" = "Keep Tasks";
"delete_tasks" = "Delete Tasks";
"locations.market" = "Market";
"locations.quest_shop" = "Quest Shop";
"locations.quest_shop" = "Quests";
"locations.seasonal_shop" = "Seasonal Shop";
"locations.time_travelers_shop" = "Time Travelers Shop";
"locations.time_travelers_shop" = "Time Travelers";
"locations.customizations" = "Customizations";
"locations.stable" = "Stable";
"NPCs.alex" = "Alex the Merchant";
Expand Down Expand Up @@ -1344,3 +1345,8 @@
"1_minute" = "1 Minute";
"swaps_in_x" = "Switches in %@";
"refresh_for_items" = "Refresh for new Items";

"spring" = "Spring";
"summer" = "Summer";
"fall" = "Fall";
"winter" = "Winter";
2 changes: 1 addition & 1 deletion HabitRPG/Strings/de.lproj/Mainstrings.strings
Original file line number Diff line number Diff line change
Expand Up @@ -718,7 +718,7 @@
"leave_challenge_title" = "Wettbewerb verlassen?";
"leave_challenge_prompt" = "Möchtest Du den Wettbewerb verlassen und die Aufgaben behalten, oder löschen?";
"locations.market" = "Markt";
"locations.quest_shop" = "Quest Shop";
"locations.quest_shop" = "Quests";
"locations.seasonal_shop" = "Jahreszeitenmarkt";
"locations.stable" = "Stall";
"NPCs.alex" = "Alex der Händler";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -520,8 +520,14 @@ class HRPGBuyItemModalViewController: UIViewController, Themeable {
HRPGBuyItemModalViewController.displayInsufficientGemsModal(reward: self.reward)
}
})
} else if purchaseType == "backgrounds" {
customizationRepository.unlock(path: "background.\(reward?.key ?? "")", value: reward?.value ?? 0).observeResult { result in
} else if purchaseType == "backgrounds" || purchaseType == "customization" {
let path: String
if purchaseType == "backgrounds" {
path = "background.\(reward?.key ?? "")"
} else {
path = reward?.path ?? ""
}
customizationRepository.unlock(path: path, value: reward?.value ?? 0, text: reward?.text ?? "").observeResult { result in
switch result {
case .success:
successBlock()
Expand Down
Loading

0 comments on commit 979ab64

Please sign in to comment.