Compare commits
18 Commits
mute-user-
...
reactions-
| Author | SHA1 | Date | |
|---|---|---|---|
|
847f31f5a6
|
|||
|
|
fd130b78e7 | ||
|
|
0be0273121 | ||
|
|
b349de22b7 | ||
|
|
cc2d196705 | ||
|
|
53be29efc2 | ||
|
|
529ee63f29 | ||
|
|
490e8ec1fb | ||
|
|
df267ffd04 | ||
|
|
b771e8f49a | ||
|
|
a88e80a346 | ||
|
|
4a851501a1 | ||
|
|
4ccfe81558 | ||
|
|
e7ed9dfe86 | ||
|
|
0dce7aea45 | ||
|
|
6376c61bad | ||
|
bdd1403a7d
|
|||
|
9172102f4d
|
@@ -12,6 +12,7 @@
|
|||||||
3169CAE6294E69C000EE4006 /* EmptyTimelineView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3169CAE5294E69C000EE4006 /* EmptyTimelineView.swift */; };
|
3169CAE6294E69C000EE4006 /* EmptyTimelineView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3169CAE5294E69C000EE4006 /* EmptyTimelineView.swift */; };
|
||||||
3169CAED294FCCFC00EE4006 /* Constants.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3169CAEC294FCCFC00EE4006 /* Constants.swift */; };
|
3169CAED294FCCFC00EE4006 /* Constants.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3169CAEC294FCCFC00EE4006 /* Constants.swift */; };
|
||||||
31D2E847295218AF006D67F8 /* Shimmer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 31D2E846295218AF006D67F8 /* Shimmer.swift */; };
|
31D2E847295218AF006D67F8 /* Shimmer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 31D2E846295218AF006D67F8 /* Shimmer.swift */; };
|
||||||
|
3A0A30BB2C21397A00F8C9BC /* EmojiPicker in Frameworks */ = {isa = PBXBuildFile; productRef = 3A0A30BA2C21397A00F8C9BC /* EmojiPicker */; };
|
||||||
3A23838E2A297DD200E5AA2E /* ZapButtonModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3A23838D2A297DD200E5AA2E /* ZapButtonModel.swift */; };
|
3A23838E2A297DD200E5AA2E /* ZapButtonModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3A23838D2A297DD200E5AA2E /* ZapButtonModel.swift */; };
|
||||||
3A3040ED29A5CB86008A0F29 /* ReplyDescriptionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3A3040EC29A5CB86008A0F29 /* ReplyDescriptionTests.swift */; };
|
3A3040ED29A5CB86008A0F29 /* ReplyDescriptionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3A3040EC29A5CB86008A0F29 /* ReplyDescriptionTests.swift */; };
|
||||||
3A3040F129A8FF97008A0F29 /* LocalizationUtil.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3A3040F029A8FF97008A0F29 /* LocalizationUtil.swift */; };
|
3A3040F129A8FF97008A0F29 /* LocalizationUtil.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3A3040F029A8FF97008A0F29 /* LocalizationUtil.swift */; };
|
||||||
@@ -32,7 +33,6 @@
|
|||||||
3ACB685F297633BC00C46468 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 3ACB685D297633BC00C46468 /* Localizable.strings */; };
|
3ACB685F297633BC00C46468 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 3ACB685D297633BC00C46468 /* Localizable.strings */; };
|
||||||
3ACBCB78295FE5C70037388A /* TimeAgoTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3ACBCB77295FE5C70037388A /* TimeAgoTests.swift */; };
|
3ACBCB78295FE5C70037388A /* TimeAgoTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3ACBCB77295FE5C70037388A /* TimeAgoTests.swift */; };
|
||||||
3AE45AF6297BB2E700C1D842 /* LibreTranslateServer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3AE45AF5297BB2E700C1D842 /* LibreTranslateServer.swift */; };
|
3AE45AF6297BB2E700C1D842 /* LibreTranslateServer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3AE45AF5297BB2E700C1D842 /* LibreTranslateServer.swift */; };
|
||||||
3AFE89C32BD4156F00AD31EF /* MCEmojiPicker in Frameworks */ = {isa = PBXBuildFile; productRef = 3AFE89C22BD4156F00AD31EF /* MCEmojiPicker */; };
|
|
||||||
3CCD1E6A2A874C4E0099A953 /* Nip98HTTPAuth.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3CCD1E692A874C4E0099A953 /* Nip98HTTPAuth.swift */; };
|
3CCD1E6A2A874C4E0099A953 /* Nip98HTTPAuth.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3CCD1E692A874C4E0099A953 /* Nip98HTTPAuth.swift */; };
|
||||||
4C011B5E2BD0A56A002F2F9B /* ChatEventView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C011B5C2BD0A56A002F2F9B /* ChatEventView.swift */; };
|
4C011B5E2BD0A56A002F2F9B /* ChatEventView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C011B5C2BD0A56A002F2F9B /* ChatEventView.swift */; };
|
||||||
4C011B5F2BD0A56A002F2F9B /* ChatroomThreadView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C011B5D2BD0A56A002F2F9B /* ChatroomThreadView.swift */; };
|
4C011B5F2BD0A56A002F2F9B /* ChatroomThreadView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C011B5D2BD0A56A002F2F9B /* ChatroomThreadView.swift */; };
|
||||||
@@ -399,6 +399,7 @@
|
|||||||
5C14C29D2BBBA40B00079FD2 /* RelayAdminDetail.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5C14C29C2BBBA40B00079FD2 /* RelayAdminDetail.swift */; };
|
5C14C29D2BBBA40B00079FD2 /* RelayAdminDetail.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5C14C29C2BBBA40B00079FD2 /* RelayAdminDetail.swift */; };
|
||||||
5C14C29F2BBBA5C600079FD2 /* RelayNipList.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5C14C29E2BBBA5C600079FD2 /* RelayNipList.swift */; };
|
5C14C29F2BBBA5C600079FD2 /* RelayNipList.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5C14C29E2BBBA5C600079FD2 /* RelayNipList.swift */; };
|
||||||
5C42E78C29DB76D90086AAC1 /* EmptyUserSearchView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5C42E78B29DB76D90086AAC1 /* EmptyUserSearchView.swift */; };
|
5C42E78C29DB76D90086AAC1 /* EmptyUserSearchView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5C42E78B29DB76D90086AAC1 /* EmptyUserSearchView.swift */; };
|
||||||
|
5C4D9EA72C042FA5005EA0F7 /* HighlightPostView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5C4D9EA62C042FA5005EA0F7 /* HighlightPostView.swift */; };
|
||||||
5C513FBA297F72980072348F /* CustomPicker.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5C513FB9297F72980072348F /* CustomPicker.swift */; };
|
5C513FBA297F72980072348F /* CustomPicker.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5C513FB9297F72980072348F /* CustomPicker.swift */; };
|
||||||
5C513FCC2984ACA60072348F /* QRCodeView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5C513FCB2984ACA60072348F /* QRCodeView.swift */; };
|
5C513FCC2984ACA60072348F /* QRCodeView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5C513FCB2984ACA60072348F /* QRCodeView.swift */; };
|
||||||
5C6E1DAD2A193EC2008FC15A /* GradientButtonStyle.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5C6E1DAC2A193EC2008FC15A /* GradientButtonStyle.swift */; };
|
5C6E1DAD2A193EC2008FC15A /* GradientButtonStyle.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5C6E1DAC2A193EC2008FC15A /* GradientButtonStyle.swift */; };
|
||||||
@@ -406,6 +407,11 @@
|
|||||||
5C7389B12B6EFA7100781E0A /* ProxyView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5C7389B02B6EFA7100781E0A /* ProxyView.swift */; };
|
5C7389B12B6EFA7100781E0A /* ProxyView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5C7389B02B6EFA7100781E0A /* ProxyView.swift */; };
|
||||||
5C7389B72B9E692E00781E0A /* MutinyButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5C7389B62B9E692E00781E0A /* MutinyButton.swift */; };
|
5C7389B72B9E692E00781E0A /* MutinyButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5C7389B62B9E692E00781E0A /* MutinyButton.swift */; };
|
||||||
5C7389B92B9E69ED00781E0A /* MutinyGradient.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5C7389B82B9E69ED00781E0A /* MutinyGradient.swift */; };
|
5C7389B92B9E69ED00781E0A /* MutinyGradient.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5C7389B82B9E69ED00781E0A /* MutinyGradient.swift */; };
|
||||||
|
5CC8529D2BD741CD0039FFC5 /* HighlightEvent.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5CC8529C2BD741CD0039FFC5 /* HighlightEvent.swift */; };
|
||||||
|
5CC8529F2BD744F60039FFC5 /* HighlightView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5CC8529E2BD744F60039FFC5 /* HighlightView.swift */; };
|
||||||
|
5CC852A22BDED9B90039FFC5 /* HighlightDescription.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5CC852A12BDED9B90039FFC5 /* HighlightDescription.swift */; };
|
||||||
|
5CC852A42BDF3CA10039FFC5 /* HighlightLink.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5CC852A32BDF3CA10039FFC5 /* HighlightLink.swift */; };
|
||||||
|
5CC852A62BE00F180039FFC5 /* HighlightEventRef.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5CC852A52BE00F180039FFC5 /* HighlightEventRef.swift */; };
|
||||||
5CC868DD2AA29B3200FB22BA /* NeutralButtonStyle.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5CC868DC2AA29B3200FB22BA /* NeutralButtonStyle.swift */; };
|
5CC868DD2AA29B3200FB22BA /* NeutralButtonStyle.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5CC868DC2AA29B3200FB22BA /* NeutralButtonStyle.swift */; };
|
||||||
5CF2DCCC2AA3AF0B00984B8D /* RelayPicView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5CF2DCCB2AA3AF0B00984B8D /* RelayPicView.swift */; };
|
5CF2DCCC2AA3AF0B00984B8D /* RelayPicView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5CF2DCCB2AA3AF0B00984B8D /* RelayPicView.swift */; };
|
||||||
5CF2DCCE2AABE1A500984B8D /* DamusLightGradient.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5CF2DCCD2AABE1A500984B8D /* DamusLightGradient.swift */; };
|
5CF2DCCE2AABE1A500984B8D /* DamusLightGradient.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5CF2DCCD2AABE1A500984B8D /* DamusLightGradient.swift */; };
|
||||||
@@ -1334,6 +1340,7 @@
|
|||||||
5C14C29C2BBBA40B00079FD2 /* RelayAdminDetail.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RelayAdminDetail.swift; sourceTree = "<group>"; };
|
5C14C29C2BBBA40B00079FD2 /* RelayAdminDetail.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RelayAdminDetail.swift; sourceTree = "<group>"; };
|
||||||
5C14C29E2BBBA5C600079FD2 /* RelayNipList.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RelayNipList.swift; sourceTree = "<group>"; };
|
5C14C29E2BBBA5C600079FD2 /* RelayNipList.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RelayNipList.swift; sourceTree = "<group>"; };
|
||||||
5C42E78B29DB76D90086AAC1 /* EmptyUserSearchView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmptyUserSearchView.swift; sourceTree = "<group>"; };
|
5C42E78B29DB76D90086AAC1 /* EmptyUserSearchView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmptyUserSearchView.swift; sourceTree = "<group>"; };
|
||||||
|
5C4D9EA62C042FA5005EA0F7 /* HighlightPostView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HighlightPostView.swift; sourceTree = "<group>"; };
|
||||||
5C513FB9297F72980072348F /* CustomPicker.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomPicker.swift; sourceTree = "<group>"; };
|
5C513FB9297F72980072348F /* CustomPicker.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomPicker.swift; sourceTree = "<group>"; };
|
||||||
5C513FCB2984ACA60072348F /* QRCodeView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = QRCodeView.swift; sourceTree = "<group>"; };
|
5C513FCB2984ACA60072348F /* QRCodeView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = QRCodeView.swift; sourceTree = "<group>"; };
|
||||||
5C6E1DAC2A193EC2008FC15A /* GradientButtonStyle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GradientButtonStyle.swift; sourceTree = "<group>"; };
|
5C6E1DAC2A193EC2008FC15A /* GradientButtonStyle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GradientButtonStyle.swift; sourceTree = "<group>"; };
|
||||||
@@ -1341,6 +1348,11 @@
|
|||||||
5C7389B02B6EFA7100781E0A /* ProxyView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProxyView.swift; sourceTree = "<group>"; };
|
5C7389B02B6EFA7100781E0A /* ProxyView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProxyView.swift; sourceTree = "<group>"; };
|
||||||
5C7389B62B9E692E00781E0A /* MutinyButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MutinyButton.swift; sourceTree = "<group>"; };
|
5C7389B62B9E692E00781E0A /* MutinyButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MutinyButton.swift; sourceTree = "<group>"; };
|
||||||
5C7389B82B9E69ED00781E0A /* MutinyGradient.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MutinyGradient.swift; sourceTree = "<group>"; };
|
5C7389B82B9E69ED00781E0A /* MutinyGradient.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MutinyGradient.swift; sourceTree = "<group>"; };
|
||||||
|
5CC8529C2BD741CD0039FFC5 /* HighlightEvent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HighlightEvent.swift; sourceTree = "<group>"; };
|
||||||
|
5CC8529E2BD744F60039FFC5 /* HighlightView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HighlightView.swift; sourceTree = "<group>"; };
|
||||||
|
5CC852A12BDED9B90039FFC5 /* HighlightDescription.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HighlightDescription.swift; sourceTree = "<group>"; };
|
||||||
|
5CC852A32BDF3CA10039FFC5 /* HighlightLink.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HighlightLink.swift; sourceTree = "<group>"; };
|
||||||
|
5CC852A52BE00F180039FFC5 /* HighlightEventRef.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HighlightEventRef.swift; sourceTree = "<group>"; };
|
||||||
5CC868DC2AA29B3200FB22BA /* NeutralButtonStyle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NeutralButtonStyle.swift; sourceTree = "<group>"; };
|
5CC868DC2AA29B3200FB22BA /* NeutralButtonStyle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NeutralButtonStyle.swift; sourceTree = "<group>"; };
|
||||||
5CF2DCCB2AA3AF0B00984B8D /* RelayPicView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RelayPicView.swift; sourceTree = "<group>"; };
|
5CF2DCCB2AA3AF0B00984B8D /* RelayPicView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RelayPicView.swift; sourceTree = "<group>"; };
|
||||||
5CF2DCCD2AABE1A500984B8D /* DamusLightGradient.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DamusLightGradient.swift; sourceTree = "<group>"; };
|
5CF2DCCD2AABE1A500984B8D /* DamusLightGradient.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DamusLightGradient.swift; sourceTree = "<group>"; };
|
||||||
@@ -1485,10 +1497,10 @@
|
|||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
4C06670428FC7EC500038D2A /* Kingfisher in Frameworks */,
|
4C06670428FC7EC500038D2A /* Kingfisher in Frameworks */,
|
||||||
|
3A0A30BB2C21397A00F8C9BC /* EmojiPicker in Frameworks */,
|
||||||
D78DB8592C1CE9CA00F0AB12 /* SwipeActions in Frameworks */,
|
D78DB8592C1CE9CA00F0AB12 /* SwipeActions in Frameworks */,
|
||||||
4C649881286E0EE300EAE2B3 /* secp256k1 in Frameworks */,
|
4C649881286E0EE300EAE2B3 /* secp256k1 in Frameworks */,
|
||||||
4C27C9322A64766F007DBC75 /* MarkdownUI in Frameworks */,
|
4C27C9322A64766F007DBC75 /* MarkdownUI in Frameworks */,
|
||||||
3AFE89C32BD4156F00AD31EF /* MCEmojiPicker in Frameworks */,
|
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
@@ -1668,6 +1680,7 @@
|
|||||||
B5C60C1F2B530D5100C5ECA7 /* MuteItem.swift */,
|
B5C60C1F2B530D5100C5ECA7 /* MuteItem.swift */,
|
||||||
B533694D2B66D791008A805E /* MutelistManager.swift */,
|
B533694D2B66D791008A805E /* MutelistManager.swift */,
|
||||||
D7D2A3802BF815D000E4B42B /* PushNotificationClient.swift */,
|
D7D2A3802BF815D000E4B42B /* PushNotificationClient.swift */,
|
||||||
|
5CC8529C2BD741CD0039FFC5 /* HighlightEvent.swift */,
|
||||||
);
|
);
|
||||||
path = Models;
|
path = Models;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@@ -2402,6 +2415,7 @@
|
|||||||
4CC7AAEE297F11B300430951 /* Events */ = {
|
4CC7AAEE297F11B300430951 /* Events */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
|
5CC852A02BDED9970039FFC5 /* Highlight */,
|
||||||
4CA927682A290F8F0098A105 /* Components */,
|
4CA927682A290F8F0098A105 /* Components */,
|
||||||
4CC7AAEF297F11C700430951 /* SelectedEventView.swift */,
|
4CC7AAEF297F11C700430951 /* SelectedEventView.swift */,
|
||||||
4CC7AAF5297F1A6A00430951 /* EventBody.swift */,
|
4CC7AAF5297F1A6A00430951 /* EventBody.swift */,
|
||||||
@@ -2699,6 +2713,18 @@
|
|||||||
path = Images;
|
path = Images;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
};
|
};
|
||||||
|
5CC852A02BDED9970039FFC5 /* Highlight */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
5CC8529E2BD744F60039FFC5 /* HighlightView.swift */,
|
||||||
|
5CC852A12BDED9B90039FFC5 /* HighlightDescription.swift */,
|
||||||
|
5CC852A32BDF3CA10039FFC5 /* HighlightLink.swift */,
|
||||||
|
5CC852A52BE00F180039FFC5 /* HighlightEventRef.swift */,
|
||||||
|
5C4D9EA62C042FA5005EA0F7 /* HighlightPostView.swift */,
|
||||||
|
);
|
||||||
|
path = Highlight;
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
7C0F392D29B57C8F0039859C /* Extensions */ = {
|
7C0F392D29B57C8F0039859C /* Extensions */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
@@ -2866,7 +2892,7 @@
|
|||||||
4C649880286E0EE300EAE2B3 /* secp256k1 */,
|
4C649880286E0EE300EAE2B3 /* secp256k1 */,
|
||||||
4C06670328FC7EC500038D2A /* Kingfisher */,
|
4C06670328FC7EC500038D2A /* Kingfisher */,
|
||||||
4C27C9312A64766F007DBC75 /* MarkdownUI */,
|
4C27C9312A64766F007DBC75 /* MarkdownUI */,
|
||||||
3AFE89C22BD4156F00AD31EF /* MCEmojiPicker */,
|
3A0A30BA2C21397A00F8C9BC /* EmojiPicker */,
|
||||||
D78DB8582C1CE9CA00F0AB12 /* SwipeActions */,
|
D78DB8582C1CE9CA00F0AB12 /* SwipeActions */,
|
||||||
);
|
);
|
||||||
productName = damus;
|
productName = damus;
|
||||||
@@ -3007,7 +3033,7 @@
|
|||||||
4CCF9AB02A1FE80B00E03CFB /* XCRemoteSwiftPackageReference "GSPlayer" */,
|
4CCF9AB02A1FE80B00E03CFB /* XCRemoteSwiftPackageReference "GSPlayer" */,
|
||||||
4C27C9302A64766F007DBC75 /* XCRemoteSwiftPackageReference "swift-markdown-ui" */,
|
4C27C9302A64766F007DBC75 /* XCRemoteSwiftPackageReference "swift-markdown-ui" */,
|
||||||
D7A343EC2AD0D77C00CED48B /* XCRemoteSwiftPackageReference "swift-snapshot-testing" */,
|
D7A343EC2AD0D77C00CED48B /* XCRemoteSwiftPackageReference "swift-snapshot-testing" */,
|
||||||
3AFE89C12BD4156F00AD31EF /* XCRemoteSwiftPackageReference "MCEmojiPicker" */,
|
3A0A30B92C21397A00F8C9BC /* XCRemoteSwiftPackageReference "EmojiPicker" */,
|
||||||
D78DB8572C1CE9CA00F0AB12 /* XCRemoteSwiftPackageReference "SwipeActions" */,
|
D78DB8572C1CE9CA00F0AB12 /* XCRemoteSwiftPackageReference "SwipeActions" */,
|
||||||
);
|
);
|
||||||
productRefGroup = 4CE6DEE427F7A08100C66700 /* Products */;
|
productRefGroup = 4CE6DEE427F7A08100C66700 /* Products */;
|
||||||
@@ -3153,6 +3179,7 @@
|
|||||||
4C75EFAD28049CFB0006080F /* PostButton.swift in Sources */,
|
4C75EFAD28049CFB0006080F /* PostButton.swift in Sources */,
|
||||||
D7EDED1E2B11797D0018B19C /* LongformEvent.swift in Sources */,
|
D7EDED1E2B11797D0018B19C /* LongformEvent.swift in Sources */,
|
||||||
504323A92A3495B6006AE6DC /* RelayModelCache.swift in Sources */,
|
504323A92A3495B6006AE6DC /* RelayModelCache.swift in Sources */,
|
||||||
|
5C4D9EA72C042FA5005EA0F7 /* HighlightPostView.swift in Sources */,
|
||||||
3A8CC6CC2A2CFEF900940F5F /* StringUtil.swift in Sources */,
|
3A8CC6CC2A2CFEF900940F5F /* StringUtil.swift in Sources */,
|
||||||
D7FD12262BD345A700CF195B /* FirstAidSettingsView.swift in Sources */,
|
D7FD12262BD345A700CF195B /* FirstAidSettingsView.swift in Sources */,
|
||||||
D7870BC12AC4750B0080BA88 /* MentionView.swift in Sources */,
|
D7870BC12AC4750B0080BA88 /* MentionView.swift in Sources */,
|
||||||
@@ -3183,6 +3210,7 @@
|
|||||||
4C32B94D2A9AD44700DC3548 /* Offset.swift in Sources */,
|
4C32B94D2A9AD44700DC3548 /* Offset.swift in Sources */,
|
||||||
4C633350283D40E500B1C9C3 /* HomeModel.swift in Sources */,
|
4C633350283D40E500B1C9C3 /* HomeModel.swift in Sources */,
|
||||||
4C987B57283FD07F0042CE38 /* FollowersModel.swift in Sources */,
|
4C987B57283FD07F0042CE38 /* FollowersModel.swift in Sources */,
|
||||||
|
5CC852A42BDF3CA10039FFC5 /* HighlightLink.swift in Sources */,
|
||||||
4C32B9552A9AD44700DC3548 /* ByteBuffer.swift in Sources */,
|
4C32B9552A9AD44700DC3548 /* ByteBuffer.swift in Sources */,
|
||||||
4C32B95B2A9AD44700DC3548 /* NativeObject.swift in Sources */,
|
4C32B95B2A9AD44700DC3548 /* NativeObject.swift in Sources */,
|
||||||
3AB72AB9298ECF30004BB58C /* Translator.swift in Sources */,
|
3AB72AB9298ECF30004BB58C /* Translator.swift in Sources */,
|
||||||
@@ -3322,6 +3350,7 @@
|
|||||||
4C3AC7A12835A81400E1F516 /* SetupView.swift in Sources */,
|
4C3AC7A12835A81400E1F516 /* SetupView.swift in Sources */,
|
||||||
4C06670128FC7C5900038D2A /* RelayView.swift in Sources */,
|
4C06670128FC7C5900038D2A /* RelayView.swift in Sources */,
|
||||||
4C285C8C28398BC7008A31F1 /* Keys.swift in Sources */,
|
4C285C8C28398BC7008A31F1 /* Keys.swift in Sources */,
|
||||||
|
5CC852A22BDED9B90039FFC5 /* HighlightDescription.swift in Sources */,
|
||||||
4C94D6432BA5AEFE00C26EFF /* QuoteRepostsView.swift in Sources */,
|
4C94D6432BA5AEFE00C26EFF /* QuoteRepostsView.swift in Sources */,
|
||||||
D7EDED332B12ACAE0018B19C /* DamusUserDefaults.swift in Sources */,
|
D7EDED332B12ACAE0018B19C /* DamusUserDefaults.swift in Sources */,
|
||||||
4CA352AE2A76C1AC003BB08B /* FollowedNotify.swift in Sources */,
|
4CA352AE2A76C1AC003BB08B /* FollowedNotify.swift in Sources */,
|
||||||
@@ -3365,7 +3394,9 @@
|
|||||||
4C2859602A12A2BE004746F7 /* SupporterBadge.swift in Sources */,
|
4C2859602A12A2BE004746F7 /* SupporterBadge.swift in Sources */,
|
||||||
4C1A9A2A29DDF54400516EAC /* DamusVideoPlayer.swift in Sources */,
|
4C1A9A2A29DDF54400516EAC /* DamusVideoPlayer.swift in Sources */,
|
||||||
4CA352A22A76AEC5003BB08B /* LikedNotify.swift in Sources */,
|
4CA352A22A76AEC5003BB08B /* LikedNotify.swift in Sources */,
|
||||||
|
5CC8529F2BD744F60039FFC5 /* HighlightView.swift in Sources */,
|
||||||
BA37598D2ABCCE500018D73B /* PhotoCaptureProcessor.swift in Sources */,
|
BA37598D2ABCCE500018D73B /* PhotoCaptureProcessor.swift in Sources */,
|
||||||
|
5CC8529D2BD741CD0039FFC5 /* HighlightEvent.swift in Sources */,
|
||||||
4C9146FD2A2A87C200DDEA40 /* wasm.c in Sources */,
|
4C9146FD2A2A87C200DDEA40 /* wasm.c in Sources */,
|
||||||
4C75EFAF28049D350006080F /* NostrFilter.swift in Sources */,
|
4C75EFAF28049D350006080F /* NostrFilter.swift in Sources */,
|
||||||
4C3EA64C28FF59AC00C48A62 /* bech32_util.c in Sources */,
|
4C3EA64C28FF59AC00C48A62 /* bech32_util.c in Sources */,
|
||||||
@@ -3477,6 +3508,7 @@
|
|||||||
B51C1CEB2B55A60A00E312A9 /* MuteDurationMenu.swift in Sources */,
|
B51C1CEB2B55A60A00E312A9 /* MuteDurationMenu.swift in Sources */,
|
||||||
4CB88389296AF99A00DC99E7 /* EventDetailBar.swift in Sources */,
|
4CB88389296AF99A00DC99E7 /* EventDetailBar.swift in Sources */,
|
||||||
4C32B9512A9AD44700DC3548 /* FlatbuffersErrors.swift in Sources */,
|
4C32B9512A9AD44700DC3548 /* FlatbuffersErrors.swift in Sources */,
|
||||||
|
5CC852A62BE00F180039FFC5 /* HighlightEventRef.swift in Sources */,
|
||||||
4CE8794E2996B16A00F758CC /* RelayToggle.swift in Sources */,
|
4CE8794E2996B16A00F758CC /* RelayToggle.swift in Sources */,
|
||||||
4C3AC79B28306D7B00E1F516 /* Contacts.swift in Sources */,
|
4C3AC79B28306D7B00E1F516 /* Contacts.swift in Sources */,
|
||||||
4C3EA63D28FF52D600C48A62 /* bolt11.c in Sources */,
|
4C3EA63D28FF52D600C48A62 /* bolt11.c in Sources */,
|
||||||
@@ -4037,6 +4069,7 @@
|
|||||||
CLANG_ENABLE_MODULES = YES;
|
CLANG_ENABLE_MODULES = YES;
|
||||||
CODE_SIGN_ENTITLEMENTS = damus/damus.entitlements;
|
CODE_SIGN_ENTITLEMENTS = damus/damus.entitlements;
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
|
CURRENT_PROJECT_VERSION = 1;
|
||||||
DEVELOPMENT_ASSET_PATHS = "\"damus/Preview Content\"";
|
DEVELOPMENT_ASSET_PATHS = "\"damus/Preview Content\"";
|
||||||
DEVELOPMENT_TEAM = XK7H4JAB3D;
|
DEVELOPMENT_TEAM = XK7H4JAB3D;
|
||||||
ENABLE_PREVIEWS = YES;
|
ENABLE_PREVIEWS = YES;
|
||||||
@@ -4063,6 +4096,7 @@
|
|||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"$(PROJECT_DIR)",
|
"$(PROJECT_DIR)",
|
||||||
);
|
);
|
||||||
|
MARKETING_VERSION = 1.10;
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = com.jb55.damus2;
|
PRODUCT_BUNDLE_IDENTIFIER = com.jb55.damus2;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
|
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
|
||||||
@@ -4086,6 +4120,7 @@
|
|||||||
CLANG_ENABLE_MODULES = YES;
|
CLANG_ENABLE_MODULES = YES;
|
||||||
CODE_SIGN_ENTITLEMENTS = damus/damus.entitlements;
|
CODE_SIGN_ENTITLEMENTS = damus/damus.entitlements;
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
|
CURRENT_PROJECT_VERSION = 1;
|
||||||
DEVELOPMENT_ASSET_PATHS = "\"damus/Preview Content\"";
|
DEVELOPMENT_ASSET_PATHS = "\"damus/Preview Content\"";
|
||||||
DEVELOPMENT_TEAM = XK7H4JAB3D;
|
DEVELOPMENT_TEAM = XK7H4JAB3D;
|
||||||
ENABLE_PREVIEWS = YES;
|
ENABLE_PREVIEWS = YES;
|
||||||
@@ -4112,6 +4147,7 @@
|
|||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"$(PROJECT_DIR)",
|
"$(PROJECT_DIR)",
|
||||||
);
|
);
|
||||||
|
MARKETING_VERSION = 1.10;
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = com.jb55.damus2;
|
PRODUCT_BUNDLE_IDENTIFIER = com.jb55.damus2;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
|
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
|
||||||
@@ -4316,12 +4352,12 @@
|
|||||||
/* End XCConfigurationList section */
|
/* End XCConfigurationList section */
|
||||||
|
|
||||||
/* Begin XCRemoteSwiftPackageReference section */
|
/* Begin XCRemoteSwiftPackageReference section */
|
||||||
3AFE89C12BD4156F00AD31EF /* XCRemoteSwiftPackageReference "MCEmojiPicker" */ = {
|
3A0A30B92C21397A00F8C9BC /* XCRemoteSwiftPackageReference "EmojiPicker" */ = {
|
||||||
isa = XCRemoteSwiftPackageReference;
|
isa = XCRemoteSwiftPackageReference;
|
||||||
repositoryURL = "https://github.com/izyumkin/MCEmojiPicker";
|
repositoryURL = "https://github.com/tyiu/EmojiPicker.git";
|
||||||
requirement = {
|
requirement = {
|
||||||
kind = upToNextMajorVersion;
|
kind = upToNextMajorVersion;
|
||||||
minimumVersion = 1.2.3;
|
minimumVersion = 0.1.1;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
4C06670228FC7EC500038D2A /* XCRemoteSwiftPackageReference "Kingfisher" */ = {
|
4C06670228FC7EC500038D2A /* XCRemoteSwiftPackageReference "Kingfisher" */ = {
|
||||||
@@ -4375,10 +4411,10 @@
|
|||||||
/* End XCRemoteSwiftPackageReference section */
|
/* End XCRemoteSwiftPackageReference section */
|
||||||
|
|
||||||
/* Begin XCSwiftPackageProductDependency section */
|
/* Begin XCSwiftPackageProductDependency section */
|
||||||
3AFE89C22BD4156F00AD31EF /* MCEmojiPicker */ = {
|
3A0A30BA2C21397A00F8C9BC /* EmojiPicker */ = {
|
||||||
isa = XCSwiftPackageProductDependency;
|
isa = XCSwiftPackageProductDependency;
|
||||||
package = 3AFE89C12BD4156F00AD31EF /* XCRemoteSwiftPackageReference "MCEmojiPicker" */;
|
package = 3A0A30B92C21397A00F8C9BC /* XCRemoteSwiftPackageReference "EmojiPicker" */;
|
||||||
productName = MCEmojiPicker;
|
productName = EmojiPicker;
|
||||||
};
|
};
|
||||||
4C06670328FC7EC500038D2A /* Kingfisher */ = {
|
4C06670328FC7EC500038D2A /* Kingfisher */ = {
|
||||||
isa = XCSwiftPackageProductDependency;
|
isa = XCSwiftPackageProductDependency;
|
||||||
|
|||||||
@@ -1,6 +1,24 @@
|
|||||||
{
|
{
|
||||||
"originHash" : "babaf4d5748afecf49bbb702530d8e9576460692f478b0a50ee43195dd4440e2",
|
"originHash" : "babaf4d5748afecf49bbb702530d8e9576460692f478b0a50ee43195dd4440e2",
|
||||||
"pins" : [
|
"pins" : [
|
||||||
|
{
|
||||||
|
"identity" : "emojikit",
|
||||||
|
"kind" : "remoteSourceControl",
|
||||||
|
"location" : "https://github.com/tyiu/EmojiKit",
|
||||||
|
"state" : {
|
||||||
|
"revision" : "05805f72d63a6d6a2d7dc7fe14abd37c1317b11a",
|
||||||
|
"version" : "0.1.2"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"identity" : "emojipicker",
|
||||||
|
"kind" : "remoteSourceControl",
|
||||||
|
"location" : "https://github.com/tyiu/EmojiPicker.git",
|
||||||
|
"state" : {
|
||||||
|
"revision" : "0c28b4a1a6b8840cf2580bda59517f6d0a733dc8",
|
||||||
|
"version" : "0.1.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"identity" : "gsplayer",
|
"identity" : "gsplayer",
|
||||||
"kind" : "remoteSourceControl",
|
"kind" : "remoteSourceControl",
|
||||||
@@ -19,15 +37,6 @@
|
|||||||
"version" : "7.6.1"
|
"version" : "7.6.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"identity" : "mcemojipicker",
|
|
||||||
"kind" : "remoteSourceControl",
|
|
||||||
"location" : "https://github.com/izyumkin/MCEmojiPicker",
|
|
||||||
"state" : {
|
|
||||||
"revision" : "e0b4903b75ae1cc418d276d84d1cb946b8a1d73c",
|
|
||||||
"version" : "1.2.3"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"identity" : "secp256k1.swift",
|
"identity" : "secp256k1.swift",
|
||||||
"kind" : "remoteSourceControl",
|
"kind" : "remoteSourceControl",
|
||||||
@@ -36,6 +45,15 @@
|
|||||||
"revision" : "40b4b38b3b1c83f7088c76189a742870e0ca06a9"
|
"revision" : "40b4b38b3b1c83f7088c76189a742870e0ca06a9"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"identity" : "swift-collections",
|
||||||
|
"kind" : "remoteSourceControl",
|
||||||
|
"location" : "https://github.com/apple/swift-collections.git",
|
||||||
|
"state" : {
|
||||||
|
"revision" : "ee97538f5b81ae89698fd95938896dec5217b148",
|
||||||
|
"version" : "1.1.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"identity" : "swift-markdown-ui",
|
"identity" : "swift-markdown-ui",
|
||||||
"kind" : "remoteSourceControl",
|
"kind" : "remoteSourceControl",
|
||||||
@@ -62,6 +80,15 @@
|
|||||||
"version" : "509.0.0"
|
"version" : "509.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"identity" : "swift-trie",
|
||||||
|
"kind" : "remoteSourceControl",
|
||||||
|
"location" : "https://github.com/tyiu/swift-trie",
|
||||||
|
"state" : {
|
||||||
|
"revision" : "4c50bff6c168f74425f70476be62a072980d2da7",
|
||||||
|
"version" : "0.1.2"
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"identity" : "swipeactions",
|
"identity" : "swipeactions",
|
||||||
"kind" : "remoteSourceControl",
|
"kind" : "remoteSourceControl",
|
||||||
|
|||||||
@@ -0,0 +1,38 @@
|
|||||||
|
{
|
||||||
|
"colors" : [
|
||||||
|
{
|
||||||
|
"color" : {
|
||||||
|
"color-space" : "srgb",
|
||||||
|
"components" : {
|
||||||
|
"alpha" : "1.000",
|
||||||
|
"blue" : "0xF2",
|
||||||
|
"green" : "0xD8",
|
||||||
|
"red" : "0xF4"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"idiom" : "universal"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"appearances" : [
|
||||||
|
{
|
||||||
|
"appearance" : "luminosity",
|
||||||
|
"value" : "dark"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"color" : {
|
||||||
|
"color-space" : "srgb",
|
||||||
|
"components" : {
|
||||||
|
"alpha" : "1.000",
|
||||||
|
"blue" : "0x45",
|
||||||
|
"green" : "0x17",
|
||||||
|
"red" : "0x47"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"idiom" : "universal"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"info" : {
|
||||||
|
"author" : "xcode",
|
||||||
|
"version" : 1
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -28,6 +28,7 @@ class DamusColors {
|
|||||||
static let green = Color("DamusGreen")
|
static let green = Color("DamusGreen")
|
||||||
static let purple = Color("DamusPurple")
|
static let purple = Color("DamusPurple")
|
||||||
static let deepPurple = Color("DamusDeepPurple")
|
static let deepPurple = Color("DamusDeepPurple")
|
||||||
|
static let highlight = Color("DamusHighlight")
|
||||||
static let blue = Color("DamusBlue")
|
static let blue = Color("DamusBlue")
|
||||||
static let bitcoin = Color("Bitcoin")
|
static let bitcoin = Color("Bitcoin")
|
||||||
static let success = Color("DamusSuccessPrimary")
|
static let success = Color("DamusSuccessPrimary")
|
||||||
|
|||||||
@@ -9,16 +9,20 @@ import UIKit
|
|||||||
import SwiftUI
|
import SwiftUI
|
||||||
|
|
||||||
struct SelectableText: View {
|
struct SelectableText: View {
|
||||||
|
let damus_state: DamusState
|
||||||
|
let event: NostrEvent?
|
||||||
let attributedString: AttributedString
|
let attributedString: AttributedString
|
||||||
let textAlignment: NSTextAlignment
|
let textAlignment: NSTextAlignment
|
||||||
|
@State private var showHighlightPost = false
|
||||||
|
@State private var selectedText = ""
|
||||||
@State private var selectedTextHeight: CGFloat = .zero
|
@State private var selectedTextHeight: CGFloat = .zero
|
||||||
@State private var selectedTextWidth: CGFloat = .zero
|
@State private var selectedTextWidth: CGFloat = .zero
|
||||||
|
|
||||||
let size: EventViewKind
|
let size: EventViewKind
|
||||||
|
|
||||||
init(attributedString: AttributedString, textAlignment: NSTextAlignment? = nil, size: EventViewKind) {
|
init(damus_state: DamusState, event: NostrEvent?, attributedString: AttributedString, textAlignment: NSTextAlignment? = nil, size: EventViewKind) {
|
||||||
|
self.damus_state = damus_state
|
||||||
|
self.event = event
|
||||||
self.attributedString = attributedString
|
self.attributedString = attributedString
|
||||||
self.textAlignment = textAlignment ?? NSTextAlignment.natural
|
self.textAlignment = textAlignment ?? NSTextAlignment.natural
|
||||||
self.size = size
|
self.size = size
|
||||||
@@ -32,6 +36,9 @@ struct SelectableText: View {
|
|||||||
font: eventviewsize_to_uifont(size),
|
font: eventviewsize_to_uifont(size),
|
||||||
fixedWidth: selectedTextWidth,
|
fixedWidth: selectedTextWidth,
|
||||||
textAlignment: self.textAlignment,
|
textAlignment: self.textAlignment,
|
||||||
|
enableHighlighting: self.enableHighlighting(),
|
||||||
|
showHighlightPost: $showHighlightPost,
|
||||||
|
selectedText: $selectedText,
|
||||||
height: $selectedTextHeight
|
height: $selectedTextHeight
|
||||||
)
|
)
|
||||||
.padding([.leading, .trailing], -1.0)
|
.padding([.leading, .trailing], -1.0)
|
||||||
@@ -46,8 +53,48 @@ struct SelectableText: View {
|
|||||||
self.selectedTextWidth = newSize.width
|
self.selectedTextWidth = newSize.width
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.sheet(isPresented: $showHighlightPost) {
|
||||||
|
if let event {
|
||||||
|
HighlightPostView(damus_state: damus_state, event: event, selectedText: $selectedText)
|
||||||
|
.presentationDragIndicator(.visible)
|
||||||
|
.presentationDetents([.height(selectedTextHeight + 150), .medium, .large])
|
||||||
|
}
|
||||||
|
}
|
||||||
.frame(height: selectedTextHeight)
|
.frame(height: selectedTextHeight)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func enableHighlighting() -> Bool {
|
||||||
|
self.event != nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fileprivate class TextView: UITextView {
|
||||||
|
@Binding var showHighlightPost: Bool
|
||||||
|
@Binding var selectedText: String
|
||||||
|
|
||||||
|
init(frame: CGRect, textContainer: NSTextContainer?, showHighlightPost: Binding<Bool>, selectedText: Binding<String>) {
|
||||||
|
self._showHighlightPost = showHighlightPost
|
||||||
|
self._selectedText = selectedText
|
||||||
|
super.init(frame: frame, textContainer: textContainer)
|
||||||
|
}
|
||||||
|
|
||||||
|
required init?(coder: NSCoder) {
|
||||||
|
fatalError("init(coder:) has not been implemented")
|
||||||
|
}
|
||||||
|
|
||||||
|
override func canPerformAction(_ action: Selector, withSender sender: Any?) -> Bool {
|
||||||
|
if action == #selector(highlightText(_:)) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
return super.canPerformAction(action, withSender: sender)
|
||||||
|
}
|
||||||
|
|
||||||
|
@objc public func highlightText(_ sender: Any?) {
|
||||||
|
guard let selectedRange = self.selectedTextRange else { return }
|
||||||
|
selectedText = self.text(in: selectedRange) ?? ""
|
||||||
|
showHighlightPost.toggle()
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fileprivate struct TextViewRepresentable: UIViewRepresentable {
|
fileprivate struct TextViewRepresentable: UIViewRepresentable {
|
||||||
@@ -57,11 +104,13 @@ struct SelectableText: View {
|
|||||||
let font: UIFont
|
let font: UIFont
|
||||||
let fixedWidth: CGFloat
|
let fixedWidth: CGFloat
|
||||||
let textAlignment: NSTextAlignment
|
let textAlignment: NSTextAlignment
|
||||||
|
let enableHighlighting: Bool
|
||||||
|
@Binding var showHighlightPost: Bool
|
||||||
|
@Binding var selectedText: String
|
||||||
@Binding var height: CGFloat
|
@Binding var height: CGFloat
|
||||||
|
|
||||||
func makeUIView(context: UIViewRepresentableContext<Self>) -> UITextView {
|
func makeUIView(context: UIViewRepresentableContext<Self>) -> TextView {
|
||||||
let view = UITextView()
|
let view = TextView(frame: .zero, textContainer: nil, showHighlightPost: $showHighlightPost, selectedText: $selectedText)
|
||||||
view.isEditable = false
|
view.isEditable = false
|
||||||
view.dataDetectorTypes = .all
|
view.dataDetectorTypes = .all
|
||||||
view.isSelectable = true
|
view.isSelectable = true
|
||||||
@@ -71,10 +120,15 @@ struct SelectableText: View {
|
|||||||
view.textContainerInset.left = 1.0
|
view.textContainerInset.left = 1.0
|
||||||
view.textContainerInset.right = 1.0
|
view.textContainerInset.right = 1.0
|
||||||
view.textAlignment = textAlignment
|
view.textAlignment = textAlignment
|
||||||
|
|
||||||
|
let menuController = UIMenuController.shared
|
||||||
|
let highlightItem = UIMenuItem(title: "Highlight", action: #selector(view.highlightText(_:)))
|
||||||
|
menuController.menuItems = self.enableHighlighting ? [highlightItem] : []
|
||||||
|
|
||||||
return view
|
return view
|
||||||
}
|
}
|
||||||
|
|
||||||
func updateUIView(_ uiView: UITextView, context: UIViewRepresentableContext<Self>) {
|
func updateUIView(_ uiView: TextView, context: UIViewRepresentableContext<Self>) {
|
||||||
let mutableAttributedString = createNSAttributedString()
|
let mutableAttributedString = createNSAttributedString()
|
||||||
uiView.attributedText = mutableAttributedString
|
uiView.attributedText = mutableAttributedString
|
||||||
uiView.textAlignment = self.textAlignment
|
uiView.textAlignment = self.textAlignment
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ struct TranslateView: View {
|
|||||||
.padding([.top, .bottom], 10)
|
.padding([.top, .bottom], 10)
|
||||||
|
|
||||||
if self.size == .selected {
|
if self.size == .selected {
|
||||||
SelectableText(attributedString: artifacts.content.attributed, size: self.size)
|
SelectableText(damus_state: damus_state, event: event, attributedString: artifacts.content.attributed, size: self.size)
|
||||||
} else {
|
} else {
|
||||||
artifacts.content.text
|
artifacts.content.text
|
||||||
.font(eventviewsize_to_font(self.size, font_size: font_size))
|
.font(eventviewsize_to_font(self.size, font_size: font_size))
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
import SwiftUI
|
import SwiftUI
|
||||||
import AVKit
|
import AVKit
|
||||||
import MediaPlayer
|
import MediaPlayer
|
||||||
|
import EmojiPicker
|
||||||
|
|
||||||
struct ZapSheet {
|
struct ZapSheet {
|
||||||
let target: ZapTarget
|
let target: ZapTarget
|
||||||
@@ -719,7 +720,8 @@ struct ContentView: View {
|
|||||||
music: MusicController(onChange: music_changed),
|
music: MusicController(onChange: music_changed),
|
||||||
video: VideoController(),
|
video: VideoController(),
|
||||||
ndb: ndb,
|
ndb: ndb,
|
||||||
quote_reposts: .init(our_pubkey: pubkey)
|
quote_reposts: .init(our_pubkey: pubkey),
|
||||||
|
emoji_provider: DefaultEmojiProvider(showAllVariations: true)
|
||||||
)
|
)
|
||||||
|
|
||||||
home.damus_state = self.damus_state!
|
home.damus_state = self.damus_state!
|
||||||
|
|||||||
@@ -9,31 +9,31 @@ import Foundation
|
|||||||
|
|
||||||
|
|
||||||
class CreateAccountModel: ObservableObject {
|
class CreateAccountModel: ObservableObject {
|
||||||
@Published var real_name: String = ""
|
@Published var display_name: String = ""
|
||||||
@Published var nick_name: String = ""
|
@Published var name: String = ""
|
||||||
@Published var about: String = ""
|
@Published var about: String = ""
|
||||||
@Published var pubkey: Pubkey = .empty
|
@Published var pubkey: Pubkey = .empty
|
||||||
@Published var privkey: Privkey = .empty
|
@Published var privkey: Privkey = .empty
|
||||||
@Published var profile_image: URL? = nil
|
@Published var profile_image: URL? = nil
|
||||||
|
|
||||||
var rendered_name: String {
|
var rendered_name: String {
|
||||||
if real_name.isEmpty {
|
if display_name.isEmpty {
|
||||||
return nick_name
|
return name
|
||||||
}
|
}
|
||||||
return real_name
|
return display_name
|
||||||
}
|
}
|
||||||
|
|
||||||
var keypair: Keypair {
|
var keypair: Keypair {
|
||||||
return Keypair(pubkey: self.pubkey, privkey: self.privkey)
|
return Keypair(pubkey: self.pubkey, privkey: self.privkey)
|
||||||
}
|
}
|
||||||
|
|
||||||
init(real: String = "", nick: String = "", about: String = "") {
|
init(display_name: String = "", name: String = "", about: String = "") {
|
||||||
let keypair = generate_new_keypair()
|
let keypair = generate_new_keypair()
|
||||||
self.pubkey = keypair.pubkey
|
self.pubkey = keypair.pubkey
|
||||||
self.privkey = keypair.privkey
|
self.privkey = keypair.privkey
|
||||||
|
|
||||||
self.real_name = real
|
self.display_name = display_name
|
||||||
self.nick_name = nick
|
self.name = name
|
||||||
self.about = about
|
self.about = about
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
import LinkPresentation
|
import LinkPresentation
|
||||||
|
import EmojiPicker
|
||||||
|
|
||||||
class DamusState: HeadlessDamusState {
|
class DamusState: HeadlessDamusState {
|
||||||
let pool: RelayPool
|
let pool: RelayPool
|
||||||
@@ -37,8 +38,9 @@ class DamusState: HeadlessDamusState {
|
|||||||
let ndb: Ndb
|
let ndb: Ndb
|
||||||
var purple: DamusPurple
|
var purple: DamusPurple
|
||||||
var push_notification_client: PushNotificationClient
|
var push_notification_client: PushNotificationClient
|
||||||
|
let emoji_provider: EmojiProvider
|
||||||
|
|
||||||
init(pool: RelayPool, keypair: Keypair, likes: EventCounter, boosts: EventCounter, contacts: Contacts, mutelist_manager: MutelistManager, profiles: Profiles, dms: DirectMessagesModel, previews: PreviewCache, zaps: Zaps, lnurls: LNUrls, settings: UserSettingsStore, relay_filters: RelayFilters, relay_model_cache: RelayModelCache, drafts: Drafts, events: EventCache, bookmarks: BookmarksManager, postbox: PostBox, bootstrap_relays: [RelayURL], replies: ReplyCounter, wallet: WalletModel, nav: NavigationCoordinator, music: MusicController?, video: VideoController, ndb: Ndb, purple: DamusPurple? = nil, quote_reposts: EventCounter) {
|
init(pool: RelayPool, keypair: Keypair, likes: EventCounter, boosts: EventCounter, contacts: Contacts, mutelist_manager: MutelistManager, profiles: Profiles, dms: DirectMessagesModel, previews: PreviewCache, zaps: Zaps, lnurls: LNUrls, settings: UserSettingsStore, relay_filters: RelayFilters, relay_model_cache: RelayModelCache, drafts: Drafts, events: EventCache, bookmarks: BookmarksManager, postbox: PostBox, bootstrap_relays: [RelayURL], replies: ReplyCounter, wallet: WalletModel, nav: NavigationCoordinator, music: MusicController?, video: VideoController, ndb: Ndb, purple: DamusPurple? = nil, quote_reposts: EventCounter, emoji_provider: EmojiProvider) {
|
||||||
self.pool = pool
|
self.pool = pool
|
||||||
self.keypair = keypair
|
self.keypair = keypair
|
||||||
self.likes = likes
|
self.likes = likes
|
||||||
@@ -70,6 +72,7 @@ class DamusState: HeadlessDamusState {
|
|||||||
)
|
)
|
||||||
self.quote_reposts = quote_reposts
|
self.quote_reposts = quote_reposts
|
||||||
self.push_notification_client = PushNotificationClient(keypair: keypair, settings: settings)
|
self.push_notification_client = PushNotificationClient(keypair: keypair, settings: settings)
|
||||||
|
self.emoji_provider = emoji_provider
|
||||||
}
|
}
|
||||||
|
|
||||||
@discardableResult
|
@discardableResult
|
||||||
@@ -135,7 +138,8 @@ class DamusState: HeadlessDamusState {
|
|||||||
music: nil,
|
music: nil,
|
||||||
video: VideoController(),
|
video: VideoController(),
|
||||||
ndb: .empty,
|
ndb: .empty,
|
||||||
quote_reposts: .init(our_pubkey: empty_pub)
|
quote_reposts: .init(our_pubkey: empty_pub),
|
||||||
|
emoji_provider: DefaultEmojiProvider(showAllVariations: true)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
34
damus/Models/HighlightEvent.swift
Normal file
34
damus/Models/HighlightEvent.swift
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
//
|
||||||
|
// HighlightEvent.swift
|
||||||
|
// damus
|
||||||
|
//
|
||||||
|
// Created by eric on 4/22/24.
|
||||||
|
//
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
struct HighlightEvent {
|
||||||
|
let event: NostrEvent
|
||||||
|
|
||||||
|
var event_ref: String? = nil
|
||||||
|
var url_ref: URL? = nil
|
||||||
|
var context: String? = nil
|
||||||
|
|
||||||
|
static func parse(from ev: NostrEvent) -> HighlightEvent {
|
||||||
|
var highlight = HighlightEvent(event: ev)
|
||||||
|
|
||||||
|
for tag in ev.tags {
|
||||||
|
guard tag.count >= 2 else { continue }
|
||||||
|
switch tag[0].string() {
|
||||||
|
case "e": highlight.event_ref = tag[1].string()
|
||||||
|
case "a": highlight.event_ref = tag[1].string()
|
||||||
|
case "r": highlight.url_ref = URL(string: tag[1].string())
|
||||||
|
case "context": highlight.context = tag[1].string()
|
||||||
|
default:
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return highlight
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -184,7 +184,7 @@ class HomeModel: ContactsDelegate {
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch kind {
|
switch kind {
|
||||||
case .chat, .longform, .text:
|
case .chat, .longform, .text, .highlight:
|
||||||
handle_text_event(sub_id: sub_id, ev)
|
handle_text_event(sub_id: sub_id, ev)
|
||||||
case .contacts:
|
case .contacts:
|
||||||
handle_contact_event(sub_id: sub_id, relay_id: relay_id, ev: ev)
|
handle_contact_event(sub_id: sub_id, relay_id: relay_id, ev: ev)
|
||||||
@@ -586,7 +586,7 @@ class HomeModel: ContactsDelegate {
|
|||||||
func subscribe_to_home_filters(friends fs: [Pubkey]? = nil, relay_id: RelayURL? = nil) {
|
func subscribe_to_home_filters(friends fs: [Pubkey]? = nil, relay_id: RelayURL? = nil) {
|
||||||
// TODO: separate likes?
|
// TODO: separate likes?
|
||||||
var home_filter_kinds: [NostrKind] = [
|
var home_filter_kinds: [NostrKind] = [
|
||||||
.text, .longform, .boost
|
.text, .longform, .boost, .highlight
|
||||||
]
|
]
|
||||||
if !damus_state.settings.onlyzaps_mode {
|
if !damus_state.settings.onlyzaps_mode {
|
||||||
home_filter_kinds.append(.like)
|
home_filter_kinds.append(.like)
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ class ProfileModel: ObservableObject, Equatable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func subscribe() {
|
func subscribe() {
|
||||||
var text_filter = NostrFilter(kinds: [.text, .longform])
|
var text_filter = NostrFilter(kinds: [.text, .longform, .highlight])
|
||||||
var profile_filter = NostrFilter(kinds: [.contacts, .metadata, .boost])
|
var profile_filter = NostrFilter(kinds: [.contacts, .metadata, .boost])
|
||||||
|
|
||||||
profile_filter.authors = [pubkey]
|
profile_filter.authors = [pubkey]
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ class SearchModel: ObservableObject {
|
|||||||
func subscribe() {
|
func subscribe() {
|
||||||
// since 1 month
|
// since 1 month
|
||||||
search.limit = self.limit
|
search.limit = self.limit
|
||||||
search.kinds = [.text, .like, .longform]
|
search.kinds = [.text, .like, .longform, .highlight]
|
||||||
|
|
||||||
//likes_filter.ids = ref_events.referenced_ids!
|
//likes_filter.ids = ref_events.referenced_ids!
|
||||||
|
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ enum NostrKind: UInt32, Codable {
|
|||||||
case longform = 30023
|
case longform = 30023
|
||||||
case zap = 9735
|
case zap = 9735
|
||||||
case zap_request = 9734
|
case zap_request = 9734
|
||||||
|
case highlight = 9802
|
||||||
case nwc_request = 23194
|
case nwc_request = 23194
|
||||||
case nwc_response = 23195
|
case nwc_response = 23195
|
||||||
case http_auth = 27235
|
case http_auth = 27235
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
import EmojiPicker
|
||||||
|
|
||||||
|
|
||||||
let test_seckey = Privkey(Data([0xe0, 0xaa, 0x60, 0x26, 0x08, 0x18, 0xac, 0x10, 0x03, 0x86, 0x4d, 0x15, 0x24, 0x9a, 0xf7, 0xa3, 0x3e, 0x4f, 0x1f, 0xc9, 0x01, 0xcf, 0xee, 0xa9, 0xb4, 0x77, 0xc7, 0x07, 0x22, 0xb7, 0x25, 0xfd]))
|
let test_seckey = Privkey(Data([0xe0, 0xaa, 0x60, 0x26, 0x08, 0x18, 0xac, 0x10, 0x03, 0x86, 0x4d, 0x15, 0x24, 0x9a, 0xf7, 0xa3, 0x3e, 0x4f, 0x1f, 0xc9, 0x01, 0xcf, 0xee, 0xa9, 0xb4, 0x77, 0xc7, 0x07, 0x22, 0xb7, 0x25, 0xfd]))
|
||||||
@@ -100,7 +101,8 @@ var test_damus_state: DamusState = ({
|
|||||||
music: .init(onChange: {_ in }),
|
music: .init(onChange: {_ in }),
|
||||||
video: .init(),
|
video: .init(),
|
||||||
ndb: ndb,
|
ndb: ndb,
|
||||||
quote_reposts: .init(our_pubkey: our_pubkey)
|
quote_reposts: .init(our_pubkey: our_pubkey),
|
||||||
|
emoji_provider: DefaultEmojiProvider(showAllVariations: true)
|
||||||
)
|
)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -10,9 +10,9 @@ import Foundation
|
|||||||
class Constants {
|
class Constants {
|
||||||
//static let EXAMPLE_DEMOS: DamusState = .empty
|
//static let EXAMPLE_DEMOS: DamusState = .empty
|
||||||
static let DAMUS_APP_GROUP_IDENTIFIER: String = "group.com.damus"
|
static let DAMUS_APP_GROUP_IDENTIFIER: String = "group.com.damus"
|
||||||
static let DEVICE_TOKEN_RECEIVER_PRODUCTION_URL: URL = URL(string: "https://notify.damus.io:8000/user-info")!
|
static let DEVICE_TOKEN_RECEIVER_PRODUCTION_URL: URL = URL(string: "http://45.33.32.5:8000/user-info")!
|
||||||
static let DEVICE_TOKEN_RECEIVER_TEST_URL: URL = URL(string: "http://localhost:8000/user-info")!
|
static let DEVICE_TOKEN_RECEIVER_TEST_URL: URL = URL(string: "http://localhost:8000/user-info")!
|
||||||
static let DEVICE_TOKEN_REVOKER_PRODUCTION_URL: URL = URL(string: "https://notify.damus.io:8000/user-info/remove")!
|
static let DEVICE_TOKEN_REVOKER_PRODUCTION_URL: URL = URL(string: "http://45.33.32.5:8000/user-info/remove")!
|
||||||
static let DEVICE_TOKEN_REVOKER_TEST_URL: URL = URL(string: "http://localhost:8000/user-info/remove")!
|
static let DEVICE_TOKEN_REVOKER_TEST_URL: URL = URL(string: "http://localhost:8000/user-info/remove")!
|
||||||
static let MAIN_APP_BUNDLE_IDENTIFIER: String = "com.jb55.damus2"
|
static let MAIN_APP_BUNDLE_IDENTIFIER: String = "com.jb55.damus2"
|
||||||
static let NOTIFICATION_EXTENSION_BUNDLE_IDENTIFIER: String = "com.jb55.damus2.DamusNotificationService"
|
static let NOTIFICATION_EXTENSION_BUNDLE_IDENTIFIER: String = "com.jb55.damus2.DamusNotificationService"
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ enum Route: Hashable {
|
|||||||
case .TranslationSettings(let settings):
|
case .TranslationSettings(let settings):
|
||||||
TranslationSettingsView(settings: settings, damus_state: damusState)
|
TranslationSettingsView(settings: settings, damus_state: damusState)
|
||||||
case .ReactionsSettings(let settings):
|
case .ReactionsSettings(let settings):
|
||||||
ReactionsSettingsView(settings: settings)
|
ReactionsSettingsView(settings: settings, damus_state: damusState)
|
||||||
case .SearchSettings(let settings):
|
case .SearchSettings(let settings):
|
||||||
SearchSettingsView(settings: settings)
|
SearchSettingsView(settings: settings)
|
||||||
case .DeveloperSettings(let settings):
|
case .DeveloperSettings(let settings):
|
||||||
|
|||||||
@@ -6,7 +6,8 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
import MCEmojiPicker
|
import EmojiPicker
|
||||||
|
import EmojiKit
|
||||||
import SwipeActions
|
import SwipeActions
|
||||||
|
|
||||||
struct EventActionBar: View {
|
struct EventActionBar: View {
|
||||||
@@ -22,7 +23,7 @@ struct EventActionBar: View {
|
|||||||
@State var show_share_action: Bool = false
|
@State var show_share_action: Bool = false
|
||||||
@State var show_repost_action: Bool = false
|
@State var show_repost_action: Bool = false
|
||||||
|
|
||||||
@State private var isOnTopHalfOfScreen: Bool = false
|
@State private var selectedEmoji: Emoji? = nil
|
||||||
|
|
||||||
@ObservedObject var bar: ActionBarModel
|
@ObservedObject var bar: ActionBarModel
|
||||||
|
|
||||||
@@ -126,7 +127,7 @@ struct EventActionBar: View {
|
|||||||
|
|
||||||
var like_button: some View {
|
var like_button: some View {
|
||||||
HStack(spacing: 4) {
|
HStack(spacing: 4) {
|
||||||
LikeButton(damus_state: damus_state, liked: bar.liked, liked_emoji: bar.our_like != nil ? to_reaction_emoji(ev: bar.our_like!) : nil, isOnTopHalfOfScreen: $isOnTopHalfOfScreen) { emoji in
|
LikeButton(damus_state: damus_state, liked: bar.liked, liked_emoji: bar.our_like != nil ? to_reaction_emoji(ev: bar.our_like!) : nil) { emoji in
|
||||||
if bar.liked {
|
if bar.liked {
|
||||||
//notify(.delete, bar.our_like)
|
//notify(.delete, bar.our_like)
|
||||||
} else {
|
} else {
|
||||||
@@ -257,20 +258,6 @@ struct EventActionBar: View {
|
|||||||
self.bar.our_like = liked.event
|
self.bar.our_like = liked.event
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.background(
|
|
||||||
GeometryReader { geometry in
|
|
||||||
EmptyView()
|
|
||||||
.onAppear {
|
|
||||||
let eventActionBarY = geometry.frame(in: .global).midY
|
|
||||||
let screenMidY = UIScreen.main.bounds.midY
|
|
||||||
self.isOnTopHalfOfScreen = eventActionBarY > screenMidY
|
|
||||||
}
|
|
||||||
.onChange(of: geometry.frame(in: .global).midY) { newY in
|
|
||||||
let screenMidY = UIScreen.main.bounds.midY
|
|
||||||
self.isOnTopHalfOfScreen = newY > screenMidY
|
|
||||||
}
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func send_like(emoji: String) {
|
func send_like(emoji: String) {
|
||||||
@@ -315,7 +302,6 @@ struct LikeButton: View {
|
|||||||
let damus_state: DamusState
|
let damus_state: DamusState
|
||||||
let liked: Bool
|
let liked: Bool
|
||||||
let liked_emoji: String?
|
let liked_emoji: String?
|
||||||
@Binding var isOnTopHalfOfScreen: Bool
|
|
||||||
let action: (_ emoji: String) -> Void
|
let action: (_ emoji: String) -> Void
|
||||||
|
|
||||||
// For reactions background
|
// For reactions background
|
||||||
@@ -324,7 +310,7 @@ struct LikeButton: View {
|
|||||||
|
|
||||||
@State private var isReactionsVisible = false
|
@State private var isReactionsVisible = false
|
||||||
|
|
||||||
@State private var selectedEmoji: String = ""
|
@State private var selectedEmoji: Emoji?
|
||||||
|
|
||||||
// Following four are Shaka animation properties
|
// Following four are Shaka animation properties
|
||||||
let timer = Timer.publish(every: 0.10, on: .main, in: .common).autoconnect()
|
let timer = Timer.publish(every: 0.10, on: .main, in: .common).autoconnect()
|
||||||
@@ -363,6 +349,11 @@ struct LikeButton: View {
|
|||||||
.foregroundColor(.gray)
|
.foregroundColor(.gray)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.sheet(isPresented: $isReactionsVisible) {
|
||||||
|
NavigationView {
|
||||||
|
EmojiPickerView(selectedEmoji: $selectedEmoji, emojiProvider: damus_state.emoji_provider)
|
||||||
|
}.presentationDetents([.medium, .large])
|
||||||
|
}
|
||||||
.accessibilityLabel(NSLocalizedString("Like", comment: "Accessibility Label for Like button"))
|
.accessibilityLabel(NSLocalizedString("Like", comment: "Accessibility Label for Like button"))
|
||||||
.rotationEffect(Angle(degrees: shouldAnimate ? rotationAngle : 0))
|
.rotationEffect(Angle(degrees: shouldAnimate ? rotationAngle : 0))
|
||||||
.onReceive(self.timer) { _ in
|
.onReceive(self.timer) { _ in
|
||||||
@@ -377,14 +368,10 @@ struct LikeButton: View {
|
|||||||
amountOfAngleIncrease = 20.0
|
amountOfAngleIncrease = 20.0
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.emojiPicker(
|
|
||||||
isPresented: $isReactionsVisible,
|
|
||||||
selectedEmoji: $selectedEmoji,
|
|
||||||
arrowDirection: isOnTopHalfOfScreen ? .down : .up,
|
|
||||||
isDismissAfterChoosing: true
|
|
||||||
)
|
|
||||||
.onChange(of: selectedEmoji) { newSelectedEmoji in
|
.onChange(of: selectedEmoji) { newSelectedEmoji in
|
||||||
self.action(newSelectedEmoji)
|
if let newSelectedEmoji {
|
||||||
|
self.action(newSelectedEmoji.value)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,8 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
import MCEmojiPicker
|
import EmojiKit
|
||||||
|
import EmojiPicker
|
||||||
import SwipeActions
|
import SwipeActions
|
||||||
|
|
||||||
fileprivate let CORNER_RADIUS: CGFloat = 10
|
fileprivate let CORNER_RADIUS: CGFloat = 10
|
||||||
@@ -34,7 +35,7 @@ struct ChatEventView: View {
|
|||||||
generator.impactOccurred()
|
generator.impactOccurred()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@State var selected_emoji: String = ""
|
@State var selected_emoji: Emoji?
|
||||||
|
|
||||||
@State private var isOnTopHalfOfScreen: Bool = false
|
@State private var isOnTopHalfOfScreen: Bool = false
|
||||||
@ObservedObject var bar: ActionBarModel
|
@ObservedObject var bar: ActionBarModel
|
||||||
@@ -154,19 +155,18 @@ struct ChatEventView: View {
|
|||||||
var event_bubble_with_long_press_interaction: some View {
|
var event_bubble_with_long_press_interaction: some View {
|
||||||
ZStack(alignment: is_ours ? .bottomLeading : .bottomTrailing) {
|
ZStack(alignment: is_ours ? .bottomLeading : .bottomTrailing) {
|
||||||
self.event_bubble
|
self.event_bubble
|
||||||
.emojiPicker(
|
.sheet(isPresented: Binding(get: { popover_state == .open_emoji_selector }, set: { new_state in
|
||||||
isPresented: Binding(get: { popover_state == .open_emoji_selector }, set: { new_state in
|
withAnimation(new_state == true ? .easeIn(duration: 0.5) : .easeOut(duration: 0.1)) {
|
||||||
withAnimation(new_state == true ? .easeIn(duration: 0.5) : .easeOut(duration: 0.1)) {
|
popover_state = new_state == true ? .open_emoji_selector : .closed
|
||||||
popover_state = new_state == true ? .open_emoji_selector : .closed
|
}
|
||||||
}
|
})) {
|
||||||
}),
|
NavigationView {
|
||||||
selectedEmoji: $selected_emoji,
|
EmojiPickerView(selectedEmoji: $selected_emoji, emojiProvider: damus_state.emoji_provider)
|
||||||
arrowDirection: isOnTopHalfOfScreen ? .down : .up,
|
}.presentationDetents([.medium, .large])
|
||||||
isDismissAfterChoosing: false
|
}
|
||||||
)
|
|
||||||
.onChange(of: selected_emoji) { newSelectedEmoji in
|
.onChange(of: selected_emoji) { newSelectedEmoji in
|
||||||
if newSelectedEmoji != "" {
|
if let newSelectedEmoji {
|
||||||
send_like(emoji: newSelectedEmoji)
|
send_like(emoji: newSelectedEmoji.value)
|
||||||
popover_state = .closed
|
popover_state = .closed
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,68 +25,44 @@ struct CreateAccountView: View {
|
|||||||
var body: some View {
|
var body: some View {
|
||||||
ZStack(alignment: .top) {
|
ZStack(alignment: .top) {
|
||||||
VStack {
|
VStack {
|
||||||
|
Spacer()
|
||||||
VStack(alignment: .center) {
|
VStack(alignment: .center) {
|
||||||
EditPictureControl(uploader: .nostrBuild, pubkey: account.pubkey, image_url: $account.profile_image , uploadObserver: profileUploadObserver, callback: uploadedProfilePicture)
|
|
||||||
|
|
||||||
Text("Public Key", comment: "Label to indicate the public key of the account.")
|
EditPictureControl(uploader: .nostrBuild, pubkey: account.pubkey, size: 75, setup: true, image_url: $account.profile_image , uploadObserver: profileUploadObserver, callback: uploadedProfilePicture)
|
||||||
|
.shadow(radius: 2)
|
||||||
|
.padding(.top, 100)
|
||||||
|
|
||||||
|
Text("Add Photo", comment: "Label to indicate user can add a photo.")
|
||||||
.bold()
|
.bold()
|
||||||
.padding()
|
.foregroundColor(DamusColors.neutral6)
|
||||||
.onTapGesture {
|
|
||||||
regen_key()
|
|
||||||
}
|
|
||||||
|
|
||||||
KeyText($account.pubkey)
|
|
||||||
.padding(.horizontal, 20)
|
|
||||||
.onTapGesture {
|
|
||||||
regen_key()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.frame(minWidth: 300, maxWidth: .infinity, minHeight: 250, alignment: .center)
|
|
||||||
.background {
|
|
||||||
RoundedRectangle(cornerRadius: 12)
|
|
||||||
.fill(DamusColors.adaptableGrey, strokeBorder: .gray.opacity(0.5), lineWidth: 1)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SignupForm {
|
SignupForm {
|
||||||
FormLabel(NSLocalizedString("Display name", comment: "Label to prompt display name entry."), optional: true)
|
FormLabel(NSLocalizedString("Name", comment: "Label to prompt name entry."), optional: false)
|
||||||
FormTextInput(NSLocalizedString("Satoshi Nakamoto", comment: "Name of Bitcoin creator(s)."), text: $account.real_name)
|
.foregroundColor(DamusColors.neutral6)
|
||||||
|
FormTextInput(NSLocalizedString("Satoshi Nakamoto", comment: "Name of Bitcoin creator(s)."), text: $account.name)
|
||||||
.textInputAutocapitalization(.words)
|
.textInputAutocapitalization(.words)
|
||||||
|
|
||||||
FormLabel(NSLocalizedString("About", comment: "Label to prompt for about text entry for user to describe about themself."), optional: true)
|
FormLabel(NSLocalizedString("Bio", comment: "Label to prompt bio entry for user to describe themself."), optional: true)
|
||||||
FormTextInput(NSLocalizedString("Creator(s) of Bitcoin. Absolute legend.", comment: "Example description about Bitcoin creator(s), Satoshi Nakamoto."), text: $account.about)
|
.foregroundColor(DamusColors.neutral6)
|
||||||
|
FormTextInput(NSLocalizedString("Absolute legend.", comment: "Example Bio"), text: $account.about)
|
||||||
}
|
}
|
||||||
.padding(.top, 10)
|
.padding(.top, 25)
|
||||||
|
|
||||||
Button(action: {
|
Button(action: {
|
||||||
nav.push(route: Route.SaveKeys(account: account))
|
nav.push(route: Route.SaveKeys(account: account))
|
||||||
}) {
|
}) {
|
||||||
HStack {
|
HStack {
|
||||||
Text("Create account now", comment: "Button to create account.")
|
Text("Next", comment: "Button to continue with account creation.")
|
||||||
.fontWeight(.semibold)
|
.fontWeight(.semibold)
|
||||||
}
|
}
|
||||||
.frame(minWidth: 300, maxWidth: .infinity, maxHeight: 12, alignment: .center)
|
.frame(minWidth: 300, maxWidth: .infinity, maxHeight: 12, alignment: .center)
|
||||||
}
|
}
|
||||||
.buttonStyle(GradientButtonStyle())
|
.buttonStyle(GradientButtonStyle())
|
||||||
.disabled(profileUploadObserver.isLoading)
|
.disabled(profileUploadObserver.isLoading || account.name.isEmpty)
|
||||||
.opacity(profileUploadObserver.isLoading ? 0.5 : 1)
|
.opacity(profileUploadObserver.isLoading || account.name.isEmpty ? 0.5 : 1)
|
||||||
.padding(.top, 20)
|
.padding(.top, 20)
|
||||||
|
|
||||||
HStack(spacing: 0) {
|
|
||||||
Text("By signing up, you agree to our ", comment: "Ask the user if they already have an account on Nostr")
|
|
||||||
.font(.subheadline)
|
|
||||||
.foregroundColor(Color("DamusMediumGrey"))
|
|
||||||
|
|
||||||
Button(action: {
|
|
||||||
nav.push(route: Route.EULA)
|
|
||||||
}, label: {
|
|
||||||
Text("EULA")
|
|
||||||
.font(.subheadline)
|
|
||||||
})
|
|
||||||
.padding(.vertical, 5)
|
|
||||||
|
|
||||||
Spacer()
|
|
||||||
}
|
|
||||||
|
|
||||||
LoginPrompt()
|
LoginPrompt()
|
||||||
.padding(.top)
|
.padding(.top)
|
||||||
|
|
||||||
@@ -94,8 +70,8 @@ struct CreateAccountView: View {
|
|||||||
}
|
}
|
||||||
.padding()
|
.padding()
|
||||||
}
|
}
|
||||||
|
.background(DamusBackground(maxHeight: UIScreen.main.bounds.size.height/2), alignment: .top)
|
||||||
.dismissKeyboardOnTap()
|
.dismissKeyboardOnTap()
|
||||||
.navigationTitle("Create account")
|
|
||||||
.navigationBarTitleDisplayMode(.inline)
|
.navigationBarTitleDisplayMode(.inline)
|
||||||
.navigationBarBackButtonHidden(true)
|
.navigationBarBackButtonHidden(true)
|
||||||
.navigationBarItems(leading: BackNav())
|
.navigationBarItems(leading: BackNav())
|
||||||
@@ -111,7 +87,7 @@ struct LoginPrompt: View {
|
|||||||
var body: some View {
|
var body: some View {
|
||||||
HStack {
|
HStack {
|
||||||
Text("Already on Nostr?", comment: "Ask the user if they already have an account on Nostr")
|
Text("Already on Nostr?", comment: "Ask the user if they already have an account on Nostr")
|
||||||
.foregroundColor(Color("DamusMediumGrey"))
|
.foregroundColor(DamusColors.neutral6)
|
||||||
|
|
||||||
Button(NSLocalizedString("Login", comment: "Button to navigate to login view.")) {
|
Button(NSLocalizedString("Login", comment: "Button to navigate to login view.")) {
|
||||||
self.dismiss()
|
self.dismiss()
|
||||||
@@ -127,8 +103,8 @@ struct BackNav: View {
|
|||||||
var body: some View {
|
var body: some View {
|
||||||
Image("chevron-left")
|
Image("chevron-left")
|
||||||
.foregroundColor(DamusColors.adaptableBlack)
|
.foregroundColor(DamusColors.adaptableBlack)
|
||||||
.onTapGesture {
|
.onTapGesture {
|
||||||
self.dismiss()
|
self.dismiss()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -148,20 +124,11 @@ extension View {
|
|||||||
|
|
||||||
struct CreateAccountView_Previews: PreviewProvider {
|
struct CreateAccountView_Previews: PreviewProvider {
|
||||||
static var previews: some View {
|
static var previews: some View {
|
||||||
let model = CreateAccountModel(real: "", nick: "jb55", about: "")
|
let model = CreateAccountModel(display_name: "", name: "jb55", about: "")
|
||||||
return CreateAccountView(account: model, nav: .init())
|
return CreateAccountView(account: model, nav: .init())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func KeyText(_ pubkey: Binding<Pubkey>) -> some View {
|
|
||||||
let bechkey = bech32_encode(hrp: PUBKEY_HRP, pubkey.wrappedValue.bytes)
|
|
||||||
return Text(bechkey)
|
|
||||||
.textSelection(.enabled)
|
|
||||||
.multilineTextAlignment(.center)
|
|
||||||
.font(.callout.monospaced())
|
|
||||||
.foregroundStyle(DamusLogoGradient.gradient)
|
|
||||||
}
|
|
||||||
|
|
||||||
func FormTextInput(_ title: String, text: Binding<String>) -> some View {
|
func FormTextInput(_ title: String, text: Binding<String>) -> some View {
|
||||||
return TextField("", text: text)
|
return TextField("", text: text)
|
||||||
.placeholder(when: text.wrappedValue.isEmpty) {
|
.placeholder(when: text.wrappedValue.isEmpty) {
|
||||||
@@ -171,6 +138,10 @@ func FormTextInput(_ title: String, text: Binding<String>) -> some View {
|
|||||||
.background {
|
.background {
|
||||||
RoundedRectangle(cornerRadius: 12)
|
RoundedRectangle(cornerRadius: 12)
|
||||||
.stroke(.gray.opacity(0.5), lineWidth: 1)
|
.stroke(.gray.opacity(0.5), lineWidth: 1)
|
||||||
|
.background {
|
||||||
|
RoundedRectangle(cornerRadius: 12)
|
||||||
|
.foregroundColor(.damusAdaptableWhite)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
.font(.body.bold())
|
.font(.body.bold())
|
||||||
}
|
}
|
||||||
@@ -183,6 +154,10 @@ func FormLabel(_ title: String, optional: Bool = false) -> some View {
|
|||||||
Text("optional", comment: "Label indicating that a form input is optional.")
|
Text("optional", comment: "Label indicating that a form input is optional.")
|
||||||
.font(.callout)
|
.font(.callout)
|
||||||
.foregroundColor(DamusColors.mediumGrey)
|
.foregroundColor(DamusColors.mediumGrey)
|
||||||
|
} else {
|
||||||
|
Text("required", comment: "Label indicating that a form input is required.")
|
||||||
|
.font(.callout)
|
||||||
|
.foregroundColor(DamusColors.mediumGrey)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,6 +45,8 @@ struct EventView: View {
|
|||||||
}
|
}
|
||||||
} else if event.known_kind == .longform {
|
} else if event.known_kind == .longform {
|
||||||
LongformPreview(state: damus, ev: event, options: options)
|
LongformPreview(state: damus, ev: event, options: options)
|
||||||
|
} else if event.known_kind == .highlight {
|
||||||
|
HighlightView(state: damus, event: event, options: options)
|
||||||
} else {
|
} else {
|
||||||
TextEvent(damus: damus, event: event, pubkey: pubkey, options: options)
|
TextEvent(damus: damus, event: event, pubkey: pubkey, options: options)
|
||||||
//.padding([.top], 6)
|
//.padding([.top], 6)
|
||||||
|
|||||||
@@ -16,7 +16,15 @@ struct ReplyPart: View {
|
|||||||
var body: some View {
|
var body: some View {
|
||||||
Group {
|
Group {
|
||||||
if let reply_ref = event.thread_reply()?.reply {
|
if let reply_ref = event.thread_reply()?.reply {
|
||||||
ReplyDescription(event: event, replying_to: events.lookup(reply_ref.note_id), ndb: ndb)
|
let replying_to = events.lookup(reply_ref.note_id)
|
||||||
|
if event.known_kind != .highlight {
|
||||||
|
ReplyDescription(event: event, replying_to: replying_to, ndb: ndb)
|
||||||
|
} else if event.known_kind == .highlight {
|
||||||
|
HighlightDescription(event: event, highlighted_event: replying_to, ndb: ndb)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
EmptyView()
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
EmptyView()
|
EmptyView()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,6 +35,8 @@ struct EventBody: View {
|
|||||||
if !options.contains(.truncate_content) {
|
if !options.contains(.truncate_content) {
|
||||||
note_content
|
note_content
|
||||||
}
|
}
|
||||||
|
} else if event.known_kind == .highlight {
|
||||||
|
HighlightBodyView(state: damus_state, ev: event, options: options)
|
||||||
} else {
|
} else {
|
||||||
note_content
|
note_content
|
||||||
}
|
}
|
||||||
|
|||||||
53
damus/Views/Events/Highlight/HighlightDescription.swift
Normal file
53
damus/Views/Events/Highlight/HighlightDescription.swift
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
//
|
||||||
|
// HighlightDescription.swift
|
||||||
|
// damus
|
||||||
|
//
|
||||||
|
// Created by eric on 4/28/24.
|
||||||
|
//
|
||||||
|
|
||||||
|
import SwiftUI
|
||||||
|
|
||||||
|
// Modified from Reply Description
|
||||||
|
struct HighlightDescription: View {
|
||||||
|
let event: NostrEvent
|
||||||
|
let highlighted_event: NostrEvent?
|
||||||
|
let ndb: Ndb
|
||||||
|
|
||||||
|
var body: some View {
|
||||||
|
(Text(Image(systemName: "highlighter")) + Text(verbatim: " \(highlight_desc(ndb: ndb, event: event, highlighted_event: highlighted_event))"))
|
||||||
|
.font(.footnote)
|
||||||
|
.foregroundColor(.gray)
|
||||||
|
.frame(maxWidth: .infinity, alignment: .leading)
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
struct HighlightDescription_Previews: PreviewProvider {
|
||||||
|
static var previews: some View {
|
||||||
|
HighlightDescription(event: test_note, highlighted_event: test_note, ndb: test_damus_state.ndb)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func highlight_desc(ndb: Ndb, event: NostrEvent, highlighted_event: NostrEvent?, locale: Locale = Locale.current) -> String {
|
||||||
|
let desc = make_reply_description(event, replying_to: highlighted_event)
|
||||||
|
let pubkeys = desc.pubkeys
|
||||||
|
|
||||||
|
let bundle = bundleForLocale(locale: locale)
|
||||||
|
|
||||||
|
if pubkeys.count == 0 {
|
||||||
|
return NSLocalizedString("Highlighted", bundle: bundle, comment: "Label to indicate that the user is highlighting their own post.")
|
||||||
|
}
|
||||||
|
|
||||||
|
guard let profile_txn = NdbTxn(ndb: ndb) else {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
let names: [String] = pubkeys.map { pk in
|
||||||
|
let prof = ndb.lookup_profile_with_txn(pk, txn: profile_txn)
|
||||||
|
|
||||||
|
return Profile.displayName(profile: prof?.profile, pubkey: pk).username.truncate(maxLength: 50)
|
||||||
|
}
|
||||||
|
|
||||||
|
let uniqueNames: [String] = Array(Set(names))
|
||||||
|
return String(format: NSLocalizedString("Highlighted %@", bundle: bundle, comment: "Label to indicate that the user is highlighting 1 user."), locale: locale, uniqueNames.first ?? "")
|
||||||
|
}
|
||||||
92
damus/Views/Events/Highlight/HighlightEventRef.swift
Normal file
92
damus/Views/Events/Highlight/HighlightEventRef.swift
Normal file
@@ -0,0 +1,92 @@
|
|||||||
|
//
|
||||||
|
// HighlightEventRef.swift
|
||||||
|
// damus
|
||||||
|
//
|
||||||
|
// Created by eric on 4/29/24.
|
||||||
|
//
|
||||||
|
|
||||||
|
import SwiftUI
|
||||||
|
import Kingfisher
|
||||||
|
|
||||||
|
struct HighlightEventRef: View {
|
||||||
|
let damus_state: DamusState
|
||||||
|
let event_ref: NoteId
|
||||||
|
|
||||||
|
init(damus_state: DamusState, event_ref: NoteId) {
|
||||||
|
self.damus_state = damus_state
|
||||||
|
self.event_ref = event_ref
|
||||||
|
}
|
||||||
|
|
||||||
|
struct FailedImage: View {
|
||||||
|
var body: some View {
|
||||||
|
Image("markdown")
|
||||||
|
.resizable()
|
||||||
|
.foregroundColor(DamusColors.neutral6)
|
||||||
|
.background(DamusColors.neutral3)
|
||||||
|
.frame(width: 35, height: 35)
|
||||||
|
.clipShape(RoundedRectangle(cornerRadius: 10))
|
||||||
|
.overlay(RoundedRectangle(cornerRadius: 10).stroke(.gray.opacity(0.5), lineWidth: 0.5))
|
||||||
|
.scaledToFit()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var body: some View {
|
||||||
|
EventLoaderView(damus_state: damus_state, event_id: event_ref) { event in
|
||||||
|
EventMutingContainerView(damus_state: damus_state, event: event) {
|
||||||
|
if event.known_kind == .longform {
|
||||||
|
HStack(alignment: .top, spacing: 10) {
|
||||||
|
let longform_event = LongformEvent.parse(from: event)
|
||||||
|
if let url = longform_event.image {
|
||||||
|
KFAnimatedImage(url)
|
||||||
|
.callbackQueue(.dispatch(.global(qos:.background)))
|
||||||
|
.backgroundDecode(true)
|
||||||
|
.imageContext(.note, disable_animation: true)
|
||||||
|
.image_fade(duration: 0.25)
|
||||||
|
.cancelOnDisappear(true)
|
||||||
|
.configure { view in
|
||||||
|
view.framePreloadCount = 3
|
||||||
|
}
|
||||||
|
.background {
|
||||||
|
FailedImage()
|
||||||
|
}
|
||||||
|
.frame(width: 35, height: 35)
|
||||||
|
.clipShape(RoundedRectangle(cornerRadius: 10))
|
||||||
|
.overlay(RoundedRectangle(cornerRadius: 10).stroke(.gray.opacity(0.5), lineWidth: 0.5))
|
||||||
|
.scaledToFit()
|
||||||
|
} else {
|
||||||
|
FailedImage()
|
||||||
|
}
|
||||||
|
|
||||||
|
VStack(alignment: .leading, spacing: 5) {
|
||||||
|
Text(longform_event.title ?? "Untitled")
|
||||||
|
.font(.system(size: 14, weight: .bold))
|
||||||
|
.lineLimit(1)
|
||||||
|
|
||||||
|
let profile_txn = damus_state.profiles.lookup(id: longform_event.event.pubkey, txn_name: "highlight-profile")
|
||||||
|
let profile = profile_txn?.unsafeUnownedValue
|
||||||
|
|
||||||
|
if let display_name = profile?.display_name {
|
||||||
|
Text(display_name)
|
||||||
|
.font(.system(size: 12))
|
||||||
|
.foregroundColor(.gray)
|
||||||
|
} else if let name = profile?.name {
|
||||||
|
Text(name)
|
||||||
|
.font(.system(size: 12))
|
||||||
|
.foregroundColor(.gray)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.padding([.leading, .vertical], 7)
|
||||||
|
.frame(maxWidth: .infinity, alignment: .leading)
|
||||||
|
.cornerRadius(10)
|
||||||
|
.overlay(
|
||||||
|
RoundedRectangle(cornerRadius: 10)
|
||||||
|
.stroke(DamusColors.neutral3, lineWidth: 2)
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
EmptyView()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
101
damus/Views/Events/Highlight/HighlightLink.swift
Normal file
101
damus/Views/Events/Highlight/HighlightLink.swift
Normal file
@@ -0,0 +1,101 @@
|
|||||||
|
//
|
||||||
|
// HighlightLink.swift
|
||||||
|
// damus
|
||||||
|
//
|
||||||
|
// Created by eric on 4/28/24.
|
||||||
|
//
|
||||||
|
|
||||||
|
import SwiftUI
|
||||||
|
import Kingfisher
|
||||||
|
|
||||||
|
struct HighlightLink: View {
|
||||||
|
let state: DamusState
|
||||||
|
let url: URL
|
||||||
|
let content: String
|
||||||
|
@Environment(\.openURL) var openURL
|
||||||
|
|
||||||
|
func text_fragment_url() -> URL? {
|
||||||
|
let fragmentDirective = "#:~:"
|
||||||
|
let textDirective = "text="
|
||||||
|
let separator = ","
|
||||||
|
var text = ""
|
||||||
|
|
||||||
|
let components = content.components(separatedBy: " ")
|
||||||
|
if components.count <= 10 {
|
||||||
|
text = content
|
||||||
|
} else {
|
||||||
|
let textStart = Array(components.prefix(5)).joined(separator: " ")
|
||||||
|
let textEnd = Array(components.suffix(2)).joined(separator: " ")
|
||||||
|
text = textStart + separator + textEnd
|
||||||
|
}
|
||||||
|
|
||||||
|
let url_with_fragments = url.absoluteString + fragmentDirective + textDirective + text
|
||||||
|
return URL(string: url_with_fragments)
|
||||||
|
}
|
||||||
|
|
||||||
|
func get_url_icon() -> URL? {
|
||||||
|
var icon = URL(string: url.absoluteString + "/favicon.ico")
|
||||||
|
if let url_host = url.host() {
|
||||||
|
icon = URL(string: "https://" + url_host + "/favicon.ico")
|
||||||
|
}
|
||||||
|
return icon
|
||||||
|
}
|
||||||
|
|
||||||
|
var body: some View {
|
||||||
|
Button(action: {
|
||||||
|
openURL(text_fragment_url() ?? url)
|
||||||
|
}, label: {
|
||||||
|
HStack(spacing: 10) {
|
||||||
|
if let url = get_url_icon() {
|
||||||
|
KFAnimatedImage(url)
|
||||||
|
.imageContext(.pfp, disable_animation: true)
|
||||||
|
.cancelOnDisappear(true)
|
||||||
|
.configure { view in
|
||||||
|
view.framePreloadCount = 3
|
||||||
|
}
|
||||||
|
.placeholder { _ in
|
||||||
|
Image("link")
|
||||||
|
.resizable()
|
||||||
|
.padding(5)
|
||||||
|
.foregroundColor(DamusColors.neutral6)
|
||||||
|
.background(DamusColors.adaptableWhite)
|
||||||
|
}
|
||||||
|
.frame(width: 35, height: 35)
|
||||||
|
.clipShape(RoundedRectangle(cornerRadius: 10))
|
||||||
|
.scaledToFit()
|
||||||
|
} else {
|
||||||
|
Image("link")
|
||||||
|
.resizable()
|
||||||
|
.padding(5)
|
||||||
|
.foregroundColor(DamusColors.neutral6)
|
||||||
|
.background(DamusColors.adaptableWhite)
|
||||||
|
.frame(width: 35, height: 35)
|
||||||
|
.clipShape(RoundedRectangle(cornerRadius: 10))
|
||||||
|
}
|
||||||
|
|
||||||
|
Text(url.absoluteString)
|
||||||
|
.font(eventviewsize_to_font(.normal, font_size: state.settings.font_size))
|
||||||
|
.foregroundColor(DamusColors.adaptableBlack)
|
||||||
|
.truncationMode(.tail)
|
||||||
|
.lineLimit(1)
|
||||||
|
}
|
||||||
|
.padding([.leading, .vertical], 7)
|
||||||
|
.frame(maxWidth: .infinity, alignment: .leading)
|
||||||
|
.background(DamusColors.neutral3)
|
||||||
|
.cornerRadius(10)
|
||||||
|
.overlay(
|
||||||
|
RoundedRectangle(cornerRadius: 10)
|
||||||
|
.stroke(DamusColors.neutral3, lineWidth: 2)
|
||||||
|
)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
struct HighlightLink_Previews: PreviewProvider {
|
||||||
|
static var previews: some View {
|
||||||
|
let url = URL(string: "https://damus.io")!
|
||||||
|
VStack {
|
||||||
|
HighlightLink(state: test_damus_state, url: url, content: "")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
78
damus/Views/Events/Highlight/HighlightPostView.swift
Normal file
78
damus/Views/Events/Highlight/HighlightPostView.swift
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
//
|
||||||
|
// HighlightPostView.swift
|
||||||
|
// damus
|
||||||
|
//
|
||||||
|
// Created by eric on 5/26/24.
|
||||||
|
//
|
||||||
|
|
||||||
|
import SwiftUI
|
||||||
|
|
||||||
|
struct HighlightPostView: View {
|
||||||
|
let damus_state: DamusState
|
||||||
|
let event: NostrEvent
|
||||||
|
@Binding var selectedText: String
|
||||||
|
|
||||||
|
@Environment(\.dismiss) var dismiss
|
||||||
|
|
||||||
|
var body: some View {
|
||||||
|
VStack(alignment: .leading, spacing: 0) {
|
||||||
|
VStack {
|
||||||
|
HStack(spacing: 5.0) {
|
||||||
|
Button(action: {
|
||||||
|
dismiss()
|
||||||
|
}, label: {
|
||||||
|
Text("Cancel", comment: "Button to cancel out of highlighting a note.")
|
||||||
|
.padding(10)
|
||||||
|
})
|
||||||
|
.buttonStyle(NeutralButtonStyle())
|
||||||
|
|
||||||
|
Spacer()
|
||||||
|
|
||||||
|
Button(NSLocalizedString("Post", comment: "Button to post a highlight.")) {
|
||||||
|
var tags: [[String]] = [ ["e", "\(self.event.id)"] ]
|
||||||
|
tags.append(["context", self.event.content])
|
||||||
|
|
||||||
|
let kind = NostrKind.highlight.rawValue
|
||||||
|
guard let ev = NostrEvent(content: selectedText, keypair: damus_state.keypair, kind: kind, tags: tags) else {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
damus_state.postbox.send(ev)
|
||||||
|
dismiss()
|
||||||
|
}
|
||||||
|
.bold()
|
||||||
|
.buttonStyle(GradientButtonStyle(padding: 10))
|
||||||
|
}
|
||||||
|
|
||||||
|
Divider()
|
||||||
|
.foregroundColor(DamusColors.neutral3)
|
||||||
|
.padding(.top, 5)
|
||||||
|
}
|
||||||
|
.frame(height: 30)
|
||||||
|
.padding()
|
||||||
|
.padding(.top, 15)
|
||||||
|
|
||||||
|
HStack {
|
||||||
|
var attributedString: AttributedString {
|
||||||
|
var attributedString = AttributedString(self.event.content)
|
||||||
|
|
||||||
|
if let range = attributedString.range(of: selectedText) {
|
||||||
|
attributedString[range].backgroundColor = DamusColors.highlight
|
||||||
|
}
|
||||||
|
|
||||||
|
return attributedString
|
||||||
|
}
|
||||||
|
|
||||||
|
Text(attributedString)
|
||||||
|
.lineSpacing(5)
|
||||||
|
.padding(10)
|
||||||
|
}
|
||||||
|
.overlay(
|
||||||
|
RoundedRectangle(cornerRadius: 25).fill(DamusColors.highlight).frame(width: 4),
|
||||||
|
alignment: .leading
|
||||||
|
)
|
||||||
|
.padding()
|
||||||
|
|
||||||
|
Spacer()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
192
damus/Views/Events/Highlight/HighlightView.swift
Normal file
192
damus/Views/Events/Highlight/HighlightView.swift
Normal file
@@ -0,0 +1,192 @@
|
|||||||
|
//
|
||||||
|
// HighlightView.swift
|
||||||
|
// damus
|
||||||
|
//
|
||||||
|
// Created by eric on 4/22/24.
|
||||||
|
//
|
||||||
|
|
||||||
|
import SwiftUI
|
||||||
|
import Kingfisher
|
||||||
|
|
||||||
|
struct HighlightTruncatedText: View {
|
||||||
|
let attributedString: AttributedString
|
||||||
|
let maxChars: Int
|
||||||
|
|
||||||
|
init(attributedString: AttributedString, maxChars: Int = 360) {
|
||||||
|
self.attributedString = attributedString
|
||||||
|
self.maxChars = maxChars
|
||||||
|
}
|
||||||
|
|
||||||
|
var body: some View {
|
||||||
|
VStack(alignment: .leading) {
|
||||||
|
|
||||||
|
let truncatedAttributedString: AttributedString? = attributedString.truncateOrNil(maxLength: maxChars)
|
||||||
|
|
||||||
|
if let truncatedAttributedString {
|
||||||
|
Text(truncatedAttributedString)
|
||||||
|
.fixedSize(horizontal: false, vertical: true)
|
||||||
|
} else {
|
||||||
|
Text(attributedString)
|
||||||
|
.fixedSize(horizontal: false, vertical: true)
|
||||||
|
}
|
||||||
|
|
||||||
|
if truncatedAttributedString != nil {
|
||||||
|
Spacer()
|
||||||
|
Button(NSLocalizedString("Show more", comment: "Button to show entire note.")) { }
|
||||||
|
.allowsHitTesting(false)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
struct HighlightBodyView: View {
|
||||||
|
let state: DamusState
|
||||||
|
let event: HighlightEvent
|
||||||
|
let options: EventViewOptions
|
||||||
|
|
||||||
|
init(state: DamusState, ev: HighlightEvent, options: EventViewOptions) {
|
||||||
|
self.state = state
|
||||||
|
self.event = ev
|
||||||
|
self.options = options
|
||||||
|
}
|
||||||
|
|
||||||
|
init(state: DamusState, ev: NostrEvent, options: EventViewOptions) {
|
||||||
|
self.state = state
|
||||||
|
self.event = HighlightEvent.parse(from: ev)
|
||||||
|
self.options = options
|
||||||
|
}
|
||||||
|
|
||||||
|
var body: some View {
|
||||||
|
Group {
|
||||||
|
if options.contains(.wide) {
|
||||||
|
Main.padding(.horizontal)
|
||||||
|
} else {
|
||||||
|
Main
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var truncate: Bool {
|
||||||
|
return options.contains(.truncate_content)
|
||||||
|
}
|
||||||
|
|
||||||
|
var truncate_very_short: Bool {
|
||||||
|
return options.contains(.truncate_content_very_short)
|
||||||
|
}
|
||||||
|
|
||||||
|
func truncatedText(attributedString: AttributedString) -> some View {
|
||||||
|
Group {
|
||||||
|
if truncate_very_short {
|
||||||
|
HighlightTruncatedText(attributedString: attributedString, maxChars: 140)
|
||||||
|
.font(eventviewsize_to_font(.normal, font_size: state.settings.font_size))
|
||||||
|
}
|
||||||
|
else if truncate {
|
||||||
|
HighlightTruncatedText(attributedString: attributedString)
|
||||||
|
.font(eventviewsize_to_font(.normal, font_size: state.settings.font_size))
|
||||||
|
} else {
|
||||||
|
Text(attributedString)
|
||||||
|
.font(eventviewsize_to_font(.normal, font_size: state.settings.font_size))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var Main: some View {
|
||||||
|
VStack(alignment: .leading, spacing: 0) {
|
||||||
|
HStack {
|
||||||
|
var attributedString: AttributedString {
|
||||||
|
var attributedString: AttributedString = ""
|
||||||
|
if let context = event.context {
|
||||||
|
if context.count < event.event.content.count {
|
||||||
|
attributedString = AttributedString(event.event.content)
|
||||||
|
} else {
|
||||||
|
attributedString = AttributedString(context)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
attributedString = AttributedString(event.event.content)
|
||||||
|
}
|
||||||
|
|
||||||
|
if let range = attributedString.range(of: event.event.content) {
|
||||||
|
attributedString[range].backgroundColor = DamusColors.highlight
|
||||||
|
}
|
||||||
|
return attributedString
|
||||||
|
}
|
||||||
|
|
||||||
|
truncatedText(attributedString: attributedString)
|
||||||
|
.lineSpacing(5)
|
||||||
|
.padding(10)
|
||||||
|
}
|
||||||
|
.overlay(
|
||||||
|
RoundedRectangle(cornerRadius: 25).fill(DamusColors.highlight).frame(width: 4),
|
||||||
|
alignment: .leading
|
||||||
|
)
|
||||||
|
.padding(.bottom, 10)
|
||||||
|
|
||||||
|
if let url = event.url_ref {
|
||||||
|
HighlightLink(state: state, url: url, content: event.event.content)
|
||||||
|
} else {
|
||||||
|
if let evRef = event.event_ref {
|
||||||
|
if let eventHex = hex_decode_id(evRef) {
|
||||||
|
HighlightEventRef(damus_state: state, event_ref: NoteId(eventHex))
|
||||||
|
.padding(.top, 5)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
struct HighlightView: View {
|
||||||
|
let state: DamusState
|
||||||
|
let event: HighlightEvent
|
||||||
|
let options: EventViewOptions
|
||||||
|
|
||||||
|
init(state: DamusState, event: NostrEvent, options: EventViewOptions) {
|
||||||
|
self.state = state
|
||||||
|
self.event = HighlightEvent.parse(from: event)
|
||||||
|
self.options = options.union(.no_mentions)
|
||||||
|
}
|
||||||
|
|
||||||
|
var body: some View {
|
||||||
|
VStack(alignment: .leading) {
|
||||||
|
EventShell(state: state, event: event.event, options: options) {
|
||||||
|
HighlightBodyView(state: state, ev: event, options: options)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
struct HighlightView_Previews: PreviewProvider {
|
||||||
|
static var previews: some View {
|
||||||
|
|
||||||
|
let content = "Nostr, a decentralized and open social network protocol. Without ads, toxic algorithms, or censorship"
|
||||||
|
let context = "Damus is built on Nostr, a decentralized and open social network protocol. Without ads, toxic algorithms, or censorship, Damus gives you access to the social network that a truly free and healthy society needs — and deserves."
|
||||||
|
|
||||||
|
let test_highlight_event = HighlightEvent.parse(from: NostrEvent(
|
||||||
|
content: content,
|
||||||
|
keypair: test_keypair,
|
||||||
|
kind: NostrKind.highlight.rawValue,
|
||||||
|
tags: [
|
||||||
|
["context", context],
|
||||||
|
["r", "https://damus.io"],
|
||||||
|
["p", "32e1827635450ebb3c5a7d12c1f8e7b2b514439ac10a67eef3d9fd9c5c68e245"],
|
||||||
|
])!
|
||||||
|
)
|
||||||
|
|
||||||
|
let test_highlight_event2 = HighlightEvent.parse(from: NostrEvent(
|
||||||
|
content: content,
|
||||||
|
keypair: test_keypair,
|
||||||
|
kind: NostrKind.highlight.rawValue,
|
||||||
|
tags: [
|
||||||
|
["context", context],
|
||||||
|
["e", "36017b098859d62e1dbd802290d59c9de9f18bb0ca00ba4b875c2930dd5891ae"],
|
||||||
|
["p", "32e1827635450ebb3c5a7d12c1f8e7b2b514439ac10a67eef3d9fd9c5c68e245"],
|
||||||
|
])!
|
||||||
|
)
|
||||||
|
VStack {
|
||||||
|
HighlightView(state: test_damus_state, event: test_highlight_event.event, options: [])
|
||||||
|
|
||||||
|
HighlightView(state: test_damus_state, event: test_highlight_event2.event, options: [.wide])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -24,7 +24,7 @@ struct LongformView: View {
|
|||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
EventShell(state: state, event: event.event, options: options) {
|
EventShell(state: state, event: event.event, options: options) {
|
||||||
SelectableText(attributedString: AttributedString(stringLiteral: event.title ?? "Untitled"), size: .title)
|
SelectableText(damus_state: state, event: event.event, attributedString: AttributedString(stringLiteral: event.title ?? "Untitled"), size: .title)
|
||||||
|
|
||||||
NoteContentView(damus_state: state, event: event.event, blur_images: false, size: .selected, options: options)
|
NoteContentView(damus_state: state, event: event.event, blur_images: false, size: .selected, options: options)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,7 +41,16 @@ struct SelectedEventView: View {
|
|||||||
.lineLimit(1)
|
.lineLimit(1)
|
||||||
|
|
||||||
if let reply_ref = event.thread_reply()?.reply {
|
if let reply_ref = event.thread_reply()?.reply {
|
||||||
ReplyDescription(event: event, replying_to: damus.events.lookup(reply_ref.note_id), ndb: damus.ndb)
|
let replying_to = damus.events.lookup(reply_ref.note_id)
|
||||||
|
if event.known_kind == .highlight {
|
||||||
|
HighlightDescription(event: event, highlighted_event: replying_to, ndb: damus.ndb)
|
||||||
|
.padding(.horizontal)
|
||||||
|
} else {
|
||||||
|
ReplyDescription(event: event, replying_to: replying_to, ndb: damus.ndb)
|
||||||
|
.padding(.horizontal)
|
||||||
|
}
|
||||||
|
} else if event.known_kind == .highlight {
|
||||||
|
HighlightDescription(event: event, highlighted_event: nil, ndb: damus.ndb)
|
||||||
.padding(.horizontal)
|
.padding(.horizontal)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -62,8 +62,9 @@ struct LoginView: View {
|
|||||||
var body: some View {
|
var body: some View {
|
||||||
ZStack(alignment: .top) {
|
ZStack(alignment: .top) {
|
||||||
VStack {
|
VStack {
|
||||||
|
Spacer()
|
||||||
|
|
||||||
SignInHeader()
|
SignInHeader()
|
||||||
.padding(.top, 100)
|
|
||||||
|
|
||||||
SignInEntry(key: $key, shouldSaveKey: $shouldSaveKey)
|
SignInEntry(key: $key, shouldSaveKey: $shouldSaveKey)
|
||||||
|
|
||||||
@@ -112,8 +113,9 @@ struct LoginView: View {
|
|||||||
Spacer()
|
Spacer()
|
||||||
}
|
}
|
||||||
.padding()
|
.padding()
|
||||||
|
.padding(.bottom, 50)
|
||||||
}
|
}
|
||||||
.background(DamusBackground(maxHeight: 350), alignment: .top)
|
.background(DamusBackground(maxHeight: UIScreen.main.bounds.size.height/2), alignment: .top)
|
||||||
.onAppear {
|
.onAppear {
|
||||||
credential_handler.check_credentials()
|
credential_handler.check_credentials()
|
||||||
}
|
}
|
||||||
@@ -320,9 +322,13 @@ struct KeyInput: View {
|
|||||||
}
|
}
|
||||||
.padding(.vertical, 2)
|
.padding(.vertical, 2)
|
||||||
.padding(.horizontal, 10)
|
.padding(.horizontal, 10)
|
||||||
.overlay {
|
.background {
|
||||||
RoundedRectangle(cornerRadius: 12)
|
RoundedRectangle(cornerRadius: 12)
|
||||||
.stroke(.gray, lineWidth: 1)
|
.stroke(.gray, lineWidth: 1)
|
||||||
|
.background {
|
||||||
|
RoundedRectangle(cornerRadius: 12)
|
||||||
|
.foregroundColor(.damusAdaptableWhite)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -337,11 +343,12 @@ struct SignInHeader: View {
|
|||||||
.padding(.bottom)
|
.padding(.bottom)
|
||||||
|
|
||||||
Text("Sign in", comment: "Title of view to log into an account.")
|
Text("Sign in", comment: "Title of view to log into an account.")
|
||||||
|
.foregroundColor(DamusColors.neutral6)
|
||||||
.font(.system(size: 32, weight: .bold))
|
.font(.system(size: 32, weight: .bold))
|
||||||
.padding(.bottom, 5)
|
.padding(.bottom, 5)
|
||||||
|
|
||||||
Text("Welcome to the social network you control", comment: "Welcome text")
|
Text("Welcome to the social network you control", comment: "Welcome text")
|
||||||
.foregroundColor(Color("DamusMediumGrey"))
|
.foregroundColor(DamusColors.neutral6)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -353,6 +360,7 @@ struct SignInEntry: View {
|
|||||||
var body: some View {
|
var body: some View {
|
||||||
VStack(alignment: .leading) {
|
VStack(alignment: .leading) {
|
||||||
Text("Enter your account key", comment: "Prompt for user to enter an account key to login.")
|
Text("Enter your account key", comment: "Prompt for user to enter an account key to login.")
|
||||||
|
.foregroundColor(DamusColors.neutral6)
|
||||||
.fontWeight(.medium)
|
.fontWeight(.medium)
|
||||||
.padding(.top, 30)
|
.padding(.top, 30)
|
||||||
|
|
||||||
@@ -444,7 +452,9 @@ struct LoginView_Previews: PreviewProvider {
|
|||||||
let bech32_pubkey = "KeyInput"
|
let bech32_pubkey = "KeyInput"
|
||||||
Group {
|
Group {
|
||||||
LoginView(key: pubkey, nav: .init())
|
LoginView(key: pubkey, nav: .init())
|
||||||
|
.previewDevice(PreviewDevice(rawValue: "iPhone SE (3rd generation)"))
|
||||||
LoginView(key: bech32_pubkey, nav: .init())
|
LoginView(key: bech32_pubkey, nav: .init())
|
||||||
|
.previewDevice(PreviewDevice(rawValue: "iPhone 15 Pro Max"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -132,10 +132,10 @@ struct NoteContentView: View {
|
|||||||
VStack(alignment: .leading) {
|
VStack(alignment: .leading) {
|
||||||
if size == .selected {
|
if size == .selected {
|
||||||
if with_padding {
|
if with_padding {
|
||||||
SelectableText(attributedString: artifacts.content.attributed, size: self.size)
|
SelectableText(damus_state: damus_state, event: self.event, attributedString: artifacts.content.attributed, size: self.size)
|
||||||
.padding(.horizontal)
|
.padding(.horizontal)
|
||||||
} else {
|
} else {
|
||||||
SelectableText(attributedString: artifacts.content.attributed, size: self.size)
|
SelectableText(damus_state: damus_state, event: self.event, attributedString: artifacts.content.attributed, size: self.size)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if with_padding {
|
if with_padding {
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ struct AboutView: View {
|
|||||||
Group {
|
Group {
|
||||||
if let about_string {
|
if let about_string {
|
||||||
let truncated_about = show_full_about ? about_string : about_string.truncateOrNil(maxLength: max_about_length)
|
let truncated_about = show_full_about ? about_string : about_string.truncateOrNil(maxLength: max_about_length)
|
||||||
SelectableText(attributedString: truncated_about ?? about_string, textAlignment: self.text_alignment, size: .subheadline)
|
SelectableText(damus_state: state, event: nil, attributedString: truncated_about ?? about_string, textAlignment: self.text_alignment, size: .subheadline)
|
||||||
|
|
||||||
if truncated_about != nil {
|
if truncated_about != nil {
|
||||||
if show_full_about {
|
if show_full_about {
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
|
import Kingfisher
|
||||||
|
|
||||||
class ImageUploadingObserver: ObservableObject {
|
class ImageUploadingObserver: ObservableObject {
|
||||||
@Published var isLoading: Bool = false
|
@Published var isLoading: Bool = false
|
||||||
@@ -14,6 +15,8 @@ class ImageUploadingObserver: ObservableObject {
|
|||||||
struct EditPictureControl: View {
|
struct EditPictureControl: View {
|
||||||
let uploader: MediaUploader
|
let uploader: MediaUploader
|
||||||
let pubkey: Pubkey
|
let pubkey: Pubkey
|
||||||
|
var size: CGFloat? = 25
|
||||||
|
var setup: Bool? = false
|
||||||
@Binding var image_url: URL?
|
@Binding var image_url: URL?
|
||||||
@ObservedObject var uploadObserver: ImageUploadingObserver
|
@ObservedObject var uploadObserver: ImageUploadingObserver
|
||||||
let callback: (URL?) -> Void
|
let callback: (URL?) -> Void
|
||||||
@@ -43,20 +46,53 @@ struct EditPictureControl: View {
|
|||||||
if uploadObserver.isLoading {
|
if uploadObserver.isLoading {
|
||||||
ProgressView()
|
ProgressView()
|
||||||
.progressViewStyle(CircularProgressViewStyle(tint: DamusColors.purple))
|
.progressViewStyle(CircularProgressViewStyle(tint: DamusColors.purple))
|
||||||
|
.frame(width: size, height: size)
|
||||||
.padding(10)
|
.padding(10)
|
||||||
.background(DamusColors.white.opacity(0.7))
|
.background(DamusColors.white.opacity(0.7))
|
||||||
.clipShape(Circle())
|
.clipShape(Circle())
|
||||||
.shadow(color: DamusColors.purple, radius: 15, x: 0, y: 0)
|
.shadow(color: DamusColors.purple, radius: 15, x: 0, y: 0)
|
||||||
|
} else if let url = image_url {
|
||||||
|
KFAnimatedImage(url)
|
||||||
|
.imageContext(.pfp, disable_animation: false)
|
||||||
|
.onFailure(fallbackUrl: URL(string: robohash(pubkey)), cacheKey: url.absoluteString)
|
||||||
|
.cancelOnDisappear(true)
|
||||||
|
.configure { view in
|
||||||
|
view.framePreloadCount = 3
|
||||||
|
}
|
||||||
|
.scaledToFill()
|
||||||
|
.frame(width: (size ?? 25) + 10, height: (size ?? 25) + 10)
|
||||||
|
.foregroundColor(DamusColors.white)
|
||||||
|
.clipShape(Circle())
|
||||||
|
.overlay(Circle().stroke(.white, lineWidth: 4))
|
||||||
} else {
|
} else {
|
||||||
Image("camera")
|
if setup ?? false {
|
||||||
.resizable()
|
Image(systemName: "person")
|
||||||
.scaledToFit()
|
.resizable()
|
||||||
.frame(width: 25, height: 25)
|
.scaledToFit()
|
||||||
.foregroundColor(DamusColors.purple)
|
.frame(width: size, height: size)
|
||||||
.padding(10)
|
.foregroundColor(DamusColors.white)
|
||||||
.background(DamusColors.white.opacity(0.7))
|
.padding(20)
|
||||||
.clipShape(Circle())
|
.clipShape(Circle())
|
||||||
.shadow(color: DamusColors.purple, radius: 15, x: 0, y: 0)
|
.background {
|
||||||
|
Circle()
|
||||||
|
.fill(PinkGradient, strokeBorder: .white, lineWidth: 4)
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
Image("camera")
|
||||||
|
.resizable()
|
||||||
|
.scaledToFit()
|
||||||
|
.frame(width: size, height: size)
|
||||||
|
.foregroundColor(DamusColors.purple)
|
||||||
|
.padding(10)
|
||||||
|
.background(DamusColors.white.opacity(0.7))
|
||||||
|
.clipShape(Circle())
|
||||||
|
.background {
|
||||||
|
Circle()
|
||||||
|
.fill(DamusColors.purple, strokeBorder: .white, lineWidth: 2)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.sheet(isPresented: $show_camera) {
|
.sheet(isPresented: $show_camera) {
|
||||||
@@ -110,7 +146,7 @@ struct EditPictureControl_Previews: PreviewProvider {
|
|||||||
let observer = ImageUploadingObserver()
|
let observer = ImageUploadingObserver()
|
||||||
ZStack {
|
ZStack {
|
||||||
Color.gray
|
Color.gray
|
||||||
EditPictureControl(uploader: .nostrBuild, pubkey: test_pubkey, image_url: url, uploadObserver: observer) { _ in
|
EditPictureControl(uploader: .nostrBuild, pubkey: test_pubkey, size: 100, setup: false, image_url: url, uploadObserver: observer) { _ in
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ struct ReactionsView: View {
|
|||||||
var body: some View {
|
var body: some View {
|
||||||
ScrollView {
|
ScrollView {
|
||||||
LazyVStack {
|
LazyVStack {
|
||||||
ForEach(model.events.events, id: \.id) { ev in
|
ForEach(model.events.events.filter { $0.last_refid() == model.target }, id: \.id) { ev in
|
||||||
ReactionView(damus_state: damus_state, reaction: ev)
|
ReactionView(damus_state: damus_state, reaction: ev)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,8 +11,6 @@ import Security
|
|||||||
struct SaveKeysView: View {
|
struct SaveKeysView: View {
|
||||||
let account: CreateAccountModel
|
let account: CreateAccountModel
|
||||||
let pool: RelayPool = RelayPool(ndb: Ndb()!)
|
let pool: RelayPool = RelayPool(ndb: Ndb()!)
|
||||||
@State var pub_copied: Bool = false
|
|
||||||
@State var priv_copied: Bool = false
|
|
||||||
@State var loading: Bool = false
|
@State var loading: Bool = false
|
||||||
@State var error: String? = nil
|
@State var error: String? = nil
|
||||||
|
|
||||||
@@ -31,81 +29,98 @@ struct SaveKeysView: View {
|
|||||||
var body: some View {
|
var body: some View {
|
||||||
ZStack(alignment: .top) {
|
ZStack(alignment: .top) {
|
||||||
VStack(alignment: .center) {
|
VStack(alignment: .center) {
|
||||||
|
|
||||||
|
Spacer()
|
||||||
|
|
||||||
|
Image("logo-nobg")
|
||||||
|
.resizable()
|
||||||
|
.shadow(color: DamusColors.purple, radius: 2)
|
||||||
|
.frame(width: 56, height: 56, alignment: .center)
|
||||||
|
.padding(.top, 20.0)
|
||||||
|
|
||||||
if account.rendered_name.isEmpty {
|
if account.rendered_name.isEmpty {
|
||||||
Text("Welcome!", comment: "Text to welcome user.")
|
Text("Welcome!", comment: "Text to welcome user.")
|
||||||
.font(.title.bold())
|
.font(.title)
|
||||||
.padding(.bottom, 10)
|
.fontWeight(.heavy)
|
||||||
|
.foregroundStyle(DamusLogoGradient.gradient)
|
||||||
} else {
|
} else {
|
||||||
Text("Welcome, \(account.rendered_name)!", comment: "Text to welcome user.")
|
Text("Welcome, \(account.rendered_name)!", comment: "Text to welcome user.")
|
||||||
.font(.title.bold())
|
.font(.title)
|
||||||
.padding(.bottom, 10)
|
.fontWeight(.heavy)
|
||||||
|
.foregroundStyle(DamusLogoGradient.gradient)
|
||||||
}
|
}
|
||||||
|
|
||||||
Text("Before we get started, you'll need to save your account info, otherwise you won't be able to login in the future if you ever uninstall Damus.", comment: "Reminder to user that they should save their account information.")
|
Text("Save your login info?", comment: "Ask user if they want to save their account information.")
|
||||||
.padding(.bottom, 10)
|
.font(.title)
|
||||||
|
.fontWeight(.heavy)
|
||||||
|
.foregroundColor(DamusColors.neutral6)
|
||||||
|
.padding(.top, 5)
|
||||||
|
|
||||||
Text("Private Key", comment: "Label to indicate that the text below is the user's private key used by only the user themself as a secret to login to access their account.")
|
Text("We'll save your account key, so you won't need to enter it manually next time you log in.", comment: "Reminder to user that they should save their account information.")
|
||||||
.font(.title2.bold())
|
.font(.system(size: 14))
|
||||||
.padding(.bottom, 10)
|
.foregroundColor(DamusColors.neutral6)
|
||||||
|
.padding(.top, 2)
|
||||||
|
.padding(.bottom, 100)
|
||||||
|
.multilineTextAlignment(.center)
|
||||||
|
|
||||||
Text("This is your secret account key. You need this to access your account. Don't share this with anyone! Save it in a password manager and keep it safe!", comment: "Label to describe that a private key is the user's secret account key and what they should do with it.")
|
Spacer()
|
||||||
.padding(.bottom, 10)
|
|
||||||
|
|
||||||
SaveKeyView(text: account.privkey.nsec, textContentType: .newPassword, is_copied: $priv_copied, focus: $privkey_focused)
|
if loading {
|
||||||
.padding(.bottom, 10)
|
ProgressView()
|
||||||
|
.progressViewStyle(.circular)
|
||||||
|
} else if let err = error {
|
||||||
|
Text("Error: \(err)", comment: "Error message indicating why saving keys failed.")
|
||||||
|
.foregroundColor(.red)
|
||||||
|
|
||||||
if priv_copied {
|
Button(action: {
|
||||||
if loading {
|
complete_account_creation(account)
|
||||||
ProgressView()
|
}) {
|
||||||
.progressViewStyle(.circular)
|
HStack {
|
||||||
} else if let err = error {
|
Text("Retry", comment: "Button to retry completing account creation after an error occurred.")
|
||||||
Text("Error: \(err)", comment: "Error message indicating why saving keys failed.")
|
.fontWeight(.semibold)
|
||||||
.foregroundColor(.red)
|
|
||||||
|
|
||||||
Button(action: {
|
|
||||||
complete_account_creation(account)
|
|
||||||
}) {
|
|
||||||
HStack {
|
|
||||||
Text("Retry", comment: "Button to retry completing account creation after an error occurred.")
|
|
||||||
.fontWeight(.semibold)
|
|
||||||
}
|
|
||||||
.frame(minWidth: 300, maxWidth: .infinity, maxHeight: 12, alignment: .center)
|
|
||||||
}
|
}
|
||||||
.buttonStyle(GradientButtonStyle())
|
.frame(minWidth: 300, maxWidth: .infinity, maxHeight: 12, alignment: .center)
|
||||||
.padding(.top, 20)
|
|
||||||
} else {
|
|
||||||
Button(action: {
|
|
||||||
complete_account_creation(account)
|
|
||||||
}) {
|
|
||||||
HStack {
|
|
||||||
Text("Let's go!", comment: "Button to complete account creation and start using the app.")
|
|
||||||
.fontWeight(.semibold)
|
|
||||||
}
|
|
||||||
.frame(minWidth: 300, maxWidth: .infinity, maxHeight: 12, alignment: .center)
|
|
||||||
}
|
|
||||||
.buttonStyle(GradientButtonStyle())
|
|
||||||
.padding(.top, 20)
|
|
||||||
}
|
}
|
||||||
|
.buttonStyle(GradientButtonStyle())
|
||||||
|
.padding(.top, 20)
|
||||||
|
} else {
|
||||||
|
|
||||||
|
Button(action: {
|
||||||
|
save_key(account)
|
||||||
|
complete_account_creation(account)
|
||||||
|
}) {
|
||||||
|
HStack {
|
||||||
|
Text("Save", comment: "Button to save key, complete account creation, and start using the app.")
|
||||||
|
.fontWeight(.semibold)
|
||||||
|
}
|
||||||
|
.frame(minWidth: 300, maxWidth: .infinity, maxHeight: 12, alignment: .center)
|
||||||
|
}
|
||||||
|
.buttonStyle(GradientButtonStyle())
|
||||||
|
.padding(.top, 20)
|
||||||
|
|
||||||
|
Button(action: {
|
||||||
|
complete_account_creation(account)
|
||||||
|
}) {
|
||||||
|
HStack {
|
||||||
|
Text("Not now", comment: "Button to not save key, complete account creation, and start using the app.")
|
||||||
|
.fontWeight(.semibold)
|
||||||
|
}
|
||||||
|
.frame(minWidth: 300, maxWidth: .infinity, maxHeight: 12, alignment: .center)
|
||||||
|
}
|
||||||
|
.buttonStyle(NeutralButtonStyle(padding: EdgeInsets(top: 15, leading: 15, bottom: 15, trailing: 15), cornerRadius: 12))
|
||||||
|
.padding(.top, 20)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.padding(20)
|
.padding(20)
|
||||||
}
|
}
|
||||||
.background(
|
.background(DamusBackground(maxHeight: UIScreen.main.bounds.size.height/2), alignment: .top)
|
||||||
Image("eula-bg")
|
|
||||||
.resizable()
|
|
||||||
.blur(radius: 70)
|
|
||||||
.ignoresSafeArea(),
|
|
||||||
alignment: .top
|
|
||||||
)
|
|
||||||
.navigationBarBackButtonHidden(true)
|
.navigationBarBackButtonHidden(true)
|
||||||
.navigationBarItems(leading: BackNav())
|
.navigationBarItems(leading: BackNav())
|
||||||
.onAppear {
|
|
||||||
// Hack to force keyboard to show up for a short moment and then hiding it to register password autofill flow.
|
}
|
||||||
pubkey_focused = true
|
|
||||||
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
|
func save_key(_ account: CreateAccountModel) {
|
||||||
pubkey_focused = false
|
credential_handler.save_credential(pubkey: account.pubkey, privkey: account.privkey)
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func complete_account_creation(_ account: CreateAccountModel) {
|
func complete_account_creation(_ account: CreateAccountModel) {
|
||||||
@@ -123,8 +138,6 @@ struct SaveKeysView: View {
|
|||||||
|
|
||||||
self.pool.register_handler(sub_id: "signup", handler: handle_event)
|
self.pool.register_handler(sub_id: "signup", handler: handle_event)
|
||||||
|
|
||||||
credential_handler.save_credential(pubkey: account.pubkey, privkey: account.privkey)
|
|
||||||
|
|
||||||
self.loading = true
|
self.loading = true
|
||||||
|
|
||||||
self.pool.connect()
|
self.pool.connect()
|
||||||
@@ -188,74 +201,13 @@ struct SaveKeysView: View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct SaveKeyView: View {
|
|
||||||
let text: String
|
|
||||||
let textContentType: UITextContentType
|
|
||||||
@Binding var is_copied: Bool
|
|
||||||
var focus: FocusState<Bool>.Binding
|
|
||||||
|
|
||||||
func copy_text() {
|
|
||||||
UIPasteboard.general.string = text
|
|
||||||
is_copied = true
|
|
||||||
}
|
|
||||||
|
|
||||||
var body: some View {
|
|
||||||
HStack {
|
|
||||||
Spacer()
|
|
||||||
VStack {
|
|
||||||
spacerBlock(width: 0, height: 0)
|
|
||||||
Button(action: copy_text) {
|
|
||||||
Label("", image: is_copied ? "check-circle.fill" : "copy2")
|
|
||||||
.foregroundColor(is_copied ? .green : .gray)
|
|
||||||
.background {
|
|
||||||
if is_copied {
|
|
||||||
Circle()
|
|
||||||
.foregroundColor(.white)
|
|
||||||
.frame(width: 25, height: 25, alignment: .center)
|
|
||||||
.padding(.leading, -8)
|
|
||||||
.padding(.top, 1)
|
|
||||||
} else {
|
|
||||||
EmptyView()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
TextField("", text: .constant(text))
|
|
||||||
.padding(5)
|
|
||||||
.background {
|
|
||||||
RoundedRectangle(cornerRadius: 4.0).opacity(0.1)
|
|
||||||
}
|
|
||||||
.textSelection(.enabled)
|
|
||||||
.font(.callout.monospaced())
|
|
||||||
.onTapGesture {
|
|
||||||
copy_text()
|
|
||||||
// Hack to force keyboard to hide. Showing keyboard on text field is necessary to register password autofill flow but the text itself should not be modified.
|
|
||||||
DispatchQueue.main.async {
|
|
||||||
end_editing()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.textContentType(textContentType)
|
|
||||||
.deleteDisabled(true)
|
|
||||||
.focused(focus)
|
|
||||||
|
|
||||||
spacerBlock(width: 0, height: 0) /// set a 'width' > 0 here to vary key Text's aspect ratio
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@ViewBuilder private func spacerBlock(width: CGFloat, height: CGFloat) -> some View {
|
|
||||||
Color.orange.opacity(1)
|
|
||||||
.frame(width: width, height: height)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
struct SaveKeysView_Previews: PreviewProvider {
|
struct SaveKeysView_Previews: PreviewProvider {
|
||||||
static var previews: some View {
|
static var previews: some View {
|
||||||
let model = CreateAccountModel(real: "William", nick: "jb55", about: "I'm me")
|
let model = CreateAccountModel(display_name: "William", name: "jb55", about: "I'm me")
|
||||||
SaveKeysView(account: model)
|
SaveKeysView(account: model)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func create_account_to_metadata(_ model: CreateAccountModel) -> Profile {
|
func create_account_to_metadata(_ model: CreateAccountModel) -> Profile {
|
||||||
return Profile(name: model.nick_name, display_name: model.real_name, about: model.about, picture: model.profile_image?.absoluteString, banner: nil, website: nil, lud06: nil, lud16: nil, nip05: nil, damus_donation: nil)
|
return Profile(name: model.name, display_name: model.display_name, about: model.about, picture: model.profile_image?.absoluteString, banner: nil, website: nil, lud06: nil, lud16: nil, nip05: nil, damus_donation: nil)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,22 +6,20 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
import MCEmojiPicker
|
import EmojiPicker
|
||||||
|
import EmojiKit
|
||||||
|
|
||||||
struct ReactionsSettingsView: View {
|
struct ReactionsSettingsView: View {
|
||||||
@ObservedObject var settings: UserSettingsStore
|
@ObservedObject var settings: UserSettingsStore
|
||||||
|
let damus_state: DamusState
|
||||||
@State private var isReactionsVisible: Bool = false
|
@State private var isReactionsVisible: Bool = false
|
||||||
|
|
||||||
|
@State private var selectedEmoji: Emoji? = nil
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
Form {
|
Form {
|
||||||
Section {
|
Section {
|
||||||
Text(settings.default_emoji_reaction)
|
Text(settings.default_emoji_reaction)
|
||||||
.emojiPicker(
|
|
||||||
isPresented: $isReactionsVisible,
|
|
||||||
selectedEmoji: $settings.default_emoji_reaction,
|
|
||||||
arrowDirection: .up,
|
|
||||||
isDismissAfterChoosing: true
|
|
||||||
)
|
|
||||||
.onTapGesture {
|
.onTapGesture {
|
||||||
isReactionsVisible = true
|
isReactionsVisible = true
|
||||||
}
|
}
|
||||||
@@ -31,43 +29,23 @@ struct ReactionsSettingsView: View {
|
|||||||
}
|
}
|
||||||
.navigationTitle(NSLocalizedString("Reactions", comment: "Title of emoji reactions view"))
|
.navigationTitle(NSLocalizedString("Reactions", comment: "Title of emoji reactions view"))
|
||||||
.navigationBarTitleDisplayMode(.large)
|
.navigationBarTitleDisplayMode(.large)
|
||||||
|
.sheet(isPresented: $isReactionsVisible) {
|
||||||
|
NavigationView {
|
||||||
|
EmojiPickerView(selectedEmoji: $selectedEmoji, emojiProvider: damus_state.emoji_provider)
|
||||||
|
}
|
||||||
|
.presentationDetents([.medium, .large])
|
||||||
|
}
|
||||||
|
.onChange(of: selectedEmoji) { newEmoji in
|
||||||
|
guard let newEmoji else {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
settings.default_emoji_reaction = newEmoji.value
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// From: https://stackoverflow.com/a/39425959
|
|
||||||
extension Character {
|
|
||||||
/// A simple emoji is one scalar and presented to the user as an Emoji
|
|
||||||
var isSimpleEmoji: Bool {
|
|
||||||
guard let firstScalar = unicodeScalars.first else { return false }
|
|
||||||
return firstScalar.properties.isEmoji && firstScalar.value > 0x238C
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Checks if the scalars will be merged into an emoji
|
|
||||||
var isCombinedIntoEmoji: Bool { unicodeScalars.count > 1 && unicodeScalars.first?.properties.isEmoji ?? false }
|
|
||||||
|
|
||||||
var isEmoji: Bool { isSimpleEmoji || isCombinedIntoEmoji }
|
|
||||||
}
|
|
||||||
|
|
||||||
extension String {
|
|
||||||
var isSingleEmoji: Bool { count == 1 && containsEmoji }
|
|
||||||
|
|
||||||
var containsEmoji: Bool { contains { $0.isEmoji } }
|
|
||||||
|
|
||||||
var containsOnlyEmoji: Bool { !isEmpty && !contains { !$0.isEmoji } }
|
|
||||||
|
|
||||||
var emojiString: String { emojis.map { String($0) }.reduce("", +) }
|
|
||||||
|
|
||||||
var emojis: [Character] { filter { $0.isEmoji } }
|
|
||||||
|
|
||||||
var emojiScalars: [UnicodeScalar] { filter { $0.isEmoji }.flatMap { $0.unicodeScalars } }
|
|
||||||
}
|
|
||||||
|
|
||||||
func isValidEmoji(_ string: String) -> Bool {
|
|
||||||
return string.isSingleEmoji
|
|
||||||
}
|
|
||||||
|
|
||||||
struct ReactionsSettingsView_Previews: PreviewProvider {
|
struct ReactionsSettingsView_Previews: PreviewProvider {
|
||||||
static var previews: some View {
|
static var previews: some View {
|
||||||
ReactionsSettingsView(settings: UserSettingsStore())
|
ReactionsSettingsView(settings: UserSettingsStore(), damus_state: test_damus_state)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,32 +28,53 @@ struct SetupView: View {
|
|||||||
.fontWeight(.heavy)
|
.fontWeight(.heavy)
|
||||||
.foregroundStyle(DamusLogoGradient.gradient)
|
.foregroundStyle(DamusLogoGradient.gradient)
|
||||||
|
|
||||||
Text("The go-to iOS Nostr client", comment: "Quick description of what Damus is")
|
Text("The social network you control", comment: "Quick description of what Damus is")
|
||||||
.foregroundColor(DamusColors.mediumGrey)
|
.foregroundColor(DamusColors.neutral6)
|
||||||
.padding(.top, 10)
|
.padding(.top, 10)
|
||||||
|
|
||||||
WhatIsNostr()
|
|
||||||
.padding()
|
|
||||||
|
|
||||||
WhyWeNeedNostr()
|
|
||||||
.padding()
|
|
||||||
|
|
||||||
Spacer()
|
Spacer()
|
||||||
|
|
||||||
|
Button(action: {
|
||||||
|
navigationCoordinator.push(route: Route.CreateAccount)
|
||||||
|
}) {
|
||||||
|
HStack {
|
||||||
|
Text("Create Account", comment: "Button to continue to the create account page.")
|
||||||
|
.fontWeight(.semibold)
|
||||||
|
}
|
||||||
|
.frame(minWidth: 300, maxWidth: .infinity, maxHeight: 12, alignment: .center)
|
||||||
|
}
|
||||||
|
.buttonStyle(GradientButtonStyle())
|
||||||
|
.padding(.horizontal)
|
||||||
|
|
||||||
Button(action: {
|
Button(action: {
|
||||||
navigationCoordinator.push(route: Route.Login)
|
navigationCoordinator.push(route: Route.Login)
|
||||||
}) {
|
}) {
|
||||||
HStack {
|
HStack {
|
||||||
Text("Let's get started!", comment: "Button to continue to login page.")
|
Text("Sign In", comment: "Button to continue to login page.")
|
||||||
.fontWeight(.semibold)
|
.fontWeight(.semibold)
|
||||||
}
|
}
|
||||||
.frame(minWidth: 300, maxWidth: .infinity, maxHeight: 12, alignment: .center)
|
.frame(minWidth: 300, maxWidth: .infinity, maxHeight: 12, alignment: .center)
|
||||||
}
|
}
|
||||||
.buttonStyle(GradientButtonStyle())
|
.buttonStyle(GradientButtonStyle())
|
||||||
.padding()
|
.padding()
|
||||||
|
|
||||||
|
HStack(spacing: 0) {
|
||||||
|
Text("By continuing you agree to our ")
|
||||||
|
.font(.subheadline)
|
||||||
|
.foregroundColor(DamusColors.neutral6)
|
||||||
|
|
||||||
|
Button(action: {
|
||||||
|
navigationCoordinator.push(route: Route.EULA)
|
||||||
|
}, label: {
|
||||||
|
Text("EULA", comment: "End User License Agreement")
|
||||||
|
.font(.subheadline)
|
||||||
|
})
|
||||||
|
.padding(.vertical, 5)
|
||||||
|
}
|
||||||
|
.padding(.bottom)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.background(DamusBackground(maxHeight: 300), alignment: .top)
|
.background(DamusBackground(maxHeight: UIScreen.main.bounds.size.height/2), alignment: .top)
|
||||||
.navigationDestination(for: Route.self) { route in
|
.navigationDestination(for: Route.self) { route in
|
||||||
route.view(navigationCoordinator: navigationCoordinator, damusState: DamusState.empty)
|
route.view(navigationCoordinator: navigationCoordinator, damusState: DamusState.empty)
|
||||||
}
|
}
|
||||||
@@ -63,61 +84,6 @@ struct SetupView: View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct LearnAboutNostrLink: View {
|
|
||||||
@Environment(\.openURL) var openURL
|
|
||||||
var body: some View {
|
|
||||||
HStack {
|
|
||||||
Button(action: {
|
|
||||||
openURL(URL(string: "https://nostr.com")!)
|
|
||||||
}, label: {
|
|
||||||
Text("Learn more about Nostr", comment: "Button that opens up a webpage where the user can learn more about Nostr.")
|
|
||||||
.foregroundColor(.accentColor)
|
|
||||||
})
|
|
||||||
|
|
||||||
Image(systemName: "arrow.up.right")
|
|
||||||
.font(.footnote)
|
|
||||||
.foregroundColor(.accentColor)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
struct WhatIsNostr: View {
|
|
||||||
var body: some View {
|
|
||||||
HStack(alignment: .top) {
|
|
||||||
Image("nostr-logo")
|
|
||||||
VStack(alignment: .leading) {
|
|
||||||
Text("What is Nostr?", comment: "Heading text for section describing what is Nostr.")
|
|
||||||
.fontWeight(.bold)
|
|
||||||
.padding(.vertical, 10)
|
|
||||||
|
|
||||||
Text("Nostr is a protocol, designed for simplicity, that aims to create a censorship-resistant global social network", comment: "Description about what is Nostr.")
|
|
||||||
.foregroundColor(DamusColors.mediumGrey)
|
|
||||||
|
|
||||||
LearnAboutNostrLink()
|
|
||||||
.padding(.top, 10)
|
|
||||||
}
|
|
||||||
Spacer()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
struct WhyWeNeedNostr: View {
|
|
||||||
var body: some View {
|
|
||||||
HStack(alignment: .top) {
|
|
||||||
Image("lightbulb")
|
|
||||||
VStack(alignment: .leading) {
|
|
||||||
Text("Why we need Nostr?", comment: "Heading text for section describing why Nostr is needed.")
|
|
||||||
.fontWeight(.bold)
|
|
||||||
.padding(.vertical, 10)
|
|
||||||
|
|
||||||
Text("Social media has developed into a key way information flows around the world. Unfortunately, our current social media systems are broken", comment: "Description about why Nostr is needed.")
|
|
||||||
.foregroundColor(DamusColors.mediumGrey)
|
|
||||||
}
|
|
||||||
Spacer()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
struct SetupView_Previews: PreviewProvider {
|
struct SetupView_Previews: PreviewProvider {
|
||||||
static var previews: some View {
|
static var previews: some View {
|
||||||
Group {
|
Group {
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
@testable import damus
|
@testable import damus
|
||||||
|
import EmojiPicker
|
||||||
|
|
||||||
// Generates a test damus state with configurable mock parameters
|
// Generates a test damus state with configurable mock parameters
|
||||||
func generate_test_damus_state(
|
func generate_test_damus_state(
|
||||||
@@ -50,7 +51,9 @@ func generate_test_damus_state(
|
|||||||
music: .init(onChange: {_ in }),
|
music: .init(onChange: {_ in }),
|
||||||
video: .init(),
|
video: .init(),
|
||||||
ndb: ndb,
|
ndb: ndb,
|
||||||
quote_reposts: .init(our_pubkey: our_pubkey) )
|
quote_reposts: .init(our_pubkey: our_pubkey),
|
||||||
|
emoji_provider: DefaultEmojiProvider(showAllVariations: false)
|
||||||
|
)
|
||||||
|
|
||||||
return damus
|
return damus
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ extension NdbNote {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func get_cached_inner_event(cache: EventCache) -> NdbNote? {
|
func get_cached_inner_event(cache: EventCache) -> NdbNote? {
|
||||||
guard self.known_kind == .boost else {
|
guard self.known_kind == .boost || self.known_kind == .highlight else {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -277,7 +277,7 @@ class NdbNote: Encodable, Equatable, Hashable {
|
|||||||
// Extension to make NdbNote compatible with NostrEvent's original API
|
// Extension to make NdbNote compatible with NostrEvent's original API
|
||||||
extension NdbNote {
|
extension NdbNote {
|
||||||
var is_textlike: Bool {
|
var is_textlike: Bool {
|
||||||
return kind == 1 || kind == 42 || kind == 30023
|
return kind == 1 || kind == 42 || kind == 30023 || kind == 9802
|
||||||
}
|
}
|
||||||
|
|
||||||
var is_quote_repost: NoteId? {
|
var is_quote_repost: NoteId? {
|
||||||
|
|||||||
Reference in New Issue
Block a user