This commit is contained in:
2024-11-26 23:15:04 +02:00
parent cec1a75c73
commit 606d6f041f
19 changed files with 251 additions and 435 deletions

View File

@@ -13,8 +13,8 @@ abstract class AppEnviroment {
switch (env) {
case Enviroment.dev:
{
baseApiUrl = "http://10.0.2.2:8080";
baseFileUrl = "http://10.0.2.2:9000";
baseApiUrl = "http://localhost:8080"; //"http://10.0.2.2:8080";
baseFileUrl = "http://localhost:9000"; //"http://10.0.2.2:9000";
whatsappAccessToken =
"EAAPINXuNFdYBOzBjTcvZA2iPXEHbHRF9uNXyP3ihkPRUcBqKNru5g9NKRRKkFaiaITEzO3BMo6CjdUmlDH4qYTW2mzDrZB4Q21ZCEZBgECZCu27vfaOXJZCYQLNxwoXkrZBRYv8ZAP37f69r3z9JxLQxdxn9gwqA3oNZAlBBRapJQzxOr6pZBTdI3bbjbu17ZBIwRcF4JCqPDCNLEZCI3bmHwEd2i2niNMYZD";
//fingerPrintPluginKey = 'h5X7a5j14iUZCobI1ZeX';

View File

@@ -27,8 +27,12 @@ class _AuthCheckState extends State<AuthCheck> {
}
void disableScreenshot() async {
bool result = await _noScreenshot.screenshotOff();
print('Screenshot Off: $result');
try {
bool result = await _noScreenshot.screenshotOff();
print('Screenshot Off: $result');
} on Exception {
print("Web");
}
}
@override

View File

@@ -3,7 +3,6 @@ import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import '../../main.dart';
import 'package:supabase_auth_ui/supabase_auth_ui.dart';
import 'package:supertokens_flutter/http.dart' as http;
import '../../mih_components/mih_inputs_and_buttons/mih_button.dart';
@@ -69,7 +68,7 @@ class _ForgotPasswordState extends State<ForgotPassword> {
//loginError();
}
}
} on AuthException {
} on Exception {
Navigator.of(context).pop();
//loginError();
}

View File

@@ -4,7 +4,6 @@ import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import '../../main.dart';
//import '../objects/sessionST.dart';
import 'package:supabase_auth_ui/supabase_auth_ui.dart';
//import 'package:supertokens_flutter/supertokens.dart';
import 'package:supertokens_flutter/http.dart' as http;
import 'package:supertokens_flutter/supertokens.dart';
@@ -125,9 +124,9 @@ class _RegisterState extends State<Register> {
}
}
}
} on AuthException catch (error) {
} on Exception catch (error) {
Navigator.of(context).pop();
loginError(error.message);
loginError(error.toString());
emailController.clear();
passwordController.clear();
confirmPasswordController.clear();

View File

@@ -3,7 +3,6 @@ import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import '../../main.dart';
import 'package:supabase_auth_ui/supabase_auth_ui.dart';
import 'package:supertokens_flutter/http.dart' as http;
import '../../mih_components/mih_inputs_and_buttons/mih_button.dart';
@@ -80,7 +79,7 @@ class _ResetPasswordState extends State<ResetPassword> {
loginError();
}
}
} on AuthException {
} on Exception {
Navigator.of(context).pop();
//loginError();
}

View File

@@ -3,7 +3,6 @@ import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import '../../main.dart';
import 'package:supabase_auth_ui/supabase_auth_ui.dart';
import 'package:supertokens_flutter/http.dart' as http;
import '../../mih_components/mih_inputs_and_buttons/mih_button.dart';
@@ -78,7 +77,7 @@ class _SignInState extends State<SignIn> {
passwordController.clear();
}
}
} on AuthException {
} on Exception {
Navigator.of(context).pop();
loginError();
passwordController.clear();

View File

@@ -1,4 +1,5 @@
import 'dart:async';
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
@@ -9,8 +10,8 @@ import 'package:mobile_scanner/mobile_scanner.dart';
// import 'package:simple_barcode_scanner/screens/web.dart';
// import 'package:simple_barcode_scanner/simple_barcode_scanner.dart';
import '../../main.dart';
//import 'package:supertokens_flutter/http.dart' as http;
import "package:universal_html/html.dart" as html;
import 'package:supertokens_flutter/http.dart' as http;
// import "package:universal_html/html.dart" as html;
import '../../mih_apis/mih_location_api.dart';
import '../../mih_components/mih_inputs_and_buttons/mih_search_input.dart';
@@ -947,27 +948,27 @@ class _MIHHomeState extends State<MIHHome> {
}
Future<void> refreshNotifications() async {
html.window.location.reload();
// var responseNotification = await http.get(Uri.parse(
// "$baseAPI/notifications/${widget.signedInUser.app_id}?amount=$amount"));
// List<MIHNotification> notifi;
// if (responseNotification.statusCode == 200) {
// String body = responseNotification.body;
// // var decodedData = jsonDecode(body);
// // MIHNotification notifications = MIHNotification.fromJson(decodedData);
//html.window.location.reload();
var responseNotification = await http.get(Uri.parse(
"$baseAPI/notifications/${widget.signedInUser.app_id}?amount=$amount"));
List<MIHNotification> notifi;
if (responseNotification.statusCode == 200) {
String body = responseNotification.body;
// var decodedData = jsonDecode(body);
// MIHNotification notifications = MIHNotification.fromJson(decodedData);
// Iterable l = jsonDecode(body);
// //print("Here2");
// List<MIHNotification> notifications = List<MIHNotification>.from(
// l.map((model) => MIHNotification.fromJson(model)));
// notifi = notifications;
// } else {
// notifi = [];
// }
// setState(() {
// notifiList = notifi;
// });
// notificationPopUp();
Iterable l = jsonDecode(body);
//print("Here2");
List<MIHNotification> notifications = List<MIHNotification>.from(
l.map((model) => MIHNotification.fromJson(model)));
notifi = notifications;
} else {
notifi = [];
}
setState(() {
notifiList = notifi;
});
notificationPopUp();
}
void notificationPopUp() {

View File

@@ -5,7 +5,9 @@ import 'package:Mzansi_Innovation_Hub/mih_objects/app_user.dart';
import 'package:Mzansi_Innovation_Hub/mih_objects/loyalty_card.dart';
import 'package:Mzansi_Innovation_Hub/mih_packages/mzansi_wallet/components/mih_card_display.dart';
import 'package:flutter/material.dart';
import 'package:syncfusion_flutter_barcodes/barcodes.dart';
import 'package:barcode_widget/barcode_widget.dart';
class BuildLoyaltyCardList extends StatefulWidget {
final AppUser signedInUser;
@@ -22,6 +24,7 @@ class BuildLoyaltyCardList extends StatefulWidget {
class _BuildLoyaltyCardListState extends State<BuildLoyaltyCardList> {
void viewCardWindow(int index) {
//print(widget.cardList[index].card_number);
showDialog(
context: context,
barrierDismissible: false,
@@ -57,8 +60,21 @@ class _BuildLoyaltyCardListState extends State<BuildLoyaltyCardList> {
const SizedBox(height: 15),
SizedBox(
height: 150,
child:
SfBarcodeGenerator(value: widget.cardList[index].card_number),
width: 500,
child: BarcodeWidget(
//color: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
barcode: Barcode.code128(),
backgroundColor: Colors.white,
data: widget.cardList[index].card_number,
drawText: false,
),
// SfBarcodeGenerator(
// backgroundColor: Colors.white,
// barColor: Colors.black,
// value: widget.cardList[index].card_number,
// symbology: Code128(),
// //showValue: true,
// ),
),
Text(
"Card Number: ${widget.cardList[index].card_number}",

View File

@@ -11,9 +11,9 @@ import 'package:Mzansi_Innovation_Hub/mih_objects/loyalty_card.dart';
import 'package:Mzansi_Innovation_Hub/mih_packages/mzansi_wallet/builder/build_loyalty_card_list.dart';
import 'package:Mzansi_Innovation_Hub/mih_packages/mzansi_wallet/components/mih_card_display.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_barcode_scanner/flutter_barcode_scanner.dart';
import 'package:mobile_scanner/mobile_scanner.dart';
import 'package:simple_barcode_scanner/simple_barcode_scanner.dart';
// import 'package:simple_barcode_scanner/simple_barcode_scanner.dart';
class LoyaltyCards extends StatefulWidget {
final AppUser signedInUser;
@@ -142,31 +142,48 @@ class _LoyaltyCardsState extends State<LoyaltyCards> {
),
const SizedBox(width: 10),
MIHButton(
onTap:
// () {
// openscanner();
// },
() async {
print("here");
String? res = await SimpleBarcodeScanner.scanBarcode(
context,
barcodeAppBar: const BarcodeAppBar(
appBarTitle: 'Scan Bardcode',
centerTitle: true,
enableBackButton: true,
backButtonIcon: Icon(Icons.arrow_back),
),
isShowFlashIcon: true,
delayMillis: 500,
cameraFace: CameraFace.back,
scanFormat: ScanFormat.ONLY_BARCODE,
);
if (res != null) {
setState(() {
cardNumberController.text = res;
});
onTap: () async {
String bcodeScanResults;
try {
bcodeScanResults = await FlutterBarcodeScanner.scanBarcode(
'#ff6666',
'Cancel',
true,
ScanMode.BARCODE,
);
} on PlatformException {
bcodeScanResults = "Platform not supported";
}
if (!mounted) return;
setState(() {
cardNumberController.text = bcodeScanResults;
});
},
// () {
// openscanner();
// },
// () async {
// print("here");
// String? res = await SimpleBarcodeScanner.scanBarcode(
// context,
// barcodeAppBar: const BarcodeAppBar(
// appBarTitle: 'Scan Bardcode',
// centerTitle: true,
// enableBackButton: true,
// backButtonIcon: Icon(Icons.arrow_back),
// ),
// isShowFlashIcon: true,
// delayMillis: 500,
// cameraFace: CameraFace.back,
// scanFormat: ScanFormat.ONLY_BARCODE,
// );
// if (res != null) {
// setState(() {
// cardNumberController.text = res;
// });
// }
// },
buttonText: "Scan",
buttonColor:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),