App/use whitelisted addresses for points (#1408)

* feat: enhance PointHistoryList and ProveScreen with disclosure event handling

- Updated PointHistoryList to include loading of disclosure events on refresh.
- Enhanced ProveScreen to set user's points address if not already defined.
- Added endpoint field to ProofHistory and database schema for better tracking.
- Introduced utility functions for fetching whitelisted disclosure addresses and managing disclosure events.

* fix: update navigation flow in PointsNavBar and GratificationScreen

- Changed navigation action in PointsNavBar from `goBack` to `navigate('Home')` for a more direct user experience.
- Updated GratificationScreen to navigate to 'Points' instead of going back, enhancing the flow after user interactions.
- Replaced the ArrowLeft icon with a new X icon for better visual consistency.
This commit is contained in:
turnoffthiscomputer
2025-11-12 23:35:38 +01:00
committed by GitHub
parent 87a81a50d5
commit 67eb0d46e4
11 changed files with 215 additions and 38 deletions

View File

@@ -31,7 +31,7 @@ export const PointsNavBar = (props: NativeStackHeaderProps) => {
color={black}
onPress={() => {
buttonTap();
props.navigation.goBack();
props.navigation.navigate('Home');
}}
/>
<View flex={1} alignItems="center" justifyContent="center">

View File

@@ -68,15 +68,15 @@ export const PointHistoryList: React.FC<PointHistoryListProps> = ({
}) => {
const selfClient = useSelfClient();
const [refreshing, setRefreshing] = useState(false);
// Subscribe to events directly from store - component will auto-update when store changes
const pointEvents = usePointEventStore(state => state.getAllPointEvents());
const isLoading = usePointEventStore(state => state.isLoading);
const refreshPoints = usePointEventStore(state => state.refreshPoints);
const refreshIncomingPoints = usePointEventStore(
state => state.refreshIncomingPoints,
);
// loadEvents only needs to be called once on mount.
// and it is called in Points.ts
const loadDisclosureEvents = usePointEventStore(
state => state.loadDisclosureEvents,
);
const formatDate = (timestamp: number) => {
return new Date(timestamp).toLocaleTimeString([], {
@@ -271,14 +271,15 @@ export const PointHistoryList: React.FC<PointHistoryListProps> = ({
[],
);
// Pull-to-refresh handler
const onRefresh = useCallback(() => {
selfClient.trackEvent(PointEvents.REFRESH_HISTORY);
setRefreshing(true);
Promise.all([refreshPoints(), refreshIncomingPoints()]).finally(() =>
setRefreshing(false),
);
}, [selfClient, refreshPoints, refreshIncomingPoints]);
Promise.all([
refreshPoints(),
refreshIncomingPoints(),
loadDisclosureEvents(),
]).finally(() => setRefreshing(false));
}, [selfClient, refreshPoints, refreshIncomingPoints, loadDisclosureEvents]);
const keyExtractor = useCallback((item: PointEvent) => item.id, []);