mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-18 01:49:40 +02:00
Move inactive projects out of active workspace: - bauntown (community website) - maerchenzauber (AI story generation) - memoro (voice memo app) - news (news aggregation) - nutriphi (nutrition tracking) - reader (reading app) - uload (URL shortener) - wisekeep (AI wisdom extraction) Update CLAUDE.md documentation: - Add presi to active projects - Document archived projects section - Update workspace configuration Archived apps can be re-activated by moving back to apps/ 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
72 lines
2 KiB
TypeScript
72 lines
2 KiB
TypeScript
import { useState, useCallback } from 'react';
|
|
import { Alert, Linking } from 'react-native';
|
|
import { useTranslation } from 'react-i18next';
|
|
import { ratingService } from '../services/ratingService';
|
|
import useNotification from '~/features/notifications/useNotification';
|
|
import { NotificationChannel } from '~/features/notifications/types';
|
|
|
|
export const useRating = () => {
|
|
const { t } = useTranslation();
|
|
const { showNotification } = useNotification();
|
|
const [isRequesting, setIsRequesting] = useState(false);
|
|
|
|
const requestRating = useCallback(async () => {
|
|
if (isRequesting) return;
|
|
|
|
try {
|
|
setIsRequesting(true);
|
|
|
|
// Check if in-app review is available
|
|
const isAvailable = await ratingService.isAvailable();
|
|
|
|
if (isAvailable) {
|
|
// Request the in-app review
|
|
const success = await ratingService.requestReview();
|
|
|
|
if (success) {
|
|
// Show a thank you notification
|
|
showNotification({
|
|
title: t('rating.thank_you_title', 'Vielen Dank!'),
|
|
body: t('rating.thank_you_message', 'Deine Unterstützung bedeutet uns viel!'),
|
|
channelType: NotificationChannel.FUNCTIONAL,
|
|
});
|
|
}
|
|
} else {
|
|
// Fallback: Show alert with option to open store
|
|
Alert.alert(
|
|
t('rating.rate_app_title', 'App bewerten'),
|
|
t('rating.rate_app_message', 'Möchtest du Memoro im App Store bewerten?'),
|
|
[
|
|
{
|
|
text: t('common.cancel', 'Abbrechen'),
|
|
style: 'cancel',
|
|
},
|
|
{
|
|
text: t('rating.open_store', 'Zum Store'),
|
|
onPress: () => {
|
|
const storeUrl = ratingService.getStoreUrl();
|
|
if (storeUrl) {
|
|
Linking.openURL(storeUrl);
|
|
}
|
|
},
|
|
},
|
|
]
|
|
);
|
|
}
|
|
} catch (error) {
|
|
console.error('Error requesting rating:', error);
|
|
showNotification({
|
|
title: t('common.error', 'Fehler'),
|
|
body: t('rating.error_message', 'Bewertung konnte nicht angefordert werden.'),
|
|
channelType: NotificationChannel.FUNCTIONAL,
|
|
});
|
|
} finally {
|
|
setIsRequesting(false);
|
|
}
|
|
}, [isRequesting, t, showNotification]);
|
|
|
|
return {
|
|
requestRating,
|
|
isRequesting,
|
|
};
|
|
};
|