diff --git a/ios/Runner/Info.plist b/ios/Runner/Info.plist
index 75c680b..8108c0a 100644
--- a/ios/Runner/Info.plist
+++ b/ios/Runner/Info.plist
@@ -91,5 +91,7 @@
TAG
+ UIApplicationSupportsIndirectInputEvents
+
diff --git a/lib/classes/utils.dart b/lib/classes/utils.dart
index 34831c2..1838cb8 100644
--- a/lib/classes/utils.dart
+++ b/lib/classes/utils.dart
@@ -401,4 +401,15 @@ class Utils {
}
return false;
}
+
+ static bool isDate(String input, String format) {
+ try {
+ DateTime d = DateFormat(format).parseStrict(input);
+ //print(d);
+ return true;
+ } catch (e) {
+ //print(e);
+ return false;
+ }
+ }
}
diff --git a/lib/ui/landing/itg/its_add_screen_video_image.dart b/lib/ui/landing/itg/its_add_screen_video_image.dart
index 61b2766..160f773 100644
--- a/lib/ui/landing/itg/its_add_screen_video_image.dart
+++ b/lib/ui/landing/itg/its_add_screen_video_image.dart
@@ -39,6 +39,12 @@ class _ITGAdsScreenState extends State {
String? masterID;
int videoDuration = 0;
+ bool hasTimerEndedBool = false;
+
+ final ValueNotifier hasTimerEnded = ValueNotifier(false);
+
+ late CountdownTimerController timerController;
+
void checkFileType() async {
String? rFile = advertisementData!.viewAttachFileColl!.first.base64String;
String? rFileExt = advertisementData!.viewAttachFileColl!.first.fileName;
@@ -56,6 +62,17 @@ class _ITGAdsScreenState extends State {
setState(() {});
}
+ void changeTimer(bool isTimerEnd) {
+ hasTimerEndedBool = isTimerEnd;
+ hasTimerEnded.value = !hasTimerEnded.value;
+ }
+
+ void onTimerEnd() {
+ changeTimer(true);
+ timerController.disposeTimer();
+ timerController.dispose();
+ }
+
Future processImage(String encodedBytes) async {
try {
Uint8List decodedBytes = base64Decode(encodedBytes.split("base64,").last);
@@ -69,18 +86,20 @@ class _ITGAdsScreenState extends State {
Future createVideoPlayer(String encodedBytes) async {
try {
- Uint8List decodedBytes = base64Decode(encodedBytes.split("base64,").last);
- Directory appDocumentsDirectory = await getApplicationDocumentsDirectory(); // 1
- File file = Io.File("${appDocumentsDirectory.path}/myAdsVideo.mp4");
- file.writeAsBytesSync(decodedBytes);
- VideoPlayerController controller = VideoPlayerController.file(file);
+ // Uint8List decodedBytes = base64Decode(encodedBytes.split("base64,").last);
+ // Directory appDocumentsDirectory = await getApplicationDocumentsDirectory(); // 1
+ // File file = Io.File("${appDocumentsDirectory.path}/myAdsVideo.mp4");
+ // file.writeAsBytesSync(decodedBytes);
+ // VideoPlayerController controller = VideoPlayerController.file(file);
+ VideoPlayerController controller = VideoPlayerController.network(advertisementData!.viewAttachFileColl!.first.base64String!);
await controller.initialize();
await controller.play();
await controller.setVolume(1.0);
await controller.setLooping(false);
return controller;
} catch (e) {
- return VideoPlayerController.asset("dataSource");
+ print(e);
+ return VideoPlayerController.network("https://apimohemmweb.cloudsolutions.com.sa/ErmAttachment/compressedvideo.mp4");
}
}
@@ -107,6 +126,7 @@ class _ITGAdsScreenState extends State {
if (advertisementData != null) {
checkFileType();
videoDuration = advertisementData?.durationInSeconds ?? 0;
+ timerController = CountdownTimerController(endTime: DateTime.now().millisecondsSinceEpoch + 1000 * videoDuration, onEnd: onTimerEnd);
}
return Scaffold(
backgroundColor: Colors.black,
@@ -131,24 +151,34 @@ class _ITGAdsScreenState extends State {
),
30.height,
CountdownTimer(
+ controller: timerController,
endTime: DateTime.now().millisecondsSinceEpoch + 1000 * videoDuration,
- onEnd: null,
- endWidget: "00:00:00".toText14(color: Colors.white, isBold: true),
+ endWidget: "00:00:00".toText16(color: Colors.white, isBold: true),
textStyle: const TextStyle(color: Colors.white, fontSize: 16, letterSpacing: -0.48, fontWeight: FontWeight.bold),
),
50.height,
- Container(padding: const EdgeInsets.all(16), decoration: Utils.containerRadius(MyColors.white, 10), child: const Icon(Icons.thumb_up, color: MyColors.gradiantEndColor))
- .onPress(() {
- try {
- DashboardApiClient().setAdvertisementViewed(masterID!, advertisementData!.advertisementId!).then((value) {
- logger.d(value);
- Navigator.pop(context);
- });
- } catch (ex) {
- logger.wtf(ex);
- Utils.handleException(ex, context, null);
- }
- }),
+ ValueListenableBuilder(
+ valueListenable: hasTimerEnded,
+ builder: (context, val, child) {
+ if (hasTimerEndedBool) {
+ return Container(
+ padding: const EdgeInsets.all(16), decoration: Utils.containerRadius(MyColors.white, 10), child: const Icon(Icons.thumb_up, color: MyColors.gradiantEndColor))
+ .onPress(() {
+ try {
+ DashboardApiClient().setAdvertisementViewed(masterID!, advertisementData!.advertisementId!).then((value) {
+ logger.d(value);
+ Navigator.pop(context);
+ });
+ } catch (ex) {
+ logger.wtf(ex);
+ Utils.handleException(ex, context, null);
+ }
+ });
+ } else {
+ return Container();
+ }
+ }),
+
// DefaultButton(LocaleKeys.home.tr(), () async {
// DashboardApiClient().setAdvertisementViewed(masterID!, advertisementData!.advertisementId!).then((value) {
// logger.d(value);
diff --git a/lib/ui/my_attendance/dynamic_screens/dynamic_input_screen.dart b/lib/ui/my_attendance/dynamic_screens/dynamic_input_screen.dart
index bd9305d..3e75813 100644
--- a/lib/ui/my_attendance/dynamic_screens/dynamic_input_screen.dart
+++ b/lib/ui/my_attendance/dynamic_screens/dynamic_input_screen.dart
@@ -340,10 +340,15 @@ class _DynamicInputScreenState extends State {
idColName = val;
if (getEitDffStructureList![j].fORMATTYPE == "X") {
- idColName = Utils.formatDateDefault(idColName!);
- // commenting to test
- // DateTime date = DateFormat('yyyy-MM-dd').parse(idColName!);
- // idColName = DateFormat('yyyy-MM-dd HH:mm:ss').format(date);
+ idColName = Utils.reverseFormatDate(idColName!);
+ if (Utils.isDate(Utils.reverseFormatDate(Utils.formatDateNew(idColName)), "yyyy-MM-dd")) {
+ idColName = Utils.formatStandardDate(Utils.formatStandardDate(Utils.formatDateNew(idColName)));
+ // idColName = DateFormat('yyyy/MM/dd HH:mm:ss').format(date);
+ } else if (Utils.isDate(Utils.reverseFormatDate(idColName), "dd-MM-yyyy")) {
+ // // change date format on 31/05/2023
+ DateTime date = DateFormat('dd-MM-yyyy').parse(idColName);
+ idColName = DateFormat('yyyy-MM-dd HH:mm:ss').format(date);
+ }
}
}