Commit 0df840c7 authored by Izol's avatar Izol

Update Patch SS.12.WWW

Release note :
- Take Out Phone Validation
- Added information loading customer
parent 18b08a00
......@@ -26,17 +26,35 @@ class MainActivity : MethodChannel.MethodCallHandler, FlutterActivity(), MifareT
private lateinit var mifareTicketingV3: MifareTicketingV3
private lateinit var lastCardUI: Ticket
override fun onMethodCall(call: MethodCall, result: MethodChannel.Result) {
when (call.method) {
// "init_library" -> {
// this.result = result
// val callback = this
// object : Thread() {
// override fun run() {
// _mifareTicketing = MifareTicketing(callback, context)
// mifareTicketingV3 = (_mifareTicketing as MifareTicketing).mTicketingLibV3
//
// _mifareTicketing?.initLibrary(MifareTicketing.USE_Dcard_D8_N, 1)
// }
// }.start()
// }
"init_library" -> {
this.result = result
val callback = this
object : Thread() {
override fun run() {
try {
_mifareTicketing = MifareTicketing(callback, context)
mifareTicketingV3 = (_mifareTicketing as MifareTicketing).mTicketingLibV3
_mifareTicketing?.initLibrary(MifareTicketing.USE_Dcard_D8_N, 1)
} catch (e: Exception) {
sleep(2000) // wait for 2 seconds before retrying
run() // retry
}
}
}.start()
}
......
sdk.dir=/Users/macbookpro/Library/Android/sdk
flutter.sdk=/Users/macbookpro/Developer/flutter
flutter.buildMode=debug
flutter.versionName=SS.11.WWW
flutter.versionCode=4
\ No newline at end of file
flutter.versionName=SS.12.WWW
flutter.versionCode=5
\ No newline at end of file
......@@ -129,10 +129,13 @@ class StartService {
var response = await platform.invokeMethod("init_library");
if (response == "success init engine") {
return true;
} else {
// Jika tidak berhasil, coba lagi dengan memanggil fungsi initLibrary()
return await initLibrary();
}
return false;
}
static Future<bool> bypassActivation() async {
return await platform.invokeMethod('bypass_activation');
}
......
......@@ -375,19 +375,19 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
context: context,
dialogType: DialogType.error,
animType: AnimType.rightSlide,
dismissOnTouchOutside: false,
headerAnimationLoop: true,
autoHide: Duration(seconds: 5),
title: 'Maaf Wristband anda sudah habis masa berlakunya!',
desc: "Sorry, your wristband has expired",
btnOkOnPress: () {
setState(() {
isShowingDialog = false;
});
if (timer != null) timer?.cancel();
tapIdle();
},
btnOkIcon: Icons.error,
btnOkColor: Colors.red)
.show();
.show().then((value){
timer?.cancel();
isShowingDialog = true;
_showTap();
tapDial();
});
} else {
print("ini response fail : ${infoInquiry['errors'][0]['details'][0]}");
String error = infoInquiry['errors'][0]['details'][0];
......@@ -526,14 +526,12 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
color: Colors.green,
fontWeight: medium,
),
).show().then((value) {
timer?.cancel();
isShowingDialog = true;
_showTap();
tapDial();
});
infoM = await StartService.print(
info,
companyName.split("-")[0],
......@@ -628,9 +626,9 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
dialogType: DialogType.error,
animType: AnimType.rightSlide,
headerAnimationLoop: true,
title: 'Kartu tidak sama ! tempelkan kartu sebelumnya',
title: 'Wristband tidak sama ! tempelkan wristband sebelumnya',
desc:
"Cards are not the same! please put the previous card ${countMax}",
"Wristband are not the same! please put the previous wristband ${countMax}",
btnOkOnPress: () async {
if (timer != null) timer?.cancel();
if (countMax < int.parse(nilaiTap)) {
......@@ -639,6 +637,7 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
AwesomeDialog(
context: context,
dismissOnTouchOutside: false,
autoHide: Duration(seconds: 5),
dialogType: DialogType.error,
animType: AnimType.rightSlide,
headerAnimationLoop: true,
......@@ -681,6 +680,7 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
AwesomeDialog(
context: context,
dismissOnTouchOutside: false,
autoHide: Duration(seconds: 5),
dialogType: DialogType.error,
animType: AnimType.rightSlide,
headerAnimationLoop: true,
......@@ -688,18 +688,15 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
'Transaksi anda gagal ! saldo tidak bertambah',
desc:
"Your transaction failed! Your balance did not increase.",
btnOkOnPress: () {
countMax = 0;
setState(() {
isShowingDialog = false;
});
if (timer != null) timer?.cancel();
tapIdle();
Navigator.pop(context);
},
btnOkIcon: Icons.cancel,
btnOkColor: Colors.red)
.show();
.show().then((value){
countMax = 0;
timer?.cancel();
isShowingDialog = true;
_showTap();
tapDial();
});
// Navigator.pop(context);
},
btnOkIcon: Icons.cancel,
......@@ -1159,227 +1156,6 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
);
}
Future<void> phone4CharValidation(String subPhone, String info, idle) async {
showDialog(
context: context,
builder: (context) {
return StatefulBuilder(builder: (context, StateSetter setState) {
return Scaffold(
resizeToAvoidBottomInset: false,
backgroundColor: lightBackgroundColor,
body: SafeArea(
child: Padding(
padding:
const EdgeInsets.symmetric(vertical: 30, horizontal: 40),
child: Column(
children: [
Align(
alignment: Alignment.topLeft,
child: GestureDetector(
onTap: () {
setState(() {
isShowingDialog = false;
});
Navigator.pop(context);
if (timer != null) timer?.cancel();
tapIdle();
},
child: Icon(
Icons.arrow_back,
size: 32,
color: Colors.black54,
),
),
),
SizedBox(
height: 95,
),
Text.rich(
TextSpan(
children: [
TextSpan(
text: "Masukkan 4 angka terakhir",
style: blackTextStyle.copyWith(
fontSize: 40,
fontWeight: FontWeight.bold,
),
),
TextSpan(
text: " nomor handphone ",
style: blackTextStyle.copyWith(
fontSize: 40,
fontWeight: FontWeight.bold,
color: Colors.blue,
),
),
TextSpan(
text: "anda !",
style: blackTextStyle.copyWith(
fontSize: 40,
fontWeight: FontWeight.bold,
),
),
],
),
),
SizedBox(
height: 10,
),
Text(
"Enter the last 4 digits of your phone number !",
style: greyTextStyle.copyWith(
fontSize: 25,
fontWeight: light,
fontStyle: FontStyle.italic,
),
textAlign: TextAlign.center,
),
SizedBox(
height: 25,
),
Container(
padding: EdgeInsets.all(28),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(12),
),
child: OTPTextField(
controller: phoneController,
length: 4,
width: MediaQuery.of(context).size.width,
textFieldAlignment: MainAxisAlignment.spaceAround,
fieldWidth: 80,
fieldStyle: FieldStyle.box,
outlineBorderRadius: 15,
style: blackTextStyle.copyWith(
fontSize: 35, fontWeight: medium),
onChanged: (pin) {
print("Changed: $pin");
if (timer != null) timer?.cancel();
tapIdle();
},
onCompleted: (pin) {
setState(() {
if (timer != null) timer?.cancel();
tapIdle();
num = pin;
});
if (timer != null) timer?.cancel();
tapIdle();
print("Completed: $num");
print("Completed: $subPhone");
String outletName =
PreferencesHelper.getString('outlet_name');
if (subPhone == num) {
AwesomeDialog(
context: context,
autoHide: Duration(seconds: 2),
dialogType: DialogType.success,
dismissOnTouchOutside: false,
animType: AnimType.rightSlide,
headerAnimationLoop: true,
title: 'Berhasil verifikasi',
desc: "verification success",
btnOkIcon: Icons.check,
btnOkColor: Colors.green)
.show().then((value) {
if (timer != null) timer?.cancel();
tapIdle();
if (mounted) {
num = "";
Navigator.of(context, rootNavigator: true).pop();
denom(outletName, info);
}
});
} else {
AwesomeDialog(
context: context,
dialogType: DialogType.error,
animType: AnimType.rightSlide,
headerAnimationLoop: true,
title: 'Pastikan nomor Anda sesuai !',
desc: "Make sure your number matches !",
btnOkOnPress: () {
if (timer != null) timer?.cancel();
tapIdle();
},
btnOkIcon: Icons.cancel,
btnOkColor: Colors.red)
.show();
}
},
),
),
SizedBox(
height: 70,
),
Center(
child: SizedBox(
width: 700,
child: CustomFilledButton(
title: 'lanjut',
subtitle: ' / proceed',
onPressed: () {
if (timer != null) timer?.cancel();
tapIdle();
print("Completed: $num");
print("Completed: $subPhone");
String outletName =
PreferencesHelper.getString('outlet_name');
if (subPhone == num) {
AwesomeDialog(
context: context,
dialogType: DialogType.success,
dismissOnTouchOutside: false,
animType: AnimType.rightSlide,
headerAnimationLoop: true,
title: 'Berhasil verifikasi',
desc: "verification success",
btnOkOnPress: () {
if (timer != null) timer?.cancel();
tapIdle();
if (mounted) {
num = "";
Navigator.of(context,
rootNavigator: true)
.pop();
denom(outletName, info);
}
},
btnOkIcon: Icons.check,
btnOkColor: Colors.green)
.show();
} else {
AwesomeDialog(
context: context,
dialogType: DialogType.error,
animType: AnimType.rightSlide,
headerAnimationLoop: true,
title: 'Pastikan nomor Anda sesuai !',
desc: "Make sure your number matches !",
btnOkOnPress: () {
if (timer != null) timer?.cancel();
tapIdle();
},
btnOkIcon: Icons.cancel,
btnOkColor: Colors.red)
.show();
}
},
),
),
),
],
),
),
),
);
});
});
}
void denom(String outletName, var info) {
SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual, overlays: []);
showDialog(
......@@ -1425,10 +1201,12 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
onTap: () {
Navigator.pop(context);
setState(() {
isShowingDialog = false;
timer?.cancel();
dataQris = null;
isShowingDialog = true;
_showTap();
tapDial();
});
if (timer != null) timer?.cancel();
tapIdle();
},
child: Icon(
Icons.arrow_back,
......@@ -1523,13 +1301,49 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
if (timer != null) {
timer!.cancel();
}
AwesomeDialog(
context: context,
dialogType: DialogType.info,
animType: AnimType.rightSlide,
dismissOnTouchOutside: false,
autoHide: Duration(seconds: 2),
headerAnimationLoop: true,
title: 'Mohon Tunggu Sebentar ...',
titleTextStyle: blackTextStyle.copyWith(
fontSize: 20,
fontWeight: bold,
),
desc: "Please wait a moment ...",
descTextStyle: blackTextStyle.copyWith(
fontSize: 18,
color: Colors.green,
fontWeight: medium,
),
).show().then((value) {
if(amountController!.text.isEmpty){
AwesomeDialog(
context: context,
dialogType: DialogType.error,
animType: AnimType.rightSlide,
headerAnimationLoop: true,
title: 'Terjadi Kesalahan',
desc: "Anda belum mengisi saldo",
btnOkOnPress: () {
if (timer != null) timer?.cancel();
tapIdle();
},
btnOkIcon: Icons.cancel,
btnOkColor: Colors.red,
).show();
}
if (mounted){
denomLimits(
outletName,
info,
int.parse(amountController!.text.replaceAll(",", ""))
);
}
} });
},
),
),
......@@ -1726,7 +1540,42 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
if (timer != null)
timer?.cancel();
// tapIdle();
AwesomeDialog(
context: context,
dialogType: DialogType.info,
animType: AnimType.rightSlide,
dismissOnTouchOutside: false,
autoHide: Duration(seconds: 2),
headerAnimationLoop: true,
title: 'Mohon Tunggu Sebentar ...',
titleTextStyle: blackTextStyle.copyWith(
fontSize: 20,
fontWeight: bold,
),
desc: "Please wait a moment ...",
descTextStyle: blackTextStyle.copyWith(
fontSize: 18,
color: Colors.green,
fontWeight: medium,
),
).show().then((value) {
if(amountController!.text.isEmpty){
AwesomeDialog(
context: context,
dialogType: DialogType.error,
animType: AnimType.rightSlide,
headerAnimationLoop: true,
title: 'Terjadi Kesalahan',
desc: "Anda belum mengisi saldo",
btnOkOnPress: () {
if (timer != null) timer?.cancel();
tapIdle();
},
btnOkIcon: Icons.cancel,
btnOkColor: Colors.red,
).show();
}
if (mounted) {
denomLimits(
outletName,
......@@ -1736,6 +1585,7 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
.replaceAll(",", "")));
}
});
});
},
),
),
......@@ -1906,11 +1756,13 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
btnOkOnPress: () {
Navigator.pop(context);
setState(() {
timer?.cancel();
dataQris = null;
isShowingDialog = false;
isShowingDialog = true;
_showTap();
tapDial();
});
if (timer != null) timer?.cancel();
tapIdle();
// if (timer != null) timer?.cancel();
},
btnOkIcon: Icons.cancel,
btnOkColor: Colors.red)
......@@ -2082,10 +1934,6 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
begin: Duration(minutes: 5),
end: Duration.zero),
onEnd: () {
// Navigator.pop(context);
// setState(() {
// dataQris = null;
// });
AwesomeDialog(
context: context,
dialogType: DialogType.warning,
......@@ -2096,61 +1944,48 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
'Waktu pembayaran anda sudah habis !',
desc:
"Your payment time has expired !",
btnOkOnPress: () {
setState(
() => isProcessCheck = true);
_cekStatus().then((value) {
btnOkOnPress: () async {
setState(() => isProcessCheck = true);
try {
bool result = await _cekStatus();
setState(() {
if (value) {
print(
"pembayaran berhasil dilakukan");
if (result) {
print("pembayaran berhasil dilakukan");
Navigator.pop(context);
showPop(approvalCode);
} else {
setState(() => isProcessCheck = false);
AwesomeDialog(
context: context,
dialogType:
DialogType
.warning,
dismissOnTouchOutside:
false,
animType: AnimType
.rightSlide,
headerAnimationLoop:
true,
title:
'Silakan Ulangi Kembali !',
desc:
"please try again !",
dialogType: DialogType.error,
animType: AnimType.rightSlide,
headerAnimationLoop: true,
title: 'Belum Terbayar , Silahkan Ulangi Kembali !',
desc: "Not paid yet , please try again !",
btnOkOnPress: () {
Navigator.pop(
context);
Navigator.pop(context);
setState(() {
timer?.cancel();
dataQris = null;
isShowingDialog =
false;
isShowingDialog = true;
_showTap();
tapDial();
});
if (timer != null)
timer?.cancel();
tapIdle();
},
btnOkIcon:
Icons.cancel,
btnOkColor:
Colors.red)
btnOkIcon: Icons.cancel,
btnOkColor: Colors.red)
.show();
}
isProcessCheck = false;
});
// isProcessCheck = false;
});
} catch (e) {
print("Error: $e");
setState(() => isProcessCheck = false);
}
},
btnOkIcon: Icons.cancel,
btnOkColor: Colors.red)
.show();
// setState((){
// Navigator.pop(context);
// dataQris = null;
// isShowingDialog = false;
// });
},
builder: (BuildContext context,
Duration value, Widget? child) {
......@@ -2160,9 +1995,6 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
final seconds =
twoDigits(value.inSeconds % 60);
// todo for checking in 30 seconds lates
// debugPrint("values in seconds ${value.inSeconds}");
// debugPrint("ini pesan second: ${seconds}");
// debugPrint("ini pesan minutes: ${minutes}");
if (minutes == '00' &&
int.parse(seconds) == int.parse("30")) {
if (!isHitApi) {
......@@ -2171,9 +2003,7 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
print("pembayaran berhasil dilakukan");
}
}
/*else {
timerCheckStatus?.cancel();
}*/
return Padding(
padding: const EdgeInsets.symmetric(
vertical: 5),
......@@ -2183,7 +2013,8 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
color: Colors.black,
fontWeight: FontWeight.bold,
fontSize: 30)));
}),
},
),
),
),
Text(
......@@ -2577,18 +2408,35 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
var infoMap = jsonDecode(infoCard);
plainCardExpirity = infoMap['cardExpirity'];
var change = DateTime.fromMillisecondsSinceEpoch(
int.parse(infoMap['cardExpirity']) * 1000);
int.parse(infoMap['cardExpirity']) * 1000,
);
dateTimeCardExpirity = change;
final DateFormat formatter = DateFormat('dd-MMM-yyyy');
cardExpirity = formatter.format(change);
deposit = CurrencyFormat.convertToIdr(
infoMap["deposit"],
2,
);
deposit = CurrencyFormat.convertToIdr(infoMap["deposit"], 2);
cardNumber = infoMap["cardNumber"];
String outletName = PreferencesHelper.getString('outlet_name');
denom(outletName, infoM);
// TODO LOADING WHEN CLICK ISI ULANG ADD ADDED VALIDATION
AwesomeDialog(
context: context,
dialogType: DialogType.info,
animType: AnimType.rightSlide,
dismissOnTouchOutside: false,
autoHide: Duration(seconds: 2),
headerAnimationLoop: true,
title: 'Mohon Tunggu Sebentar ...',
titleTextStyle: blackTextStyle.copyWith(
fontSize: 20,
fontWeight: bold,
),
desc: "Please wait a moment ...",
descTextStyle: blackTextStyle.copyWith(
fontSize: 18,
color: Colors.green,
fontWeight: medium,
),
).show().then((value) {
denom(outletName, infoCard);
});
},
child: const HomeServices(
iconUrl: 'assets/ic_topup.png',
......@@ -2596,6 +2444,7 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
subtitle: " topup balance",
),
),
TextButton(
onPressed: () {
timer?.cancel();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment