feat: N1d/N2/N3 + قانون فلاتر وإعادة ضبط تطبيق السائق
الباك إند: - تعيين أول أدمن صار يُنشئ المستخدم إن لم يوجد — كان يشترط دخولاً سابقاً، وهي بيضة ودجاجة تمنع الدخول إلى لوحة أي مستأجر جديد أصلاً. - OTP_DEV_MODE كان يفشل مفتوحاً (`!== 'false'`): غياب المتغيّر أو خطأ مطبعي يترك الإنتاج برمز ثابت يفتح كل حساب، ويحرس السحب المالي كذلك. صار `=== 'true'` في الإعداد وفي قارئَيه، مع تحذير عند الإقلاع. - N2: التحقّق من اللوغو عند الرفع (PNG/JPEG · 512+ · مربّع · سقف 5MB) عبر قراءة الترويسة بلا اعتمادية — بدل اكتشاف أيقونة ممطوطة بعد النشر. N3: السكربت يولّد build_config.dart بأعلام const (طبقات docs/22 §1.5)، ويضبط bundle IDs واسم التطبيق والأيقونات/splash، و--build يشغّل Shorebird. فلاتر: - docs/23: قانون مُلزِم للتطبيقين (البنية · Cubit · طبقة الشبكة · الأعلام). - السائق: أُزيل Dart القديم (GetX) مع الإبقاء على الأصيل والإضافات وشهادات التوقيع وShorebird وFirebase الخاص به، وأُعيد هيكلته مطابقاً للراكب. - طبقة الشبكة ترسل x-device-id وتجدّد التوكن عند 401 مرة واحدة فقط. - الحزم موحّدة بين التطبيقين، والـAPI https حصراً في الاثنين. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5
parent
3ab74a13a8
commit
de4bbd00ac
@@ -1,94 +0,0 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:sefer_driver/constant/box_name.dart';
|
||||
import 'package:sefer_driver/constant/links.dart';
|
||||
import 'package:sefer_driver/controller/functions/crud.dart';
|
||||
import 'package:sefer_driver/main.dart';
|
||||
import 'package:sefer_driver/views/widgets/error_snakbar.dart';
|
||||
import 'package:sefer_driver/views/widgets/mydialoug.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
// Import url_launcher to open the app store
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
class RatingController extends GetxController {
|
||||
var userRating = 0.obs;
|
||||
final comment = TextEditingController();
|
||||
void submitRating(int rating) {
|
||||
userRating.value = rating;
|
||||
|
||||
_saveRating(rating);
|
||||
}
|
||||
|
||||
void _redirectToAppStore() async {
|
||||
// URLs for App Store and Google Play Store
|
||||
const appStoreUrl =
|
||||
'https://apps.apple.com/st/app/intaleq-driver/id6482995159';
|
||||
const playStoreUrl =
|
||||
'https://play.google.com/store/apps/details?id=com.intaleq_driver';
|
||||
final url = GetPlatform.isIOS ? appStoreUrl : playStoreUrl;
|
||||
|
||||
if (await launchUrl(Uri.parse(url))) {
|
||||
await launchUrl(Uri.parse(url));
|
||||
} else {
|
||||
mySnackeBarError("Could not open the app store.");
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _saveRating(int rating) async {
|
||||
// Build the payload with user data
|
||||
final payload = {
|
||||
"name": box.read(BoxName.driverID) != null
|
||||
? box.read(BoxName.nameDriver)
|
||||
: box.read(BoxName.name),
|
||||
"email": (box.read(BoxName.emailDriver)).toString(),
|
||||
"phone": (box.read(BoxName.phoneDriver)).toString(),
|
||||
"userId": box.read(BoxName.driverID),
|
||||
"userType": "driver",
|
||||
"rating": rating.toString(),
|
||||
"comment": comment.text.isEmpty
|
||||
? 'nothing'
|
||||
: comment.text, // Get actual text from comment controller
|
||||
};
|
||||
|
||||
// Send the rating data to the backend
|
||||
var res = await CRUD().post(link: AppLink.addRateApp, payload: payload);
|
||||
|
||||
// Handle the response and check if it's JSON-formatted
|
||||
if (res != 'failure') {
|
||||
try {
|
||||
// Attempt to parse the response as JSON
|
||||
final parsedResponse = (res);
|
||||
|
||||
if (parsedResponse['status'] == 'success') {
|
||||
// Display a success message
|
||||
CRUD().post(link: AppLink.sendEmailRateingApp, payload: {
|
||||
"name": payload["name"],
|
||||
"email": payload["email"],
|
||||
"phone": payload["phone"],
|
||||
"rating": rating.toString(),
|
||||
"comment": payload["comment"],
|
||||
});
|
||||
MyDialog().getDialog('Rating submitted successfully'.tr, '', () {
|
||||
if (rating == 5) {
|
||||
Get.back();
|
||||
_redirectToAppStore();
|
||||
} else {
|
||||
Get.back();
|
||||
}
|
||||
});
|
||||
|
||||
// Send confirmation email if the rating was successfully submitted
|
||||
} else {
|
||||
mySnackeBarError('Failed to submit rating');
|
||||
}
|
||||
} catch (e) {
|
||||
// If JSON decoding fails, log the response directly
|
||||
// Get.snackbar('Success', 'Rating submitted successfully',
|
||||
// backgroundColor: AppColor.greenColor);
|
||||
}
|
||||
} else {
|
||||
mySnackeBarError('Failed to connect to the server');
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user