@@ -3,7 +3,7 @@ import { useIntl } from 'react-intl';
33import WebView from 'react-native-webview' ;
44import { Platform , View } from 'react-native' ;
55import { SafeAreaView } from 'react-native-safe-area-context' ;
6- import type { Operation } from '@ecency/sdk' ;
6+ import type { Operation , TransactionConfirmation } from '@ecency/sdk' ;
77import { hsOptions } from '../../constants/hsOptions' ;
88import styles from './hiveSignerModal.styles' ;
99import { ModalHeader } from '../modalHeader' ;
@@ -12,6 +12,7 @@ import { StatusContent } from '../hiveAuthModal/children/statusContent';
1212import AUTH_TYPE from '../../constants/authType' ;
1313import { useAppSelector } from '../../hooks' ;
1414import { selectCurrentAccount } from '../../redux/selectors' ;
15+ import { parseHiveSignerSignResult } from '../../utils/hiveSignerCallback' ;
1516
1617export const HiveSignerModal = ( { route, navigation } : any ) => {
1718 const intl = useIntl ( ) ;
@@ -104,30 +105,24 @@ export const HiveSignerModal = ({ route, navigation }: any) => {
104105 return ;
105106 }
106107
107- // Parse URL robustly to detect success
108- let isSuccess = false ;
109- try {
110- if ( url . includes ( '/sign/success' ) ) {
111- isSuccess = true ;
112- } else {
113- const parsedUrl = new URL ( url ) ;
114- const successParam = parsedUrl . searchParams . get ( 'success' ) ;
115- if ( successParam === 'true' ) {
116- isSuccess = true ;
117- }
118- }
119- } catch ( error ) {
120- // If URL parsing fails, fall back to includes check
121- if ( url . includes ( '?success=true' ) ) {
122- isSuccess = true ;
123- }
124- }
108+ const result = parseHiveSignerSignResult ( url , hsOptions . redirect_uri ) ;
125109
126- if ( isSuccess ) {
110+ if ( result ) {
127111 // Mark success as handled to prevent duplicate calls
128112 successHandledRef . current = true ;
129- // Transaction was successfully signed
130- onSuccessRef . current ?.( ) ;
113+ // Transaction was successfully signed. Pass the confirmation through when the
114+ // callback carried one: the SDK gates recordActivity on the transaction id, so
115+ // without it the action earns nothing and never reaches quest progress.
116+ onSuccessRef . current ?.(
117+ result . id
118+ ? ( {
119+ id : result . id ,
120+ block_num : result . blockNum ,
121+ trx_num : result . trxNum ,
122+ expired : false ,
123+ } as unknown as TransactionConfirmation )
124+ : undefined ,
125+ ) ;
131126 navigation . goBack ( ) ;
132127 }
133128 } ;
@@ -155,7 +150,15 @@ export const HiveSignerModal = ({ route, navigation }: any) => {
155150 return null ;
156151 }
157152
158- const _hsUri = `${ hsOptions . base_url } ${ hiveuri . substring ( 7 ) } ` ;
153+ // Ask HiveSigner to hand the broadcast result back. Without a redirect_uri (or a
154+ // callback baked into the uri) it simply stops on its own success page, which is why
155+ // the signing path never had a transaction id to record the point activity with. The
156+ // loopback URI is the one already registered for this client and used by the OAuth
157+ // login flow: the WebView never actually loads it, it only reads the query params off
158+ // the navigation attempt.
159+ const _hsUri = `${ hsOptions . base_url } ${ hiveuri . substring ( 7 ) } ${
160+ hiveuri . includes ( '?' ) ? '&' : '?'
161+ } redirect_uri=${ encodeURIComponent ( hsOptions . redirect_uri ) } `;
159162
160163 // Render HiveSigner WebView for HiveSigner operations
161164 return (
0 commit comments