25-2/24/1

This commit is contained in:
Hamza-Ayed
2025-02-24 23:38:42 +03:00
parent 218e174c87
commit 3162b1bec6
56 changed files with 1318 additions and 527 deletions

16
.env
View File

@@ -5,7 +5,7 @@ accountSIDTwillo=QFx0qy456juj3839xuy2194q629q1fj0y7XrXlBl
serverAPI=QQQQobSrrFi:QVQ87xU7zwCvmZzZdaxuS2f23Y4mz7MzyOzr8od2br6KYyeFaTVLG3K3hx5ZaUyx7eYvAYpAVdKk-286NTRi3zs9iSOnXtXRIxswg3KecBmsl3VxJ9wO-vIpwu4Pv7dkHkXniuxMSDgWXrXlBl serverAPI=QQQQobSrrFi:QVQ87xU7zwCvmZzZdaxuS2f23Y4mz7MzyOzr8od2br6KYyeFaTVLG3K3hx5ZaUyx7eYvAYpAVdKk-286NTRi3zs9iSOnXtXRIxswg3KecBmsl3VxJ9wO-vIpwu4Pv7dkHkXniuxMSDgWXrXlBl
mapAPIKEY=QOmqZsFsutLDCtZCRIUAZAkB5v6AMkKEPMbJGa3XrXlBl mapAPIKEY=QOmqZsFsutLDCtZCRIUAZAkB5v6AMkKEPMbJGa3XrXlBl
twilloRecoveryCode=CAU79DHPH1BE9PUH4ETXTSXZXrXlBl twilloRecoveryCode=CAU79DHPH1BE9PUH4ETXTSXZXrXlBl
apiKeyHere=g_WNUb5L-7-F8oHpUmgIzH7ETeH9xZ8RwGG9_G8zX9A apiKeyHere=g_WNUb5L-tripz7-F8oHpUmgIzH7ETeH9xZ8RwGG9_G8zX9A
authTokenTwillo=70u98ju0214xx4q0u74028u021u4qu65XrXlBl authTokenTwillo=70u98ju0214xx4q0u74028u021u4qu65XrXlBl
chatGPTkey=zg-4C26q4SYBKQeHZDqkWowC9XrxgUEfUy9JRw2rm6Q2adb3kjwXrXlBl chatGPTkey=zg-4C26q4SYBKQeHZDqkWowC9XrxgUEfUy9JRw2rm6Q2adb3kjwXrXlBl
transactionCloude=Qhcwilomqcoib:QVO_JNYED2XWA26YXKC2TP:YK1DVH6SJB31N3PE1UXrXlBl transactionCloude=Qhcwilomqcoib:QVO_JNYED2XWA26YXKC2TP:YK1DVH6SJB31N3PE1UXrXlBl
@@ -36,7 +36,7 @@ agoraAppCertificate=j17q944u49390q758u1649448q2y6xfuXrXlBl
usernamePayMob=37319104052XrXlBl usernamePayMob=37319104052XrXlBl
passwordPayMob='g@nkD2#99!hD_.wXrXlBl' passwordPayMob='g@nkD2#99!hD_.wXrXlBl'
integrationIdPayMob=0237730XrXlBl integrationIdPayMob=0237730XrXlBl
payMobApikey='MDrGqKEWS1rVqHvEPDvPjJ7vZDBExrO7S3BEBgrlfUwTA3i5RnP5ZnvoL3M2S9rEBgrlNTdexH5pTPf7NJrvy1reZJv1Tn7zf7vTIDywjHg1C7Ley38HTDyNA3v7TPfdxJrax1rwPmPtMJyzqKEYZeghq3MuLUrFH3A1AgHcH15CZ9UaZTLOxnw0BTdzHHrBArisZerUMUUzZ1BnBeEijHvNjYLnS1BUICMhSmPhA15ifHyVqKEMHWyKLbyuIPvcH9UeL3vZyDf=XrXlBl' payMobApikey='MDrGqKEWS1rVqHvEPDvPjJ7vZDBExrO7S3BEBgrlfUwTA3i5RnP5ZnvoL3M2S9rEBgrlNTdexH5pTPf7NJrvy1reZJv1Tn7zf7vTIDywjHg1C7Ley38HTDyNA3v7TPfdxJrax1rwPmPtMJyzqKEYZeghq3MuLUrFH3A1AgHcH15CZ9UaZTLOxnw0BTdzHHrBArisZerUMUUzZ1BnBeEijHvNjYLnS1BUICMhSmPhA15ifHyVqKEMHWyKLbyuIPvcH9UeL3vZyDf=cvcXrXlBlbbbbb'
integrationIdPayMobWallet=0237739XrXlBl integrationIdPayMobWallet=0237739XrXlBl
ocpApimSubscriptionKey=0f5dacccdbce4131b1a5f952996302e3 ocpApimSubscriptionKey=0f5dacccdbce4131b1a5f952996302e3
smsPasswordEgypt="J)Vh=qb/@MXrXlBl" smsPasswordEgypt="J)Vh=qb/@MXrXlBl"
@@ -47,11 +47,15 @@ payMobOutClientSecrret='xyjjRlahJM0Xc38WjApCOh8bvgL9slFpNdM9YeCu9AhLqboKMPtmSvc2
payMobOutClient_id='Z05ut48dVkS2gI2zenFFcKsfDKfHAU0WELqKyJ0LXrXlBl' payMobOutClient_id='Z05ut48dVkS2gI2zenFFcKsfDKfHAU0WELqKyJ0LXrXlBl'
payMobOutPassword='D2zJFxkE#LN3vz38z2dYxpNfWXrXlBl' payMobOutPassword='D2zJFxkE#LN3vz38z2dYxpNfWXrXlBl'
payMobOutUserName='zjujl_qvo_fwjfgjlXrXlBl' payMobOutUserName='zjujl_qvo_fwjfgjlXrXlBl'
keyOfApp=nqryjp@1737wqnmqqsjyzjujljksvceiXrXlBl keyOfApp=nqryjpb@1737wqlnmqqsQ5nuJeIYhMN4PDYr7qjyzjujljksvceiXrXlBl
initializationVector=abcdefghijklmnop initializationVector=abcdefghijklmnop
privateKeyFCM="-----BEGIN PRIVATE KEY-----\\nMIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQD0zH9TQGDQHUv3\\na3/JAD1UKPwAp3wNKT0a6fxiIzjI3JxQWI30QvZCcfl6CdMhIcydX1ncSaYTcEeC\\n/AdPVCPkqyJx1YIGGg6P/mRzCWeaN8fsp6z250m5vcObDCZc3dbJEkepbep+6FPY\\n21m3KO+AHh1glgsTGZOTm5xiU8NGXpdk2QEh8wpiIIlR/HuKwVw9g8urNe3Sno+U\\nDm3z37iFqvZdmpqO8aWTJu6beb3hsREK9XK2I9JqC2JUwiGQRo3idOvPP6hkqrWx\\nKSX96vglQFYfakvJdDp2ZATOlpBYPMtS/IWhJ985u58TSS+Kl8qpnpaZBSxgJirf\\nhWzhnKLfAgMBAAECggEAJP785SePGhS7ZN6ltspm+l+hSjYFrPWFCxq+rlQ1YkHZ\\nC9l+RqKSFhOkiPmQI2s4wbXl3kFxLHHlFNoi/q2wKQBmGb8TQfnRJpjjNHGA61Ev\\n0Ue7/6qPvVb9B2MsLw/FxKiTFPuMG3bgKR9pbSFuJLYoaW7zqITOhVnYphGTqwAY\\nBVVcvISSLvELDmH9VZcv/9DVqVlqbbESHWh1Z4W6XGPoEqeDH/upNTyQQ/46Msgm\\nTGE6VqLHpWuSf6SqHp+r0Y0lI3vIPM1vz5FAJDJbOE/enHa0fSup0OHSMxl0HVMn\\nnO1yrGF3vsIPOej5HKr5d71bEIckzk73/yjNC1/mDQKBgQD7RtUvc9omsSsFMJ6e\\nBASAn6Dktx/QY/XNJjFzHQj69cywLDe5t5AL2gUi3phQ2oqB5XJdwnd5bTIEPEPZ\\nDOuOai2802p6FJk6kjmZAMVGx5JtXBH+vs6jrmQQSMiKbjwN1TT6xIWakvLOonUi\\nX6ZvjYYjU/E0YJU3jSiXWEr76wKBgQD5Zn4SouJ6BCDZMbausJVMBkk3qxsYooip\\np89WakC6e7AZinpkRcqjGGV9GOvc8crJs6fyXAA9ORepGP47Mc0ZrDssOkstznsM\\npr8R0S6MKwEZaT9ixOHdOcLZ47ps+JzA2Wr4KN2OvFHksUkB/46ATD1j9WZVgB8M\\namsYp/Y73QKBgHOo+PvsoZ9psVmkNX6abtAdqdtdB0HOoRea2uwXk0ig12TIFaZg\\nfedWpUKVnxqoXVTJHklV99RmlL0qWDiSH+LfsMnXro0e6iDxqZ1po2Se/CFmXcoa\\nXdctsFVmixhdATuExewfhTfPKABA+xWlXWC/jdy5CK+JPWXijaqMM4edAoGAE5Bj\\nsWiPpYyvWvpYX0nA3G7dzX0hqgQN/mkIjbnWDArp3IcNZNJIvBSM2Yxb7EAXbU0n\\njo6DAkp5Pa2VO+WDNlFZbvW/sf8xjeOCt44WPa6d7nVgIIpbQXRngZoopKW3/jTP\\n/FmQT8McFXmGxZ5belsAsdetSGW9icbLUerTGQ0CgYEAmf/G8Ag3XxmqTXvvHuv2\\n14OP7WnrVqkEMnydrftEwn4peXd/Lz+/GYX5Zc4ZoNgbN8IvZ5z0+OmRsallsbiW\\nBw0/tc68CjzxXOvReWxDluUopqWVGj5tlGqE5xUDku9SWJSxbkiQ3rqutzBdPXpr\\noqHwPyDrmK/Zgqn+uiIm4Ck=\\n-----END PRIVATE KEY-----\\n" privateKeyFCM="-----BEGIN PRIVATE KEY-----\\nMIIEvQIBAkki5DANBgkqhjbjhbjbhjhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQD0zH9TQGDQHUv3\\na3/JAD1UKPwAp3wNKT0a6fxiIzjI3JxQWI30QvZCcfl6CdMhIcydX1ncSaYTcEeC\\n/AdPVCPkqyJx1YIGGg6P/mRzCWeaN8fsp6z250m5vcObDCZc3dbJEkepbep+6FPY\\n21m3KO+AHh1glgsT9GZOTm5xiU8NGXpdk2QEh8wpiIIlR/HuKwVw9g8urNe3Sno+U\\nDm3z37iFqvZdmpqO8aWTJu6beb3hsREK9XK2I9JqC2JUwiGQRo3idOvPP6hkqrWx\\nKSX96vgio9lQFYfakvJdDp2ZATOlpBYPMtS/IWhJ985u58TSS+Kl8qpnpaZBSxgJirf\\nhWzhnKLfAgMBAAECggEAJP785SePGhS7ZN6ltspm+l+hSjYFrPWFCxq+rlQ1YkHZ\\nC9l+RqKSFhOkiPmQI2s4wbXl3kFxLHHlFNoi/q2wKQBmGb8TQfnRJpjjNHGA61Ev\\n0Ue7/6qPvVb9B2MsLw/FxKiTFPuMG3bgKR9pbSFuJLYoaW7zqITOhVnYphGTqwAY\\nBVVcvISSLvELDmH9VZcv/9DVqVlqbbESHWh1Z4W6XGPoEqeDH/upNTyQQ/46Msgm\\nTGE6VqLHpWuSf6SqHp+r0Y0lI3vIPM1vz5FAJDJbOE/enHa0fSup0OHSMxl0HVMn\\nnO1yrGF3vsIPOej5HKr5d71bEIckzk73/yjNC1/mDQKBgQD7RtUvc9omsSsFMJ6e\\nBASAn6Dktx/QY/XNJjFzHQj69cywLDe5t5AL2gUi3phQ2oqB5XJdwnd5bTIEPEPZ\\nDOuOai2802p6FJk6kjmZAMVGx5JtXBH+vs6jrmQQSMiKbjwN1TT6xIWakvLOonUi\\nX6ZvjYYjU/E0YJU3jSiXWEr76wKBgQD5Zn4SouJ6BCDZMbausJVMBkk3qxsYooip\\np89WakC6e7AZinpkRcqjGGV9GOvc8crJs6fyXAA9ORepGP47Mc0ZrDssOkstznsM\\npr8R0S6MKwEZaT9ixOHdOcLZ47ps+JzA2Wr4KN2OvFHksUkB/46ATD1j9WZVgB8M\\namsYp/Y73QKBgHOo+PvsoZ9psVmkNX6abtAdqdtdB0HOoRea2uwXk0ig12TIFaZg\\nfedWpUKVnxqoXVTJHklV99RmlL0qWDiSH+LfsMnXro0e6iDxqZ1po2Se/CFmXcoa\\nXdctsFVmixhdATuExewfhTfPKABA+xWlXWC/jdy5CK+JPWXijaqMM4edAoGAE5Bj\\nsWiPpYyvWvpYX0nA3G7dzX0hqgQN/mkIjbnWDArp3IcNZNJIvBSM2Yxb7EAXbU0n\\njo6DAkp5Pa2VO+WDNlFZbvW/sf8xjeOCt44WPa6d7nVgIIpbQXRngZoopKW3/jTP\\n/FmQT8McFXmGxZ5belsAsdetSGW9icbLUerTGQ0CgYEAmf/G8Ag3XxmqTXvvHuv2\\n14OP7WnrVqkEMnydrftEwn4peXd/Lz+/GYX5Zc4ZoNgbN8IvZ5z0+OmRsallsbiW\\nBw0/tc68CjzxXOvReWxDluUopqWVGj5tlGqE5xUDku9SWJSxbkiQ3rqutzBdPXpr\\noqHwPyDrmK/Zgqn+uiIm4Ck=\\n-----END PRIVATE KEY-----\\n"
sss_pass=wqnmqqsjyvwv:nqrYJP@17378XrXlBl
sss_encryptionSalt=zg-vlie-2l1ZlpxiLJ6wQOvbb4TnC9XrxgUEyVQIu6TID4qP4FUUqoS5XrXlBl
addd=BlBlNl
allowed=mobile-app:
passnpassenger=hbgbitbXrXrBr
newId=new
a=q a=q
b=x b=x
c=f c=f

View File

@@ -61,8 +61,8 @@ android {
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration. // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
minSdk = 23 minSdk = 23
targetSdk = flutter.targetSdkVersion targetSdk = flutter.targetSdkVersion
versionCode = 118 versionCode = 121
versionName = '2.0.118' versionName = '2.0.121'
multiDexEnabled =true multiDexEnabled =true
// manifestPlaceholders can be specified here if needed // manifestPlaceholders can be specified here if needed
@@ -98,6 +98,7 @@ dependencies {
// implementation platform('com.google.firebase:firebase-bom:32.1.1') // implementation platform('com.google.firebase:firebase-bom:32.1.1')
implementation "com.stripe:stripe-android:20.52.2" implementation "com.stripe:stripe-android:20.52.2"
implementation 'com.stripe:paymentsheet:20.52.2' implementation 'com.stripe:paymentsheet:20.52.2'
implementation 'com.scottyab:rootbeer-lib:0.1.0'
// If push provisioning is needed, make sure you have the correct version: // If push provisioning is needed, make sure you have the correct version:

View File

@@ -1,8 +1,76 @@
package com.mobileapp.store.ride package com.mobileapp.store.ride
import io.flutter.embedding.android.FlutterActivity import android.app.AlertDialog
import android.os.Bundle
import android.util.Log
import io.flutter.embedding.android.FlutterFragmentActivity import io.flutter.embedding.android.FlutterFragmentActivity
import java.util.*
class MainActivity : FlutterFragmentActivity() { class MainActivity : FlutterFragmentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
Log.d("DEBUG", "onCreate executed - Checking root status...")
// بدء فحص الأمان
performSecurityChecks()
}
private fun performSecurityChecks() {
val rootDetection = RootDetection
val isRooted = rootDetection.isRooted()
val isDevMode = rootDetection.isDevMode(this)
val isTampered = rootDetection.isTampered(this)
val isRealDevice = rootDetection.isRealDevice()
val isOnExternalStorage = rootDetection.isOnExternalStorage()
val isNotTrust = rootDetection.isNotTrust()
val checkForIssues = rootDetection.checkForIssues()
Log.d("DEBUG", "Security Check Results:")
Log.d("DEBUG", "isRooted: $isRooted")
Log.d("DEBUG", "isDevMode: $isDevMode")
Log.d("DEBUG", "isTampered: $isTampered")
Log.d("DEBUG", "isRealDevice: $isRealDevice")
Log.d("DEBUG", "isOnExternalStorage: $isOnExternalStorage")
Log.d("DEBUG", "isNotTrust: $isNotTrust")
Log.d("DEBUG", "checkForIssues: $checkForIssues")
if (isRooted || isTampered) {
Log.e("DEBUG", "Security issue detected! Showing dialog.")
showSecurityWarningDialog()
} else {
Log.d(
"DEBUG",
getString(R.string.device_secure)
) // Using dynamic string based on the device language
}
}
private fun showSecurityWarningDialog() {
val builder = AlertDialog.Builder(this)
builder.setTitle(getString(R.string.security_warning_title)) // Title based on language
builder.setMessage(
getString(R.string.security_warning_message)
) // Message based on language
builder.setPositiveButton(getString(R.string.exit_button)) { _, _ ->
Log.e("DEBUG", "User clicked exit. Closing app.")
clearAppDataAndExit()
}
builder.setCancelable(false)
val alertDialog = builder.create()
alertDialog.show()
}
private fun clearAppDataAndExit() {
// حذف جميع البيانات هنا، مثل ملفات التخزين وبيانات التطبيق
// يمكنك استخدام SharedPreferences أو قاعدة بيانات
Log.d("DEBUG", "Clearing app data...")
// يمكنك استخدام كود لحذف جميع البيانات (SharedPreferences, DB, ملفات)
// ثم إغلاق التطبيق:
finishAffinity() // يغلق جميع الأنشطة ويفتح نافذة جديدة
}
} }

View File

@@ -0,0 +1,61 @@
package com.mobileapp.store.ride
import android.content.Context
import android.os.Build
import android.os.Environment
import android.provider.Settings
import com.scottyab.rootbeer.RootBeer
import java.io.File
object RootDetection {
fun isRooted(): Boolean {
val paths =
arrayOf(
"/system/app/Superuser.apk",
"/system/xbin/su",
"/system/bin/su",
"/system/bin/magisk",
"/system/xbin/magisk",
"/sbin/magisk"
)
for (path in paths) {
if (File(path).exists()) {
return true
}
}
return false
}
fun isDevMode(context: Context): Boolean {
return Settings.Global.getInt(
context.contentResolver,
Settings.Global.DEVELOPMENT_SETTINGS_ENABLED,
0
) == 1
}
fun isTampered(context: Context): Boolean {
val rootBeer = RootBeer(context)
return rootBeer.isRooted
}
fun checkForIssues(): Boolean {
// يمكنك إضافة المزيد من الفحوصات حسب حاجتك
return false // نفترض أنه لا توجد مشاكل للأجهزة غير المتجذرة
}
fun isRealDevice(): Boolean {
return !Build.FINGERPRINT.contains("generic") && !Build.MODEL.contains("google_sdk")
}
fun isOnExternalStorage(): Boolean {
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT &&
Environment.getExternalStorageState() == Environment.MEDIA_MOUNTED
}
fun isNotTrust(): Boolean {
// مثال تحقق من الثقة (قد تحتاج لتطوير هذا حسب متطلباتك)
return false // نفترض أن الجهاز موثوق
}
}

View File

@@ -0,0 +1,6 @@
<resources>
<string name="security_warning_title">تحذير أمني</string>
<string name="security_warning_message">تم اكتشاف مشكلة أمنية أو تعديل على هذا الجهاز. لا يمكن تشغيل التطبيق على هذا الجهاز.</string>
<string name="exit_button">إغلاق التطبيق</string>
<string name="device_secure">الجهاز آمن. الاستمرار بشكل طبيعي.</string>
</resources>

View File

@@ -4,4 +4,10 @@
<!-- <string name="default_notification_channel_id">default_channel</string> --> <!-- <string name="default_notification_channel_id">default_channel</string> -->
<string name="default_notification_channel_id">high_importance_channel</string> <string name="default_notification_channel_id">high_importance_channel</string>
<string name="api_key">AIzaSyCyfwRXTwSTLOFQSQgN5p7QZgGJVZnEKq0</string> <string name="api_key">AIzaSyCyfwRXTwSTLOFQSQgN5p7QZgGJVZnEKq0</string>
<string name="security_warning_title">Security Warning</string>
<string name="security_warning_message">A security issue or modification has been detected on
this device. The app cannot run on this device.</string>
<string name="exit_button">Exit App</string>
<string name="device_secure">Device is secure. Proceeding normally.</string>
</resources> </resources>

View File

@@ -2,7 +2,7 @@ org.gradle.jvmargs=-Xmx4096M
android.useAndroidX=true android.useAndroidX=true
android.enableJetifier=true android.enableJetifier=true
android.defaults.buildfeatures.buildconfig=true android.defaults.buildfeatures.buildconfig=true
android.nonTransitiveRClass=false android.nonTransitiveRClass=true
android.nonFinalResIds=false android.nonFinalResIds=true
dart.obfuscation=true
android.enableR8.fullMode=true android.enableR8.fullMode=true

View File

@@ -135,6 +135,10 @@ PODS:
- TOCropViewController (~> 2.7.4) - TOCropViewController (~> 2.7.4)
- image_picker_ios (0.0.1): - image_picker_ios (0.0.1):
- Flutter - Flutter
- IOSSecuritySuite (1.9.11)
- jailbreak_root_detection (1.0.1):
- Flutter
- IOSSecuritySuite (~> 1.9.10)
- just_audio (0.0.1): - just_audio (0.0.1):
- Flutter - Flutter
- live_activities (0.0.1): - live_activities (0.0.1):
@@ -238,6 +242,7 @@ DEPENDENCIES:
- google_sign_in_ios (from `.symlinks/plugins/google_sign_in_ios/darwin`) - google_sign_in_ios (from `.symlinks/plugins/google_sign_in_ios/darwin`)
- image_cropper (from `.symlinks/plugins/image_cropper/ios`) - image_cropper (from `.symlinks/plugins/image_cropper/ios`)
- image_picker_ios (from `.symlinks/plugins/image_picker_ios/ios`) - image_picker_ios (from `.symlinks/plugins/image_picker_ios/ios`)
- jailbreak_root_detection (from `.symlinks/plugins/jailbreak_root_detection/ios`)
- just_audio (from `.symlinks/plugins/just_audio/ios`) - just_audio (from `.symlinks/plugins/just_audio/ios`)
- live_activities (from `.symlinks/plugins/live_activities/ios`) - live_activities (from `.symlinks/plugins/live_activities/ios`)
- local_auth_darwin (from `.symlinks/plugins/local_auth_darwin/darwin`) - local_auth_darwin (from `.symlinks/plugins/local_auth_darwin/darwin`)
@@ -277,6 +282,7 @@ SPEC REPOS:
- GoogleUtilities - GoogleUtilities
- GTMAppAuth - GTMAppAuth
- GTMSessionFetcher - GTMSessionFetcher
- IOSSecuritySuite
- nanopb - nanopb
- PromisesObjC - PromisesObjC
- RecaptchaInterop - RecaptchaInterop
@@ -323,6 +329,8 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/image_cropper/ios" :path: ".symlinks/plugins/image_cropper/ios"
image_picker_ios: image_picker_ios:
:path: ".symlinks/plugins/image_picker_ios/ios" :path: ".symlinks/plugins/image_picker_ios/ios"
jailbreak_root_detection:
:path: ".symlinks/plugins/jailbreak_root_detection/ios"
just_audio: just_audio:
:path: ".symlinks/plugins/just_audio/ios" :path: ".symlinks/plugins/just_audio/ios"
live_activities: live_activities:
@@ -396,6 +404,8 @@ SPEC CHECKSUMS:
GTMSessionFetcher: 5aea5ba6bd522a239e236100971f10cb71b96ab6 GTMSessionFetcher: 5aea5ba6bd522a239e236100971f10cb71b96ab6
image_cropper: 37d40f62177c101ff4c164906d259ea2c3aa70cf image_cropper: 37d40f62177c101ff4c164906d259ea2c3aa70cf
image_picker_ios: c560581cceedb403a6ff17f2f816d7fea1421fc1 image_picker_ios: c560581cceedb403a6ff17f2f816d7fea1421fc1
IOSSecuritySuite: b51056d5411aee567153ca86ce7f6edfdc5d2654
jailbreak_root_detection: b95de80c3e51eec1fc7d0225784d2fc038fa95ed
just_audio: baa7252489dbcf47a4c7cc9ca663e9661c99aafa just_audio: baa7252489dbcf47a4c7cc9ca663e9661c99aafa
live_activities: 5a5ddcfe2bd2cbbe7555a5da9c35b07d1a4ff2e8 live_activities: 5a5ddcfe2bd2cbbe7555a5da9c35b07d1a4ff2e8
local_auth_darwin: 66e40372f1c29f383a314c738c7446e2f7fdadc3 local_auth_darwin: 66e40372f1c29f383a314c738c7446e2f7fdadc3

View File

@@ -16,6 +16,7 @@
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; };
C60CA7372BE9EF38002095B2 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = C60CA7362BE9EF38002095B2 /* GoogleService-Info.plist */; }; C60CA7372BE9EF38002095B2 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = C60CA7362BE9EF38002095B2 /* GoogleService-Info.plist */; };
C6229B682D610CB20014397D /* JailbreakDetection.swift in Sources */ = {isa = PBXBuildFile; fileRef = C6229B672D610C970014397D /* JailbreakDetection.swift */; };
C624C4642BD56D34002834AF /* tone1.mp3 in Resources */ = {isa = PBXBuildFile; fileRef = C624C45C2BD56D34002834AF /* tone1.mp3 */; }; C624C4642BD56D34002834AF /* tone1.mp3 in Resources */ = {isa = PBXBuildFile; fileRef = C624C45C2BD56D34002834AF /* tone1.mp3 */; };
C624C4652BD56D34002834AF /* start.wav in Resources */ = {isa = PBXBuildFile; fileRef = C624C45D2BD56D34002834AF /* start.wav */; }; C624C4652BD56D34002834AF /* start.wav in Resources */ = {isa = PBXBuildFile; fileRef = C624C45D2BD56D34002834AF /* start.wav */; };
C624C4672BD56D34002834AF /* promo.wav in Resources */ = {isa = PBXBuildFile; fileRef = C624C45F2BD56D34002834AF /* promo.wav */; }; C624C4672BD56D34002834AF /* promo.wav in Resources */ = {isa = PBXBuildFile; fileRef = C624C45F2BD56D34002834AF /* promo.wav */; };
@@ -23,6 +24,7 @@
C628BC412C316B1200E4D33B /* ding.wav in Resources */ = {isa = PBXBuildFile; fileRef = C628BC402C316B1100E4D33B /* ding.wav */; }; C628BC412C316B1200E4D33B /* ding.wav in Resources */ = {isa = PBXBuildFile; fileRef = C628BC402C316B1100E4D33B /* ding.wav */; };
C6B15AA12B5FB24600746405 /* order.wav in Resources */ = {isa = PBXBuildFile; fileRef = C6B15A9F2B5FB24600746405 /* order.wav */; }; C6B15AA12B5FB24600746405 /* order.wav in Resources */ = {isa = PBXBuildFile; fileRef = C6B15A9F2B5FB24600746405 /* order.wav */; };
C6B15AA22B5FB24600746405 /* tone2.wav in Resources */ = {isa = PBXBuildFile; fileRef = C6B15AA02B5FB24600746405 /* tone2.wav */; }; C6B15AA22B5FB24600746405 /* tone2.wav in Resources */ = {isa = PBXBuildFile; fileRef = C6B15AA02B5FB24600746405 /* tone2.wav */; };
C6B450142D67556C001427AA /* Constants1.swift in Sources */ = {isa = PBXBuildFile; fileRef = C6B450132D67556B001427AA /* Constants1.swift */; };
D529E7C8240CCC30BB7358A2 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B099132D71B1299FCDFD9C8 /* Pods_Runner.framework */; }; D529E7C8240CCC30BB7358A2 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B099132D71B1299FCDFD9C8 /* Pods_Runner.framework */; };
/* End PBXBuildFile section */ /* End PBXBuildFile section */
@@ -72,6 +74,7 @@
97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; }; 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
C60CA7362BE9EF38002095B2 /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = "GoogleService-Info.plist"; path = "../../../../../Downloads/GoogleService-Info.plist"; sourceTree = "<group>"; }; C60CA7362BE9EF38002095B2 /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = "GoogleService-Info.plist"; path = "../../../../../Downloads/GoogleService-Info.plist"; sourceTree = "<group>"; };
C6229B672D610C970014397D /* JailbreakDetection.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JailbreakDetection.swift; sourceTree = "<group>"; };
C624C45C2BD56D34002834AF /* tone1.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; name = tone1.mp3; path = ../../android/app/src/main/res/raw/tone1.mp3; sourceTree = "<group>"; }; C624C45C2BD56D34002834AF /* tone1.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; name = tone1.mp3; path = ../../android/app/src/main/res/raw/tone1.mp3; sourceTree = "<group>"; };
C624C45D2BD56D34002834AF /* start.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; name = start.wav; path = ../../android/app/src/main/res/raw/start.wav; sourceTree = "<group>"; }; C624C45D2BD56D34002834AF /* start.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; name = start.wav; path = ../../android/app/src/main/res/raw/start.wav; sourceTree = "<group>"; };
C624C45F2BD56D34002834AF /* promo.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; name = promo.wav; path = ../../android/app/src/main/res/raw/promo.wav; sourceTree = "<group>"; }; C624C45F2BD56D34002834AF /* promo.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; name = promo.wav; path = ../../android/app/src/main/res/raw/promo.wav; sourceTree = "<group>"; };
@@ -80,6 +83,7 @@
C69588332A8C1F6B00C3AC67 /* Runner.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Runner.entitlements; sourceTree = "<group>"; }; C69588332A8C1F6B00C3AC67 /* Runner.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Runner.entitlements; sourceTree = "<group>"; };
C6B15A9F2B5FB24600746405 /* order.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; path = order.wav; sourceTree = "<group>"; }; C6B15A9F2B5FB24600746405 /* order.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; path = order.wav; sourceTree = "<group>"; };
C6B15AA02B5FB24600746405 /* tone2.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; path = tone2.wav; sourceTree = "<group>"; }; C6B15AA02B5FB24600746405 /* tone2.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; path = tone2.wav; sourceTree = "<group>"; };
C6B450132D67556B001427AA /* Constants1.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Constants1.swift; sourceTree = "<group>"; };
CAF37DC30C17166B851DBC8C /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = "<group>"; }; CAF37DC30C17166B851DBC8C /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = "<group>"; };
F231BA28015FE2C634809733 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = "<group>"; }; F231BA28015FE2C634809733 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = "<group>"; };
/* End PBXFileReference section */ /* End PBXFileReference section */
@@ -160,6 +164,7 @@
97C146F01CF9000F007C117D /* Runner */ = { 97C146F01CF9000F007C117D /* Runner */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
C6229B672D610C970014397D /* JailbreakDetection.swift */,
C69588332A8C1F6B00C3AC67 /* Runner.entitlements */, C69588332A8C1F6B00C3AC67 /* Runner.entitlements */,
C6B15A9F2B5FB24600746405 /* order.wav */, C6B15A9F2B5FB24600746405 /* order.wav */,
C6B15AA02B5FB24600746405 /* tone2.wav */, C6B15AA02B5FB24600746405 /* tone2.wav */,
@@ -176,6 +181,7 @@
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */,
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */,
74858FAE1ED2DC5600515810 /* AppDelegate.swift */, 74858FAE1ED2DC5600515810 /* AppDelegate.swift */,
C6B450132D67556B001427AA /* Constants1.swift */,
74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */, 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */,
); );
path = Runner; path = Runner;
@@ -428,6 +434,8 @@
isa = PBXSourcesBuildPhase; isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
C6229B682D610CB20014397D /* JailbreakDetection.swift in Sources */,
C6B450142D67556C001427AA /* Constants1.swift in Sources */,
74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */, 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */,
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */,
); );

View File

@@ -2,19 +2,39 @@ import UIKit
import Flutter import Flutter
import FirebaseCore import FirebaseCore
import GoogleMaps import GoogleMaps
// import Constants
@main @main
@objc class AppDelegate: FlutterAppDelegate { @objc class AppDelegate: FlutterAppDelegate {
override func application( override func application(
_ application: UIApplication, _ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool { ) -> Bool {
GMSServices.provideAPIKey("AIzaSyCyfwRXTwSTLOFQSQgN5p7QZgGJVZnEKq0") GMSServices.provideAPIKey(Constants.googleMapsAPIKey)
FirebaseApp.configure() FirebaseApp.configure()
GeneratedPluginRegistrant.register(with: self) GeneratedPluginRegistrant.register(with: self)
return true
if JailbreakDetection.isJailbroken() {
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
self.showJailbreakAlert()
} }
} }
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}
func showJailbreakAlert() {
guard let rootVC = UIApplication.shared.keyWindow?.rootViewController else { return }
let alert = UIAlertController(
title: "تحذير أمني",
message: "تم اكتشاف أن جهازك يحتوي على جيلبريك. لا يمكن تشغيل التطبيق على هذا الجهاز.",
preferredStyle: .alert
)
alert.addAction(UIAlertAction(title: "إنهاء التطبيق", style: .destructive) { _ in
exit(0)
})
rootVC.present(alert, animated: true, completion: nil)
}
}

View File

@@ -1,8 +0,0 @@
//
// Constants.swift
// Runner
//
// Created by Hamza Aleghwairyeen on 15/01/2024.
//
import Foundation

View File

@@ -0,0 +1,12 @@
//
// Constants1.swift
// Runner
//
// Created by Hamza Aleghwairyeen on 20/02/2025.
//
import Foundation
struct Constants {
static let googleMapsAPIKey = "AIzaSyCyfwRXTwSTLOFQSQgN5p7QZgGJVZnEKq0"
}

View File

@@ -2,6 +2,15 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0"> <plist version="1.0">
<dict> <dict>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>undecimus</string>
<string>sileo</string>
<string>zbra</string>
<string>filza</string>
<string>activator</string>
<string>cydia</string>
</array>
<key>NSContactsUsageDescription</key> <key>NSContactsUsageDescription</key>
<string>This app requires contacts access to function properly.</string> <string>This app requires contacts access to function properly.</string>
<key>LSMinimumSystemVersion</key> <key>LSMinimumSystemVersion</key>
@@ -41,11 +50,11 @@
<key>CFBundlePackageType</key> <key>CFBundlePackageType</key>
<string>APPL</string> <string>APPL</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>94</string> <string>95</string>
<key>CFBundleSignature</key> <key>CFBundleSignature</key>
<string>????</string> <string>????</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>5.0.94</string> <string>5.0.95</string>
<key>NSHumanReadableCopyright</key> <key>NSHumanReadableCopyright</key>
<string></string> <string></string>
<key>FirebaseAppDelegateProxyEnabled</key> <key>FirebaseAppDelegateProxyEnabled</key>
@@ -57,8 +66,8 @@
<key>LSRequiresIPhoneOS</key> <key>LSRequiresIPhoneOS</key>
<true /> <true />
<key>NSCameraUsageDescription</key> <key>NSCameraUsageDescription</key>
<string>Sovo app requires access to your camera in order to scan QR codes and capture <string>Sovo app requires access to your camera in order to scan QR codes and capture images
images for uploading and access to connect to a call.</string> for uploading and access to connect to a call.</string>
<key>NSFaceIDUsageDescription</key> <key>NSFaceIDUsageDescription</key>
<string>Use Face ID to securely authenticate payment accounts.</string> <string>Use Face ID to securely authenticate payment accounts.</string>
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key> <key>NSLocationAlwaysAndWhenInUseUsageDescription</key>

View File

@@ -0,0 +1,25 @@
//
// JailbreakDetection.swift
// Runner
//
// Created by Hamza Aleghwairyeen on 15/02/2025.
//
import Foundation
class JailbreakDetection {
static func isJailbroken() -> Bool {
let paths = [
"/Applications/Cydia.app",
"/Library/MobileSubstrate/MobileSubstrate.dylib",
"/usr/sbin/sshd",
"/etc/apt"
]
for path in paths {
if FileManager.default.fileExists(atPath: path) {
return true
}
}
return false
}
}

View File

@@ -1,3 +1,4 @@
import 'package:Tripz/main.dart';
import 'package:secure_string_operations/secure_string_operations.dart'; import 'package:secure_string_operations/secure_string_operations.dart';
import '../env/env.dart'; import '../env/env.dart';
@@ -6,6 +7,15 @@ import 'char_map.dart';
class AK { class AK {
static final String publishableKey = static final String publishableKey =
X.r(X.r(X.r(Env.stripePublishableKe, cn), cC), cs); X.r(X.r(X.r(Env.stripePublishableKe, cn), cC), cs);
static final String sss_pass = X.r(X.r(X.r(Env.sss_pass, cn), cC), cs);
static final String allowed = Env.allowed;
static final String passnpassenger = X
.r(X.r(X.r(Env.passnpassenger, cn), cC), cs)
.toString()
.split(Env.addd)[0];
static final String newId = Env.newId;
static final String sss_encryptionSalt =
X.r(X.r(X.r(Env.sss_encryptionSalt, cn), cC), cs);
static final String secretKey = X.r(X.r(X.r(Env.secretKey, cn), cC), cs); static final String secretKey = X.r(X.r(X.r(Env.secretKey, cn), cC), cs);
static final String basicAuthCredentials = static final String basicAuthCredentials =
X.r(X.r(X.r(Env.basicAuthCredentials, cn), cC), cs); X.r(X.r(X.r(Env.basicAuthCredentials, cn), cC), cs);

View File

@@ -7,6 +7,10 @@ class BoxName {
static const String lang = "lang"; static const String lang = "lang";
static const String serverChosen = "serverChosen"; static const String serverChosen = "serverChosen";
static const String gender = "gender"; static const String gender = "gender";
static const String jwt = "jwt";
static const String fingerPrint = "fingerPrint";
static const String payMobApikey = "payMobApikey";
static const String refreshToken = "refreshToken";
static const String serverLocations = "serverLocations"; static const String serverLocations = "serverLocations";
static const String carType = "carType"; static const String carType = "carType";
static const String carPlate = "carPlate"; static const String carPlate = "carPlate";
@@ -16,6 +20,7 @@ class BoxName {
static const String locationName = "locationName"; static const String locationName = "locationName";
static const String isVerified = 'isVerified'; static const String isVerified = 'isVerified';
static const String isFirstTime = 'isFirstTime'; static const String isFirstTime = 'isFirstTime';
static const String firstTimeLoadKey = 'firstTimeLoadKey';
static const String isSavedPhones = 'isSavedPhones'; static const String isSavedPhones = 'isSavedPhones';
static const String statusDriverLocation = "statusDriverLocation"; static const String statusDriverLocation = "statusDriverLocation";
static const String isTest = "isTest"; static const String isTest = "isTest";
@@ -70,6 +75,8 @@ class BoxName {
static const String onBoarding = 'onBoarding'; static const String onBoarding = 'onBoarding';
static const String stripePublishableKey = 'stripe_publishableKe'; static const String stripePublishableKey = 'stripe_publishableKe';
static const String apiKeyRun = 'apiKeyRun'; static const String apiKeyRun = 'apiKeyRun';
static const String keyOfApp = 'keyOfApp';
static const String initializationVector = 'initializationVector';
static const String serverAPI = 'serverAPI'; static const String serverAPI = 'serverAPI';
static const String secretKey = 'secretKey'; static const String secretKey = 'secretKey';
static const String basicAuthCredentials = 'basicAuthCredentials'; static const String basicAuthCredentials = 'basicAuthCredentials';

View File

@@ -6,6 +6,7 @@ class AppInformation {
'https://www.linkedin.com/in/hamza-ayed/'; 'https://www.linkedin.com/in/hamza-ayed/';
static const String website = 'https://sefer.live'; static const String website = 'https://sefer.live';
static const String email = 'hamzaayed@sefer.live'; static const String email = 'hamzaayed@sefer.live';
static const String addd = 'BlBlNl';
static const String privacyPolicy = ''' static const String privacyPolicy = '''

View File

@@ -206,7 +206,8 @@ class AppLink {
// ===================================== // =====================================
static String addRateToPassenger = "$ride/rate/add.php"; static String addRateToPassenger = "$ride/rate/add.php";
static String savePlacesServer = "$ride/places/add.php"; static String savePlacesServer = "$ride/places/add.php";
static String getapiKey = "$ride/apiKey/get.php"; static String getapiKey =
"https://server.sefer.live/sefer.click/sefer/ride/apiKey/get.php";
static String addRateToDriver = "$ride/rate/addRateToDriver.php"; static String addRateToDriver = "$ride/rate/addRateToDriver.php";
static String getDriverRate = "$ride/rate/getDriverRate.php"; static String getDriverRate = "$ride/rate/getDriverRate.php";
static String getPassengerRate = "$ride/rate/getPassengerRate.php"; static String getPassengerRate = "$ride/rate/getPassengerRate.php";
@@ -264,6 +265,10 @@ class AppLink {
static String auth = '$server/auth'; static String auth = '$server/auth';
static String login = "$auth/login.php"; static String login = "$auth/login.php";
static String loginJwtRider = "$server/login.php";
static String loginJwtWalletRider = "$seferPaymentServer/loginWallet.php";
static String loginFirstTime =
"https://server.sefer.live/sefer.click/sefer/loginFirstTime.php";
static String getTesterApp = "$auth/Tester/getTesterApp.php"; static String getTesterApp = "$auth/Tester/getTesterApp.php";
static String updateTesterApp = "$auth/Tester/updateTesterApp.php"; static String updateTesterApp = "$auth/Tester/updateTesterApp.php";
static String signUp = "$auth/signup.php"; static String signUp = "$auth/signup.php";

View File

@@ -1,3 +1,5 @@
import 'package:Tripz/env/env.dart';
class TableName { class TableName {
static const String placesFavorite = "placesFavorite"; static const String placesFavorite = "placesFavorite";
static const String recentLocations = "recentLocations"; static const String recentLocations = "recentLocations";
@@ -7,3 +9,11 @@ class TableName {
static const String faceDetectTimes = "faceDetectTimes"; static const String faceDetectTimes = "faceDetectTimes";
static const String captainNotification = "captainNotification"; static const String captainNotification = "captainNotification";
} }
class Pasenger {
static const String pasengerpas = 'MG6DEJZSczBT6Rx0jOlehQ==';
static const String payMobApikey = 'payMobApikey';
static const String initializationVector = 'initializationVector';
static const String keyOfApp = 'keyOfApp';
static const String FCM_PRIVATE_KEY = 'FCM_PRIVATE_KEY';
}

View File

@@ -167,11 +167,11 @@ class GoogleSignInHelper {
// Store driver information // Store driver information
box.write(BoxName.passengerID, user.id); box.write(BoxName.passengerID, user.id);
box.write(BoxName.email, encryptionHelper.encryptData(user.email)); box.write(BoxName.email, EncryptionHelper.instance.encryptData(user.email));
box.write(BoxName.name, box.write(BoxName.name,
encryptionHelper.encryptData(user.displayName.toString())); EncryptionHelper.instance.encryptData(user.displayName.toString()));
box.write(BoxName.passengerPhotoUrl, box.write(BoxName.passengerPhotoUrl,
encryptionHelper.encryptData(user.photoUrl.toString())); EncryptionHelper.instance.encryptData(user.photoUrl.toString()));
// Perform any additional sign-up tasks or API calls here // Perform any additional sign-up tasks or API calls here
// For example, you can send the user data to your server for registration // For example, you can send the user data to your server for registration

View File

@@ -1,5 +1,9 @@
import 'dart:convert'; import 'dart:convert';
import 'dart:io'; import 'dart:io';
import 'package:Tripz/constant/api_key.dart';
import 'package:Tripz/controller/functions/sss.dart';
import 'package:Tripz/env/env.dart';
import 'package:http/http.dart' as http;
import 'package:Tripz/constant/info.dart'; import 'package:Tripz/constant/info.dart';
import 'package:Tripz/controller/firebase/firbase_messge.dart'; import 'package:Tripz/controller/firebase/firbase_messge.dart';
@@ -14,11 +18,16 @@ import 'package:Tripz/constant/links.dart';
import 'package:Tripz/controller/functions/crud.dart'; import 'package:Tripz/controller/functions/crud.dart';
import 'package:Tripz/main.dart'; import 'package:Tripz/main.dart';
import 'package:Tripz/views/home/map_page_passenger.dart'; import 'package:Tripz/views/home/map_page_passenger.dart';
import 'package:jwt_decoder/jwt_decoder.dart';
import 'package:location/location.dart'; import 'package:location/location.dart';
import 'package:secure_string_operations/secure_string_operations.dart';
import '../../constant/char_map.dart';
import '../../constant/table_names.dart';
import '../../print.dart'; import '../../print.dart';
import '../functions/encrypt_decrypt.dart'; import '../functions/encrypt_decrypt.dart';
import '../functions/package_info.dart'; import '../functions/package_info.dart';
import '../functions/secure_storage.dart';
class LoginController extends GetxController { class LoginController extends GetxController {
final formKey = GlobalKey<FormState>(); final formKey = GlobalKey<FormState>();
@@ -36,6 +45,7 @@ class LoginController extends GetxController {
update(); update();
} }
var dev = '';
@override @override
void onInit() async { void onInit() async {
box.read(BoxName.isTest) == null || box.read(BoxName.isTest) == null ||
@@ -75,13 +85,108 @@ class LoginController extends GetxController {
update(); update();
} }
getJwtWallet() async {
await SecurityHelper.performSecurityChecks();
String fingerPrint = await getDeviceFingerprint();
dev = Platform.isAndroid ? 'android' : 'ios';
var payload = {
'id': box.read(BoxName.passengerID),
'password': AK.passnpassenger,
'aud': '${AK.allowed}$dev',
'fingerPrint': fingerPrint
};
var response1 = await http.post(
Uri.parse(AppLink.loginJwtWalletRider),
body: payload,
);
Log.print('req: ${response1.request}');
Log.print('response: ${response1.body}');
Log.print('payload: ${payload}');
Log.print('decodedResponse1: ${jsonDecode(response1.body)}');
return jsonDecode(response1.body)['jwt'].toString();
}
getJWT() async {
print(Pasenger.pasengerpas);
await SecurityHelper.performSecurityChecks();
Log.print('firstTimeLoadKey: ${box.read(BoxName.firstTimeLoadKey)}');
dev = Platform.isAndroid ? 'android' : 'ios';
if (box.read(BoxName.firstTimeLoadKey).toString() != 'false') {
var response0 = await http.post(
Uri.parse(AppLink.loginFirstTime),
body: {
'id': box.read(BoxName.passengerID) ?? AK.newId,
'password': AK.passnpassenger,
'aud': '${AK.allowed}$dev',
},
);
if (response0.statusCode == 200) {
final decodedResponse1 = jsonDecode(response0.body);
final jwt = decodedResponse1['jwt'];
final refreshToken = decodedResponse1['refresh_token'];
box.write(BoxName.jwt, X.c(X.c(X.c(jwt, cn), cC), cs));
// Sss.write(BoxName.jwt, jwt);
await storage.write(key: BoxName.refreshToken, value: refreshToken);
await AppInitializer().getAIKey(Pasenger.keyOfApp);
await AppInitializer().getAIKey(Pasenger.initializationVector);
await Future.delayed(Duration.zero);
await EncryptionHelper.initialize();
await AppInitializer().getAIKey(Pasenger.payMobApikey);
await AppInitializer().getAIKey(Pasenger.FCM_PRIVATE_KEY);
await AppInitializer().getKey();
} else {}
} else {
await EncryptionHelper.initialize();
var payload = {
'id': box.read(BoxName.passengerID),
'password': AK.passnpassenger,
'aud': '${AK.allowed}$dev',
};
var response1 = await http.post(
Uri.parse(AppLink.loginJwtRider),
body: payload,
);
Log.print('req: ${response1.request}');
Log.print('response: ${response1.body}');
Log.print('payload: ${payload}');
Log.print('decodedResponse1: ${jsonDecode(response1.body)}');
if (response1.statusCode == 200) {
final decodedResponse1 = jsonDecode(response1.body);
Log.print('decodedResponse1: ${decodedResponse1}');
final jwt = decodedResponse1['jwt'];
await box.write(BoxName.jwt, X.c(X.c(X.c(jwt, cn), cC), cs));
await AppInitializer().getKey();
final refreshToken = decodedResponse1['refresh_token'];
await storage.write(key: BoxName.refreshToken, value: refreshToken);
} else {}
}
}
loginUsingCredentials(String passengerID, email) async { loginUsingCredentials(String passengerID, email) async {
isloading = true; isloading = true;
update(); update();
bool isTokenExpired = JwtDecoder.isExpired(X
.r(X.r(X.r(box.read(BoxName.jwt), cn), cC), cs)
.toString()
.split(AppInformation.addd)[0]);
if (isTokenExpired) {
Log.print('isTokenExpired loginUsingCredentials: ${isTokenExpired}');
await getJWT();
}
var res = var res =
await CRUD().get(link: AppLink.loginFromGooglePassenger, payload: { await CRUD().get(link: AppLink.loginFromGooglePassenger, payload: {
'email': email.toString().contains('@') 'email': email.toString().contains('@')
? encryptionHelper.encryptData(email) ? EncryptionHelper.instance.encryptData(email)
: email, : email,
'id': passengerID, 'id': passengerID,
"platform": Platform.isAndroid ? 'android' : 'ios', "platform": Platform.isAndroid ? 'android' : 'ios',
@@ -110,18 +215,22 @@ class LoginController extends GetxController {
box.write(BoxName.validity, d['validity']); box.write(BoxName.validity, d['validity']);
box.write(BoxName.isInstall, d['isInstall'] ?? 'none'); box.write(BoxName.isInstall, d['isInstall'] ?? 'none');
box.write(BoxName.isGiftToken, d['isGiftToken'] ?? 'none'); box.write(BoxName.isGiftToken, d['isGiftToken'] ?? 'none');
box.write(BoxName.firstTimeLoadKey, 'false');
d['inviteCode'] != null d['inviteCode'] != null
? box.write( ? box.write(
BoxName.inviteCode, BoxName.inviteCode,
encryptionHelper.decryptData(d['inviteCode'].toString()) ?? EncryptionHelper.instance
.decryptData(d['inviteCode'].toString()) ??
'none') 'none')
: null; : null;
var token = await CRUD().get(link: AppLink.getTokens, payload: { var token = await CRUD().get(link: AppLink.getTokens, payload: {
'passengerID': box.read(BoxName.passengerID).toString() 'passengerID': box.read(BoxName.passengerID).toString()
}); });
var fingerPrint = await getDeviceFingerprint();
await storage.write(key: BoxName.fingerPrint, value: fingerPrint);
if (token != 'failure') { if (token != 'failure') {
if (encryptionHelper.decryptData( if (EncryptionHelper.instance.decryptData(
jsonDecode(token)['data'][0]['token'].toString()) != jsonDecode(token)['data'][0]['token'].toString()) !=
box.read(BoxName.tokenFCM)) { box.read(BoxName.tokenFCM)) {
MyDialog().getDialog('change device'.tr, 'token change'.tr, MyDialog().getDialog('change device'.tr, 'token change'.tr,
@@ -131,20 +240,23 @@ class LoginController extends GetxController {
link: "${AppLink.server}/ride/firebase/add.php", link: "${AppLink.server}/ride/firebase/add.php",
payload: { payload: {
'token': box.read(BoxName.tokenFCM), 'token': box.read(BoxName.tokenFCM),
'passengerID': box.read(BoxName.passengerID).toString() 'passengerID': box.read(BoxName.passengerID).toString(),
'fingerPrint': (fingerPrint).toString()
}), }),
CRUD().post( CRUD().post(
link: link:
"${AppLink.tripzAlexandriaServer}/ride/firebase/add.php", "${AppLink.tripzAlexandriaServer}/ride/firebase/add.php",
payload: { payload: {
'token': box.read(BoxName.tokenFCM), 'token': box.read(BoxName.tokenFCM),
'passengerID': box.read(BoxName.passengerID).toString() 'passengerID': box.read(BoxName.passengerID).toString(),
'fingerPrint': (fingerPrint).toString()
}), }),
CRUD().post( CRUD().post(
link: "${AppLink.tripzGizaServer}/ride/firebase/add.php", link: "${AppLink.tripzGizaServer}/ride/firebase/add.php",
payload: { payload: {
'token': box.read(BoxName.tokenFCM), 'token': box.read(BoxName.tokenFCM),
'passengerID': box.read(BoxName.passengerID).toString() 'passengerID': box.read(BoxName.passengerID).toString(),
'fingerPrint': (fingerPrint).toString()
}), }),
]; ];
// cameras = await availableCameras(); // cameras = await availableCameras();
@@ -153,7 +265,7 @@ class LoginController extends GetxController {
.sendNotificationToDriverMAP( .sendNotificationToDriverMAP(
'token change'.tr, 'token change'.tr,
'change device'.tr, 'change device'.tr,
encryptionHelper.decryptData( EncryptionHelper.instance.decryptData(
jsonDecode(token)['data'][0]['token'].toString()), jsonDecode(token)['data'][0]['token'].toString()),
[], [],
'cancel.wav', 'cancel.wav',
@@ -174,9 +286,7 @@ class LoginController extends GetxController {
Get.offAll(() => const MapPagePassenger()); Get.offAll(() => const MapPagePassenger());
}, },
); );
} else { } else {}
print('same');
}
} // Logging to check if inviteCode is written correctly } // Logging to check if inviteCode is written correctly
if (d['inviteCode'] != 'none' && if (d['inviteCode'] != 'none' &&
@@ -185,7 +295,7 @@ class LoginController extends GetxController {
box.read(BoxName.isInstall).toString() != '1') { box.read(BoxName.isInstall).toString() != '1') {
await CRUD() await CRUD()
.post(link: AppLink.updatePassengersInvitation, payload: { .post(link: AppLink.updatePassengersInvitation, payload: {
"inviteCode": encryptionHelper "inviteCode": EncryptionHelper.instance
.encryptData(box.read(BoxName.inviteCode).toString()), .encryptData(box.read(BoxName.inviteCode).toString()),
"passengerID": box.read(BoxName.passengerID).toString(), "passengerID": box.read(BoxName.passengerID).toString(),
}); });
@@ -198,7 +308,7 @@ class LoginController extends GetxController {
try { try {
CRUD().post(link: AppLink.addPassengersPromo, payload: { CRUD().post(link: AppLink.addPassengersPromo, payload: {
"promoCode": "promoCode":
'S-${encryptionHelper.decryptData(box.read(BoxName.name)).toString().split(' ')[0]}', 'S-${EncryptionHelper.instance.decryptData(box.read(BoxName.name)).toString().split(' ')[0]}',
"amount": '25', "amount": '25',
"passengerID": box.read(BoxName.passengerID).toString(), "passengerID": box.read(BoxName.passengerID).toString(),
"description": 'promo first' "description": 'promo first'
@@ -236,7 +346,7 @@ class LoginController extends GetxController {
update(); update();
var res = var res =
await CRUD().get(link: AppLink.loginFromGooglePassenger, payload: { await CRUD().get(link: AppLink.loginFromGooglePassenger, payload: {
'email': encryptionHelper.encryptData(emailController.text), 'email': EncryptionHelper.instance.encryptData(emailController.text),
'id': passwordController.text 'id': passwordController.text
}); });

View File

@@ -143,7 +143,8 @@ class RegisterController extends GetxController {
var responseChecker = await CRUD().post( var responseChecker = await CRUD().post(
link: AppLink.checkPhoneNumberISVerfiedPassenger, link: AppLink.checkPhoneNumberISVerfiedPassenger,
payload: { payload: {
'phone_number': encryptionHelper.encryptData(phoneNumber), 'phone_number':
EncryptionHelper.instance.encryptData(phoneNumber),
'email': box.read(BoxName.email), 'email': box.read(BoxName.email),
}, },
); );
@@ -156,8 +157,8 @@ class RegisterController extends GetxController {
Get.snackbar('Phone number is verified before'.tr, '', Get.snackbar('Phone number is verified before'.tr, '',
backgroundColor: AppColor.greenColor); backgroundColor: AppColor.greenColor);
box.write(BoxName.isVerified, '1'); box.write(BoxName.isVerified, '1');
box.write( box.write(BoxName.phone,
BoxName.phone, encryptionHelper.encryptData(phoneNumber)); EncryptionHelper.instance.encryptData(phoneNumber));
Get.offAll(const MapPagePassenger()); Get.offAll(const MapPagePassenger());
} else { } else {
await sendOtp(phoneNumber, randomNumber, isEgyptianNumber, await sendOtp(phoneNumber, randomNumber, isEgyptianNumber,
@@ -193,18 +194,18 @@ class RegisterController extends GetxController {
// Trim any leading or trailing whitespace from the phone number // Trim any leading or trailing whitespace from the phone number
phoneNumber = phoneNumber.trim(); phoneNumber = phoneNumber.trim();
var dd = await CRUD().post(link: AppLink.sendVerifyOtpMessage, payload: { var dd = await CRUD().post(link: AppLink.sendVerifyOtpMessage, payload: {
'phone_number': encryptionHelper.encryptData(phoneNumber), 'phone_number': EncryptionHelper.instance.encryptData(phoneNumber),
'token': encryptionHelper.encryptData(otp.toString()), 'token': EncryptionHelper.instance.encryptData(otp.toString()),
}); });
Log.print('dd: ${dd}'); Log.print('dd: ${dd}');
if (isEgyptian) { if (isEgyptian) {
await CRUD().post(link: AppLink.updatePhoneInvalidSMSPassenger, payload: { await CRUD().post(link: AppLink.updatePhoneInvalidSMSPassenger, payload: {
"phone_number": encryptionHelper "phone_number": EncryptionHelper.instance
.encryptData(Get.find<RegisterController>().phoneController.text) .encryptData(Get.find<RegisterController>().phoneController.text)
}); });
box.write( box.write(BoxName.phone,
BoxName.phone, encryptionHelper.encryptData(phoneController.text)); EncryptionHelper.instance.encryptData(phoneController.text));
var nameParts = encryptionHelper var nameParts = EncryptionHelper.instance
.decryptData(box.read(BoxName.name)) .decryptData(box.read(BoxName.name))
.toString() .toString()
.split(' '); .split(' ');
@@ -213,14 +214,14 @@ class RegisterController extends GetxController {
var payload = { var payload = {
'id': box.read(BoxName.passengerID), 'id': box.read(BoxName.passengerID),
'phone': encryptionHelper.encryptData(phoneController.text), 'phone': EncryptionHelper.instance.encryptData(phoneController.text),
'email': box.read(BoxName.email), 'email': box.read(BoxName.email),
'password': encryptionHelper.encryptData('unknown'), 'password': EncryptionHelper.instance.encryptData('unknown'),
'gender': encryptionHelper.encryptData('unknown'), 'gender': EncryptionHelper.instance.encryptData('unknown'),
'birthdate': encryptionHelper.encryptData('2002-01-01'), 'birthdate': EncryptionHelper.instance.encryptData('2002-01-01'),
'site': box.read(BoxName.passengerPhotoUrl) ?? 'unknown', 'site': box.read(BoxName.passengerPhotoUrl) ?? 'unknown',
'first_name': encryptionHelper.encryptData(firstName), 'first_name': EncryptionHelper.instance.encryptData(firstName),
'last_name': encryptionHelper.encryptData(lastName), 'last_name': EncryptionHelper.instance.encryptData(lastName),
}; };
var res1 = await CRUD().post( var res1 = await CRUD().post(
@@ -245,8 +246,8 @@ class RegisterController extends GetxController {
box.write(BoxName.isVerified, '1'); box.write(BoxName.isVerified, '1');
box.write(BoxName.isFirstTime, '0'); box.write(BoxName.isFirstTime, '0');
box.write( box.write(BoxName.phone,
BoxName.phone, encryptionHelper.encryptData(phoneController.text)); EncryptionHelper.instance.encryptData(phoneController.text));
Get.put(LoginController()).loginUsingCredentials( Get.put(LoginController()).loginUsingCredentials(
box.read(BoxName.passengerID).toString(), box.read(BoxName.passengerID).toString(),
@@ -257,8 +258,8 @@ class RegisterController extends GetxController {
} else if (phoneController.text.toString().length >= 10) { } else if (phoneController.text.toString().length >= 10) {
box.write(BoxName.isVerified, '1'); box.write(BoxName.isVerified, '1');
box.write(BoxName.isFirstTime, '0'); //todo check if first or not box.write(BoxName.isFirstTime, '0'); //todo check if first or not
box.write( box.write(BoxName.phone,
BoxName.phone, encryptionHelper.encryptData(phoneController.text)); EncryptionHelper.instance.encryptData(phoneController.text));
Get.put(LoginController()).loginUsingCredentials( Get.put(LoginController()).loginUsingCredentials(
box.read(BoxName.passengerID).toString(), box.read(BoxName.passengerID).toString(),
@@ -279,14 +280,16 @@ class RegisterController extends GetxController {
try { try {
if (formKey3.currentState!.validate()) { if (formKey3.currentState!.validate()) {
var res = await CRUD().post(link: AppLink.verifyOtpMessage, payload: { var res = await CRUD().post(link: AppLink.verifyOtpMessage, payload: {
'phone_number': encryptionHelper.encryptData(phoneController.text), 'phone_number':
'token': encryptionHelper.encryptData(verifyCode.text.toString()), EncryptionHelper.instance.encryptData(phoneController.text),
'token':
EncryptionHelper.instance.encryptData(verifyCode.text.toString()),
}); });
if (res != 'failure') { if (res != 'failure') {
box.write(BoxName.phone, box.write(BoxName.phone,
encryptionHelper.encryptData(phoneController.text)); EncryptionHelper.instance.encryptData(phoneController.text));
var nameParts = encryptionHelper var nameParts = EncryptionHelper.instance
.decryptData(box.read(BoxName.name)) .decryptData(box.read(BoxName.name))
.toString() .toString()
.split(' '); .split(' ');
@@ -295,7 +298,8 @@ class RegisterController extends GetxController {
var payload = { var payload = {
'id': box.read(BoxName.passengerID), 'id': box.read(BoxName.passengerID),
'phone': encryptionHelper.decryptData(phoneController.text), 'phone':
EncryptionHelper.instance.decryptData(phoneController.text),
'email': box.read(BoxName.email), 'email': box.read(BoxName.email),
'password': 'unknown', 'password': 'unknown',
'gender': 'unknown', 'gender': 'unknown',
@@ -328,7 +332,7 @@ class RegisterController extends GetxController {
box.write(BoxName.isVerified, '1'); box.write(BoxName.isVerified, '1');
box.write(BoxName.isFirstTime, '0'); box.write(BoxName.isFirstTime, '0');
box.write(BoxName.phone, box.write(BoxName.phone,
encryptionHelper.decryptData(phoneController.text)); EncryptionHelper.instance.decryptData(phoneController.text));
Get.put(LoginController()).loginUsingCredentials( Get.put(LoginController()).loginUsingCredentials(
box.read(BoxName.passengerID).toString(), box.read(BoxName.passengerID).toString(),

View File

@@ -23,8 +23,8 @@ class TokenController extends GetxController {
'Basic ${base64Encode(utf8.encode(basicAuthCredentials.toString()))}', 'Basic ${base64Encode(utf8.encode(basicAuthCredentials.toString()))}',
}, },
body: { body: {
'token': 'token': EncryptionHelper.instance
encryptionHelper.decryptData(box.read(BoxName.tokenFCM.toString())), .decryptData(box.read(BoxName.tokenFCM.toString())),
'passengerID': box.read(BoxName.passengerID).toString() 'passengerID': box.read(BoxName.passengerID).toString()
}, },
); );

View File

@@ -94,8 +94,8 @@ class FirebaseMessagesController extends GetxController {
Future getToken() async { Future getToken() async {
fcmToken.getToken().then((token) { fcmToken.getToken().then((token) {
box.write( box.write(BoxName.tokenFCM,
BoxName.tokenFCM, encryptionHelper.encryptData(token.toString())); EncryptionHelper.instance.encryptData(token.toString()));
}); });
FirebaseMessaging.onMessage.listen((RemoteMessage message) { FirebaseMessaging.onMessage.listen((RemoteMessage message) {
@@ -415,7 +415,7 @@ class FirebaseMessagesController extends GetxController {
confirm: MyElevatedButton( confirm: MyElevatedButton(
title: 'Ok I will go now.'.tr, title: 'Ok I will go now.'.tr,
onPressed: () { onPressed: () {
FirebaseMessagesController().sendNotificationToPassengerToken( sendNotificationToPassengerToken(
'Hi ,I will go now', 'Hi ,I will go now',
'I will go now'.tr, 'I will go now'.tr,
Get.find<MapPassengerController>().driverToken, Get.find<MapPassengerController>().driverToken,
@@ -440,7 +440,7 @@ class FirebaseMessagesController extends GetxController {
confirm: MyElevatedButton( confirm: MyElevatedButton(
title: 'Ok'.tr, title: 'Ok'.tr,
onPressed: () { onPressed: () {
// FirebaseMessagesController().sendNotificationToPassengerToken( // Get.find<FirebaseMessagesController>().sendNotificationToPassengerToken(
// 'Hi ,I will go now'.tr, // 'Hi ,I will go now'.tr,
// 'I will go now'.tr, // 'I will go now'.tr,
// Get.find<MapPassengerController>().driverToken, []); // Get.find<MapPassengerController>().driverToken, []);
@@ -557,25 +557,32 @@ class FirebaseMessagesController extends GetxController {
// }); // });
// } // }
// } // }
late String serviceAccountKeyJson;
@override
Future<void> onInit() async {
super.onInit();
try {
var encryptedKey = await storage.read(key: 'FCM_PRIVATE_KEY');
// Log.print('encryptedKey: ${encryptedKey}');
if (encryptedKey != null) {
serviceAccountKeyJson =
EncryptionHelper.instance.decryptData(encryptedKey);
// Log.print('serviceAccountKeyJson: ${serviceAccountKeyJson}');
} else {
print('🔴 Error: FCM_PRIVATE_KEY not found in Secure Storage');
}
} catch (e) {
print('🔴 Error decrypting FCM key: $e');
}
}
void sendNotificationToPassengerToken( void sendNotificationToPassengerToken(
String title, body, token, List<String> map, String tone) async { String title, body, token, List<String> map, String tone) async {
try { try {
String serviceAccountKeyJson = '''{ if (serviceAccountKeyJson.isEmpty) {
"type": "service_account", print("🔴 Error: Service Account Key is empty");
"project_id": "ride-b1bd8", return;
"private_key_id": "75e817c0b902db2ef35edf2c2bd159dec1f13249",
"private_key": "-----BEGIN PRIVATE KEY-----\\nMIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQD0zH9TQGDQHUv3\\na3/JAD1UKPwAp3wNKT0a6fxiIzjI3JxQWI30QvZCcfl6CdMhIcydX1ncSaYTcEeC\\n/AdPVCPkqyJx1YIGGg6P/mRzCWeaN8fsp6z250m5vcObDCZc3dbJEkepbep+6FPY\\n21m3KO+AHh1glgsTGZOTm5xiU8NGXpdk2QEh8wpiIIlR/HuKwVw9g8urNe3Sno+U\\nDm3z37iFqvZdmpqO8aWTJu6beb3hsREK9XK2I9JqC2JUwiGQRo3idOvPP6hkqrWx\\nKSX96vglQFYfakvJdDp2ZATOlpBYPMtS/IWhJ985u58TSS+Kl8qpnpaZBSxgJirf\\nhWzhnKLfAgMBAAECggEAJP785SePGhS7ZN6ltspm+l+hSjYFrPWFCxq+rlQ1YkHZ\\nC9l+RqKSFhOkiPmQI2s4wbXl3kFxLHHlFNoi/q2wKQBmGb8TQfnRJpjjNHGA61Ev\\n0Ue7/6qPvVb9B2MsLw/FxKiTFPuMG3bgKR9pbSFuJLYoaW7zqITOhVnYphGTqwAY\\nBVVcvISSLvELDmH9VZcv/9DVqVlqbbESHWh1Z4W6XGPoEqeDH/upNTyQQ/46Msgm\\nTGE6VqLHpWuSf6SqHp+r0Y0lI3vIPM1vz5FAJDJbOE/enHa0fSup0OHSMxl0HVMn\\nnO1yrGF3vsIPOej5HKr5d71bEIckzk73/yjNC1/mDQKBgQD7RtUvc9omsSsFMJ6e\\nBASAn6Dktx/QY/XNJjFzHQj69cywLDe5t5AL2gUi3phQ2oqB5XJdwnd5bTIEPEPZ\\nDOuOai2802p6FJk6kjmZAMVGx5JtXBH+vs6jrmQQSMiKbjwN1TT6xIWakvLOonUi\\nX6ZvjYYjU/E0YJU3jSiXWEr76wKBgQD5Zn4SouJ6BCDZMbausJVMBkk3qxsYooip\\np89WakC6e7AZinpkRcqjGGV9GOvc8crJs6fyXAA9ORepGP47Mc0ZrDssOkstznsM\\npr8R0S6MKwEZaT9ixOHdOcLZ47ps+JzA2Wr4KN2OvFHksUkB/46ATD1j9WZVgB8M\\namsYp/Y73QKBgHOo+PvsoZ9psVmkNX6abtAdqdtdB0HOoRea2uwXk0ig12TIFaZg\\nfedWpUKVnxqoXVTJHklV99RmlL0qWDiSH+LfsMnXro0e6iDxqZ1po2Se/CFmXcoa\\nXdctsFVmixhdATuExewfhTfPKABA+xWlXWC/jdy5CK+JPWXijaqMM4edAoGAE5Bj\\nsWiPpYyvWvpYX0nA3G7dzX0hqgQN/mkIjbnWDArp3IcNZNJIvBSM2Yxb7EAXbU0n\\njo6DAkp5Pa2VO+WDNlFZbvW/sf8xjeOCt44WPa6d7nVgIIpbQXRngZoopKW3/jTP\\n/FmQT8McFXmGxZ5belsAsdetSGW9icbLUerTGQ0CgYEAmf/G8Ag3XxmqTXvvHuv2\\n14OP7WnrVqkEMnydrftEwn4peXd/Lz+/GYX5Zc4ZoNgbN8IvZ5z0+OmRsallsbiW\\nBw0/tc68CjzxXOvReWxDluUopqWVGj5tlGqE5xUDku9SWJSxbkiQ3rqutzBdPXpr\\noqHwPyDrmK/Zgqn+uiIm4Ck=\\n-----END PRIVATE KEY-----\\n",
"client_email": "firebase-adminsdk-o2wqi@ride-b1bd8.iam.gserviceaccount.com",
"client_id": "111210077025005706623",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://oauth2.googleapis.com/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/firebase-adminsdk-o2wqi%40ride-b1bd8.iam.gserviceaccount.com",
"universe_domain": "googleapis.com"
} }
'''; // As defined above
// Initialize AccessTokenManager // Initialize AccessTokenManager
final accessTokenManager = AccessTokenManager(serviceAccountKeyJson); final accessTokenManager = AccessTokenManager(serviceAccountKeyJson);
@@ -619,16 +626,14 @@ class FirebaseMessagesController extends GetxController {
); );
if (response.statusCode == 200) { if (response.statusCode == 200) {
print( print('✅ Notification sent successfully!');
'Notification sent successfully. Status code: ${response.statusCode}');
print('Response body: ${response.body}');
} else { } else {
print( print(
'Failed to send notification. Status code: ${response.statusCode}'); '🔴 Failed to send notification. Status code: ${response.statusCode}');
print('Response body: ${response.body}'); print('Response body: ${response.body}');
} }
} catch (e) { } catch (e) {
print('Error sending notification: $e'); print('🔴 Error sending notification: $e');
} }
} }
@@ -636,23 +641,14 @@ class FirebaseMessagesController extends GetxController {
String title, String body, String token, List<String> data, String tone, String title, String body, String token, List<String> data, String tone,
{int retryCount = 2}) async { {int retryCount = 2}) async {
try { try {
String serviceAccountKeyJson = '''{ if (serviceAccountKeyJson.isEmpty) {
"type": "service_account", print("🔴 Error: Service Account Key is empty");
"project_id": "ride-b1bd8", return;
"private_key_id": "75e817c0b902db2ef35edf2c2bd159dec1f13249",
"private_key": "-----BEGIN PRIVATE KEY-----\\nMIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQD0zH9TQGDQHUv3\\na3/JAD1UKPwAp3wNKT0a6fxiIzjI3JxQWI30QvZCcfl6CdMhIcydX1ncSaYTcEeC\\n/AdPVCPkqyJx1YIGGg6P/mRzCWeaN8fsp6z250m5vcObDCZc3dbJEkepbep+6FPY\\n21m3KO+AHh1glgsTGZOTm5xiU8NGXpdk2QEh8wpiIIlR/HuKwVw9g8urNe3Sno+U\\nDm3z37iFqvZdmpqO8aWTJu6beb3hsREK9XK2I9JqC2JUwiGQRo3idOvPP6hkqrWx\\nKSX96vglQFYfakvJdDp2ZATOlpBYPMtS/IWhJ985u58TSS+Kl8qpnpaZBSxgJirf\\nhWzhnKLfAgMBAAECggEAJP785SePGhS7ZN6ltspm+l+hSjYFrPWFCxq+rlQ1YkHZ\\nC9l+RqKSFhOkiPmQI2s4wbXl3kFxLHHlFNoi/q2wKQBmGb8TQfnRJpjjNHGA61Ev\\n0Ue7/6qPvVb9B2MsLw/FxKiTFPuMG3bgKR9pbSFuJLYoaW7zqITOhVnYphGTqwAY\\nBVVcvISSLvELDmH9VZcv/9DVqVlqbbESHWh1Z4W6XGPoEqeDH/upNTyQQ/46Msgm\\nTGE6VqLHpWuSf6SqHp+r0Y0lI3vIPM1vz5FAJDJbOE/enHa0fSup0OHSMxl0HVMn\\nnO1yrGF3vsIPOej5HKr5d71bEIckzk73/yjNC1/mDQKBgQD7RtUvc9omsSsFMJ6e\\nBASAn6Dktx/QY/XNJjFzHQj69cywLDe5t5AL2gUi3phQ2oqB5XJdwnd5bTIEPEPZ\\nDOuOai2802p6FJk6kjmZAMVGx5JtXBH+vs6jrmQQSMiKbjwN1TT6xIWakvLOonUi\\nX6ZvjYYjU/E0YJU3jSiXWEr76wKBgQD5Zn4SouJ6BCDZMbausJVMBkk3qxsYooip\\np89WakC6e7AZinpkRcqjGGV9GOvc8crJs6fyXAA9ORepGP47Mc0ZrDssOkstznsM\\npr8R0S6MKwEZaT9ixOHdOcLZ47ps+JzA2Wr4KN2OvFHksUkB/46ATD1j9WZVgB8M\\namsYp/Y73QKBgHOo+PvsoZ9psVmkNX6abtAdqdtdB0HOoRea2uwXk0ig12TIFaZg\\nfedWpUKVnxqoXVTJHklV99RmlL0qWDiSH+LfsMnXro0e6iDxqZ1po2Se/CFmXcoa\\nXdctsFVmixhdATuExewfhTfPKABA+xWlXWC/jdy5CK+JPWXijaqMM4edAoGAE5Bj\\nsWiPpYyvWvpYX0nA3G7dzX0hqgQN/mkIjbnWDArp3IcNZNJIvBSM2Yxb7EAXbU0n\\njo6DAkp5Pa2VO+WDNlFZbvW/sf8xjeOCt44WPa6d7nVgIIpbQXRngZoopKW3/jTP\\n/FmQT8McFXmGxZ5belsAsdetSGW9icbLUerTGQ0CgYEAmf/G8Ag3XxmqTXvvHuv2\\n14OP7WnrVqkEMnydrftEwn4peXd/Lz+/GYX5Zc4ZoNgbN8IvZ5z0+OmRsallsbiW\\nBw0/tc68CjzxXOvReWxDluUopqWVGj5tlGqE5xUDku9SWJSxbkiQ3rqutzBdPXpr\\noqHwPyDrmK/Zgqn+uiIm4Ck=\\n-----END PRIVATE KEY-----\\n",
"client_email": "firebase-adminsdk-o2wqi@ride-b1bd8.iam.gserviceaccount.com",
"client_id": "111210077025005706623",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://oauth2.googleapis.com/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/firebase-adminsdk-o2wqi%40ride-b1bd8.iam.gserviceaccount.com",
"universe_domain": "googleapis.com"
} }
'''; // As defined above
// Initialize AccessTokenManager // Initialize AccessTokenManager
final accessTokenManager = AccessTokenManager(serviceAccountKeyJson); final accessTokenManager = AccessTokenManager(serviceAccountKeyJson);
// Log.print('accessTokenManager: ${accessTokenManager}');
// Obtain an OAuth 2.0 access token // Obtain an OAuth 2.0 access token
final accessToken = await accessTokenManager.getAccessToken(); final accessToken = await accessTokenManager.getAccessToken();

View File

@@ -1,15 +1,23 @@
import 'dart:convert'; import 'dart:convert';
import 'package:Tripz/constant/box_name.dart'; import 'package:Tripz/constant/box_name.dart';
import 'package:Tripz/constant/links.dart'; import 'package:Tripz/constant/links.dart';
import 'package:Tripz/controller/auth/login_controller.dart';
import 'package:Tripz/controller/functions/encrypt_decrypt.dart';
import 'package:Tripz/controller/functions/package_info.dart';
import 'package:Tripz/main.dart'; import 'package:Tripz/main.dart';
import 'package:Tripz/views/widgets/mydialoug.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:http/http.dart' as http; import 'package:http/http.dart' as http;
import 'package:Tripz/env/env.dart'; import 'package:Tripz/env/env.dart';
import 'package:secure_string_operations/secure_string_operations.dart';
import '../../constant/api_key.dart'; import '../../constant/api_key.dart';
import '../../constant/char_map.dart';
import '../../constant/info.dart';
import '../../print.dart'; import '../../print.dart';
import '../../views/widgets/elevated_btn.dart'; import '../../views/widgets/elevated_btn.dart';
import '../../views/widgets/error_snakbar.dart';
import 'add_error.dart'; import 'add_error.dart';
import 'upload_image.dart'; import 'upload_image.dart';
@@ -27,25 +35,89 @@ class CRUD {
headers: { headers: {
"Content-Type": "application/x-www-form-urlencoded", "Content-Type": "application/x-www-form-urlencoded",
'Authorization': 'Authorization':
'Basic ${base64Encode(utf8.encode(AK.basicAuthCredentials.toString()))}', // 'Bearer ${box.read(BoxName.firstTimeLoadKey) != null ? EncryptionHelper.instance.decryptData(box.read(BoxName.jwt).toString()) : box.read(BoxName.jwt).toString()}'
// 'Bearer ${box.read(BoxName.jwt).toString()}'
'Bearer ${X.r(X.r(X.r(box.read(BoxName.jwt), cn), cC), cs).toString().split(AppInformation.addd)[0]}'
}, },
); );
// Log.print('req: ${response.request}'); Log.print('req: ${response.request}');
// Log.print('response: ${response.body}'); Log.print('response: ${response.body}');
// Log.print('payload: ${payload}'); Log.print('payload: ${payload}');
// if (response.statusCode == 200) { if (response.statusCode == 200) {
var jsonData = jsonDecode(response.body); var jsonData = jsonDecode(response.body);
if (jsonData['status'] == 'success') { if (jsonData['status'] == 'success') {
return response.body; return response.body;
} }
return jsonData['status']; return jsonData['status'];
} else if (response.statusCode == 401) {
// Specifically handle 401 Unauthorized
var jsonData = jsonDecode(response.body);
if (jsonData['error'] == 'Token expired') {
// Show snackbar prompting to re-login
await Get.put(LoginController()).getJWT();
mySnackbarSuccess('please order now'.tr);
return 'token_expired'; // Return a specific value for token expiration
} else {
// Other 401 errors
addError('Unauthorized: ${jsonData['error']}', 'crud().post - 401');
return 'failure';
}
} else {
addError('Non-200 response code: ${response.statusCode}',
'crud().post - Other');
return 'failure';
}
} }
Future<dynamic> post({ Future<dynamic> getWallet({
required String link, required String link,
Map<String, dynamic>? payload, Map<String, dynamic>? payload,
}) async { }) async {
var s = await LoginController().getJwtWallet();
var url = Uri.parse(
link,
);
var response = await http.post(
url,
body: payload,
headers: {
"Content-Type": "application/x-www-form-urlencoded",
'Authorization': 'Bearer $s'
},
);
if (response.statusCode == 200) {
var jsonData = jsonDecode(response.body);
if (jsonData['status'] == 'success') {
return response.body;
}
return jsonData['status'];
} else if (response.statusCode == 401) {
// Specifically handle 401 Unauthorized
var jsonData = jsonDecode(response.body);
if (jsonData['error'] == 'Token expired') {
// Show snackbar prompting to re-login
await Get.put(LoginController()).getJwtWallet();
return 'token_expired'; // Return a specific value for token expiration
} else {
// Other 401 errors
addError('Unauthorized: ${jsonData['error']}', 'crud().post - 401');
return 'failure';
}
} else {
addError('Non-200 response code: ${response.statusCode}',
'crud().post - Other');
return 'failure';
}
}
Future<dynamic> post(
{required String link, Map<String, dynamic>? payload}) async {
var url = Uri.parse(link); var url = Uri.parse(link);
try { try {
var response = await http.post( var response = await http.post(
@@ -54,34 +126,56 @@ class CRUD {
headers: { headers: {
"Content-Type": "application/x-www-form-urlencoded", "Content-Type": "application/x-www-form-urlencoded",
'Authorization': 'Authorization':
'Basic ${base64Encode(utf8.encode(AK.basicAuthCredentials))}', 'Bearer ${X.r(X.r(X.r(box.read(BoxName.jwt), cn), cC), cs).toString().split(AppInformation.addd)[0]}'
// 'Authorization': 'Bearer ${box.read(BoxName.jwt)}'
}, },
); );
if (response.statusCode == 200) {
try {
// Log.print('req: ${response.request}'); // Log.print('req: ${response.request}');
// Log.print('response: ${response.body}'); // Log.print('response: ${response.body}');
// Log.print('payload: ${payload}'); // Log.print('payload: ${payload}');
if (response.statusCode == 200) {
try {
var jsonData = jsonDecode(response.body); var jsonData = jsonDecode(response.body);
if (jsonData['status'] == 'success') { if (jsonData['status'] == 'success') {
return jsonData; return jsonData;
} else { } else {
return jsonData['status']; return jsonData['status'];
} }
} catch (e) { } catch (e) {
addError(e.toString(), 'crud().post'); addError(e.toString(), 'crud().post - JSON decoding');
return 'failure'; // Return a recognizable failure string for JSON errors return 'failure';
}
} else if (response.statusCode == 401) {
// Specifically handle 401 Unauthorized
var jsonData = jsonDecode(response.body);
if (jsonData['error'] == 'Token expired') {
// Show snackbar prompting to re-login
await Get.put(LoginController()).getJWT();
// MyDialog().getDialog(
// 'Session expired. Please log in again.'.tr,
// '',
// () {
// Get.put(LoginController()).loginUsingCredentials(
// box.read(BoxName.passengerID), box.read(BoxName.email));
// Get.back();
// },
// );
return 'token_expired'; // Return a specific value for token expiration
} else {
// Other 401 errors
addError('Unauthorized: ${jsonData['error']}', 'crud().post - 401');
return 'failure';
} }
} else { } else {
addError( addError('Non-200 response code: ${response.statusCode}',
'Non-200 response code: ${response.statusCode}', 'crud().post'); 'crud().post - Other');
return 'failure'; // Handle unexpected status codes as failures return 'failure';
} }
} catch (e) { } catch (e) {
addError('HTTP request error: $e', 'crud().post'); addError('HTTP request error: $e', 'crud().post - HTTP');
return 'failure'; // Handle HTTP request errors as failures return 'failure';
} }
} }
@@ -509,24 +603,24 @@ class CRUD {
} }
} }
Future<dynamic> update({ // Future<dynamic> update({
required String endpoint, // required String endpoint,
required Map<String, dynamic> data, // required Map<String, dynamic> data,
required String id, // required String id,
}) async { // }) async {
// String? basicAuthCredentials = // // String? basicAuthCredentials =
// await storage.read(key: BoxName.basicAuthCredentials); // // await storage.read(key: BoxName.basicAuthCredentials);
var url = Uri.parse('$endpoint/$id'); // var url = Uri.parse('$endpoint/$id');
var response = await http.put( // var response = await http.put(
url, // url,
body: json.encode(data), // body: json.encode(data),
headers: { // headers: {
'Authorization': // 'Authorization':
'Basic ${base64Encode(utf8.encode(AK.basicAuthCredentials))}', // 'Basic ${base64Encode(utf8.encode(AK.basicAuthCredentials))}',
}, // },
); // );
return json.decode(response.body); // return json.decode(response.body);
} // }
Future<dynamic> delete({ Future<dynamic> delete({
required String endpoint, required String endpoint,

View File

@@ -1,90 +1,92 @@
// import 'dart:io'; import 'dart:io';
//
// import 'package:device_info_plus/device_info_plus.dart'; import 'package:device_info_plus/device_info_plus.dart';
//
// class DeviceInfoPlus { import '../../print.dart';
// static List<Map<String, dynamic>> deviceDataList = [];
// class DeviceInfoPlus {
// static Future<List<Map<String, dynamic>>> getDeviceInfo() async { static List<Map<String, dynamic>> deviceDataList = [];
// final DeviceInfoPlugin deviceInfoPlugin = DeviceInfoPlugin();
// static Future<List<Map<String, dynamic>>> getDeviceInfo() async {
// try { final DeviceInfoPlugin deviceInfoPlugin = DeviceInfoPlugin();
// if (Platform.isAndroid) {
// AndroidDeviceInfo androidInfo = await deviceInfoPlugin.androidInfo; try {
// Map<String, dynamic> deviceData = { if (Platform.isAndroid) {
// 'platform': 'Android', AndroidDeviceInfo androidInfo = await deviceInfoPlugin.androidInfo;
// 'brand': androidInfo.brand, Map<String, dynamic> deviceData = {
// 'model': androidInfo.model, 'platform': 'Android',
// 'androidId': androidInfo.device, 'brand': androidInfo.brand,
// 'versionRelease': androidInfo.version.release, 'model': androidInfo.model,
// 'sdkVersion': androidInfo.version.sdkInt, 'androidId': androidInfo.device,
// 'manufacturer': androidInfo.manufacturer, 'versionRelease': androidInfo.version.release,
// 'isPhysicalDevice': androidInfo.isPhysicalDevice, 'sdkVersion': androidInfo.version.sdkInt,
// 'serialNumber': androidInfo.serialNumber, 'manufacturer': androidInfo.manufacturer,
// 'fingerprint': androidInfo.fingerprint, 'isPhysicalDevice': androidInfo.isPhysicalDevice,
// 'type': androidInfo.type, 'serialNumber': androidInfo.serialNumber,
// 'data': androidInfo.data, 'fingerprint': androidInfo.fingerprint,
// 'version': androidInfo.version, 'type': androidInfo.type,
// 'tags': androidInfo.tags, 'data': androidInfo.data,
// 'display': androidInfo.display, 'version': androidInfo.version,
// }; 'tags': androidInfo.tags,
// deviceDataList.add(deviceData); 'display': androidInfo.display,
// } else if (Platform.isIOS) { };
// IosDeviceInfo iosInfo = await deviceInfoPlugin.iosInfo; // Log.print('deviceData: ${deviceData}');
// Map<String, dynamic> deviceData = { deviceDataList.add(deviceData);
// 'brand': 'Apple', } else if (Platform.isIOS) {
// 'model': iosInfo.model, IosDeviceInfo iosInfo = await deviceInfoPlugin.iosInfo;
// 'systemName': iosInfo.systemName, Map<String, dynamic> deviceData = {
// 'systemVersion': iosInfo.systemVersion, 'brand': 'Apple',
// 'utsname': iosInfo.utsname, 'model': iosInfo.model,
// 'isPhysicalDevice': iosInfo.isPhysicalDevice, 'systemName': iosInfo.systemName,
// 'identifierForVendor': iosInfo.identifierForVendor, 'systemVersion': iosInfo.systemVersion,
// 'name': iosInfo.name, 'utsname': iosInfo.utsname,
// 'localizedModel': iosInfo.localizedModel, 'isPhysicalDevice': iosInfo.isPhysicalDevice,
// }; 'identifierForVendor': iosInfo.identifierForVendor,
// deviceDataList.add(deviceData); 'name': iosInfo.name,
// } else if (Platform.isMacOS) { 'localizedModel': iosInfo.localizedModel,
// MacOsDeviceInfo macInfo = await deviceInfoPlugin.macOsInfo; };
// Map<String, dynamic> deviceData = { deviceDataList.add(deviceData);
// 'platform': 'macOS', } else if (Platform.isMacOS) {
// 'model': macInfo.model, MacOsDeviceInfo macInfo = await deviceInfoPlugin.macOsInfo;
// 'version': macInfo.systemGUID, Map<String, dynamic> deviceData = {
// }; 'platform': 'macOS',
// deviceDataList.add(deviceData); 'model': macInfo.model,
// } else if (Platform.isWindows) { 'version': macInfo.systemGUID,
// WindowsDeviceInfo windowsInfo = await deviceInfoPlugin.windowsInfo; };
// Map<String, dynamic> deviceData = { deviceDataList.add(deviceData);
// 'platform': 'Windows', } else if (Platform.isWindows) {
// 'manufacturer': windowsInfo.computerName, WindowsDeviceInfo windowsInfo = await deviceInfoPlugin.windowsInfo;
// 'version': windowsInfo.majorVersion, Map<String, dynamic> deviceData = {
// 'deviceId': windowsInfo.deviceId, 'platform': 'Windows',
// 'userName': windowsInfo.userName, 'manufacturer': windowsInfo.computerName,
// 'productName': windowsInfo.productName, 'version': windowsInfo.majorVersion,
// 'installDate': windowsInfo.installDate, 'deviceId': windowsInfo.deviceId,
// 'productId': windowsInfo.productId, 'userName': windowsInfo.userName,
// 'numberOfCores': windowsInfo.numberOfCores, 'productName': windowsInfo.productName,
// 'systemMemoryInMegabytes': windowsInfo.systemMemoryInMegabytes, 'installDate': windowsInfo.installDate,
// }; 'productId': windowsInfo.productId,
// deviceDataList.add(deviceData); 'numberOfCores': windowsInfo.numberOfCores,
// } else if (Platform.isLinux) { 'systemMemoryInMegabytes': windowsInfo.systemMemoryInMegabytes,
// LinuxDeviceInfo linuxInfo = await deviceInfoPlugin.linuxInfo; };
// Map<String, dynamic> deviceData = { deviceDataList.add(deviceData);
// 'platform': 'Linux', } else if (Platform.isLinux) {
// 'manufacturer': linuxInfo.name, LinuxDeviceInfo linuxInfo = await deviceInfoPlugin.linuxInfo;
// 'version': linuxInfo.version, Map<String, dynamic> deviceData = {
// }; 'platform': 'Linux',
// deviceDataList.add(deviceData); 'manufacturer': linuxInfo.name,
// } 'version': linuxInfo.version,
// } catch (e) { };
// } deviceDataList.add(deviceData);
// }
// return deviceDataList; } catch (e) {}
// }
// return deviceDataList;
// // Method to print all device data }
// static void printDeviceInfo() {
// for (Map<String, dynamic> deviceData in deviceDataList) { // Method to print all device data
// 'Version: ${deviceData['version'] ?? deviceData['versionRelease'] ?? 'N/A'}'); static void printDeviceInfo() {
// } for (Map<String, dynamic> deviceData in deviceDataList) {
// } 'Version: ${deviceData['version'] ?? deviceData['versionRelease'] ?? 'N/A'}';
// } }
}
}

View File

@@ -1,33 +1,51 @@
import 'package:Tripz/constant/box_name.dart';
import 'package:encrypt/encrypt.dart' as encrypt; import 'package:encrypt/encrypt.dart' as encrypt;
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
import '../../env/env.dart'; import '../../main.dart';
import '../../print.dart';
var secretKey = Env.keyOfApp
.toString()
.split('XrXlBl')[0]; // Must be 16 characters for AES-128
String initializationVector = Env.initializationVector; // Must be 16 characters
final encryptionHelper = EncryptionHelper(
secretKey: secretKey,
initializationVector: initializationVector,
);
class EncryptionHelper { class EncryptionHelper {
final encrypt.Key key; static EncryptionHelper? _instance;
final encrypt.IV iv;
EncryptionHelper( late final encrypt.Key key;
{required String secretKey, required String initializationVector}) late final encrypt.IV iv;
: key = encrypt.Key.fromUtf8(secretKey),
iv = encrypt.IV.fromUtf8(initializationVector);
// Initialize the helper EncryptionHelper._(this.key, this.iv);
static EncryptionHelper get instance {
if (_instance == null) {
throw Exception(
"EncryptionHelper is not initialized. Call `await EncryptionHelper.initialize()` in main.");
}
return _instance!;
}
/// Encrypts the given plain text /// Initializes and stores the instance globally
static Future<void> initialize() async {
if (_instance != null) {
debugPrint("EncryptionHelper is already initialized.");
return; // Prevent re-initialization
}
debugPrint("Initializing EncryptionHelper...");
// Read stored keys
String? keyOfApp = await storage.read(key: BoxName.keyOfApp);
// Log.print('keyOfApp: ${keyOfApp}');
String? initializationVector =
await storage.read(key: BoxName.initializationVector);
// Log.print('initializationVector: ${initializationVector}');
// Set the global instance
_instance = EncryptionHelper._(
encrypt.Key.fromUtf8(keyOfApp!),
encrypt.IV.fromUtf8(initializationVector!),
);
debugPrint("EncryptionHelper initialized successfully.");
}
/// Encrypts a string
String encryptData(String plainText) { String encryptData(String plainText) {
try { try {
final encrypter = encrypt.Encrypter(encrypt.AES(key, final encrypter =
mode: encrypt.AESMode.cbc)); // Explicitly use CBC mode encrypt.Encrypter(encrypt.AES(key, mode: encrypt.AESMode.cbc));
final encrypted = encrypter.encrypt(plainText, iv: iv); final encrypted = encrypter.encrypt(plainText, iv: iv);
return encrypted.base64; return encrypted.base64;
} catch (e) { } catch (e) {
@@ -36,14 +54,13 @@ class EncryptionHelper {
} }
} }
/// Decrypts the given encrypted text /// Decrypts a string
String decryptData(String encryptedText) { String decryptData(String encryptedText) {
try { try {
final encrypter = encrypt.Encrypter(encrypt.AES(key, final encrypter =
mode: encrypt.AESMode.cbc)); // Explicitly use CBC mode encrypt.Encrypter(encrypt.AES(key, mode: encrypt.AESMode.cbc));
final encrypted = encrypt.Encrypted.fromBase64(encryptedText); final encrypted = encrypt.Encrypted.fromBase64(encryptedText);
final decrypted = encrypter.decrypt(encrypted, iv: iv); return encrypter.decrypt(encrypted, iv: iv);
return decrypted;
} catch (e) { } catch (e) {
debugPrint('Decryption Error: $e'); debugPrint('Decryption Error: $e');
return ''; return '';

View File

@@ -1,13 +1,15 @@
import 'dart:io'; import 'dart:io';
import 'dart:ui'; import 'dart:ui';
import 'package:flutter/cupertino.dart'; import 'package:device_info_plus/device_info_plus.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:jailbreak_root_detection/jailbreak_root_detection.dart';
import 'package:package_info_plus/package_info_plus.dart'; import 'package:package_info_plus/package_info_plus.dart';
import 'package:url_launcher/url_launcher.dart'; import 'package:url_launcher/url_launcher.dart';
import '../../constant/box_name.dart'; import '../../constant/box_name.dart';
import '../../constant/colors.dart'; import '../../constant/colors.dart';
import '../../main.dart'; import '../../main.dart';
import 'encrypt_decrypt.dart';
Future<void> checkForUpdate(BuildContext context) async { Future<void> checkForUpdate(BuildContext context) async {
final packageInfo = await PackageInfo.fromPlatform(); final packageInfo = await PackageInfo.fromPlatform();
@@ -38,6 +40,24 @@ checkForBounusInvitation() {
// } // }
// return ''; // return '';
// } // }
getDeviceFingerprint() async {
final deviceInfo = await DeviceInfoPlugin().deviceInfo;
var deviceData;
if (Platform.isAndroid) {
deviceData = deviceInfo.data;
} else if (Platform.isIOS) {
deviceData = deviceInfo.data;
}
final String deviceId =
deviceData['androidId'] ?? deviceData['identifierForVendor'];
final String deviceModel = deviceData['model'];
final String osVersion = deviceData['systemVersion'];
return EncryptionHelper.instance
.encryptData('${deviceId}_${deviceModel}_$osVersion');
}
void showUpdateDialog(BuildContext context) { void showUpdateDialog(BuildContext context) {
final String storeUrl = Platform.isAndroid final String storeUrl = Platform.isAndroid
@@ -158,3 +178,103 @@ void showUpdateDialog(BuildContext context) {
}, },
); );
} }
class SecurityHelper {
/// Performs security checks and handles potential risks
static Future<void> performSecurityChecks() async {
bool isNotTrust = false;
bool isJailBroken = false;
bool isRealDevice = true;
bool isOnExternalStorage = false;
bool checkForIssues = false;
bool isDevMode = false;
bool isTampered = false;
String bundleId = "";
try {
isNotTrust = await JailbreakRootDetection.instance.isNotTrust;
isJailBroken = await JailbreakRootDetection.instance.isJailBroken;
isRealDevice = await JailbreakRootDetection.instance.isRealDevice;
isOnExternalStorage =
await JailbreakRootDetection.instance.isOnExternalStorage;
List<JailbreakIssue> issues =
await JailbreakRootDetection.instance.checkForIssues;
checkForIssues = issues.isNotEmpty;
isDevMode = await JailbreakRootDetection.instance.isDevMode;
// Get Bundle ID
PackageInfo packageInfo = await PackageInfo.fromPlatform();
bundleId = packageInfo.packageName;
if (bundleId.isNotEmpty) {
// Pass the CORRECT bundle ID to isTampered
isTampered = await JailbreakRootDetection.instance.isTampered(bundleId);
}
} catch (e) {
debugPrint("Error during security checks: $e");
// Consider handling specific exceptions, not just general errors.
}
// Save values to storage (using GetStorage)
await box.write('isNotTrust', isNotTrust); // Use await for write operations
await box.write('isTampered', isTampered); // Use await
await box.write('isJailBroken', isJailBroken); // Use await
// debugPrint("Security Check Results:");
// debugPrint("isNotTrust: $isNotTrust");
// debugPrint("isJailBroken: $isJailBroken");
// debugPrint("isRealDevice: $isRealDevice");
// debugPrint("isOnExternalStorage: $isOnExternalStorage");
// debugPrint("checkForIssues: $checkForIssues");
// debugPrint("isDevMode: $isDevMode");
// debugPrint("isTampered: $isTampered");
// debugPrint("Bundle ID: $bundleId"); // Print the bundle ID
// Check for security risks and potentially show a warning
if (isNotTrust ||
isJailBroken ||
isTampered ||
isDevMode ||
isOnExternalStorage ||
!isRealDevice) {
// print("security_warning".tr); //using easy_localization
// Use a more robust approach to show a warning, like a dialog:
_showSecurityWarning();
}
}
/// Deletes all app data
static Future<void> clearAllData() async {
//await storage.deleteAll(); // What's 'storage'? Be specific. Likely GetStorage as well.
await box.erase(); // Clear GetStorage data
exit(0); // This will terminate the app. Be VERY careful with this.
}
static void _showSecurityWarning() {
// Show a dialog, navigate to an error screen, etc.
// Example using Get.dialog (if you use GetX):
Get.dialog(
AlertDialog(
title: Text("Security Warning".tr), // Or use localized string
content: Text(
"Potential security risks detected. The application may not function correctly."
.tr), //Or use localized string
actions: [
TextButton(
onPressed: () async {
await storage.deleteAll();
await box.erase();
Get.back(); // Close the dialog
// Or, if you really must, exit the app (but give the user a chance!)
exit(0);
},
child: Text("OK"), // Or use a localized string
),
],
),
barrierDismissible: false, // Prevent closing by tapping outside
);
}
}

View File

@@ -1,8 +1,12 @@
import 'dart:convert'; import 'dart:convert';
import 'package:Tripz/constant/box_name.dart'; import 'package:Tripz/constant/box_name.dart';
import 'package:flutter_secure_storage/flutter_secure_storage.dart'; import 'package:Tripz/constant/info.dart';
import 'package:Tripz/controller/auth/login_controller.dart';
import 'package:jwt_decoder/jwt_decoder.dart';
import 'package:secure_string_operations/secure_string_operations.dart';
import '../../constant/char_map.dart';
import '../../constant/links.dart'; import '../../constant/links.dart';
import '../../main.dart'; import '../../main.dart';
import '../../print.dart'; import '../../print.dart';
@@ -10,15 +14,13 @@ import 'crud.dart';
import 'encrypt_decrypt.dart'; import 'encrypt_decrypt.dart';
class SecureStorage { class SecureStorage {
final FlutterSecureStorage _storage = const FlutterSecureStorage();
void saveData(String key, value) async { void saveData(String key, value) async {
await _storage.write(key: key, value: value); await storage.write(key: key, value: value);
} }
Future<String?> readData(String boxName) async { Future<String?> readData(String boxName) async {
final String? value = await _storage.read(key: boxName); final String? value = await storage.read(key: boxName);
return value; return value.toString();
} }
} }
@@ -34,19 +36,34 @@ class AppInitializer {
List<Map<String, dynamic>> links = []; List<Map<String, dynamic>> links = [];
Future<void> initializeApp() async { Future<void> initializeApp() async {
await getKey(); // Log.print('box.read("jwt"): ${box.read(BoxName.jwt)}');
// await getAIKey('FCM_PRIVATE_KEY'); if (box.read(BoxName.jwt) == null) {
await LoginController().getJWT();
} else {
// print('firstTimeLoadKey ${box.read(BoxName.firstTimeLoadKey)}');
bool isTokenExpired = JwtDecoder.isExpired(X
.r(X.r(X.r(box.read(BoxName.jwt), cn), cC), cs)
.toString()
.split(AppInformation.addd)[0]);
// Log.print('isTokenExpired: $isTokenExpired');
if (isTokenExpired) {
await LoginController().getJWT();
}
} }
getAIKey(String key) async { // await getKey();
}
getAIKey(String key1) async {
if (box.read(BoxName.firstTimeLoadKey) == null) {
var res = var res =
await CRUD().get(link: AppLink.getapiKey, payload: {"keyName": key}); await CRUD().get(link: AppLink.getapiKey, payload: {"keyName": key1});
if (res != 'failure') { if (res != 'failure') {
var d = jsonDecode(res)['message']; var d = jsonDecode(res)['message'];
storage.write(key: 'FCM_PRIVATE_KEY', value: d[key].toString()); storage.write(key: key1, value: d[key1].toString());
// return d[key].toString();
} else {} } else {}
} }
}
Future<void> getKey() async { Future<void> getKey() async {
try { try {
@@ -62,13 +79,15 @@ class AppInitializer {
await box.remove(links[2]['name']); await box.remove(links[2]['name']);
await box.write(BoxName.locationName, links); await box.write(BoxName.locationName, links);
await box.write(BoxName.basicLink, await box.write(BoxName.basicLink,
encryptionHelper.decryptData(links[0]['server_link'])); EncryptionHelper.instance.decryptData(links[0]['server_link']));
await box.write(links[2]['name'], await box.write(links[2]['name'],
encryptionHelper.decryptData(links[2]['server_link'])); EncryptionHelper.instance.decryptData(links[2]['server_link']));
await box.write(links[1]['name'], await box.write(links[1]['name'],
encryptionHelper.decryptData(links[1]['server_link'])); EncryptionHelper.instance.decryptData(links[3]['server_link']));
await box.write(links[3]['name'],
EncryptionHelper.instance.decryptData(links[1]['server_link']));
await box.write(BoxName.paymentLink, await box.write(BoxName.paymentLink,
encryptionHelper.decryptData(links[4]['server_link'])); EncryptionHelper.instance.decryptData(links[4]['server_link']));
} }
} catch (e) { } catch (e) {
print('Error fetching or decoding location data: $e'); print('Error fetching or decoding location data: $e');

View File

@@ -0,0 +1,18 @@
import 'package:secure_string_operations/secure_string_operations.dart';
import '../../constant/char_map.dart';
import '../../main.dart';
class Sss {
static read(String boxname) async {
return box.read(X.r(X.r(X.r(boxname, cn), cC), cs));
}
static write(String boxname, value) async {
return box.write(boxname, X.c(X.c(X.c(value, cn), cC), cs));
}
static delete(String boxname) async {
return box.remove(boxname);
}
}

View File

@@ -7,9 +7,12 @@ import 'package:http/http.dart' as http;
import 'package:image_cropper/image_cropper.dart'; import 'package:image_cropper/image_cropper.dart';
import 'package:image_picker/image_picker.dart'; import 'package:image_picker/image_picker.dart';
import 'package:path/path.dart'; import 'package:path/path.dart';
import 'package:secure_string_operations/secure_string_operations.dart';
import '../../constant/box_name.dart'; import '../../constant/box_name.dart';
import '../../constant/char_map.dart';
import '../../constant/colors.dart'; import '../../constant/colors.dart';
import '../../constant/info.dart';
import '../../main.dart'; import '../../main.dart';
class ImageController extends GetxController { class ImageController extends GetxController {
@@ -75,7 +78,7 @@ class ImageController extends GetxController {
); );
request.headers.addAll({ request.headers.addAll({
'Authorization': 'Authorization':
'Basic ${base64Encode(utf8.encode(AK.basicAuthCredentials.toString()))}', 'Bearer ${X.r(X.r(X.r(box.read(BoxName.jwt), cn), cC), cs).toString().split(AppInformation.addd)[0]}'
}); });
// Set the file name to the driverID // Set the file name to the driverID
request.files.add( request.files.add(

View File

@@ -543,12 +543,12 @@ class MapPassengerController extends GetxController {
void sendSMS(String to) async { void sendSMS(String to) async {
// Get the driver's phone number. // Get the driver's phone number.
String driverPhone = encryptionHelper.decryptData( String driverPhone = EncryptionHelper.instance.decryptData(
dataCarsLocationByPassenger['message'][carsOrder]['phone'].toString()); dataCarsLocationByPassenger['message'][carsOrder]['phone'].toString());
// Format the message. // Format the message.
String message = String message =
'Hi! This is ${encryptionHelper.decryptData(box.read(BoxName.name).toString().split(' ')[0]).toString()}.\n I am using ${box.read(AppInformation.appName)} to ride with $passengerName as the driver. $passengerName \nis driving a $model\n with license plate $licensePlate.\n I am currently located at $passengerLocation.\n If you need to reach me, please contact the driver directly at\n\n $driverPhone.'; 'Hi! This is ${EncryptionHelper.instance.decryptData(box.read(BoxName.name).toString().split(' ')[0]).toString()}.\n I am using ${box.read(AppInformation.appName)} to ride with $passengerName as the driver. $passengerName \nis driving a $model\n with license plate $licensePlate.\n I am currently located at $passengerLocation.\n If you need to reach me, please contact the driver directly at\n\n $driverPhone.';
// Launch the URL to send the SMS. // Launch the URL to send the SMS.
launchCommunication('sms', to, message); launchCommunication('sms', to, message);
@@ -560,7 +560,7 @@ class MapPassengerController extends GetxController {
// Format the message. // Format the message.
String message = String message =
'${'${'Hi! This is'.tr} ${encryptionHelper.decryptData(box.read(BoxName.name).toString().split(' ')[0]).toString()}.\n${' I am using'.tr}'} ${AppInformation.appName}${' to ride with'.tr} $passengerName${' as the driver.'.tr} $passengerName \n${'is driving a '.tr}$model\n${' with license plate '.tr}$licensePlate.\n${' I am currently located at '.tr} https://www.google.com/maps/place/${passengerLocation.latitude},${passengerLocation.longitude}.\n${' If you need to reach me, please contact the driver directly at'.tr}\n\n $driverPhone.'; '${'${'Hi! This is'.tr} ${EncryptionHelper.instance.decryptData(box.read(BoxName.name).toString().split(' ')[0]).toString()}.\n${' I am using'.tr}'} ${AppInformation.appName}${' to ride with'.tr} $passengerName${' as the driver.'.tr} $passengerName \n${'is driving a '.tr}$model\n${' with license plate '.tr}$licensePlate.\n${' I am currently located at '.tr} https://www.google.com/maps/place/${passengerLocation.latitude},${passengerLocation.longitude}.\n${' If you need to reach me, please contact the driver directly at'.tr}\n\n $driverPhone.';
// Launch the URL to send the WhatsApp message. // Launch the URL to send the WhatsApp message.
launchCommunication('whatsapp', to, message); launchCommunication('whatsapp', to, message);
@@ -942,7 +942,7 @@ class MapPassengerController extends GetxController {
box.write(BoxName.passengerWalletTotal, '0'); box.write(BoxName.passengerWalletTotal, '0');
update(); update();
if (box.read(BoxName.parentTripSelected) == true) { if (box.read(BoxName.parentTripSelected) == true) {
FirebaseMessagesController().sendNotificationToPassengerToken( Get.find<FirebaseMessagesController>().sendNotificationToPassengerToken(
"Finish Monitor".tr, "Finish Monitor".tr,
"Finish Monitor".tr, "Finish Monitor".tr,
box.read(BoxName.tokenParent), box.read(BoxName.tokenParent),
@@ -1530,7 +1530,7 @@ class MapPassengerController extends GetxController {
// passengerRate.toStringAsFixed(2), // passengerRate.toStringAsFixed(2),
// ]; // ];
// Log.print('body: ${body}'); // Log.print('body: ${body}');
// FirebaseMessagesController().sendNotificationToDriverMAP( // Get.find<FirebaseMessagesController>().sendNotificationToDriverMAP(
// 'OrderSpeed', // 'OrderSpeed',
// rideId, // rideId,
// driverData['token'].toString(), // driverData['token'].toString(),
@@ -1673,7 +1673,7 @@ class MapPassengerController extends GetxController {
// ]; // ];
// // Log.print('body: ${body}'); // // Log.print('body: ${body}');
// FirebaseMessagesController().sendNotificationToDriverMAP( // Get.find<FirebaseMessagesController>().sendNotificationToDriverMAP(
// 'OrderSpeed', // 'OrderSpeed',
// rideId.toString(), // rideId.toString(),
// dataCarsLocationByPassenger['message'][i]['token'].toString(), // dataCarsLocationByPassenger['message'][i]['token'].toString(),
@@ -1956,10 +1956,11 @@ class MapPassengerController extends GetxController {
Future.delayed(const Duration(microseconds: 10)); Future.delayed(const Duration(microseconds: 10));
final body = constructNotificationBody(driverData); final body = constructNotificationBody(driverData);
// Log.print('body:ww ${body}'); // Log.print('body:ww ${body}');
FirebaseMessagesController().sendNotificationToDriverMAP( Get.find<FirebaseMessagesController>().sendNotificationToDriverMAP(
'Order'.tr, 'Order'.tr,
endNameAddress, endNameAddress,
encryptionHelper.decryptData(driverData['token'].toString()), EncryptionHelper.instance
.decryptData(driverData['token'].toString()),
body, body,
'order.wav'); 'order.wav');
} }
@@ -1980,15 +1981,16 @@ class MapPassengerController extends GetxController {
distance.toStringAsFixed(2), distance.toStringAsFixed(2),
driverData['driver_id'].toString(), driverData['driver_id'].toString(),
box.read(BoxName.passengerID).toString(), box.read(BoxName.passengerID).toString(),
encryptionHelper EncryptionHelper.instance
.decryptData(box.read(BoxName.name).toString().split(' ')[0]) .decryptData(box.read(BoxName.name).toString().split(' ')[0])
.toString(), .toString(),
encryptionHelper.decryptData(box.read(BoxName.tokenFCM).toString()), EncryptionHelper.instance
encryptionHelper.decryptData(box.read(BoxName.phone).toString()), .decryptData(box.read(BoxName.tokenFCM).toString()),
EncryptionHelper.instance.decryptData(box.read(BoxName.phone).toString()),
durationToPassenger.toStringAsFixed(0) ?? '120', durationToPassenger.toStringAsFixed(0) ?? '120',
distanceByPassenger.toString() ?? '2000', distanceByPassenger.toString() ?? '2000',
paymentController.isWalletChecked.toString(), paymentController.isWalletChecked.toString(),
encryptionHelper.decryptData(driverData['token'].toString()), EncryptionHelper.instance.decryptData(driverData['token'].toString()),
durationToPassenger.toString(), durationToPassenger.toString(),
rideId.toString(), rideId.toString(),
rideTimerBegin.toString(), rideTimerBegin.toString(),
@@ -2186,26 +2188,28 @@ class MapPassengerController extends GetxController {
var response = jsonDecode(res); var response = jsonDecode(res);
Log.print('getUpdatedRideForDriverApply: $response'); Log.print('getUpdatedRideForDriverApply: $response');
driverId = response['data']['driver_id']; driverId = response['data']['driver_id'];
driverPhone = encryptionHelper.decryptData(response['data']['phone']); driverPhone =
EncryptionHelper.instance.decryptData(response['data']['phone']);
driverCarMake = response['data']['make']; driverCarMake = response['data']['make'];
model = response['data']['model']; model = response['data']['model'];
colorHex = response['data']['color_hex']; colorHex = response['data']['color_hex'];
carColor = response['data']['color']; carColor = response['data']['color'];
make = response['data']['make']; make = response['data']['make'];
licensePlate = licensePlate =
encryptionHelper.decryptData(response['data']['car_plate']); EncryptionHelper.instance.decryptData(response['data']['car_plate']);
passengerName = passengerName = EncryptionHelper.instance
encryptionHelper.decryptData(response['data']['passengerName']); .decryptData(response['data']['passengerName']);
driverName = encryptionHelper driverName = EncryptionHelper.instance
.decryptData(response['data']['driverName'].toString()); .decryptData(response['data']['driverName'].toString());
driverToken = encryptionHelper.decryptData(response['data']['token']); driverToken =
EncryptionHelper.instance.decryptData(response['data']['token']);
// Log.print('driverToken updated: $driverToken'); // Log.print('driverToken updated: $driverToken');
carYear = response['data']['year']; carYear = response['data']['year'];
driverRate = response['data']['ratingDriver'].toString(); driverRate = response['data']['ratingDriver'].toString();
} }
// driversToken.remove(driverToken); // driversToken.remove(driverToken);
// for (var i = 1; i < driversToken.length; i++) { // for (var i = 1; i < driversToken.length; i++) {
FirebaseMessagesController().sendNotificationToDriverMAP( Get.find<FirebaseMessagesController>().sendNotificationToDriverMAP(
'Order Accepted'.tr, 'Order Accepted'.tr,
'$driverName${'Accepted your order'.tr}', '$driverName${'Accepted your order'.tr}',
driverToken.toString(), driverToken.toString(),
@@ -2452,9 +2456,9 @@ class MapPassengerController extends GetxController {
longitude >= minLongitude && longitude >= minLongitude &&
longitude <= maxLongitude) { longitude <= maxLongitude) {
box.write(BoxName.serverChosen, box.write(BoxName.serverChosen,
encryptionHelper.decryptData(locationData['server_link'])); EncryptionHelper.instance.decryptData(locationData['server_link']));
// Log.print( // Log.print(
// 'locationData----server_link: ${encryptionHelper.decryptData(locationData['server_link'])}'); // 'locationData----server_link: ${EncryptionHelper.instance.decryptData(locationData['server_link'])}');
return locationData['name']; return locationData['name'];
} }
} }
@@ -2609,7 +2613,7 @@ class MapPassengerController extends GetxController {
_getIconForCar(json), _getIconForCar(json),
); );
driversToken.add(encryptionHelper.decryptData(json['token'])); driversToken.add(EncryptionHelper.instance.decryptData(json['token']));
} }
// Add fake car markers // Add fake car markers
@@ -2921,10 +2925,11 @@ class MapPassengerController extends GetxController {
Get.back(); Get.back();
})); }));
} else if (res1['status'] == 'success') { } else if (res1['status'] == 'success') {
var tokenParent = encryptionHelper.decryptData(res1['data'][0]['token']); var tokenParent =
EncryptionHelper.instance.decryptData(res1['data'][0]['token']);
Get.snackbar("The invitation was sent successfully".tr, '', Get.snackbar("The invitation was sent successfully".tr, '',
backgroundColor: AppColor.greenColor); backgroundColor: AppColor.greenColor);
FirebaseMessagesController().sendNotificationToPassengerToken( Get.find<FirebaseMessagesController>().sendNotificationToPassengerToken(
"Trip Monitoring".tr, "Trip Monitoring".tr,
"Trip Monitoring".tr, "Trip Monitoring".tr,
tokenParent, tokenParent,
@@ -3161,7 +3166,7 @@ class MapPassengerController extends GetxController {
changeCancelRidePageShow(); changeCancelRidePageShow();
if (rideId != 'yet') { if (rideId != 'yet') {
Log.print('cancelRide: 1'); Log.print('cancelRide: 1');
await FirebaseMessagesController().sendNotificationToDriverMAP( await Get.find<FirebaseMessagesController>().sendNotificationToDriverMAP(
'Cancel Trip'.tr, 'Cancel Trip'.tr,
'Trip Cancelled'.tr, 'Trip Cancelled'.tr,
driverToken.toString(), driverToken.toString(),
@@ -5163,10 +5168,12 @@ class MapPassengerController extends GetxController {
timeSelected); timeSelected);
// Optionally, set up local notification or send a push notification // Optionally, set up local notification or send a push notification
await FirebaseMessagesController().sendNotificationToDriverMAP( await Get.find<FirebaseMessagesController>()
.sendNotificationToDriverMAP(
'OrderVIP', 'OrderVIP',
rideId.toString(), rideId.toString(),
encryptionHelper.decryptData(driver['token'].toString()), EncryptionHelper.instance
.decryptData(driver['token'].toString()),
[ [
id, id,
rideId, rideId,
@@ -5174,15 +5181,17 @@ class MapPassengerController extends GetxController {
passengerLocation.latitude.toString(), passengerLocation.latitude.toString(),
startNameAddress.toString(), startNameAddress.toString(),
passengerLocation.longitude.toString(), passengerLocation.longitude.toString(),
encryptionHelper EncryptionHelper.instance
.decryptData(box.read(BoxName.name).toString().split(' ')[0]) .decryptData(
box.read(BoxName.name).toString().split(' ')[0])
.toString(), .toString(),
box.read(BoxName.passengerID).toString(), box.read(BoxName.passengerID).toString(),
box.read(BoxName.phone).toString(), box.read(BoxName.phone).toString(),
box.read(BoxName.email).toString(), box.read(BoxName.email).toString(),
box.read(BoxName.passengerPhotoUrl).toString(), box.read(BoxName.passengerPhotoUrl).toString(),
box.read(BoxName.tokenFCM).toString(), box.read(BoxName.tokenFCM).toString(),
encryptionHelper.decryptData(driver['token'].toString()), EncryptionHelper.instance
.decryptData(driver['token'].toString()),
], ],
'order.wav'); 'order.wav');
if (response['message'] == "Trip updated successfully") { if (response['message'] == "Trip updated successfully") {
@@ -5190,7 +5199,7 @@ class MapPassengerController extends GetxController {
Log.print( Log.print(
'previous_driver_token: ${response['previous_driver_token']}'); 'previous_driver_token: ${response['previous_driver_token']}');
FirebaseMessagesController().sendNotificationToDriverMAP( Get.find<FirebaseMessagesController>().sendNotificationToDriverMAP(
'Order VIP Canceld'.tr, 'Order VIP Canceld'.tr,
'Passenger cancel order'.tr, 'Passenger cancel order'.tr,
response['previous_driver_token'].toString(), response['previous_driver_token'].toString(),
@@ -5214,7 +5223,7 @@ class MapPassengerController extends GetxController {
} }
cancelVip(String token, tripId) async { cancelVip(String token, tripId) async {
// FirebaseMessagesController().sendNotificationToDriverMAP( // Get.find<FirebaseMessagesController>().sendNotificationToDriverMAP(
// 'Order VIP Canceld'.tr, // 'Order VIP Canceld'.tr,
// 'Passenger cancel order'.tr, // 'Passenger cancel order'.tr,
// token, // token,
@@ -5230,7 +5239,7 @@ class MapPassengerController extends GetxController {
} }
sendToDriverAgain(String token) { sendToDriverAgain(String token) {
FirebaseMessagesController().sendNotificationToDriverMAP( Get.find<FirebaseMessagesController>().sendNotificationToDriverMAP(
'Order VIP Canceld'.tr, 'Order VIP Canceld'.tr,
'Passenger cancel order'.tr, 'Passenger cancel order'.tr,
token, token,
@@ -5377,6 +5386,7 @@ class MapPassengerController extends GetxController {
reloadStartApp = false; reloadStartApp = false;
startMarkerReloading(); startMarkerReloading();
Get.put(TextToSpeechController()); Get.put(TextToSpeechController());
Get.put(FirebaseMessagesController());
box.write(BoxName.carType, 'yet'); box.write(BoxName.carType, 'yet');
box.write(BoxName.tipPercentage, '0'); box.write(BoxName.tipPercentage, '0');
Get.put(AudioRecorderController()); Get.put(AudioRecorderController());

View File

@@ -179,9 +179,9 @@ Download the Tripz app now and enjoy your ride!
int.parse(driverInvitationDataToPassengers[index]['countOfInvitDriver'] int.parse(driverInvitationDataToPassengers[index]['countOfInvitDriver']
.toString()) < .toString()) <
2 2
? '${'When'.tr} ${encryptionHelper.decryptData(driverInvitationDataToPassengers[index]['passengerName'].toString())} ${"complete, you can claim your gift".tr} ' ? '${'When'.tr} ${EncryptionHelper.instance.decryptData(driverInvitationDataToPassengers[index]['passengerName'].toString())} ${"complete, you can claim your gift".tr} '
: 'You deserve the gift'.tr, : 'You deserve the gift'.tr,
'${encryptionHelper.decryptData(driverInvitationDataToPassengers[index]['passengerName'].toString())} ${driverInvitationDataToPassengers[index]['countOfInvitDriver'].toString()} / 2 ${'Trip'.tr}', '${EncryptionHelper.instance.decryptData(driverInvitationDataToPassengers[index]['passengerName'].toString())} ${driverInvitationDataToPassengers[index]['countOfInvitDriver'].toString()} / 2 ${'Trip'.tr}',
() async { () async {
if (int.parse(driverInvitationDataToPassengers[index] if (int.parse(driverInvitationDataToPassengers[index]
['countOfInvitDriver'] ['countOfInvitDriver']
@@ -270,7 +270,8 @@ Download the Tripz app now and enjoy your ride!
var response = var response =
await CRUD().post(link: AppLink.addInvitationPassenger, payload: { await CRUD().post(link: AppLink.addInvitationPassenger, payload: {
"driverId": box.read(BoxName.passengerID), "driverId": box.read(BoxName.passengerID),
"inviterPassengerPhone": encryptionHelper.encryptData('+2$phoneNumber') "inviterPassengerPhone":
EncryptionHelper.instance.encryptData('+2$phoneNumber')
}); });
if (response != 'failure') { if (response != 'failure') {

View File

@@ -1,7 +1,9 @@
import 'dart:async'; import 'dart:async';
import 'package:Tripz/constant/style.dart';
import 'package:Tripz/controller/functions/secure_storage.dart';
import 'package:Tripz/views/widgets/my_scafold.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:Tripz/views/auth/login_page.dart'; import 'package:Tripz/views/auth/login_page.dart';
import 'package:package_info_plus/package_info_plus.dart'; import 'package:package_info_plus/package_info_plus.dart';
@@ -28,9 +30,19 @@ class SplashScreenController extends GetxController
update(); update();
} }
String iss = '';
@override @override
void onInit() { Future<void> onInit() async {
super.onInit(); super.onInit();
// storage.read(key: 'iss').then((s) {
// // print(s);
// iss = s!;
// });
// if (iss == null) {
SecureStorage().saveData('iss', 'mobile-app:');
// }
_getPackageInfo(); _getPackageInfo();
_animationController = AnimationController( _animationController = AnimationController(
vsync: this, vsync: this,
@@ -56,6 +68,12 @@ class SplashScreenController extends GetxController
if (elapsed >= totalTime) { if (elapsed >= totalTime) {
timer.cancel(); timer.cancel();
// await SecurityHelper.performSecurityChecks();
// if (box.read('isNotTrust') ||
// box.read('isJailBroken') ||
// box.read('isTampered')) {
// Get.to(() => SecurityPage());
// } else {
box.read(BoxName.onBoarding) == null box.read(BoxName.onBoarding) == null
? Get.off(() => OnBoardingPage()) ? Get.off(() => OnBoardingPage())
: box.read(BoxName.email) != null && : box.read(BoxName.email) != null &&
@@ -68,6 +86,7 @@ class SplashScreenController extends GetxController
) )
: Get.off(() => LoginPage()); : Get.off(() => LoginPage());
} }
// }
}); });
} }
@@ -94,3 +113,39 @@ class SplashScreenController extends GetxController
super.onClose(); super.onClose();
} }
} }
class SecurityPage extends StatelessWidget {
const SecurityPage({
super.key,
});
@override
Widget build(BuildContext context) {
return MyScafolld(
title: "security_warning".tr,
body: [
Center(
child: Padding(
padding: const EdgeInsets.all(20),
child: Column(
children: [
Text(
"security_message".tr,
style: AppStyle.headTitle2,
),
TextButton(
onPressed: () async {
// await SecurityHelper.clearAllData();
},
child: Text(
"security_warning".tr,
),
),
],
),
),
)
],
isleading: false);
}
}

View File

@@ -287,7 +287,7 @@ class VipWaittingPage extends StatelessWidget {
? MyElevatedButton( ? MyElevatedButton(
title: "Click here to begin your trip\n\nGood luck, " title: "Click here to begin your trip\n\nGood luck, "
.tr + .tr +
encryptionHelper EncryptionHelper.instance
.decryptData(box .decryptData(box
.read(BoxName.name) .read(BoxName.name)
.toString() .toString()

View File

@@ -71,7 +71,12 @@ class MyTranslation extends Translations {
"Wallet": "المحفظة", "Wallet": "المحفظة",
"Profile": "الملف الشخصي", "Profile": "الملف الشخصي",
"Contact Support": "اتصل بالدعم", "Contact Support": "اتصل بالدعم",
// 'Session expired. Please log in again.':
'انتهت الجلسة. يرجى تسجيل الدخول مرة أخرى.',
"Security Warning": "⚠️ تحذير أمني",
"Potential security risks detected. The application may not function correctly.":
"تم اكتشاف ثغرات أمنية على هذا الجهاز. للحفاظ على أمان بياناتك، سيتم حذف جميع البيانات وإغلاق التطبيق.",
'please order now': " ‏الرجاء الطلب مرة أخرى",
"Where to": "على فين؟", "Where to": "على فين؟",
"Where are you going?": "رايح فين؟", "Where are you going?": "رايح فين؟",
"Quick Actions": "إجراءات سريعة", "Quick Actions": "إجراءات سريعة",

View File

@@ -47,7 +47,7 @@ class PassengerNotificationController extends GetxController {
'title': title, 'title': title,
'body': body, 'body': body,
}); });
FirebaseMessagesController().sendNotificationToPassengerToken( Get.find<FirebaseMessagesController>().sendNotificationToPassengerToken(
title, title,
body, body,
'token', 'token',

View File

@@ -14,7 +14,7 @@ class DriverWalletHistoryController extends GetxController {
getArchivePayment() async { getArchivePayment() async {
isLoading = true; isLoading = true;
update(); update();
var res = await CRUD().get( var res = await CRUD().getWallet(
link: AppLink.getWalletByDriver, link: AppLink.getWalletByDriver,
payload: {'driverID': box.read(BoxName.driverID)}); payload: {'driverID': box.read(BoxName.driverID)});
if (res == 'failure') { if (res == 'failure') {

View File

@@ -17,7 +17,7 @@ class PassengerWalletHistoryController extends GetxController {
isLoading = true; isLoading = true;
update(); update();
var res = await CRUD().get( var res = await CRUD().getWallet(
link: AppLink.getPassengerWalletArchive, link: AppLink.getPassengerWalletArchive,
payload: {'passenger_id': box.read(BoxName.passengerID)}, payload: {'passenger_id': box.read(BoxName.passengerID)},
); );

View File

@@ -56,7 +56,7 @@ class PaymentController extends GetxController {
isLoading = true; isLoading = true;
update(); update();
await CRUD().get( await CRUD().getWallet(
link: AppLink.getWalletByPassenger, link: AppLink.getWalletByPassenger,
payload: {'passenger_id': box.read(BoxName.passengerID)}).then((value) { payload: {'passenger_id': box.read(BoxName.passengerID)}).then((value) {
box.write(BoxName.passengerWalletTotal, box.write(BoxName.passengerWalletTotal,
@@ -134,7 +134,7 @@ class PaymentController extends GetxController {
}); });
if (res != 'failure') { if (res != 'failure') {
FirebaseMessagesController().sendNotificationToDriverMAP( Get.find<FirebaseMessagesController>().sendNotificationToDriverMAP(
'Cancel', 'Cancel',
'Trip Cancelled. The cost of the trip will be added to your wallet.' 'Trip Cancelled. The cost of the trip will be added to your wallet.'
.tr, .tr,
@@ -265,7 +265,7 @@ class PaymentController extends GetxController {
merchantDisplayName: AppInformation.appName, merchantDisplayName: AppInformation.appName,
billingDetails: BillingDetails( billingDetails: BillingDetails(
name: box.read(BoxName.nameDriver) == null name: box.read(BoxName.nameDriver) == null
? encryptionHelper ? EncryptionHelper.instance
.decryptData( .decryptData(
box.read(BoxName.name).toString().split(' ')[0]) box.read(BoxName.name).toString().split(' ')[0])
.toString() .toString()

View File

@@ -135,14 +135,15 @@ class PaymobManager extends GetxController {
"amount_cents": amount, "amount_cents": amount,
"currency": currency, "currency": currency,
"billing_data": { "billing_data": {
"first_name": encryptionHelper "first_name": EncryptionHelper.instance
.decryptData(box.read(BoxName.name).toString().split(' ')[0]) .decryptData(box.read(BoxName.name).toString().split(' ')[0])
.toString(), .toString(),
"last_name": encryptionHelper "last_name": EncryptionHelper.instance
.decryptData(box.read(BoxName.name).toString().split(' ')[1]) .decryptData(box.read(BoxName.name).toString().split(' ')[1])
.toString(), .toString(),
"email": encryptionHelper.decryptData(box.read(BoxName.email)), "email": EncryptionHelper.instance.decryptData(box.read(BoxName.email)),
"phone_number": encryptionHelper.decryptData(box.read(BoxName.phone)), "phone_number":
EncryptionHelper.instance.decryptData(box.read(BoxName.phone)),
"apartment": "NA", "apartment": "NA",
"floor": "NA", "floor": "NA",
"street": "NA", "street": "NA",

View File

@@ -226,13 +226,14 @@ class PaymobBillingData {
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
return { return {
"email": box.read(BoxName.email) ?? box.read(BoxName.emailDriver), "email": box.read(BoxName.email) ?? box.read(BoxName.emailDriver),
"first_name": encryptionHelper "first_name": EncryptionHelper.instance
.decryptData(box.read(BoxName.name).toString().split(' ')[0]) .decryptData(box.read(BoxName.name).toString().split(' ')[0])
.toString(), .toString(),
"last_name": encryptionHelper "last_name": EncryptionHelper.instance
.decryptData(box.read(BoxName.name).toString().split(' ')[1]) .decryptData(box.read(BoxName.name).toString().split(' ')[1])
.toString(), .toString(),
"phone_number": encryptionHelper.decryptData(box.read(BoxName.phone)), "phone_number":
EncryptionHelper.instance.decryptData(box.read(BoxName.phone)),
"apartment": apartment ?? "NA", "apartment": apartment ?? "NA",
"floor": floor ?? "NA", "floor": floor ?? "NA",
"building": building ?? "NA", "building": building ?? "NA",

View File

@@ -267,11 +267,11 @@ class PaymobBillingDataWallet {
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
return { return {
"email": encryptionHelper.decryptData(box.read(BoxName.email)), "email": EncryptionHelper.instance.decryptData(box.read(BoxName.email)),
"first_name": encryptionHelper "first_name": EncryptionHelper.instance
.decryptData(box.read(BoxName.name).toString().split(' ')[0]) .decryptData(box.read(BoxName.name).toString().split(' ')[0])
.toString(), .toString(),
"last_name": encryptionHelper "last_name": EncryptionHelper.instance
.decryptData(box.read(BoxName.name).toString().split(' ')[1]) .decryptData(box.read(BoxName.name).toString().split(' ')[1])
.toString() ?? .toString() ??
'tripz', 'tripz',

View File

@@ -74,11 +74,14 @@ class ProfileController extends GetxController {
Get.back(); Get.back();
await updateColumn({ await updateColumn({
'id': box.read(BoxName.passengerID), 'id': box.read(BoxName.passengerID),
columnName: encryptionHelper.encryptData(txtController.text), columnName:
EncryptionHelper.instance.encryptData(txtController.text),
}); });
if (columnName == 'first_name') { if (columnName == 'first_name') {
box.write(BoxName.name, box.write(
encryptionHelper.encryptData(txtController.text)); BoxName.name,
EncryptionHelper.instance
.encryptData(txtController.text));
} }
txtController.clear(); txtController.clear();

View File

@@ -70,7 +70,7 @@ class RateController extends GetxController {
'token': token1, 'token': token1,
}); });
if (res != 'failure') { if (res != 'failure') {
FirebaseMessagesController().sendNotificationToDriverMAP( Get.find<FirebaseMessagesController>().sendNotificationToDriverMAP(
'You Have Tips'.tr, 'You Have Tips'.tr,
'${'${tip.toString()}\$${' tips\nTotal is'.tr}'} ${tip + (Get.find<MapPassengerController>().totalPassenger)}', '${'${tip.toString()}\$${' tips\nTotal is'.tr}'} ${tip + (Get.find<MapPassengerController>().totalPassenger)}',
Get.find<MapPassengerController>().driverToken.toString(), Get.find<MapPassengerController>().driverToken.toString(),

View File

@@ -1,6 +1,7 @@
import 'dart:io'; import 'dart:io';
import 'dart:math'; import 'dart:math';
import 'package:Tripz/constant/box_name.dart';
import 'package:Tripz/controller/payment/paymob/paymob_response.dart'; import 'package:Tripz/controller/payment/paymob/paymob_response.dart';
import 'package:Tripz/views/home/HomePage/contact_us.dart'; import 'package:Tripz/views/home/HomePage/contact_us.dart';
import 'package:Tripz/views/home/HomePage/share_app_page.dart'; import 'package:Tripz/views/home/HomePage/share_app_page.dart';
@@ -21,6 +22,7 @@ import 'constant/info.dart';
import 'constant/notification.dart'; import 'constant/notification.dart';
import 'controller/firebase/firbase_messge.dart'; import 'controller/firebase/firbase_messge.dart';
import 'controller/firebase/local_notification.dart'; import 'controller/firebase/local_notification.dart';
import 'controller/functions/encrypt_decrypt.dart';
import 'controller/functions/secure_storage.dart'; import 'controller/functions/secure_storage.dart';
import 'controller/local/local_controller.dart'; import 'controller/local/local_controller.dart';
import 'controller/local/translations.dart'; import 'controller/local/translations.dart';
@@ -30,12 +32,13 @@ import 'models/db_sql.dart';
import 'splash_screen_page.dart'; import 'splash_screen_page.dart';
final box = GetStorage(); final box = GetStorage();
const storage = FlutterSecureStorage(); final storage = FlutterSecureStorage();
// final PaymobPayment paymobPayment = PaymobPayment(); // final PaymobPayment paymobPayment = PaymobPayment();
final PaymobPayment paymobPayment = PaymobPayment(); final PaymobPayment paymobPayment = PaymobPayment();
final PaymobPaymentWallet paymobPaymentWallet = PaymobPaymentWallet(); final PaymobPaymentWallet paymobPaymentWallet = PaymobPaymentWallet();
DbSql sql = DbSql.instance; DbSql sql = DbSql.instance;
// EncryptionHelper encryptionHelper = EncryptionHelper.instance;
@pragma('vm:entry-point') @pragma('vm:entry-point')
Future<void> backgroundMessageHandler(RemoteMessage message) async { Future<void> backgroundMessageHandler(RemoteMessage message) async {
await Firebase.initializeApp(); await Firebase.initializeApp();
@@ -46,20 +49,20 @@ Future<void> backgroundMessageHandler(RemoteMessage message) async {
void main() async { void main() async {
WidgetsFlutterBinding.ensureInitialized(); WidgetsFlutterBinding.ensureInitialized();
WakelockPlus.enable(); WakelockPlus.enable();
// await LocationController().startLocationUpdates();
// if (Platform.isAndroid) { await GetStorage.init();
final AppInitializer initializer = AppInitializer();
await initializer.initializeApp();
await EncryptionHelper.initialize();
NotificationController notificationController = NotificationController notificationController =
Get.put(NotificationController()); Get.put(NotificationController());
// await NotificationController().initNotifications();
// }
await GetStorage.init();
// Get.put(DriverCallController());
// await AC().gAK();
'local is ${WidgetsBinding.instance.platformDispatcher.locale.countryCode}';
Stripe.publishableKey = AK.publishableKey; Stripe.publishableKey = AK.publishableKey;
// if (box.read(BoxName.driverID) != null) {} // if (box.read(BoxName.driverID) != null) {}
if (Platform.isAndroid || Platform.isIOS) { if (Platform.isAndroid || Platform.isIOS) {
await Firebase.initializeApp( await Firebase.initializeApp(
options: DefaultFirebaseOptions.currentPlatform, options: DefaultFirebaseOptions.currentPlatform,
@@ -79,16 +82,19 @@ void main() async {
DeviceOrientation.portraitDown, DeviceOrientation.portraitDown,
]); ]);
} }
String? key = (await storage.read(key: BoxName.payMobApikey));
String? apiKey = EncryptionHelper.instance.decryptData(key!);
PaymobPayment.instance.initialize( PaymobPayment.instance.initialize(
apiKey: AK apiKey: apiKey,
.payMobApikey, // from dashboard Select Settings -> Account Info -> API Key
integrationID: int.parse(AK.integrationIdPayMob), integrationID: int.parse(AK.integrationIdPayMob),
userTokenExpiration: 200, userTokenExpiration: 200,
iFrameID: 837992, iFrameID: 837992,
); );
PaymobPaymentWallet.instance.initialize( PaymobPaymentWallet.instance.initialize(
apiKey: AK.payMobApikey, apiKey: apiKey,
integrationID: int.parse(AK.integrationIdPayMobWallet), integrationID: int.parse(AK.integrationIdPayMobWallet),
userTokenExpiration: 200, userTokenExpiration: 200,
iFrameID: 837992, iFrameID: 837992,
@@ -105,8 +111,7 @@ void main() async {
randomMessage.split(':')[1], randomMessage.split(':')[1],
"tone1", "tone1",
); );
final AppInitializer initializer = AppInitializer(); // final encryptionHelper = await EncryptionHelper.initialize();
await initializer.initializeApp();
final QuickActions quickActions = QuickActions(); final QuickActions quickActions = QuickActions();

View File

@@ -1,6 +1,9 @@
import 'dart:io'; import 'dart:io';
import 'package:Tripz/constant/char_map.dart';
import 'package:Tripz/controller/functions/crud.dart';
import 'package:Tripz/controller/functions/encrypt_decrypt.dart'; import 'package:Tripz/controller/functions/encrypt_decrypt.dart';
import 'package:Tripz/env/env.dart';
import 'package:firebase_auth/firebase_auth.dart'; import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/gestures.dart'; import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@@ -12,11 +15,13 @@ import 'package:Tripz/constant/colors.dart';
import 'package:Tripz/constant/style.dart'; import 'package:Tripz/constant/style.dart';
import 'package:Tripz/main.dart'; import 'package:Tripz/main.dart';
import 'package:Tripz/views/widgets/my_scafold.dart'; import 'package:Tripz/views/widgets/my_scafold.dart';
import 'package:secure_string_operations/secure_string_operations.dart';
import '../../constant/info.dart'; import '../../constant/info.dart';
import '../../controller/auth/apple_signin_controller.dart'; import '../../controller/auth/apple_signin_controller.dart';
import '../../controller/auth/google_sign.dart'; import '../../controller/auth/google_sign.dart';
import '../../controller/auth/login_controller.dart'; import '../../controller/auth/login_controller.dart';
import '../../print.dart';
import '../home/HomePage/contact_us.dart'; import '../home/HomePage/contact_us.dart';
import '../home/profile/passenger_profile_page.dart'; import '../home/profile/passenger_profile_page.dart';
@@ -29,6 +34,7 @@ class LoginPage extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
Get.put(LoginController()); Get.put(LoginController());
Get.put(CRUD());
return GetBuilder<LoginController>( return GetBuilder<LoginController>(
builder: (controller) => MyScafolld( builder: (controller) => MyScafolld(
title: 'Login'.tr, title: 'Login'.tr,
@@ -88,8 +94,10 @@ class LoginPage extends StatelessWidget {
User? user = await authController.signInWithApple(); User? user = await authController.signInWithApple();
if (user != null) { if (user != null) {
box.write(BoxName.passengerID, user.uid); box.write(BoxName.passengerID, user.uid);
box.write(BoxName.email, box.write(
encryptionHelper.encryptData(user.email.toString())); BoxName.email,
EncryptionHelper.instance
.encryptData(user.email.toString()));
await controller.loginUsingCredentials( await controller.loginUsingCredentials(
box.read(BoxName.passengerID).toString(), box.read(BoxName.passengerID).toString(),
box.read(BoxName.email).toString(), box.read(BoxName.email).toString(),
@@ -113,6 +121,17 @@ class LoginPage extends StatelessWidget {
style: AppStyle.subtitle.copyWith(color: Colors.grey), style: AppStyle.subtitle.copyWith(color: Colors.grey),
), ),
), ),
// TextButton(
// onPressed: () async {
// var encrypt = EncryptionHelper.instance.encryptData('');
// Log.print('encrypt: ${encrypt}');
// Log.print(
// 'encrypt: ${EncryptionHelper.instance.decryptData(encrypt)}');
// },
// child: Text(
// "Text Button",
// ),
// ),
], ],
), ),
), ),

View File

@@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import '../../constant/box_name.dart'; import '../../constant/box_name.dart';
import '../../constant/colors.dart'; import '../../constant/colors.dart';
import '../../controller/functions/crud.dart';
import '../../controller/functions/package_info.dart'; import '../../controller/functions/package_info.dart';
import '../../controller/home/map_passenger_controller.dart'; import '../../controller/home/map_passenger_controller.dart';
import '../../main.dart'; import '../../main.dart';
@@ -31,6 +32,7 @@ class MapPagePassenger extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
Get.put(MapPassengerController()); Get.put(MapPassengerController());
Get.put(MyMenuController()); Get.put(MyMenuController());
Get.put(CRUD());
WidgetsBinding.instance.addPostFrameCallback((_) { WidgetsBinding.instance.addPostFrameCallback((_) {
checkForUpdate(context); checkForUpdate(context);
}); });

View File

@@ -257,7 +257,8 @@ class ApplyOrderWidget extends StatelessWidget {
padding: const EdgeInsets.only(bottom: 8.0), padding: const EdgeInsets.only(bottom: 8.0),
child: ElevatedButton( child: ElevatedButton(
onPressed: () { onPressed: () {
FirebaseMessagesController().sendNotificationToDriverMAP( Get.find<FirebaseMessagesController>()
.sendNotificationToDriverMAP(
'message From passenger', 'message From passenger',
message.tr, message.tr,
controller.driverToken.toString(), controller.driverToken.toString(),
@@ -290,7 +291,8 @@ class ApplyOrderWidget extends StatelessWidget {
IconButton( IconButton(
onPressed: () { onPressed: () {
if (controller.messagesFormKey.currentState!.validate()) { if (controller.messagesFormKey.currentState!.validate()) {
FirebaseMessagesController().sendNotificationToDriverMAP( Get.find<FirebaseMessagesController>()
.sendNotificationToDriverMAP(
'message From passenger', 'message From passenger',
controller.messageToDriver.text, controller.messageToDriver.text,
controller.driverToken, controller.driverToken,

View File

@@ -1,11 +1,30 @@
import 'dart:convert';
import 'dart:io';
import 'package:http/http.dart' as http;
import 'package:Tripz/constant/box_name.dart';
import 'package:Tripz/main.dart';
import 'package:device_info_plus/device_info_plus.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_font_icons/flutter_font_icons.dart'; import 'package:flutter_font_icons/flutter_font_icons.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart'; import 'package:google_maps_flutter/google_maps_flutter.dart';
import 'package:jwt_decoder/jwt_decoder.dart';
import 'package:secure_string_operations/secure_string_operations.dart';
import '../../../constant/api_key.dart';
import '../../../constant/char_map.dart';
import '../../../constant/colors.dart'; import '../../../constant/colors.dart';
import '../../../constant/info.dart';
import '../../../constant/links.dart';
import '../../../constant/table_names.dart';
import '../../../controller/functions/crud.dart';
import '../../../controller/functions/encrypt_decrypt.dart';
import '../../../controller/functions/package_info.dart';
import '../../../controller/functions/secure_storage.dart';
import '../../../controller/functions/tts.dart'; import '../../../controller/functions/tts.dart';
import '../../../controller/home/map_passenger_controller.dart'; import '../../../controller/home/map_passenger_controller.dart';
import '../../../controller/home/vip_waitting_page.dart'; import '../../../controller/home/vip_waitting_page.dart';
import '../../../env/env.dart';
import '../../../print.dart';
GetBuilder<MapPassengerController> leftMainMenuIcons() { GetBuilder<MapPassengerController> leftMainMenuIcons() {
Get.put(TextToSpeechController()); Get.put(TextToSpeechController());
@@ -54,32 +73,41 @@ GetBuilder<MapPassengerController> leftMainMenuIcons() {
tooltip: 'VIP Waiting Page', // More descriptive tooltip tooltip: 'VIP Waiting Page', // More descriptive tooltip
), ),
// const SizedBox(width: 8), // const SizedBox(width: 8),
// _buildIconButtonWithAnimation( _buildIconButtonWithAnimation(
// controller: controller, controller: controller,
// icon: Octicons.screen_full, icon: Octicons.screen_full,
// onPressed: () async { onPressed: () async {
// final plainText = 'Hello, Safar App!'; Get.to(() => TestPage());
// debugPrint('Plain Text: $plainText'); },
tooltip: 'Recent Locations', // More descriptive tooltip
// // Encrypt the data ),
// final encryptedData = encryptionHelper.encryptData(plainText);
// debugPrint('Encrypted: $encryptedData');
// // Decrypt the data
// final decryptedData = encryptionHelper
// .decryptData(encryptedData); // Use the encryptedData variable
// debugPrint('Decrypted: $decryptedData');
// //kVb4a+11Scs9jQWwzeVfx0PxSDiPWDCuMI/RWYxafMU=
// //kVb4a+11Scs9jQWwzeVfx0PxSDiPWDCuMI/RWYxafMU=
// },
// tooltip: 'Recent Locations', // More descriptive tooltip
// ),
], ],
), ),
), ),
); );
} }
class TestPage extends StatelessWidget {
const TestPage({
super.key,
});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(),
body: Center(
child: TextButton(
onPressed: () async {},
child: Text(
"Text Button",
),
),
),
);
}
}
Widget _buildIconButtonWithAnimation({ Widget _buildIconButtonWithAnimation({
required MapPassengerController controller, required MapPassengerController controller,
required IconData icon, required IconData icon,

View File

@@ -459,7 +459,7 @@ class MainBottomMenuMap extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text( Text(
'${'Where to'.tr} ${encryptionHelper.decryptData(box.read(BoxName.name).toString().split(' ')[0])} ', '${'Where to'.tr} ${EncryptionHelper.instance.decryptData(box.read(BoxName.name).toString().split(' ')[0])} ',
style: AppStyle.subtitle), style: AppStyle.subtitle),
// if (controller.noCarString) // if (controller.noCarString)
// Text('Nearest Car: ~'.tr, // Text('Nearest Car: ~'.tr,

View File

@@ -72,7 +72,7 @@ class NewMainBottomSheet extends StatelessWidget {
children: [ children: [
const Icon(Icons.search), const Icon(Icons.search),
Text( Text(
"${"Where you want go ".tr}${encryptionHelper.decryptData(box.read(BoxName.name).toString().split(' ')[0]).toString()} ?", "${"Where you want go ".tr}${EncryptionHelper.instance.decryptData(box.read(BoxName.name).toString().split(' ')[0]).toString()} ?",
), ),
], ],
), ),

View File

@@ -222,7 +222,7 @@ class CardTripzWallet extends StatelessWidget {
Align( Align(
alignment: Alignment.bottomRight, alignment: Alignment.bottomRight,
child: Text( child: Text(
encryptionHelper EncryptionHelper.instance
.decryptData( .decryptData(
box.read(BoxName.name).toString().split(' ')[0]) box.read(BoxName.name).toString().split(' ')[0])
.toString(), .toString(),

View File

@@ -54,7 +54,7 @@ class PassengerProfilePage extends StatelessWidget {
), ),
trailing: const Icon(Icons.arrow_forward_ios), trailing: const Icon(Icons.arrow_forward_ios),
subtitle: Text( subtitle: Text(
'${encryptionHelper.decryptData(controller.prfoileData['first_name'])} ${encryptionHelper.decryptData(controller.prfoileData['last_name'])}'), '${EncryptionHelper.instance.decryptData(controller.prfoileData['first_name'])} ${EncryptionHelper.instance.decryptData(controller.prfoileData['last_name'])}'),
onTap: () { onTap: () {
controller.updatField( controller.updatField(
'first_name', TextInputType.name); 'first_name', TextInputType.name);
@@ -70,8 +70,9 @@ class PassengerProfilePage extends StatelessWidget {
width: 35, width: 35,
), ),
trailing: const Icon(Icons.arrow_forward_ios), trailing: const Icon(Icons.arrow_forward_ios),
subtitle: Text(encryptionHelper.decryptData( subtitle: Text(EncryptionHelper.instance
controller.prfoileData['gender'].toString())), .decryptData(controller.prfoileData['gender']
.toString())),
onTap: () { onTap: () {
Get.defaultDialog( Get.defaultDialog(
title: 'Update Gender'.tr, title: 'Update Gender'.tr,
@@ -84,8 +85,9 @@ class PassengerProfilePage extends StatelessWidget {
controller.updateColumn({ controller.updateColumn({
'id': controller.prfoileData['id'] 'id': controller.prfoileData['id']
.toString(), .toString(),
'gender': 'gender': EncryptionHelper
encryptionHelper.encryptData( .instance
.encryptData(
controller.gender), controller.gender),
}); });
Get.back(); Get.back();
@@ -181,7 +183,7 @@ class PassengerProfilePage extends StatelessWidget {
size: 35, size: 35,
), ),
trailing: const Icon(Icons.arrow_forward_ios), trailing: const Icon(Icons.arrow_forward_ios),
subtitle: Text(encryptionHelper subtitle: Text(EncryptionHelper.instance
.decryptData( .decryptData(
controller.prfoileData['sosPhone']) controller.prfoileData['sosPhone'])
.toString()), .toString()),

View File

@@ -295,13 +295,13 @@ packages:
source: hosted source: hosted
version: "0.7.10" version: "0.7.10"
device_info_plus: device_info_plus:
dependency: transitive dependency: "direct main"
description: description:
name: device_info_plus name: device_info_plus
sha256: "4fa68e53e26ab17b70ca39f072c285562cfc1589df5bb1e9295db90f6645f431" sha256: "72d146c6d7098689ff5c5f66bcf593ac11efc530095385356e131070333e64da"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "11.2.0" version: "11.3.0"
device_info_plus_platform_interface: device_info_plus_platform_interface:
dependency: transitive dependency: transitive
description: description:
@@ -1125,6 +1125,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.0.5" version: "1.0.5"
jailbreak_root_detection:
dependency: "direct main"
description:
name: jailbreak_root_detection
sha256: ee98f5e69b43c758ee1779204b0926a09f0371eebe1462b876fb6a8bd130cbe5
url: "https://pub.dev"
source: hosted
version: "1.1.5"
js: js:
dependency: transitive dependency: transitive
description: description:
@@ -1165,6 +1173,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "0.4.13" version: "0.4.13"
jwt_decoder:
dependency: "direct main"
description:
name: jwt_decoder
sha256: "54774aebf83f2923b99e6416b4ea915d47af3bde56884eb622de85feabbc559f"
url: "https://pub.dev"
source: hosted
version: "2.0.1"
leak_tracker: leak_tracker:
dependency: transitive dependency: transitive
description: description:
@@ -1342,21 +1358,21 @@ packages:
source: hosted source: hosted
version: "2.1.1" version: "2.1.1"
package_info_plus: package_info_plus:
dependency: "direct main" dependency: transitive
description: description:
name: package_info_plus name: package_info_plus
sha256: "70c421fe9d9cc1a9a7f3b05ae56befd469fe4f8daa3b484823141a55442d858d" sha256: "67eae327b1b0faf761964a1d2e5d323c797f3799db0e85aa232db8d9e922bc35"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "8.1.2" version: "8.2.1"
package_info_plus_platform_interface: package_info_plus_platform_interface:
dependency: transitive dependency: transitive
description: description:
name: package_info_plus_platform_interface name: package_info_plus_platform_interface
sha256: a5ef9986efc7bf772f2696183a3992615baa76c1ffb1189318dd8803778fb05b sha256: "205ec83335c2ab9107bbba3f8997f9356d72ca3c715d2f038fc773d0366b4c76"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "3.0.2" version: "3.1.0"
path: path:
dependency: "direct main" dependency: "direct main"
description: description:

View File

@@ -58,7 +58,7 @@ dependencies:
google_sign_in: ^6.2.1 google_sign_in: ^6.2.1
sign_in_with_apple: ^6.1.0 sign_in_with_apple: ^6.1.0
firebase_auth: ^5.1.2 firebase_auth: ^5.1.2
package_info_plus: ^8.0.0 device_info_plus: ^11.3.0
uni_links: ^0.5.1 uni_links: ^0.5.1
googleapis_auth: ^1.6.0 googleapis_auth: ^1.6.0
flutter_confetti: ^0.3.0 flutter_confetti: ^0.3.0
@@ -69,6 +69,9 @@ dependencies:
encrypt: ^5.0.3 encrypt: ^5.0.3
live_activities: ^2.3.0 live_activities: ^2.3.0
quick_actions: ^1.1.0 quick_actions: ^1.1.0
jwt_decoder: ^2.0.1
jailbreak_root_detection: ^1.1.5
# jailbreak_root_detection: ^1.1.5
dev_dependencies: dev_dependencies:
flutter_test: flutter_test: