feat(apps): الدراور على نمط سيرو — المكافآت والدعوات والمساعدة

جُرد دراور سيرو: 14 مدخلاً للراكب (map_menu_widget) و23 للسائق
(drawer_captain). بُني ما له نقطة فعلية على NestJS، والباقي مذكور صراحةً.

## مبنيّ
- **المكافآت** (features/rewards): GET /rewards/referrals و /rewards/coupons —
  كلاهما مُتحقَّق حيّاً. كود الدعوة يُنسخ ويُشارك، وعدّادات دعوتَهم/قيد
  التأكيد/مدفوعة. يقابل Promos + Invite Driver في سيرو
- **شارك التطبيق · قيّم التطبيق · سياسة الخصوصية · تطبيق الطرف الآخر** —
  أفعال محليّة بلا نقطة خادم (share_plus + url_launcher)
- **المساعدة** وُسّعت: أسئلة شائعة قابلة للطيّ · واتساب الدعم ·
  **فحص توافق الجهاز** (نمط سيرو) يفحص ما يُعطّل التطبيق فعلاً: خدمة الموقع
  وإذنها وإذن الإشعارات — أسباب حقيقية لشكوى «التطبيق لا يعمل»
- روابط المتجر والخصوصية والدعم صارت قيم بناء لكل مستأجر في BuildConfig

## غير مبنيّ — ولا نقطة خادم له
الشكاوى (R3 في الباكلوج) · الإحصاءات · التحدّيات ولوحة المتصدّرين · مركز
الصيانة · جدولي · التأمين الصحي (مؤجَّل بقرار المالك) · الطعام والمواصلات
(خارج النطاق، docs/39 §1). بناء واجهة بلا خادم يعني شاشة تكذب على المستخدم.

## سجلّ الإشعارات
سيرو يعرض قائمة إشعارات؛ الخادم يوفّر POST /notifications/token فقط بلا نقطة
سرد. لم تُبنَ شاشة قائمة على فراغ.

flutter analyze نظيف في التطبيقين.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Hamza-Ayed
2026-08-05 01:34:23 +03:00
co-authored by Claude Opus 5
parent 6a33cc7241
commit ca766a2d4e
27 changed files with 1406 additions and 48 deletions
@@ -1,4 +1,7 @@
import 'package:flutter/material.dart';
import 'package:geolocator/geolocator.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:url_launcher/url_launcher.dart';
import '../../../core/build_config.dart';
import '../../../core/design/tokens.dart';
@@ -7,35 +10,79 @@ import '../../../core/l10n/l10n.dart';
import '../../../core/ui/tripz_card.dart';
import '../../../core/ui/tripz_scaffold.dart';
/// المساعدة و«عن التطبيق». محتوى محلّي عمداً: الخادم لا يوفّر نقطة أسئلة
/// شائعة، وربطها بنصّ من الشبكة يعني شاشة فارغة حين ينقطع الاتصال — وهو
/// بالضبط الوقت الذي يفتح فيه المستخدم المساعدة.
/// المساعدة: أسئلة شائعة · تواصل · فحص توافق الجهاز · عن التطبيق.
///
/// المحتوى **محلّي عمداً**: الخادم لا يوفّر نقطة أسئلة شائعة، وربطها بالشبكة
/// يعني شاشة فارغة حين ينقطع الاتصال — وهو بالضبط الوقت الذي يفتح فيه
/// المستخدم المساعدة.
class SupportPage extends StatelessWidget {
const SupportPage({super.key});
@override
Widget build(BuildContext context) {
final l10n = context.l10n;
final faq = [
(l10n.supportFaqQ1, l10n.supportFaqA1),
(l10n.supportFaqQ2, l10n.supportFaqA2),
(l10n.supportFaqQ3, l10n.supportFaqA3),
(l10n.supportFaqQ4, l10n.supportFaqA4),
];
return TripzScaffold(
title: l10n.supportTitle,
child: ListView(
children: [
TripzCard(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(l10n.supportContact, style: context.texts.titleMedium),
const SizedBox(height: Space.xs),
Text(
l10n.supportWhatsapp,
style: context.texts.bodyMedium?.copyWith(
color: context.colors.onSurfaceVariant,
Text(l10n.supportFaq, style: context.texts.titleMedium),
const SizedBox(height: Space.xs),
for (final (q, a) in faq)
Card(
margin: const EdgeInsets.only(bottom: Space.xs),
child: ExpansionTile(
shape: const RoundedRectangleBorder(borderRadius: Radii.card_),
title: Text(q, style: context.texts.bodyMedium),
children: [
Padding(
padding: Space.page,
child: Text(
a,
style: context.texts.bodySmall?.copyWith(
color: context.colors.onSurfaceVariant,
),
),
),
),
],
),
),
const SizedBox(height: Space.lg),
Text(l10n.supportContact, style: context.texts.titleMedium),
const SizedBox(height: Space.xs),
TripzCard(
onTap: () => _openWhatsapp(BuildConfig.supportPhone),
child: Row(
children: [
Icon(Icons.chat_outlined, color: context.tripzColors.success),
const SizedBox(width: Space.sm),
Expanded(child: Text(l10n.supportWhatsapp)),
const Icon(Icons.chevron_left_rounded),
],
),
),
const SizedBox(height: Space.md),
TripzCard(
onTap: () => _showDeviceCheck(context),
child: Row(
children: [
const Icon(Icons.phonelink_setup_outlined),
const SizedBox(width: Space.sm),
Expanded(child: Text(l10n.supportDeviceCheck)),
const Icon(Icons.chevron_left_rounded),
],
),
),
const SizedBox(height: Space.lg),
TripzCard(
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
@@ -54,4 +101,69 @@ class SupportPage extends StatelessWidget {
),
);
}
static Future<void> _openWhatsapp(String phone) async {
final uri = Uri.parse('https://wa.me/$phone');
await launchUrl(uri, mode: LaunchMode.externalApplication);
}
/// فحص توافق الجهاز — نمط سيرو. يفحص ما يُعطّل التطبيق فعلاً: خدمة الموقع
/// وإذنها وإذن الإشعارات. أسبابٌ حقيقية لشكاوى «التطبيق لا يعمل».
static Future<void> _showDeviceCheck(BuildContext context) async {
final l10n = context.l10n;
final issues = <String>[];
if (!await Geolocator.isLocationServiceEnabled()) {
issues.add(l10n.rideNoLocation);
}
final locationPermission = await Permission.locationWhenInUse.status;
if (!locationPermission.isGranted && !locationPermission.isLimited) {
issues.add(l10n.permissionDeniedForever);
}
if (await Permission.notification.isDenied) {
issues.add(l10n.notifDenied);
}
if (!context.mounted) return;
showDialog<void>(
context: context,
builder: (context) => AlertDialog(
title: Text(l10n.supportDeviceCheck),
content: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: issues.isEmpty
? [
Row(children: [
Icon(Icons.check_circle_rounded,
color: context.tripzColors.success),
const SizedBox(width: Space.xs),
Expanded(child: Text(l10n.supportDeviceOk)),
]),
]
: [
Text(l10n.supportDeviceIssues),
const SizedBox(height: Space.xs),
for (final issue in issues)
Padding(
padding: const EdgeInsets.only(bottom: Space.xxs),
child: Row(children: [
Icon(Icons.error_outline_rounded,
size: Sizes.iconSm,
color: context.tripzColors.warning),
const SizedBox(width: Space.xs),
Expanded(child: Text(issue)),
]),
),
],
),
actions: [
TextButton(
onPressed: () => Navigator.of(context).pop(),
child: Text(l10n.actionContinue),
),
],
),
);
}
}