Commit 3638c385 authored by Izol's avatar Izol

push adjustv3

parent a4e322ba
......@@ -61,14 +61,14 @@ android {
versionName flutterVersionName
// Sun miT2S
// ndk {
// abiFilters 'armeabi', 'armeabi-v7a'
// }
ndk {
abiFilters 'armeabi', 'armeabi-v7a'
}
// Sun miT2Mini
ndk {
abiFilters 'arm64-v8a', 'armeabi', 'armeabi-v7a'
}
// ndk {
// abiFilters 'arm64-v8a', 'armeabi', 'armeabi-v7a'
// }
}
buildTypes {
......@@ -96,7 +96,8 @@ dependencies {
implementation 'androidx.annotation:annotation:1.5.0'
// library mdd
implementation(group: 'com.mdd.topup', name: 'mifare_mdd_lib', version: '0.0.11', ext: 'aar')
// change 11
implementation(group: 'com.mdd.topup', name: 'mifare_mdd_lib', version: '0.0.40', ext: 'aar')
implementation(group: 'com.mdd.payment', name: 'aar-deviceid-release', version: '2.0.6', ext: 'aar')
implementation(group: 'com.mdd.library', name: 'android-escpos-receipt', version: '1.0.1', ext: 'aar')
implementation(group: 'com.mdd.payment', name: 'nativecripto-release', version: '2.0.1', ext: 'aar')
......
// ignore_for_file: prefer_typing_uninitialized_variables, avoid_print
import 'package:flutter/cupertino.dart';
import 'package:flutter/services.dart';
import 'package:self_service_3/shared/preference_constant.dart';
......@@ -49,11 +50,23 @@ class StartService {
String prevBalance,
String serviceCharge,
String serviceChargeAmount,
String denom,
String denom,
String metodeBayar,
String status,
) async {
var result;
debugPrint('=============PARAMETER PRINT===========');
debugPrint('ticketJson: $ticketJson');
debugPrint('companyName: $companyName');
debugPrint('companyAddress: $companyAddress');
debugPrint('companyPhone: $companyPhone');
debugPrint('approvalCode: $approvalCode');
debugPrint('prevBalance: $prevBalance');
debugPrint('serviceCharge: $serviceCharge');
debugPrint('serviceChargeAmount: $serviceChargeAmount');
debugPrint('denom: $denom');
debugPrint('metodeBayar: $metodeBayar');
debugPrint('status: $status');
try {
result = await platform.invokeMethod("print_topup", <String, dynamic>{
"ticket_json": ticketJson,
......@@ -81,7 +94,8 @@ class StartService {
String samReport,
String approvalCode,
String paymentMethod,
String paymentProvider) async {
String paymentProvider,
) async {
var result;
try {
result = await platform.invokeMethod("topup_confirm", <String, dynamic>{
......@@ -121,7 +135,8 @@ class StartService {
return await platform.invokeMethod('bypass_activation');
}
static Future<bool> activateLibrary() async {
static Future<bool>
activateLibrary() async {
return await platform.invokeMethod('activate_library');
}
......
......@@ -74,12 +74,25 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
late Timer? timer;
bool isShowingDialog = false;
var infoCard, prevInfoCard, balance,
cardExpirity, cardType, deposit,
cardNumber, name, getRegDb,
lastBalance, approvalCode,
amount , report, infoM,
infoMulti, companyAddress, num;
var infoCard,
prevInfoCard,
balance,
cardExpirity,
cardType,
deposit,
cardNumber,
name,
getRegDb,
lastBalance,
approvalCode,
amount,
report,
infoM,
dateTimeCardExpirity,
infoMulti,
companyAddress,
num,
plainCardExpirity;
Map<String, dynamic>? dataQris;
var countMax = 0;
......@@ -226,42 +239,73 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
});
amount = amountController!.text.replaceAll(",", "").toString();
var responseInquiry = await StartService.topupInquiryResponse(
outletName, prevBalance!, cardNumber, getRegDb, amount);
outletName, prevBalance!, cardNumber, getRegDb, amount);
var infoInquiry = jsonDecode(responseInquiry);
var name = infoMap["name"].toString().trim();
if (infoInquiry["response"]["code"].toString() == "200") {
var currentDate = DateTime.now();
print("ini adalah kadaluarsa pada $cardExpirity");
// menyesuaikan tanggal hari ini
var cardExpDate = dateTimeCardExpirity;
// var cardExpDate = DateTime.now().subtract(Duration(days:1));
if (infoInquiry["response"]["code"].toString() == "200" &&
currentDate.isBefore(cardExpDate)) {
print("ini response sukses : ${infoInquiry['response']['message']}");
approvalCode = infoInquiry["data"]["approval_code"].toString();
_showQris(context);
} else if (currentDate.isAfter(cardExpDate)) {
AwesomeDialog(
context: context,
dialogType: DialogType.error,
animType: AnimType.rightSlide,
headerAnimationLoop: true,
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();
} else {
print("ini response fail : ${infoInquiry['errors'][0]['details'][0]}");
String error = infoInquiry['errors'][0]['details'][0];
if(error == "Card not found"){
if (error == "Card not found") {
AwesomeDialog(
context: context,
dialogType: DialogType.error,
animType: AnimType.rightSlide,
headerAnimationLoop: true,
title: 'Maaf kartu anda tidak dapat digunakan untuk isi saldo',
desc: "Sorry, your card cannot be used to top up",
btnOkOnPress: () {
setState((){
isShowingDialog = false;
});
if (timer != null) timer?.cancel();
tapIdle();
},
btnOkIcon: Icons.error,
btnOkColor: Colors.red)
context: context,
dialogType: DialogType.error,
animType: AnimType.rightSlide,
headerAnimationLoop: true,
title: 'Maaf kartu anda tidak dapat digunakan untuk isi saldo',
desc: "Sorry, your card cannot be used to top up",
btnOkOnPress: () {
setState(() {
isShowingDialog = false;
});
if (timer != null) timer?.cancel();
tapIdle();
},
btnOkIcon: Icons.error,
btnOkColor: Colors.red)
.show();
}
}
}
Future<String> topUpBalance(String approvalCode) async {
var info, infoMap, lastBalance, samReport, paymentMethod, paymentProvider,metodeBayar,status;
var info,
infoMap,
lastBalance,
samReport,
paymentMethod,
paymentProvider,
metodeBayar,
status;
info = await StartService.topupBalanceCard(cardNumber, int.parse(amount));
infoMap = jsonDecode(info);
lastBalance = infoMap['balance'].toString();
......@@ -274,7 +318,13 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
var infoConfirm = await StartService.topUpConfirm(cardNumber, lastBalance,
samReport, approvalCode, paymentMethod, paymentProvider);
String readerDate, gateId, persoReff, kodeGate, outletName, versionApp, rawData;
String readerDate,
gateId,
persoReff,
kodeGate,
outletName,
versionApp,
rawData;
readerDate = DateFormat("ddMMyyyyHHmmss").format(DateTime.now());
gateId = PreferencesHelper.getString('tid');
......@@ -284,16 +334,40 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
versionApp = PreferencesHelper.getString(kVersionApp);
rawData = (report == null)
? "balance|""$report,""$kodeGate,""$outletName,""$gateId,"
"$cardNumber,""$readerDate,""$amount,""$lastBalance,""$versionApp"
: "$kodeGate,""$outletName,""$gateId,""$cardNumber,""$readerDate,"
"$amount,""$lastBalance,""$versionApp";
? "balance|"
"$report,"
"$kodeGate,"
"$outletName,"
"$gateId,"
"$cardNumber,"
"$readerDate,"
"$amount,"
"$lastBalance,"
"$versionApp"
: "$kodeGate,"
"$outletName,"
"$gateId,"
"$cardNumber,"
"$readerDate,"
"$amount,"
"$lastBalance,"
"$versionApp";
print("proses define wristband info");
WristbandInfo wristbandInfo = WristbandInfo(
readerDate, int.parse(amount), gateId, 'TOPUP',
cardNumber, 'card_topup', lastBalance, prevBalance!,
"M", rawData, persoReff, 'Link-Aja', 'Berhasil' );
readerDate,
int.parse(amount),
gateId,
'TOPUP',
cardNumber,
'card_topup',
lastBalance,
prevBalance!,
"M",
rawData,
persoReff,
'Link-Aja',
'Berhasil');
DatabaseHelper.insertTransaction(wristbandInfo);
print("ini pesan tersimpan berhasil ke database$wristbandInfo");
......@@ -303,7 +377,7 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
companyAddress = PreferencesHelper.getString('multioutletaddress');
denom = amountController!.text.replaceAll(",", "");
String sca =
PreferencesHelper.getString("multioutletservicechargeamount");
PreferencesHelper.getString("multioutletservicechargeamount");
String sc = PreferencesHelper.getString("multioutletservicecharge");
String metodeBayar = "link-aja";
String status = "Berhasil";
......@@ -316,7 +390,7 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
companyPhone,
approvalCode,
prevBalance!,
sca!+sc!,
sca! + sc!,
(int.parse(amount) + int.parse(sca) + int.parse(sc)).toString(),
denom.replaceAll(",", ""),
metodeBayar,
......@@ -348,13 +422,13 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
.toString()
.toLowerCase()
.contains('settlement')) {
Navigator.pop(context);
Navigator.pop(context);
//TODO: getcard
tapBalance();
showPop(approvalCode);
dataQris = null;
result = true;
//TODO: getcard
tapBalance();
showPop(approvalCode);
dataQris = null;
result = true;
} else {
result = false;
if (!isBackgroundServices) {
......@@ -391,7 +465,7 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
var infoMap = jsonDecode(info);
String newCardNumber = infoMap["cardNumber"];
if (newCardNumber == cardNumber) {
topUpBalance(approvalCode);
topUpBalance(approvalCode);
} else {
AwesomeDialog(
context: context,
......@@ -400,52 +474,63 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
animType: AnimType.rightSlide,
headerAnimationLoop: true,
title: 'Kartu tidak sama ! tempelkan kartu sebelumnya',
desc: "Cards are not the same! please put the previous card ${countMax}",
desc:
"Cards are not the same! please put the previous card ${countMax}",
btnOkOnPress: () async {
if (timer != null) timer?.cancel();
if (countMax < 3) {
// var isTap = await StartService.getCard();
// _getInfoBeforeTopup(isTap);
tapBalance();
}else{
} else {
AwesomeDialog(
context: context,
dismissOnTouchOutside: false,
dialogType: DialogType.error,
animType: AnimType.rightSlide,
headerAnimationLoop: true,
title: 'Transaksi anda gagal ! dikarenakan tidak menempelkan kartu sebelumnya',
desc: "Your transaction failed ! because didn't attach the previous card!",
btnOkOnPress: (){
countMax = 0 ;
if (timer != null) timer?.cancel();
String companyName, companyPhone,metodeBayar;
companyName = PreferencesHelper.getString('outletname');
companyName = PreferencesHelper.getString('outletname');
companyPhone = PreferencesHelper.getString('companyphone');
companyAddress = PreferencesHelper.getString('multioutletaddress');
lastBalance = infoMap['balance'].toString();
metodeBayar = "link-aja";
String sca =
PreferencesHelper.getString("multioutletservicechargeamount");
String sc = PreferencesHelper.getString("multioutletservicecharge");
StartService.print(
prevInfoCard,
companyName.split("-")[0],
companyAddress,
companyPhone,
approvalCode,
lastBalance!,
sca!+sc!,
(int.parse(amount) + int.parse(sca) + int.parse(sc)).toString(),
'0',
metodeBayar,
'Gagal',
);
Navigator.pop(context);
},
btnOkIcon: Icons.cancel,
btnOkColor: Colors.red)
context: context,
dismissOnTouchOutside: false,
dialogType: DialogType.error,
animType: AnimType.rightSlide,
headerAnimationLoop: true,
title:
'Transaksi anda gagal ! dikarenakan tidak menempelkan kartu sebelumnya',
desc:
"Your transaction failed ! because didn't attach the previous card!",
btnOkOnPress: () {
countMax = 0;
if (timer != null) timer?.cancel();
String companyName, companyPhone, metodeBayar;
companyName =
PreferencesHelper.getString('outletname');
companyName =
PreferencesHelper.getString('outletname');
companyPhone =
PreferencesHelper.getString('companyphone');
companyAddress = PreferencesHelper.getString(
'multioutletaddress');
lastBalance = infoMap['balance'].toString();
metodeBayar = "link-aja";
String sca = PreferencesHelper.getString(
"multioutletservicechargeamount");
String sc = PreferencesHelper.getString(
"multioutletservicecharge");
StartService.print(
prevInfoCard,
companyName.split("-")[0],
companyAddress,
companyPhone,
approvalCode,
lastBalance!,
sca! + sc!,
(int.parse(amount) +
int.parse(sca) +
int.parse(sc))
.toString(),
'0',
metodeBayar,
'Gagal',
);
Navigator.pop(context);
},
btnOkIcon: Icons.cancel,
btnOkColor: Colors.red)
.show();
}
},
......@@ -454,7 +539,6 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
.show();
}
}
});
}
......@@ -552,15 +636,15 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
var infoMap = jsonDecode(info);
switch (infoMap["cardType"]) {
case 1:
// Perubahan cardType 1 baru menjadi
// Perubahan cardType 1 baru menjadi
cardType = "Kartu Belum Aktif";
break;
case 2:
// Perubahan cardType 2 Belum aktif menjadi
// Perubahan cardType 2 Belum aktif menjadi
cardType = "Kartu Aktif";
break;
case 3:
// Perubahan cardType 3 aktif menjadi
// Perubahan cardType 3 aktif menjadi
cardType = "Binding Customer";
break;
case 4:
......@@ -631,27 +715,32 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
}
void tapDial() async {
Future.delayed(const Duration(milliseconds: 200), () async {
Future.delayed(const Duration(milliseconds: 500), () async {
var isTap = await StartService.getCard();
_getInfoCard(isTap);
// timer?.cancel();
try {
var infoMap = jsonDecode(isTap);
_getInfoCard(isTap);
} catch (e){
print("Error $isTap");
tapDial();
}
});
}
void tapBalance() async {
Future.delayed(const Duration(milliseconds: 200), () async {
var isTap = await StartService.getCard();
print("ini tapcard $isTap");
if(isTap == "Failed detect card"){
print("ini tapcard balance $isTap");
if (isTap == "Failed detect card") {
tapBalance();
}else{
} else {
_getInfoBeforeTopup(isTap);
}
});
}
Future<void> _showTap() {
return showDialog<void>(
context: context,
barrierDismissible: false, // user must tap button!
......@@ -681,6 +770,7 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
"assets/logo.png",
height: 60,
width: 120,
// fit:,
),
SizedBox(
width: 90,
......@@ -852,7 +942,7 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
alignment: Alignment.topLeft,
child: GestureDetector(
onTap: () {
setState((){
setState(() {
isShowingDialog = false;
});
Navigator.pop(context);
......@@ -1057,8 +1147,8 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
child: GestureDetector(
onTap: () {
Navigator.pop(context);
setState((){
isShowingDialog =false;
setState(() {
isShowingDialog = false;
});
if (timer != null) timer?.cancel();
tapIdle();
......@@ -1362,7 +1452,6 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
int.parse(amountController!
.text
.replaceAll(",", "")));
}
});
......@@ -1445,7 +1534,7 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
decoration: BoxDecoration(
boxShadow: [
BoxShadow(
color: Colors.grey.withOpacity(0.3),
color: Colors.white.withOpacity(0.3),
//color of shadow
spreadRadius: 3,
//spread radius
......@@ -1545,13 +1634,13 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
desc:
"Are you sure you want to cancel the payment ?",
btnOkOnPress: () {
Navigator.pop(context);
setState((){
dataQris = null;
isShowingDialog = false;
});
if (timer != null) timer?.cancel();
tapIdle();
Navigator.pop(context);
setState(() {
dataQris = null;
isShowingDialog = false;
});
if (timer != null) timer?.cancel();
tapIdle();
},
btnOkIcon: Icons.cancel,
btnOkColor: Colors.red)
......@@ -1617,11 +1706,12 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
),
//button saya sudah bayar di showqris
TextButton(
onPressed: () {
onPressed: () async {
setState(() => isProcessCheck = true);
_cekStatus().then((value) {
try {
bool result = await _cekStatus();
setState(() {
if (value) {
if (result) {
print("pembayaran berhasil dilakukan");
Navigator.pop(context);
showPop(approvalCode);
......@@ -1640,8 +1730,37 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
}
isProcessCheck = false;
});
});
} catch (e) {
print("Error: $e");
}
},
// onPressed: () {
// setState(() => isProcessCheck = true);
// _cekStatus().then((value) {
// setState(() {
// if (value) {
// print("pembayaran berhasil dilakukan");
// Navigator.pop(context);
// showPop(approvalCode);
// } else {
// AwesomeDialog(
// context: context,
// dialogType: DialogType.error,
// animType: AnimType.rightSlide,
// headerAnimationLoop: true,
// title: 'Belum Terbayar !',
// desc: "Not paid yet !",
// btnOkOnPress: () {},
// btnOkIcon: Icons.cancel,
// btnOkColor: Colors.red)
// .show();
// }
// isProcessCheck = false;
// });
// });
// },
child: (isProcessCheck)
? Column(
children: [
......@@ -1722,50 +1841,64 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
// dataQris = null;
// });
AwesomeDialog(
context: context,
dialogType: DialogType.warning,
dismissOnTouchOutside: false,
animType: AnimType.rightSlide,
headerAnimationLoop: true,
title: 'Waktu pembayaran anda sudah habis !',
desc: "Your payment time has expired !",
btnOkOnPress: () {
setState(() => isProcessCheck = true);
_cekStatus().then((value) {
setState(() {
if (value) {
print("pembayaran berhasil dilakukan");
showPop(approvalCode);
} else {
AwesomeDialog(
context: context,
dialogType: DialogType.warning,
dismissOnTouchOutside: false,
animType: AnimType.rightSlide,
headerAnimationLoop: true,
title:
'Silakan Ulangi Kembali !',
desc:
"please try again !",
btnOkOnPress: () {
Navigator.pop(context);
setState((){
dataQris = null;
isShowingDialog = false;
});
if (timer != null) timer?.cancel();
tapIdle();
},
btnOkIcon: Icons.cancel,
btnOkColor: Colors.red)
.show();
}
isProcessCheck = false;
});
});
},
btnOkIcon: Icons.cancel,
btnOkColor: Colors.red)
context: context,
dialogType: DialogType.warning,
dismissOnTouchOutside: false,
animType: AnimType.rightSlide,
headerAnimationLoop: true,
title:
'Waktu pembayaran anda sudah habis !',
desc:
"Your payment time has expired !",
btnOkOnPress: () {
setState(
() => isProcessCheck = true);
_cekStatus().then((value) {
setState(() {
if (value) {
print(
"pembayaran berhasil dilakukan");
showPop(approvalCode);
} else {
AwesomeDialog(
context: context,
dialogType:
DialogType
.warning,
dismissOnTouchOutside:
false,
animType: AnimType
.rightSlide,
headerAnimationLoop:
true,
title:
'Silakan Ulangi Kembali !',
desc:
"please try again !",
btnOkOnPress: () {
Navigator.pop(
context);
setState(() {
dataQris = null;
isShowingDialog =
false;
});
if (timer != null)
timer?.cancel();
tapIdle();
},
btnOkIcon:
Icons.cancel,
btnOkColor:
Colors.red)
.show();
}
isProcessCheck = false;
});
});
},
btnOkIcon: Icons.cancel,
btnOkColor: Colors.red)
.show();
// setState((){
// Navigator.pop(context);
......@@ -1782,9 +1915,10 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
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") ) {
// debugPrint("ini pesan second: ${seconds}");
// debugPrint("ini pesan minutes: ${minutes}");
if (minutes == '00' &&
int.parse(seconds) == int.parse("30")) {
if (!isHitApi) {
isHitApi = true;
_cekStatus(isBackgroundServices: true);
......@@ -2132,8 +2266,10 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
tapIdle();
amountController?.clear();
var infoMap = jsonDecode(infoCard);
plainCardExpirity = infoMap['cardExpirity'];
var change = DateTime.fromMillisecondsSinceEpoch(
int.parse(infoMap['cardExpirity']) * 1000);
dateTimeCardExpirity = change;
final DateFormat formatter = DateFormat('dd-MMM-yyyy');
cardExpirity = formatter.format(change);
deposit = CurrencyFormat.convertToIdr(
......@@ -2162,7 +2298,13 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
headerAnimationLoop: true,
title: 'Nomor telepon tidak ditemukan !',
desc: "phone number not found !",
btnOkOnPress: () {},
btnOkOnPress: () {
setState(() {
isShowingDialog = false;
});
if (timer != null) timer?.cancel();
tapIdle();
},
btnOkIcon: Icons.cancel,
btnOkColor: Colors.red)
.show();
......@@ -2187,6 +2329,30 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
subtitle: 'balance',
),
),
// TextButton(
// onPressed: () async{
// var info = {"balance":4004,"cardExpirity":"1706869211","cardNumber":"9876540165008514","cardType":4,"cardUid":"E46B63BA000000000000000000000000","deposit":10000,"isMember":false,"listGate":[],"minBalance":0,"name":"Enzo-08756789987654","point":0,"regDb":"1675333210000000","report":"00000000000000000000000000000000F3003EA8DB630100BB0B0000A40F0000FFFFFFFFFFFFFFFFFFFFFFFF4968968A","ticketExpirity":"1675357199"}.toString();
// print("TestButton Press");
// await StartService.print(
// info,
// "Terminal POS Self Service",
// "Jagakarsa",
// "companyPhone",
// "63dba48c81979",
// "3003",
// "10",
// "10",
// "10",
// "linkaja",
// "Berhasil",
// );
// },
// child: const HomeServices(
// iconUrl: 'assets/ic_send.png',
// title: 'Print test',
// subtitle: 'print',
// ),
// ),
// Container(
// height: 100,
// width: 100,
......
......@@ -86,35 +86,50 @@ class _SplashPageState extends State<SplashPage> with TickerProviderStateMixin{
}
void permissionState() async {
// Request multiple permissions at once
Map<Permission, PermissionStatus> status = await [Permission.storage, Permission.phone].request();
// Check if all permissions were granted
bool allGranted = true;
status.forEach((permission, permissionStatus) {
if (permissionStatus != PermissionStatus.granted) {
allGranted = false;
}
});
if (allGranted) {
// All permissions were granted
// Initialize library and check activation
StartService.initLibrary().then((value){
if (await Permission.storage.request().isGranted &&
await Permission.phone.request().isGranted) {
StartService.initLibrary().then((value) {
Future.delayed(Duration(seconds: 3), () {
if (mounted){
checkAktivation();
}
checkAktivation();
});
});
} else {
// Handle denied permissions
status.forEach((permission, permissionStatus) {
if (permissionStatus == PermissionStatus.denied) {
print('$permission permission was denied');
}
Future.delayed(Duration(seconds: 10), () {
showDialog(
context: context,
builder: (BuildContext context) {
return AlertDialog(
title: Text("Error"),
content: Text("The app is taking too long to start. Please try again."),
actions: <Widget>[
TextButton(
child: Text("Try Again"),
onPressed: () {
Navigator.of(context).pop();
permissionState();
},
),
TextButton(
child: Text("Cancel"),
onPressed: () {
Navigator.of(context).pop();
},
),
],
);
},
);
});
}
// You can request multiple permissions at once.
Map<Permission, PermissionStatus> statuses = await [
Permission.phone,
Permission.storage,
].request();
print("phone : ${statuses[Permission.phone]}");
print("storage : ${statuses[Permission.storage]}");
}
void checkAktivation() {
......@@ -157,7 +172,15 @@ class _SplashPageState extends State<SplashPage> with TickerProviderStateMixin{
),
),
),
// child: Text(
// 'UNDER MAINTENANCE',
// style: blackTextStyle.copyWith(
// fontSize: 30,
// fontWeight: semiBold,
// ),
// ),
),
),
),
]
......
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