Skip to content

Commit

Permalink
IOS-7677 markdown support (#3734)
Browse files Browse the repository at this point in the history
  • Loading branch information
Andoran90 authored Sep 1, 2024
1 parent 65143ee commit 14222d7
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
//

import SwiftUI
import MarkdownUI

struct DescriptionBottomSheetInfo: Identifiable, Equatable {
let id: UUID = .init()
Expand Down Expand Up @@ -46,7 +47,8 @@ struct DescriptionBottomSheetView: View {
.padding(.vertical, 12)
}

Text(info.description)
Markdown { info.description }
.markdownSoftBreakMode(.lineBreak)
.frame(maxWidth: .infinity, alignment: .topLeading)
.style(Fonts.Regular.callout, color: Colors.Text.primary1)
.fixedSize(horizontal: false, vertical: true)
Expand All @@ -61,3 +63,10 @@ extension DescriptionBottomSheetView: SelfSizingBottomSheetContent, Setupable {
map { $0.sheetHeight = binding }
}
}

#Preview {
DescriptionBottomSheetView(info: .init(
title: "About Ethereum",
description: "Ethereum network is a blockchain network.\n- Ethereum is an open-source platform for decentralized applications.\n- It aims to create a world computer for building applications in a decentralized manner.\n- Supports smart contracts allowing developers to program digital value.\n- Examples of dapps include tokens, NFTs, DeFi apps, lending protocols, and decentralized exchanges.\n- Transactions and smart contract executions require Gas fees, paid in Ether (ETH).\n- Gas measures the computational effort needed for operations, with fees fluctuating based on network demand.\n\n• Tether (USDT) is a stablecoin pegged to the U.S. dollar. \n • It offers stability in the volatile crypto market. \n• Issued by Tether Limited, governed by British Virgin Islands laws.\n• Used on exchanges like Bitfinex for trading cryptocurrencies.\n• Facilitates quick and cheap fiat movement in exchanges.\n• No transaction fees, but conversion fees apply on Tether.to.\n• Supports Ethereum network; ending support on EOS, Algorand, and others."
))
}
17 changes: 17 additions & 0 deletions TangemApp.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -532,6 +532,7 @@
B0AF2DF82B1DF42D001A8696 /* PendingExpressTransaction.swift in Sources */ = {isa = PBXBuildFile; fileRef = B0AF2DF72B1DF42D001A8696 /* PendingExpressTransaction.swift */; };
B0AF9BFB2C32D01200EC5830 /* TokenMarketsDetailsView+Skeletons.swift in Sources */ = {isa = PBXBuildFile; fileRef = B0AF9BF92C32D01200EC5830 /* TokenMarketsDetailsView+Skeletons.swift */; };
B0B09BCF295B54FB001D6BA4 /* WalletConnectSessionsStorage.swift in Sources */ = {isa = PBXBuildFile; fileRef = B0B09BCE295B54FB001D6BA4 /* WalletConnectSessionsStorage.swift */; };
B0B11A082C787FE70018A2A6 /* MarkdownUI in Frameworks */ = {isa = PBXBuildFile; productRef = B0B11A072C787FE70018A2A6 /* MarkdownUI */; };
B0B2DF6026E1FD5400BC0934 /* AnimatedView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B0B2DF5F26E1FD5400BC0934 /* AnimatedView.swift */; };
B0B335D229FA89EE00E2082E /* BalanceFormatter.swift in Sources */ = {isa = PBXBuildFile; fileRef = B0B335D129FA89EE00E2082E /* BalanceFormatter.swift */; };
B0B335DC29FA948F00E2082E /* FakeTokenItemInfoProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = B0B335DB29FA948F00E2082E /* FakeTokenItemInfoProvider.swift */; };
Expand Down Expand Up @@ -3747,6 +3748,7 @@
buildActionMask = 2147483647;
files = (
B6E298CF2C5D9CC3004336BC /* DGCharts in Frameworks */,
B0B11A082C787FE70018A2A6 /* MarkdownUI in Frameworks */,
B6C1BE6D2B6C2F4E008FE5A0 /* secp256k1 in Frameworks */,
EF2D9C9B2BBDA87D0055C485 /* TangemFoundation.framework in Frameworks */,
EF9E29A82B4F0C9900418559 /* TangemExpress.framework in Frameworks */,
Expand Down Expand Up @@ -9885,6 +9887,7 @@
B620FC9F2C5D326D00AD0FD1 /* DGCharts */,
B620FCAD2C5D337900AD0FD1 /* DGCharts */,
B6E298CE2C5D9CC3004336BC /* DGCharts */,
B0B11A072C787FE70018A2A6 /* MarkdownUI */,
);
productName = "Tangem Tap";
productReference = 5D3F77C224BF56D800E8695B /* Tangem.app */;
Expand Down Expand Up @@ -10160,6 +10163,7 @@
0A81B38C2BB3018E0008F21C /* XCRemoteSwiftPackageReference "ZIPFoundation" */,
0ABC61132C410AFD00065EBA /* XCRemoteSwiftPackageReference "tweetnacl-swiftwrap" */,
B6E298CD2C5D9CC2004336BC /* XCRemoteSwiftPackageReference "DGCharts" */,
B0B11A062C787FE70018A2A6 /* XCRemoteSwiftPackageReference "swift-markdown-ui" */,
);
productRefGroup = 5D3F77C324BF56D800E8695B /* Products */;
projectDirPath = "";
Expand Down Expand Up @@ -18086,6 +18090,14 @@
minimumVersion = 1.1.0;
};
};
B0B11A062C787FE70018A2A6 /* XCRemoteSwiftPackageReference "swift-markdown-ui" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/gonzalezreal/swift-markdown-ui";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 2.4.0;
};
};
B6C1BE6B2B6C2F4E008FE5A0 /* XCRemoteSwiftPackageReference "secp256k1.swift" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/GigaBitcoin/secp256k1.swift.git";
Expand Down Expand Up @@ -18123,6 +18135,11 @@
package = 0ABC61132C410AFD00065EBA /* XCRemoteSwiftPackageReference "tweetnacl-swiftwrap" */;
productName = TweetNacl;
};
B0B11A072C787FE70018A2A6 /* MarkdownUI */ = {
isa = XCSwiftPackageProductDependency;
package = B0B11A062C787FE70018A2A6 /* XCRemoteSwiftPackageReference "swift-markdown-ui" */;
productName = MarkdownUI;
};
B620FC9F2C5D326D00AD0FD1 /* DGCharts */ = {
isa = XCSwiftPackageProductDependency;
productName = DGCharts;
Expand Down
20 changes: 19 additions & 1 deletion TangemApp.xcworkspace/xcshareddata/swiftpm/Package.resolved
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"originHash" : "075de3e24c2b843c7ca823c45d9a9eb94d54bca81938a008551eefd90553cf5f",
"originHash" : "b28913ecd789c4712900743ff0a5e2709f20a88cfbdf046c9516a04cdd85d340",
"pins" : [
{
"identity" : "anyasyncsequence",
Expand Down Expand Up @@ -82,6 +82,15 @@
"version" : "0.1.2-tangem3"
}
},
{
"identity" : "networkimage",
"kind" : "remoteSourceControl",
"location" : "https://github.com/gonzalezreal/NetworkImage",
"state" : {
"revision" : "7aff8d1b31148d32c5933d75557d42f6323ee3d1",
"version" : "6.0.0"
}
},
{
"identity" : "potentcodables",
"kind" : "remoteSourceControl",
Expand Down Expand Up @@ -163,6 +172,15 @@
"version" : "1.5.4"
}
},
{
"identity" : "swift-markdown-ui",
"kind" : "remoteSourceControl",
"location" : "https://github.com/gonzalezreal/swift-markdown-ui",
"state" : {
"revision" : "55441810c0f678c78ed7e2ebd46dde89228e02fc",
"version" : "2.4.0"
}
},
{
"identity" : "swift-nio",
"kind" : "remoteSourceControl",
Expand Down

0 comments on commit 14222d7

Please sign in to comment.