|
|
|
@ -1,19 +1,14 @@
|
|
|
|
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
|
|
|
|
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
|
|
|
|
import 'package:diplomaticquarterapp/config/size_config.dart';
|
|
|
|
import 'package:diplomaticquarterapp/config/size_config.dart';
|
|
|
|
import 'package:diplomaticquarterapp/models/Authentication/check_activation_code_request.dart';
|
|
|
|
|
|
|
|
import 'package:diplomaticquarterapp/models/Authentication/check_activation_code_response.dart';
|
|
|
|
import 'package:diplomaticquarterapp/models/Authentication/check_activation_code_response.dart';
|
|
|
|
import 'package:diplomaticquarterapp/models/Authentication/check_paitent_authentication_req.dart';
|
|
|
|
import 'package:diplomaticquarterapp/models/Authentication/check_paitent_authentication_req.dart';
|
|
|
|
import 'package:diplomaticquarterapp/core/service/client/base_app_client.dart';
|
|
|
|
|
|
|
|
import 'package:diplomaticquarterapp/models/Authentication/select_device_imei_res.dart';
|
|
|
|
|
|
|
|
import 'package:diplomaticquarterapp/pages/login/login-type.dart';
|
|
|
|
import 'package:diplomaticquarterapp/pages/login/login-type.dart';
|
|
|
|
import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart';
|
|
|
|
|
|
|
|
import 'package:diplomaticquarterapp/routes.dart';
|
|
|
|
import 'package:diplomaticquarterapp/routes.dart';
|
|
|
|
|
|
|
|
import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart';
|
|
|
|
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
|
|
|
|
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
|
|
|
|
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
|
|
|
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
|
|
|
import 'package:diplomaticquarterapp/uitl/utils.dart';
|
|
|
|
import 'package:diplomaticquarterapp/uitl/utils.dart';
|
|
|
|
import 'package:diplomaticquarterapp/widgets/buttons/button.dart';
|
|
|
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart';
|
|
|
|
import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart';
|
|
|
|
import 'package:diplomaticquarterapp/widgets/card/rounded_container.dart';
|
|
|
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/input/text_field.dart';
|
|
|
|
import 'package:diplomaticquarterapp/widgets/input/text_field.dart';
|
|
|
|
import 'package:diplomaticquarterapp/widgets/mobile-no/mobile_no.dart';
|
|
|
|
import 'package:diplomaticquarterapp/widgets/mobile-no/mobile_no.dart';
|
|
|
|
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
|
|
|
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
|
|
|
@ -21,7 +16,6 @@ import 'package:diplomaticquarterapp/widgets/progress_indicator/app_circular_pro
|
|
|
|
import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart';
|
|
|
|
import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart';
|
|
|
|
import 'package:flutter/cupertino.dart';
|
|
|
|
import 'package:flutter/cupertino.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Login extends StatefulWidget {
|
|
|
|
class Login extends StatefulWidget {
|
|
|
|
@override
|
|
|
|
@override
|
|
|
|
@ -41,9 +35,16 @@ class _Login extends State<Login> {
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
@override
|
|
|
|
void initState() {
|
|
|
|
void initState() {
|
|
|
|
|
|
|
|
// getDeviceToken();
|
|
|
|
super.initState();
|
|
|
|
super.initState();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
getDeviceToken() async {
|
|
|
|
|
|
|
|
setState(() async {
|
|
|
|
|
|
|
|
nationalIDorFile.text = await sharedPref.getString(PUSH_TOKEN);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return AppScaffold(
|
|
|
|
return AppScaffold(
|
|
|
|
@ -184,20 +185,17 @@ class _Login extends State<Login> {
|
|
|
|
request['PatientID'] = int.parse(nationalIDorFile.text);
|
|
|
|
request['PatientID'] = int.parse(nationalIDorFile.text);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// request.isRegister = false;
|
|
|
|
// request.isRegister = false;
|
|
|
|
this
|
|
|
|
this.authService.checkActivationCode(request, code).then((result) => {
|
|
|
|
.authService
|
|
|
|
result = CheckActivationCode.fromJson(result),
|
|
|
|
.checkActivationCode(request, code)
|
|
|
|
this.sharedPref.setObject(USER_PROFILE, result.list),
|
|
|
|
.then((result) => {
|
|
|
|
this.sharedPref.setObject(LOGIN_TOKEN_ID, result.logInTokenID),
|
|
|
|
result = CheckActivationCode.fromJson(result),
|
|
|
|
this.sharedPref.setString(TOKEN, result.authenticationTokenID),
|
|
|
|
this.sharedPref.setObject(USER_PROFILE, result.list),
|
|
|
|
//this.checkIfUserAgreedBefore(result),
|
|
|
|
this.sharedPref.setObject(LOGIN_TOKEN_ID, result.logInTokenID),
|
|
|
|
Navigator.of(context).pushNamed(
|
|
|
|
this.sharedPref.setString(TOKEN, result.authenticationTokenID),
|
|
|
|
HOME,
|
|
|
|
//this.checkIfUserAgreedBefore(result),
|
|
|
|
)
|
|
|
|
Navigator.of(context).pushNamed(
|
|
|
|
// SMSOTP.showLoadingDialog(context, false),
|
|
|
|
HOME,
|
|
|
|
});
|
|
|
|
)
|
|
|
|
|
|
|
|
// SMSOTP.showLoadingDialog(context, false),
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
showLoader(bool isTrue) {
|
|
|
|
showLoader(bool isTrue) {
|
|
|
|
|