unsafe device added, swipe only added, force update added,
parent
fc1fb41bb9
commit
0a8b3314ce
@ -0,0 +1,80 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:test_sa/extensions/context_extension.dart';
|
||||
import 'package:test_sa/extensions/int_extensions.dart';
|
||||
import 'package:test_sa/extensions/text_extensions.dart';
|
||||
import 'package:test_sa/extensions/widget_extensions.dart';
|
||||
import 'package:test_sa/new_views/app_style/app_color.dart';
|
||||
import 'package:test_sa/new_views/common_widgets/app_filled_button.dart';
|
||||
|
||||
class UnsafeDeviceScreen extends StatefulWidget {
|
||||
const UnsafeDeviceScreen({Key? key}) : super(key: key);
|
||||
static const String routeName = "/unSafeDevice";
|
||||
|
||||
|
||||
@override
|
||||
State<UnsafeDeviceScreen> createState() => _UnsafeDeviceScreenState();
|
||||
}
|
||||
|
||||
class _UnsafeDeviceScreenState extends State<UnsafeDeviceScreen> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
body: SafeArea(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
21.height,
|
||||
// Center(child: Image.asset("assets/images/logos/main_mohemm_logo.png", width: 200, height: 50)),
|
||||
"logo".toSvgAsset(height: 64),
|
||||
50.height,
|
||||
"Sorry".heading5(context),
|
||||
21.height,
|
||||
"You are using Atoms app on an unsafe device. To be able to use the app with all it's features, Please make sure that the below points are considered: "
|
||||
.heading5(context).paddingOnly(start: 20, end: 20),
|
||||
48.height,
|
||||
passwordConstraintsUI("The device is not jailbroken or rooted.", true).paddingOnly(start: 24, end: 5),
|
||||
8.height,
|
||||
passwordConstraintsUI("The app is not installed on external storage.", true).paddingOnly(start: 24, end: 5),
|
||||
8.height,
|
||||
passwordConstraintsUI("Development mode is disabled.", true).paddingOnly(start: 24, end: 5),
|
||||
21.height,
|
||||
AppFilledButton(label: context.translation.done, maxWidth: true, onPressed: () async {
|
||||
if (Platform.isAndroid) {
|
||||
SystemChannels.platform.invokeMethod('SystemNavigator.pop');
|
||||
} else {
|
||||
// MinimizeApp.minimizeApp();
|
||||
}
|
||||
}).paddingAll(24),
|
||||
// DefaultButton(LocaleKeys.ok.tr(), () async {
|
||||
// if (Platform.isAndroid) {
|
||||
// SystemChannels.platform.invokeMethod('SystemNavigator.pop');
|
||||
// } else {
|
||||
// // MinimizeApp.minimizeApp();
|
||||
// }
|
||||
// })
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget passwordConstraintsUI(String description, bool check) {
|
||||
return Row(
|
||||
children: [
|
||||
4.width,
|
||||
SizedBox(
|
||||
width: 12,
|
||||
height: 12,
|
||||
child: Checkbox(fillColor: MaterialStateProperty.all(AppColor.backgroundDark), shape: const CircleBorder(), value: check, onChanged: null),
|
||||
),
|
||||
8.width,
|
||||
description.heading6(context)
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,159 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:nfc_manager/nfc_manager.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:test_sa/controllers/providers/api/user_provider.dart';
|
||||
import 'package:test_sa/controllers/providers/settings/setting_provider.dart';
|
||||
import 'package:test_sa/extensions/context_extension.dart';
|
||||
import 'package:test_sa/extensions/int_extensions.dart';
|
||||
import 'package:test_sa/extensions/text_extensions.dart';
|
||||
import 'package:test_sa/extensions/widget_extensions.dart';
|
||||
import 'package:test_sa/new_views/app_style/app_color.dart';
|
||||
import 'package:test_sa/new_views/common_widgets/app_drawer.dart';
|
||||
import 'package:test_sa/new_views/swipe_module/circular_animated_widget.dart';
|
||||
import 'package:test_sa/new_views/swipe_module/swipe_history_view.dart';
|
||||
import 'package:test_sa/new_views/swipe_module/utils/swipe_general_utils.dart';
|
||||
import 'package:test_sa/views/widgets/dialogs/dialog.dart';
|
||||
|
||||
class SwipeView extends StatefulWidget {
|
||||
static const String routeName = "/swipe-view";
|
||||
|
||||
const SwipeView({
|
||||
Key? key,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<SwipeView> createState() => _SwipeViewState();
|
||||
}
|
||||
|
||||
class _SwipeViewState extends State<SwipeView> {
|
||||
late UserProvider _userProvider;
|
||||
final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_userProvider = Provider.of<UserProvider>(context, listen: false);
|
||||
if (_userProvider.user != null) {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
_userProvider.getSwipeLastTransaction(userId: _userProvider.user!.userID!);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return WillPopScope(
|
||||
onWillPop: () async {
|
||||
bool result = await showDialog(
|
||||
context: context,
|
||||
builder: (_) => AAlertDialog(title: context.translation.signOut, content: context.translation.logoutAlert),
|
||||
);
|
||||
if (result) {
|
||||
Provider.of<SettingProvider>(context, listen: false).resetSettings();
|
||||
Provider.of<UserProvider>(context, listen: false).reset();
|
||||
Navigator.of(context).pop();
|
||||
Navigator.of(context).pop();
|
||||
}
|
||||
return false;
|
||||
},
|
||||
child: Scaffold(
|
||||
key: _scaffoldKey,
|
||||
drawer: const AppDrawer(),
|
||||
appBar: AppBar(
|
||||
automaticallyImplyLeading: false,
|
||||
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
|
||||
titleSpacing: 0,
|
||||
title: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Consumer<UserProvider>(builder: (context, snapshot, _) {
|
||||
return CircleAvatar(
|
||||
radius: 24,
|
||||
backgroundColor: context.isDark ? AppColor.neutral50 : AppColor.neutral40,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(1), // Border radius
|
||||
child: ClipOval(
|
||||
child: snapshot.profileImage != null
|
||||
? Image.file(snapshot.profileImage!)
|
||||
: (snapshot.user?.profilePhotoName?.isNotEmpty ?? false)
|
||||
? Image.network(snapshot.user!.profilePhotoName!)
|
||||
: const Icon(Icons.person, size: 24, color: Colors.white),
|
||||
),
|
||||
),
|
||||
).onPress(() {
|
||||
_scaffoldKey.currentState!.isDrawerOpen ? _scaffoldKey.currentState!.closeDrawer() : _scaffoldKey.currentState!.openDrawer();
|
||||
});
|
||||
}),
|
||||
],
|
||||
).paddingOnly(start: 16, end: 16),
|
||||
),
|
||||
body: Stack(
|
||||
children: [
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
context.translation.welcome,
|
||||
style: AppTextStyles.heading6.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral20),
|
||||
),
|
||||
Text(
|
||||
_userProvider.user?.username ?? "",
|
||||
style: AppTextStyles.heading2.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50, fontWeight: FontWeight.w600),
|
||||
),
|
||||
],
|
||||
).paddingOnly(start: 16, end: 16, top: 8, bottom: 4),
|
||||
SwipeHistoryView().expanded,
|
||||
],
|
||||
),
|
||||
Positioned(
|
||||
right: 20.toScreenWidth,
|
||||
bottom: 60.toScreenHeight,
|
||||
child: GestureDetector(
|
||||
onTap: () async {
|
||||
bool isNfcSupported = await NfcManager.instance.isAvailable();
|
||||
SwipeGeneralUtils.instance.showSwipeTypeBottomSheetSheet(isNfcSupported: isNfcSupported);
|
||||
},
|
||||
child: CircularAnimatedContainer(
|
||||
child: Container(
|
||||
width: 100.toScreenWidth,
|
||||
height: 100.toScreenHeight,
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: AppColor.white10,
|
||||
border: Border.all(color: AppColor.primary80.withOpacity(0.5), width: 2),
|
||||
),
|
||||
child: Consumer<UserProvider>(builder: (context, userProvider, child) {
|
||||
return Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
'swipe'.toSvgAsset(width: 32, height: 32),
|
||||
8.height,
|
||||
Text(
|
||||
("${context.translation.checkIn}\n${userProvider.swipeTransactionModel != null && userProvider.swipeTransactionModel.swipeTime != null ? SwipeGeneralUtils.instance.formatTimeOnly(userProvider.swipeTransactionModel.swipeTime!) : '--:--'}"),
|
||||
style: AppTextStyles.bodyText2.copyWith(color: AppColor.neutral80, fontWeight: FontWeight.w500, fontFamily: "Poppins"),
|
||||
),
|
||||
],
|
||||
);
|
||||
}),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -1,77 +0,0 @@
|
||||
///todo deleted
|
||||
// import 'package:firebase_core/firebase_core.dart';
|
||||
// import 'package:flare_flutter/flare_actor.dart';
|
||||
// import 'package:flutter/material.dart';
|
||||
// import 'package:provider/provider.dart';
|
||||
// import 'package:test_sa/controllers/notification/notification_manger.dart';
|
||||
// import 'package:test_sa/controllers/providers/api/user_provider.dart';
|
||||
// import 'package:test_sa/controllers/providers/settings/setting_provider.dart';
|
||||
// import 'package:test_sa/models/user.dart';
|
||||
// import 'package:test_sa/new_views/pages/land_page/land_page.dart';
|
||||
//
|
||||
// import 'login.dart';
|
||||
//
|
||||
// class SplashScreen extends StatefulWidget {
|
||||
// static const String id = '/splash';
|
||||
//
|
||||
// const SplashScreen({Key? key}) : super(key: key);
|
||||
//
|
||||
// @override
|
||||
// State<SplashScreen> createState() => _SplashScreenState();
|
||||
// }
|
||||
//
|
||||
// class _SplashScreenState extends State<SplashScreen> {
|
||||
// SettingProvider _settingProvider;
|
||||
// UserProvider _userProvider;
|
||||
//
|
||||
// _goToUserScreen(User user) {
|
||||
// if (user.tokenlife != null && (DateTime.tryParse(user.tokenlife)?.isAfter(DateTime.now()) ?? false)) {
|
||||
// _userProvider.user = user;
|
||||
// // Navigator.of(context).pushNamed(Login.id);
|
||||
// Navigator.of(context).pushNamed(LandPage.routeName);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @override
|
||||
// void initState() {
|
||||
// Firebase.initializeApp();
|
||||
//
|
||||
// NotificationManger.initialisation((notificationDetails) {
|
||||
// // todo @sikander, check notifications payload, because notification model is different to need to check from backend
|
||||
// // SystemNotificationModel notification = SystemNotificationModel.fromJson(json.decode(notificationDetails.payload));
|
||||
// // if (notification.path == null || notification.path.isEmpty) return;
|
||||
// // Navigator.pushNamed(context, notification.path, arguments: notification.requestId);
|
||||
// }, (id, title, body, payload) async {});
|
||||
// super.initState();
|
||||
// }
|
||||
//
|
||||
// @override
|
||||
// Widget build(BuildContext context) {
|
||||
// _settingProvider = Provider.of<SettingProvider>(context, listen: false);
|
||||
// _userProvider = Provider.of<UserProvider>(context, listen: false);
|
||||
// return Scaffold(
|
||||
// backgroundColor: Colors.white,
|
||||
// body: Center(
|
||||
// child: SizedBox(
|
||||
// width: MediaQuery.of(context).size.width / 1.1,
|
||||
// child: FlareActor(
|
||||
// "assets/rives/atoms_splash.flr",
|
||||
// fit: BoxFit.contain,
|
||||
// animation: "splash",
|
||||
// callback: (animation) async {
|
||||
// Navigator.of(context).pushNamed(Login.id);
|
||||
// if (_settingProvider.isLoaded && _settingProvider.user != null) {
|
||||
// _goToUserScreen(_settingProvider.user);
|
||||
// }
|
||||
// },
|
||||
// ),
|
||||
// //const Center(child: CircularProgressIndicator())
|
||||
//
|
||||
// // Image.asset("assets/images/logo.png",
|
||||
// // fit: BoxFit.contain,
|
||||
// // ),
|
||||
// ),
|
||||
// ),
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
@ -0,0 +1,54 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:test_sa/extensions/context_extension.dart';
|
||||
import 'package:test_sa/extensions/int_extensions.dart';
|
||||
import 'package:test_sa/extensions/text_extensions.dart';
|
||||
import 'package:test_sa/extensions/widget_extensions.dart';
|
||||
import 'package:test_sa/new_views/app_style/app_color.dart';
|
||||
import 'package:test_sa/new_views/common_widgets/app_filled_button.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
class UpdateAvailableScreen extends StatelessWidget {
|
||||
static const String routeName = "/UpdateAvailableScreen";
|
||||
|
||||
UpdateAvailableScreen({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
body: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Hero(tag: "logo", child: "logo".toSvgAsset(height: 64)),
|
||||
48.height,
|
||||
Text(
|
||||
"Update Available",
|
||||
style: AppTextStyles.heading4.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral50),
|
||||
),
|
||||
24.height,
|
||||
Text(
|
||||
"A new update is available on store.\nUpdate now to enjoy the latest features, improvements, and bug fixes for a smoother experience! ",
|
||||
textAlign: TextAlign.center,
|
||||
style: AppTextStyles.heading6.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral20),
|
||||
),
|
||||
24.height,
|
||||
AppFilledButton(
|
||||
label: context.translation.update,
|
||||
maxWidth: true,
|
||||
onPressed: () {
|
||||
if (Platform.isAndroid || Platform.isIOS) {
|
||||
final appId = Platform.isAndroid ? 'com.hmg.atoms' : '6446684161';
|
||||
final url = Uri.parse(Platform.isAndroid ? "market://details?id=$appId" : "https://apps.apple.com/app/id$appId");
|
||||
launchUrl(
|
||||
url,
|
||||
mode: LaunchMode.externalApplication,
|
||||
);
|
||||
}
|
||||
}),
|
||||
],
|
||||
).paddingAll(24),
|
||||
);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue