25-10-6/1
This commit is contained in:
@@ -2,6 +2,7 @@ import 'dart:convert';
|
||||
import 'dart:io';
|
||||
import 'dart:math';
|
||||
import 'package:Intaleq/constant/api_key.dart';
|
||||
import 'package:Intaleq/controller/firebase/firbase_messge.dart';
|
||||
import 'package:Intaleq/views/auth/otp_page.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
|
||||
@@ -47,33 +48,34 @@ class LoginController extends GetxController {
|
||||
var dev = '';
|
||||
@override
|
||||
void onInit() async {
|
||||
await getAppTester();
|
||||
Log.print('box.read(BoxName.isTest): ${box.read(BoxName.isTest)}');
|
||||
// await getAppTester();
|
||||
// Log.print('box.read(BoxName.isTest): ${box.read(BoxName.isTest)}');
|
||||
box.write(BoxName.countryCode, 'Syria');
|
||||
FirebaseMessagesController().getToken();
|
||||
super.onInit();
|
||||
}
|
||||
|
||||
getAppTester() async {
|
||||
var res = await CRUD().get(
|
||||
link: AppLink.getTesterApp,
|
||||
payload: {'appPlatform': AppInformation.appName});
|
||||
if (res != 'failure') {
|
||||
var d = jsonDecode(res);
|
||||
// getAppTester() async {
|
||||
// var res = await CRUD().get(
|
||||
// link: AppLink.getTesterApp,
|
||||
// payload: {'appPlatform': AppInformation.appName});
|
||||
// if (res != 'failure') {
|
||||
// var d = jsonDecode(res);
|
||||
|
||||
isTest = int.parse(d['message'][0]['isTest'].toString());
|
||||
box.write(BoxName.isTest, isTest);
|
||||
update();
|
||||
} else {
|
||||
box.write(BoxName.isTest, '1');
|
||||
update();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// isTest = int.parse(d['message'][0]['isTest'].toString());
|
||||
// box.write(BoxName.isTest, isTest);
|
||||
// update();
|
||||
// } else {
|
||||
// box.write(BoxName.isTest, '1');
|
||||
// update();
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
|
||||
updateAppTester(String appPlatform) async {
|
||||
await CRUD().post(
|
||||
link: AppLink.updateTesterApp, payload: {'appPlatform': appPlatform});
|
||||
}
|
||||
// updateAppTester(String appPlatform) async {
|
||||
// await CRUD().post(
|
||||
// link: AppLink.updateTesterApp, payload: {'appPlatform': appPlatform});
|
||||
// }
|
||||
|
||||
void saveAgreementTerms() {
|
||||
box.write(BoxName.agreeTerms, 'agreed');
|
||||
@@ -362,7 +364,7 @@ class LoginController extends GetxController {
|
||||
// var token = await CRUD().get(link: AppLink.getTokens, payload: {
|
||||
// 'passengerID': box.read(BoxName.passengerID).toString()
|
||||
// });
|
||||
await updateAppTester(AppInformation.appName);
|
||||
// await updateAppTester(AppInformation.appName);
|
||||
|
||||
Get.offAll(() => const MapPagePassenger());
|
||||
} else {
|
||||
|
||||
@@ -9,6 +9,7 @@ import 'package:get/get.dart';
|
||||
import '../../print.dart';
|
||||
import '../../views/home/map_page_passenger.dart';
|
||||
import '../firebase/firbase_messge.dart';
|
||||
import '../firebase/notification_service.dart';
|
||||
import '../functions/package_info.dart';
|
||||
|
||||
class OtpVerificationController extends GetxController {
|
||||
@@ -94,12 +95,20 @@ class OtpVerificationController extends GetxController {
|
||||
? Get.find<FirebaseMessagesController>()
|
||||
: Get.put(FirebaseMessagesController());
|
||||
|
||||
await fcm.sendNotificationToDriverMAP(
|
||||
'token change',
|
||||
'change device'.tr,
|
||||
ptoken.toString(),
|
||||
[],
|
||||
'cancel.wav',
|
||||
// await fcm.sendNotificationToDriverMAP(
|
||||
// 'token change',
|
||||
// 'change device'.tr,
|
||||
// ptoken.toString(),
|
||||
// [],
|
||||
// 'cancel',
|
||||
// );
|
||||
await NotificationService.sendNotification(
|
||||
target: ptoken.toString(),
|
||||
title: 'token change'.tr,
|
||||
body: 'change device'.tr,
|
||||
isTopic: false, // Important: this is a token
|
||||
tone: 'cancel',
|
||||
driverList: [],
|
||||
);
|
||||
await CRUD().post(
|
||||
link: "${AppLink.seferPaymentServer}/ride/firebase/add.php",
|
||||
|
||||
Reference in New Issue
Block a user