damus

nostr ios client
git clone git://jb55.com/damus
Log | Files | Refs | README | LICENSE

commit 3d27e49e702c0b6832161ac257c9d7e3d82efd30
parent e9be227009873bb4c5b28c2e9cb96c91b29f2997
Author: William Casarin <jb55@jb55.com>
Date:   Thu,  6 Apr 2023 17:09:50 -0700

Add custom #nostr and #coffeechain hashtags

Changelog-Added: Custom hashtags for #nostr and #coffeechain

Diffstat:
Mdamus.xcodeproj/project.pbxproj | 4++++
Adamus/Assets.xcassets/Colors/DamusBrown.colorset/Contents.json | 20++++++++++++++++++++
Adamus/Assets.xcassets/Hashtags/Contents.json | 6++++++
Rdamus/Assets.xcassets/bitcoin-hashtag.imageset/Contents.json -> damus/Assets.xcassets/Hashtags/bitcoin-hashtag.imageset/Contents.json | 0
Adamus/Assets.xcassets/Hashtags/bitcoin-hashtag.imageset/bitcoin-hashtag.svg | 43+++++++++++++++++++++++++++++++++++++++++++
Adamus/Assets.xcassets/Hashtags/coffee-hashtag.imageset/Contents.json | 23+++++++++++++++++++++++
Adamus/Assets.xcassets/Hashtags/coffee-hashtag.imageset/coffee.svg | 55+++++++++++++++++++++++++++++++++++++++++++++++++++++++
Adamus/Assets.xcassets/Hashtags/nostr-hashtag.imageset/Contents.json | 23+++++++++++++++++++++++
Adamus/Assets.xcassets/Hashtags/nostr-hashtag.imageset/nostr-hashtag.svg | 51+++++++++++++++++++++++++++++++++++++++++++++++++++
Ddamus/Assets.xcassets/bitcoin-hashtag.imageset/bitcoin-hashtag.svg | 43-------------------------------------------
Mdamus/Components/DamusColors.swift | 1+
Adamus/Util/Hashtags.swift | 60++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mdamus/Views/NoteContentView.swift | 21---------------------
13 files changed, 286 insertions(+), 64 deletions(-)

diff --git a/damus.xcodeproj/project.pbxproj b/damus.xcodeproj/project.pbxproj @@ -138,6 +138,7 @@ 4C8682872814DE470026224F /* ProfileView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C8682862814DE470026224F /* ProfileView.swift */; }; 4C8D00C829DF791C0036AF10 /* CompatibleAttribute.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C8D00C729DF791C0036AF10 /* CompatibleAttribute.swift */; }; 4C8D00CA29DF80350036AF10 /* TruncatedText.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C8D00C929DF80350036AF10 /* TruncatedText.swift */; }; + 4C8D00CC29DF92DF0036AF10 /* Hashtags.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C8D00CB29DF92DF0036AF10 /* Hashtags.swift */; }; 4C8EC52529D1FA6C0085D9A8 /* DamusColors.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C8EC52429D1FA6C0085D9A8 /* DamusColors.swift */; }; 4C90BD162839DB54008EE7EF /* NostrMetadata.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C90BD152839DB54008EE7EF /* NostrMetadata.swift */; }; 4C90BD18283A9EE5008EE7EF /* LoginView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C90BD17283A9EE5008EE7EF /* LoginView.swift */; }; @@ -539,6 +540,7 @@ 4C8682862814DE470026224F /* ProfileView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProfileView.swift; sourceTree = "<group>"; }; 4C8D00C729DF791C0036AF10 /* CompatibleAttribute.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CompatibleAttribute.swift; sourceTree = "<group>"; }; 4C8D00C929DF80350036AF10 /* TruncatedText.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TruncatedText.swift; sourceTree = "<group>"; }; + 4C8D00CB29DF92DF0036AF10 /* Hashtags.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Hashtags.swift; sourceTree = "<group>"; }; 4C8EC52429D1FA6C0085D9A8 /* DamusColors.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DamusColors.swift; sourceTree = "<group>"; }; 4C90BD152839DB54008EE7EF /* NostrMetadata.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NostrMetadata.swift; sourceTree = "<group>"; }; 4C90BD17283A9EE5008EE7EF /* LoginView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginView.swift; sourceTree = "<group>"; }; @@ -988,6 +990,7 @@ 4CE4F0F129D4FCFA005914DB /* DebouncedOnChange.swift */, 4C1A9A1929DCA17E00516EAC /* ReplyCounter.swift */, 4C8D00C729DF791C0036AF10 /* CompatibleAttribute.swift */, + 4C8D00CB29DF92DF0036AF10 /* Hashtags.swift */, ); path = Util; sourceTree = "<group>"; @@ -1631,6 +1634,7 @@ 4CE6DF1627F8DEBF00C66700 /* RelayConnection.swift in Sources */, 4C3BEFD6281D995700B3DE84 /* ActionBarModel.swift in Sources */, 4C363AA428296DEE006E126D /* SearchModel.swift in Sources */, + 4C8D00CC29DF92DF0036AF10 /* Hashtags.swift in Sources */, 4CEE2AF3280B25C500AB5EEF /* ProfilePicView.swift in Sources */, 4CC7AAF6297F1A6A00430951 /* EventBody.swift in Sources */, 4CEE2AF9280B2EAC00AB5EEF /* PowView.swift in Sources */, diff --git a/damus/Assets.xcassets/Colors/DamusBrown.colorset/Contents.json b/damus/Assets.xcassets/Colors/DamusBrown.colorset/Contents.json @@ -0,0 +1,20 @@ +{ + "colors" : [ + { + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "red" : "0xBE", + "green" : "0x5F", + "blue" : "0x00" + } + }, + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/damus/Assets.xcassets/Hashtags/Contents.json b/damus/Assets.xcassets/Hashtags/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/damus/Assets.xcassets/bitcoin-hashtag.imageset/Contents.json b/damus/Assets.xcassets/Hashtags/bitcoin-hashtag.imageset/Contents.json diff --git a/damus/Assets.xcassets/Hashtags/bitcoin-hashtag.imageset/bitcoin-hashtag.svg b/damus/Assets.xcassets/Hashtags/bitcoin-hashtag.imageset/bitcoin-hashtag.svg @@ -0,0 +1,43 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg + width="13.599426" + height="18" + viewBox="0 0 13.599426 17.999999" + version="1.1" + id="svg2" + sodipodi:docname="bitcoin-hashtag.svg" + inkscape:version="1.3-dev (77bc73e, 2022-05-18)" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns="http://www.w3.org/2000/svg" + xmlns:svg="http://www.w3.org/2000/svg"> + <defs + id="defs2" /> + <sodipodi:namedview + id="namedview2" + pagecolor="#ffffff" + bordercolor="#000000" + borderopacity="0.25" + inkscape:showpageshadow="2" + inkscape:pageopacity="0.0" + inkscape:pagecheckerboard="0" + inkscape:deskcolor="#d1d1d1" + showgrid="false" + inkscape:zoom="31.12" + inkscape:cx="4.2255784" + inkscape:cy="7.5032134" + inkscape:window-width="1526" + inkscape:window-height="957" + inkscape:window-x="1637" + inkscape:window-y="38" + inkscape:window-maximized="0" + inkscape:current-layer="svg2" /> + <g + id="surface1" + transform="translate(-4.867188,-3.484375)"> + <path + style="fill:#f59119;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1.40637" + d="M 18.388175,10.742602 C 18.668352,8.874761 17.240002,7.8694225 15.295251,7.193703 L 15.927019,4.6611305 14.383304,4.2765743 13.768015,6.7432244 C 13.361486,6.644338 12.943967,6.545453 12.531944,6.4520613 L 13.152726,3.9689298 11.609011,3.584375 10.977241,6.1169476 C 10.642129,6.0400371 10.312509,5.9686201 9.988384,5.886215 L 9.993834,5.880715 7.8623408,5.3478364 7.4558114,6.9959316 c 0,0 1.1426793,0.2636953 1.1207046,0.2801765 0.6207823,0.1538223 0.7361485,0.5658464 0.714174,0.8954659 l -0.7196673,2.889659 c 0.043949,0.01099 0.098885,0.02747 0.1648089,0.04944 L 8.5710227,11.072223 7.5601911,15.11555 c -0.076912,0.192277 -0.26919,0.477948 -0.7031873,0.368073 0.010984,0.02198 -1.1261994,-0.280174 -1.1261994,-0.280174 l -0.7636164,1.76346 2.0106754,0.505417 c 0.3735682,0.0934 0.7361485,0.186784 1.0987301,0.280176 l -0.6427568,2.565534 1.5437155,0.384556 0.6317701,-2.538067 c 0.4230107,0.115364 0.8295407,0.219746 1.2305777,0.318632 l -0.63177,2.527079 1.543716,0.384557 0.637263,-2.560042 c 2.631459,0.499922 4.614667,0.296656 5.444208,-2.082094 0.670226,-1.917284 -0.03296,-3.021507 -1.417363,-3.741176 1.010832,-0.236227 1.768957,-0.895465 1.972221,-2.268877 z m -3.526922,4.944286 c -0.477949,1.917283 -3.702721,0.884477 -4.752008,0.620782 l 0.851514,-3.395075 c 1.043795,0.2582 4.394922,0.774604 3.900494,2.774293 z M 15.3392,10.715134 c -0.433999,1.74698 -3.120394,0.857008 -3.993884,0.642757 l 0.769111,-3.081939 c 0.87349,0.219746 3.675252,0.620784 3.224773,2.439182 z m 0,0" + id="path2" /> + </g> +</svg> diff --git a/damus/Assets.xcassets/Hashtags/coffee-hashtag.imageset/Contents.json b/damus/Assets.xcassets/Hashtags/coffee-hashtag.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "coffee.svg", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "coffee.svg", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "coffee.svg", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/damus/Assets.xcassets/Hashtags/coffee-hashtag.imageset/coffee.svg b/damus/Assets.xcassets/Hashtags/coffee-hashtag.imageset/coffee.svg @@ -0,0 +1,55 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Svg Vector Icons : http://www.onlinewebfonts.com/icon --> + +<svg + version="1.1" + x="0px" + y="0px" + viewBox="0 0 13.999999 18" + enable-background="new 0 0 1000 1000" + xml:space="preserve" + id="svg4" + sodipodi:docname="coffee.svg" + width="14" + height="18" + inkscape:version="1.3-dev (77bc73e, 2022-05-18)" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns="http://www.w3.org/2000/svg" + xmlns:svg="http://www.w3.org/2000/svg"><defs + id="defs4" /><sodipodi:namedview + id="namedview4" + pagecolor="#ffffff" + bordercolor="#000000" + borderopacity="0.25" + inkscape:showpageshadow="2" + inkscape:pageopacity="0.0" + inkscape:pagecheckerboard="0" + inkscape:deskcolor="#d1d1d1" + showgrid="false" + inkscape:zoom="10.680141" + inkscape:cx="-17.181421" + inkscape:cy="4.07298" + inkscape:window-width="1368" + inkscape:window-height="947" + inkscape:window-x="1764" + inkscape:window-y="58" + inkscape:window-maximized="0" + inkscape:current-layer="svg4" /> +<metadata + id="metadata1"> Svg Vector Icons : http://www.onlinewebfonts.com/icon </metadata> +<g + id="g4" + transform="matrix(0.01779387,0,0,0.01779387,-1.8340539,0.04465199)"><g + transform="matrix(0.1,0,0,-0.1,0,511)" + id="g3"><path + d="m 4302.6,4870.6 c 149.5,-177.8 240.5,-319.3 347.6,-545.6 119.2,-254.6 169.7,-448.6 183.9,-699.2 22.2,-462.7 -137.4,-778 -539.5,-1060.9 -474.9,-335.4 -685,-739.6 -687,-1315.5 0,-260.7 38.4,-501.1 115.2,-739.6 50.5,-149.5 56.6,-159.6 60.6,-97 18.2,234.4 56.6,476.9 101,626.4 121.2,422.3 305.1,622.4 885.1,959.8 424.3,248.5 575.9,487 575.9,905.3 -2,501.1 -359.7,1295.3 -798.2,1768.1 -82.8,88.9 -198,202.1 -256.6,250.6 l -105.1,86.9 z" + id="path1" + style="fill:#be5f00;fill-opacity:1" /><path + d="m 5981.8,3577.3 c 272.8,-369.8 309.2,-846.7 90.9,-1192.2 -147.5,-232.4 -373.8,-406.2 -822.4,-638.5 -592,-303.1 -854.7,-683 -854.7,-1232.6 0,-276.8 14.2,-343.5 72.7,-343.5 38.4,0 48.5,16.2 68.7,111.1 34.4,167.7 135.4,349.6 262.7,476.9 147.5,145.5 349.6,244.5 838.6,412.2 503.2,171.8 725.4,280.9 846.7,416.3 210.1,232.4 276.8,535.5 202.1,903.2 -76.8,373.8 -216.2,618.3 -537.5,943.7 -155.7,155.6 -214.3,206.1 -167.8,143.4 z" + id="path2" + style="fill:#be5f00;fill-opacity:1" /><path + d="M 2748.7,592.8 C 2158.7,507.9 1732.3,352.3 1542.4,156.3 1415.1,25 1409,-11.4 1427.2,-445.8 c 34.3,-832.5 181.9,-1729.7 462.7,-2829 153.6,-600.1 309.2,-1113.4 351.6,-1159.9 56.6,-62.6 272.8,-157.6 476.9,-210.1 668.8,-173.8 2172.2,-196 2960.3,-42.4 357.7,68.7 604.2,163.7 731.5,278.9 68.7,60.6 84.9,92.9 107.1,198 64.7,335.4 56.6,319.3 131.3,319.3 107.1,0 438.5,92.9 602.2,167.7 220.3,103.1 363.7,202.1 567.8,398.1 470.8,452.6 759.8,1149.8 761.8,1840.8 0,398.1 -72.7,614.3 -274.8,818.4 -220.3,222.3 -466.8,309.2 -937.6,325.4 l -309.2,12.1 14.2,218.2 14.2,218.2 -56.6,52.5 C 6866.9,314 6274.9,499.9 5696.9,582.7 L 5614,594.8 5533.2,457.4 5450.4,322 5565.6,305.8 c 588,-84.9 868.9,-159.6 978,-256.6 56.6,-50.5 60.6,-62.6 44.5,-113.2 -80.8,-226.3 -1000.2,-371.8 -2329.8,-371.8 -1220.5,0 -2097.5,123.3 -2295.5,321.3 -52.5,54.5 -56.6,66.7 -36.4,111.1 48.5,107.1 341.5,206.1 822.4,276.8 143.5,20.2 301.1,38.4 349.6,38.4 46.5,0 84.9,4 84.9,8.1 0,8.1 -175.8,295 -185.9,305.1 -4.2,2.1 -115.3,-12 -248.7,-32.2 z m 4797.1,-1614.5 c 153.6,-26.3 272.8,-82.8 317.2,-153.6 56.6,-84.9 60.6,-400.1 8.1,-652.7 -111.1,-545.6 -404.1,-996.2 -788.1,-1220.5 -139.4,-80.8 -333.4,-151.5 -355.6,-129.3 -8.1,8.1 18.2,216.2 58.6,462.7 78.8,482.9 159.6,1073 202.1,1450.8 l 24.2,232.4 70.7,12.1 c 115.3,20.3 325.4,20.3 462.8,-1.9 z" + id="path3" + style="fill:#be5f00;fill-opacity:1" /></g></g> +</svg> diff --git a/damus/Assets.xcassets/Hashtags/nostr-hashtag.imageset/Contents.json b/damus/Assets.xcassets/Hashtags/nostr-hashtag.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "nostr-hashtag.svg", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "nostr-hashtag.svg", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "nostr-hashtag.svg", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/damus/Assets.xcassets/Hashtags/nostr-hashtag.imageset/nostr-hashtag.svg b/damus/Assets.xcassets/Hashtags/nostr-hashtag.imageset/nostr-hashtag.svg @@ -0,0 +1,51 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg + version="1.0" + width="18pt" + height="18.199053pt" + viewBox="0 0 18 18.199053" + preserveAspectRatio="xMidYMid" + id="svg1" + sodipodi:docname="nostr-hashtag.svg" + inkscape:version="1.3-dev (77bc73e, 2022-05-18)" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns="http://www.w3.org/2000/svg" + xmlns:svg="http://www.w3.org/2000/svg"> + <defs + id="defs1" /> + <sodipodi:namedview + id="namedview1" + pagecolor="#ffffff" + bordercolor="#000000" + borderopacity="0.25" + inkscape:showpageshadow="2" + inkscape:pageopacity="0.0" + inkscape:pagecheckerboard="0" + inkscape:deskcolor="#d1d1d1" + inkscape:document-units="pt" + showgrid="false" + inkscape:zoom="5.4017383" + inkscape:cx="50.354161" + inkscape:cy="-13.514168" + inkscape:window-width="1497" + inkscape:window-height="866" + inkscape:window-x="1747" + inkscape:window-y="96" + inkscape:window-maximized="0" + inkscape:current-layer="svg1" /> + <metadata + id="metadata1"> +Created by potrace 1.15, written by Peter Selinger 2001-2017 +</metadata> + <g + transform="matrix(0.00138509,0,0,-0.00138509,0.3,17.927982)" + fill="#000000" + stroke="none" + id="g1"> + <path + d="m 11315,12756 c -49,-23 -135,-71 -190,-106 -128,-81 -170,-100 -222,-100 -37,0 -43,-3 -43,-22 0,-11 12,-36 26,-55 l 26,-34 -20,-37 c -128,-248 -171,-359 -212,-547 -56,-262 -43,-645 36,-1045 48,-244 104,-451 234,-865 158,-503 280,-942 320,-1145 27,-140 60,-448 60,-559 0,-164 -39,-366 -92,-478 -57,-123 -176,-222 -286,-239 -49,-8 -50,-23 -5,-38 18,-6 34,-14 38,-18 13,-13 -25,-66 -97,-134 -121,-115 -267,-174 -432,-174 -200,0 -327,87 -732,507 -233,240 -541,529 -604,567 -31,18 -32,18 -27,0 3,-11 9,-36 13,-56 8,-49 -5,-49 -65,1 -75,62 -168,118 -250,150 -134,51 -214,63 -481,70 l -245,6 -65,41 c -100,63 -125,68 -295,66 -186,-3 -262,7 -484,64 -279,71 -341,67 -780,-61 -334,-97 -442,-118 -761,-150 -200,-19 -365,-19 -496,1 -58,9 -107,14 -111,11 -3,-4 6,-22 21,-41 l 27,-35 -23,-5 c -13,-3 -61,-8 -106,-11 -113,-9 -157,-26 -219,-87 -50,-49 -54,-51 -140,-64 -60,-10 -108,-25 -153,-48 -304,-157 -331,-166 -471,-166 -48,0 -120,7 -160,15 -40,9 -74,13 -78,10 -3,-3 0,-20 7,-37 6,-18 10,-34 7,-36 -2,-3 -24,0 -47,7 -24,6 -103,16 -176,23 -163,15 -350,1 -521,-40 l -114,-26 51,-23 c 53,-23 76,-50 66,-77 -3,-8 -51,-38 -105,-66 -251,-129 -515,-384 -727,-703 -110,-166 -208,-325 -217,-355 -6,-21 -5,-22 34,-16 36,6 41,4 41,-12 0,-11 -15,-45 -34,-76 -46,-75 -76,-161 -127,-359 -78,-307 -137,-444 -243,-569 -38,-44 -51,-67 -43,-72 7,-4 40,-8 75,-8 37,0 62,-4 62,-11 0,-6 -12,-26 -27,-45 -32,-43 -24,-53 48,-60 108,-11 103,-6 95,-82 -4,-37 -11,-128 -15,-202 -5,-74 -16,-164 -26,-200 -22,-85 -75,-190 -136,-269 -27,-35 -49,-67 -49,-72 0,-4 17,-11 38,-14 20,-3 49,-8 64,-10 64,-10 285,31 408,76 101,37 249,117 348,188 54,38 110,75 126,80 15,6 70,11 123,11 267,0 582,98 766,239 34,26 72,53 83,59 25,13 31,8 58,-46 21,-40 38,-32 57,26 30,93 97,200 141,223 25,14 38,3 98,-86 27,-38 73,-95 104,-125 31,-30 56,-63 56,-75 0,-11 -20,-60 -45,-110 -42,-84 -81,-202 -70,-213 3,-3 27,16 54,41 50,47 81,59 81,34 0,-8 -10,-49 -21,-93 -26,-97 -32,-275 -10,-313 l 14,-25 36,41 c 42,48 118,88 251,131 102,33 185,47 345,57 55,4 159,13 230,21 292,34 285,35 368,-56 66,-72 122,-115 170,-130 20,-6 37,-15 37,-19 0,-12 -22,-35 -75,-77 -27,-21 -151,-133 -275,-248 -424,-394 -462,-415 -864,-486 -65,-12 -145,-29 -177,-39 -191,-60 -348,-213 -554,-541 -103,-165 -162,-241 -292,-383 -176,-190 -332,-333 -778,-711 -497,-422 -750,-737 -895,-1113 -64,-165 -104,-203 -216,-203 -38,0 -94,7 -124,15 -74,20 -244,20 -301,0 -27,-10 -61,-33 -87,-62 -41,-45 -43,-46 -89,-39 -25,3 -67,18 -92,33 C 457,781 369,812 175,813 49,814 0,786 0,713 0,669 31,628 122,557 204,491 254,434 469,153 527,77 549,57 597,33 652,7 662,5 780,6 c 69,0 150,6 180,14 30,7 132,32 225,56 281,72 308,76 511,84 181,6 195,8 247,34 76,37 137,107 231,267 230,392 287,481 394,626 219,293 469,581 756,869 284,284 368,342 641,439 164,59 295,123 410,199 101,68 257,219 295,286 14,24 56,76 93,116 100,106 177,142 437,203 165,40 229,62 390,133 191,85 220,94 460,143 118,24 239,49 267,56 29,7 56,10 59,6 4,-3 15,-50 26,-104 14,-73 21,-159 25,-331 6,-265 -3,-385 -47,-605 -50,-247 -105,-393 -222,-592 -59,-98 -74,-167 -58,-256 23,-126 61,-177 174,-232 95,-47 169,-52 357,-28 125,16 244,22 505,26 667,12 1011,-35 1799,-241 277,-73 308,-86 376,-161 72,-79 113,-170 175,-388 19,-66 42,-130 50,-143 42,-63 155,-112 261,-112 109,0 124,57 54,206 -48,102 -53,149 -17,165 31,15 73,-5 102,-48 12,-18 45,-87 75,-153 57,-132 106,-197 173,-233 35,-18 56,-21 136,-20 73,2 110,-3 159,-19 89,-29 333,-32 403,-5 114,44 140,145 60,231 -23,24 -112,72 -272,143 -71,32 -199,124 -250,179 -71,78 -111,140 -224,343 -132,236 -172,297 -262,391 -58,61 -94,89 -148,115 -113,56 -85,53 -866,85 -223,9 -616,36 -656,45 -11,2 -86,12 -165,20 -179,20 -595,95 -712,130 -145,42 -319,139 -371,208 -32,42 -53,102 -67,187 -22,144 48,316 261,640 125,190 193,317 230,428 31,95 60,282 60,392 0,76 4,102 16,114 20,20 25,18 192,-102 73,-52 168,-114 210,-137 83,-47 132,-82 132,-95 0,-4 -14,-17 -32,-28 l -32,-21 29,-11 c 108,-41 305,-52 707,-39 186,6 345,9 353,5 8,-3 15,-15 15,-27 0,-20 3,-21 54,-15 110,13 266,81 426,187 89,58 99,63 170,69 161,14 229,78 523,495 88,124 143,185 169,185 2,0 2,-27 0,-60 -2,-33 0,-60 5,-60 23,0 140,145 212,263 117,192 165,317 271,712 106,394 111,410 135,410 15,0 22,-10 29,-40 13,-53 12,-52 42,-24 40,36 103,133 154,234 25,50 50,90 55,90 6,0 11,-17 13,-37 2,-21 7,-38 12,-38 19,0 93,101 139,190 29,56 87,206 140,363 50,147 114,318 142,380 132,288 199,526 246,867 25,190 25,756 0,975 -23,195 -53,379 -78,485 -46,194 -152,515 -233,706 -130,306 -218,564 -260,764 -48,228 -48,572 1,770 31,128 82,204 166,246 64,33 118,83 187,174 120,158 184,199 503,321 250,96 347,153 347,204 0,41 -42,57 -174,68 -112,9 -385,70 -439,99 -10,5 -27,29 -37,54 -23,53 -99,137 -159,176 -56,35 -72,36 -40,1 24,-26 23,-26 -13,3 -21,16 -42,41 -47,56 -9,26 -14,28 -60,28 -50,0 -101,16 -101,32 0,4 -42,8 -92,7 -88,0 -98,-3 -183,-43 z m 550,-126 c 10,-11 16,-20 13,-20 -3,0 -13,9 -23,20 -10,11 -16,20 -13,20 3,0 13,-9 23,-20 z" + id="path1" + style="fill:#cc43c5;fill-opacity:1" /> + </g> +</svg> diff --git a/damus/Assets.xcassets/bitcoin-hashtag.imageset/bitcoin-hashtag.svg b/damus/Assets.xcassets/bitcoin-hashtag.imageset/bitcoin-hashtag.svg @@ -1,43 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<svg - width="9.5679588" - height="12.664063" - viewBox="0 0 9.5679588 12.664063" - version="1.1" - id="svg2" - sodipodi:docname="bitcoin-hashtag.svg" - inkscape:version="1.3-dev (77bc73e, 2022-05-18)" - xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" - xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" - xmlns="http://www.w3.org/2000/svg" - xmlns:svg="http://www.w3.org/2000/svg"> - <defs - id="defs2" /> - <sodipodi:namedview - id="namedview2" - pagecolor="#ffffff" - bordercolor="#000000" - borderopacity="0.25" - inkscape:showpageshadow="2" - inkscape:pageopacity="0.0" - inkscape:pagecheckerboard="0" - inkscape:deskcolor="#d1d1d1" - showgrid="false" - inkscape:zoom="31.12" - inkscape:cx="4.2095116" - inkscape:cy="7.4710797" - inkscape:window-width="1571" - inkscape:window-height="957" - inkscape:window-x="1707" - inkscape:window-y="66" - inkscape:window-maximized="0" - inkscape:current-layer="svg2" /> - <g - id="surface1" - transform="translate(-4.867188,-3.484375)"> - <path - style="fill:#f59119;fill-opacity:1;fill-rule:nonzero;stroke:none" - d="M 14.410156,8.574219 C 14.609375,7.246094 13.59375,6.53125 12.210938,6.050781 L 12.660156,4.25 11.5625,3.976562 11.125,5.730469 C 10.835938,5.660156 10.539062,5.589844 10.246094,5.523438 L 10.6875,3.757812 9.589844,3.484375 9.140625,5.285156 C 8.902344,5.230469 8.667969,5.179688 8.4375,5.121094 L 8.441406,5.117188 6.925781,4.738281 6.636719,5.910156 c 0,0 0.8125,0.1875 0.796875,0.199219 C 7.875,6.21875 7.957031,6.511719 7.941406,6.746094 L 7.429688,8.800781 C 7.460938,8.808594 7.5,8.820312 7.546875,8.835938 l -0.117187,-0.027344 -0.71875,2.875 c -0.054688,0.136718 -0.191407,0.339844 -0.5,0.261718 0.00781,0.01563 -0.800782,-0.199218 -0.800782,-0.199218 L 4.867188,13 6.296875,13.359375 c 0.265625,0.06641 0.523437,0.132813 0.78125,0.199219 L 6.621094,15.382812 7.71875,15.65625 8.167969,13.851562 c 0.300781,0.08203 0.589843,0.15625 0.875,0.226563 L 8.59375,15.875 l 1.097656,0.273438 0.453125,-1.820313 c 1.871094,0.355469 3.28125,0.210937 3.871094,-1.480469 0.476563,-1.363281 -0.02344,-2.148437 -1.007813,-2.660156 0.71875,-0.167969 1.257813,-0.636719 1.402344,-1.613281 z m -2.507812,3.515625 C 11.5625,13.453125 9.269531,12.71875 8.523438,12.53125 l 0.605468,-2.414062 c 0.742188,0.183593 3.125,0.550781 2.773438,1.972656 z M 12.242188,8.554688 C 11.933594,9.796875 10.023438,9.164062 9.402344,9.011719 L 9.949219,6.820312 c 0.621093,0.15625 2.613281,0.441407 2.292969,1.734376 z m 0,0" - id="path2" /> - </g> -</svg> diff --git a/damus/Components/DamusColors.swift b/damus/Components/DamusColors.swift @@ -12,6 +12,7 @@ class DamusColors { static let adaptableGrey = Color("DamusAdaptableGrey") static let white = Color("DamusWhite") static let black = Color("DamusBlack") + static let brown = Color("DamusBrown") static let lightGrey = Color("DamusLightGrey") static let mediumGrey = Color("DamusMediumGrey") static let darkGrey = Color("DamusDarkGrey") diff --git a/damus/Util/Hashtags.swift b/damus/Util/Hashtags.swift @@ -0,0 +1,60 @@ +// +// Hashtags.swift +// damus +// +// Created by William Casarin on 2023-04-06. +// + +import Foundation +import SwiftUI + +struct CustomHashtag { + let name: String + let color: Color? + + init(name: String, color: Color? = nil) { + self.name = name + self.color = color + } + + static let coffee = CustomHashtag(name: "coffee", color: DamusColors.brown) + static let bitcoin = CustomHashtag(name: "bitcoin", color: Color.orange) + static let nostr = CustomHashtag(name: "nostr", color: DamusColors.purple) +} + + +let custom_hashtags: [String: CustomHashtag] = [ + "bitcoin": CustomHashtag.bitcoin, + "nostr": CustomHashtag.nostr, + "coffee": CustomHashtag.coffee, + "coffeechain": CustomHashtag.coffee, +] + +func hashtag_str(_ htag: String) -> CompatibleText { + var attributedString = AttributedString(stringLiteral: "#\(htag)") + attributedString.link = URL(string: "damus:t:\(htag)") + + let lowertag = htag.lowercased() + + var text = Text(attributedString) + if let custom_hashtag = custom_hashtags[lowertag] { + if let col = custom_hashtag.color { + attributedString.foregroundColor = col + } + + let name = custom_hashtag.name + + text = Text(attributedString) + if let img = UIImage(named: "\(name)-hashtag") { + attributedString = attributedString + " " + attributed_string_attach_icon(&attributedString, img: img) + } + let img = Image("\(name)-hashtag") + text = text + Text(" \(img)") + } else { + attributedString.foregroundColor = DamusColors.purple + } + + return CompatibleText(text: text, attributed: attributedString) + } + diff --git a/damus/Views/NoteContentView.swift b/damus/Views/NoteContentView.swift @@ -218,27 +218,6 @@ func attributed_string_attach_icon(_ astr: inout AttributedString, img: UIImage) astr.append(wrapped) } -func hashtag_str(_ htag: String) -> CompatibleText { - var attributedString = AttributedString(stringLiteral: "#\(htag)") - attributedString.link = URL(string: "damus:t:\(htag)") - - var text = Text(attributedString) - - if htag.lowercased() == "bitcoin" { - attributedString.foregroundColor = Color.orange - if let img = UIImage(named: "bitcoin-hashtag") { - attributedString = attributedString + " " - attributed_string_attach_icon(&attributedString, img: img) - } - let img = Image("bitcoin-hashtag") - text = text.foregroundColor(.orange) + Text(" \(img)") - } else { - attributedString.foregroundColor = DamusColors.purple - } - - return CompatibleText(text: text, attributed: attributedString) - } - func url_str(_ url: URL) -> CompatibleText { var attributedString = AttributedString(stringLiteral: url.absoluteString) attributedString.link = url