feat: استيراد كود سيرو إلى تريبز (سيرو @ecfe7568) — بلا تعديل

قرار المالك 2026-07-27: باك إند سيرو PHP هو المعتمد، وتطبيقاته المجرّبة
ميدانياً تحل محل إعادة البناء المؤرشفة. سيرو نفسه لم يُمسّ.

الخريطة:
  backend · payment_server · loction_server · ride_server ·
  passenger_server · docker · dashboard · stress_test  → الجذر
  siro_rider  → apps/rider          siro_driver  → apps/driver
  siro_admin  → dashboards/admin    siro_service → dashboards/service
  android_bot → apps/android_bot    socialBot    → apps/socialBot

نُسخ المتعقَّب في git سيرو فقط عبر `git archive` (3,198 ملفاً / ~169 م.ب)
لا `cp -r` — فاستُثنيت مخلفات البناء تلقائياً. بلا أي تعديل محتوى عمداً:
كل ما يلي يصير فرقاً مقروءاً مقابل المصدر.

لم يُستورد وسببه: siromove.com (الموقع التسويقي يبقى marketing/ في تريبز،
سيرو فيه 8 ملفات) · docs و planning (تريبز له docs/ الخاص) · deploy.sh
(ليس نشراً على سيرفر بل `git add . && git push origin --all` — فخّ في
مستودع آخر) · transit_dashboard (بانتظار قرار مصير backend-transit و
dashboards/transit-web).

⚠️ لا يبني بعد — ثلاثة نواقص متوقعة ومقصودة:
1. `.env` و `lib/env/env.g.dart` غير متعقَّبين في سيرو (أسرار لكل مستأجر):
   كل تطبيق فلاتر يحتاج .env خاصاً ثم توليد env.g.dart بـ build_runner.
2. إعدادات Firebase (9 ملفات google-services.json و GoogleService-Info.plist)
   يستبعدها .gitignore تريبز — ولكل مستأجر مشروع Firebase خاص أصلاً.
3. apps/driver في سيرو يشير إلى `../../Intaleq/packages/get` خارج المستودع →
   يجب ضمّ الحزم داخله أسوة بـ apps/rider.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Hamza-Ayed
2026-07-27 05:14:13 +03:00
co-authored by Claude Opus 5
parent 9909d9b4c1
commit 4d8414c96b
3198 changed files with 766859 additions and 0 deletions
@@ -0,0 +1,155 @@
import 'dart:io';
import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:get_storage/src/storage_impl.dart';
import 'package:get_storage/src/read_write_value.dart';
import 'package:path_provider/path_provider.dart';
import 'utils/list_equality.dart';
void main() async {
TestWidgetsFlutterBinding.ensureInitialized();
late GetStorage g;
const channel = MethodChannel('plugins.flutter.io/path_provider');
void setUpMockChannels(MethodChannel channel) {
TestDefaultBinaryMessengerBinding.instance?.defaultBinaryMessenger
.setMockMethodCallHandler(
channel,
(MethodCall? methodCall) async {
if (methodCall?.method == 'getApplicationDocumentsDirectory') {
return '.';
}
return null;
},
);
}
setUpAll(() async {
setUpMockChannels(channel);
});
setUp(() async {
await GetStorage.init();
g = GetStorage();
await g.erase();
});
test('write, read listen, e removeListen', () async {
String valueListen = "";
g.write('test', 'a');
g.write('test2', 'a');
final removeListen = g.listenKey('test', (val) {
valueListen = val;
});
expect('a', g.read('test'));
await g.write('test', 'b');
expect('b', g.read<String>('test'));
expect('b', valueListen);
removeListen();
await g.write('test', 'c');
expect('c', g.read<String>('test'));
expect('b', valueListen);
await g.write('test', 'd');
expect('d', g.read<String>('test'));
});
test('Write and read', () {
var list = new List<int>.generate(50, (i) {
int count = i + 1;
g.write('write', count);
return count;
});
expect(list.last, g.read('write'));
});
test('Test backup and recover corrupted file', () async {
await g.write('write', 'abc');
expect('abc', g.read('write'));
final file = await _fileDb();
file.writeAsStringSync('ndj323e');
await GetStorage.init();
expect('abc', g.read('write'));
});
test('Write and read using delegate', () {
final data = 0.val('write');
var list = new List<int>.generate(50, (i) {
int count = i + 1;
data.val = count;
return count;
});
expect(list.last, data.val);
});
test('Write, read, remove and exists', () {
expect(null, g.read('write'));
var list = new List<int>.generate(50, (i) {
int count = i + 1;
g.write('write', count);
return count;
});
expect(list.last, g.read('write'));
g.remove('write');
expect(null, g.read('write'));
});
test('newContainer', () async {
final container1 = await GetStorage.init('container1');
await GetStorage.init('newContainer');
final newContainer = GetStorage('newContainer');
/// Attempting to start a Container that has already started must return the container already created.
var container2 = await GetStorage.init();
expect(container1 == container2, true);
newContainer.write('test', '1234');
g.write('test', 'a');
expect(g.read('test') == newContainer.read('test'), false);
});
group('get keys/values', () {
Function(Iterable, List) eq =
(i, l) => const ListEquality().equals(i.toList(), l);
test('should return their stored dynamic values', () {
expect(eq(g.getKeys().toList(), []), true);
expect(eq(g.getValues().toList(), []), true);
g.write('key1', 1);
expect(eq(g.getKeys(), ['key1']), true);
expect(eq(g.getValues(), [1]), true);
g.write('key2', 'a');
expect(eq(g.getKeys(), ['key1', 'key2']), true);
expect(eq(g.getValues(), [1, 'a']), true);
g.write('key3', 3.0);
expect(eq(g.getKeys(), ['key1', 'key2', 'key3']), true);
expect(eq(g.getValues(), [1, 'a', 3.0]), true);
});
});
}
Future<File> _fileDb(
{bool isBackup = false, String fileName = 'GetStorage'}) async {
final dir = await getApplicationDocumentsDirectory();
final _path = dir.path;
final _file =
isBackup ? File('$_path/$fileName.bak') : File('$_path/$fileName.gs');
return _file;
}
@@ -0,0 +1,71 @@
const int _HASH_MASK = 0x7fffffff;
class ListEquality<E> implements Equality<List<E>> {
final Equality<E> _elementEquality;
const ListEquality([Equality<E> elementEquality = const DefaultEquality()])
: _elementEquality = elementEquality;
@override
bool equals(List<E> list1, List<E> list2) {
if (identical(list1, list2)) return true;
var length = list1.length;
if (length != list2.length) return false;
for (var i = 0; i < length; i++) {
if (!_elementEquality.equals(list1[i], list2[i])) return false;
}
return true;
}
@override
int hash(List<E> list) {
// Jenkins's one-at-a-time hash function.
// This code is almost identical to the one in IterableEquality, except
// that it uses indexing instead of iterating to get the elements.
var hash = 0;
for (var i = 0; i < list.length; i++) {
var c = _elementEquality.hash(list[i]);
hash = (hash + c) & _HASH_MASK;
hash = (hash + (hash << 10)) & _HASH_MASK;
hash ^= (hash >> 6);
}
hash = (hash + (hash << 3)) & _HASH_MASK;
hash ^= (hash >> 11);
hash = (hash + (hash << 15)) & _HASH_MASK;
return hash;
}
@override
bool isValidKey(Object o) => o is List<E>;
}
abstract class Equality<E> {
const factory Equality() = DefaultEquality<E>;
/// Compare two elements for being equal.
///
/// This should be a proper equality relation.
bool equals(E e1, E e2);
/// Get a hashcode of an element.
///
/// The hashcode should be compatible with [equals], so that if
/// `equals(a, b)` then `hash(a) == hash(b)`.
int hash(E e);
/// Test whether an object is a valid argument to [equals] and [hash].
///
/// Some implementations may be restricted to only work on specific types
/// of objects.
bool isValidKey(Object o);
}
class DefaultEquality<E> implements Equality<E> {
const DefaultEquality();
@override
bool equals(Object? e1, Object? e2) => e1 == e2;
@override
int hash(Object? e) => e.hashCode;
@override
bool isValidKey(Object o) => true;
}