Skip to content

Commit

Permalink
feat: add share button on XAppInfoOverlay
Browse files Browse the repository at this point in the history
  • Loading branch information
N3TC4T committed Sep 26, 2024
1 parent d66c1a7 commit 461537c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
16 changes: 15 additions & 1 deletion src/screens/Modal/XAppBrowser/XAppBrowserModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
InteractionManager,
Linking,
NativeEventSubscription,
Share,
Share as RNShare,
Text,
View,
Expand Down Expand Up @@ -805,6 +806,18 @@ class XAppBrowserModal extends Component<Props, State> {
});
};

shareXApp = () => {
const { app } = this.state;

const { identifier, title } = app!;

Share.share({
title,
message: `https://${HOSTNAME}/detect/xapp:${identifier}`,
url: undefined,
});
};

lunchMonetization = () => {
const profile = ProfileRepository.getProfile();

Expand All @@ -829,8 +842,9 @@ class XAppBrowserModal extends Component<Props, State> {
identifier,
title: title!,
icon: icon!,
displayButtonTypes: [DisplayButtonTypes.DONATION],
displayButtonTypes: [DisplayButtonTypes.DONATION, DisplayButtonTypes.SHARE],
onDonationPress: this.openDonation,
onSharePress: this.shareXApp,
});
};

Expand Down
3 changes: 2 additions & 1 deletion src/screens/Overlay/XAppInfo/XAppInfoOverlay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ class XAppInfoOverlay extends Component<Props, State> {
const { displayButtonTypes } = this.props;

if (
!displayButtonTypes?.includes(DisplayButtonTypes.OPEN) ||
!displayButtonTypes?.includes(DisplayButtonTypes.OPEN) &&
!displayButtonTypes?.includes(DisplayButtonTypes.SHARE)
) {
return null;
Expand All @@ -179,6 +179,7 @@ class XAppInfoOverlay extends Component<Props, State> {
style={AppStyles.flex1}
rounded
light
icon="IconShare"
label={Localize.t('global.share')}
onPress={this.onSharePress}
/>
Expand Down

0 comments on commit 461537c

Please sign in to comment.