feat: submit user login with app
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
sdk.dir=C:/Users/Housh11/AppData/Local/Android/Sdk
|
sdk.dir=C:/Users/Housh11/AppData/Local/Android/Sdk
|
||||||
flutter.sdk=C:\\src\\flutter
|
flutter.sdk=C:\\src\\flutter
|
||||||
flutter.buildMode=release
|
flutter.buildMode=debug
|
||||||
flutter.versionName=1.3.16
|
flutter.versionName=1.3.17
|
||||||
flutter.versionCode=13
|
flutter.versionCode=14
|
||||||
@@ -10,4 +10,6 @@ abstract class AuthRemoteDataSource {
|
|||||||
Future<bool> hasAuthenticated();
|
Future<bool> hasAuthenticated();
|
||||||
|
|
||||||
Future<UserInfoModel?> getUserInfo(String phoneNumber);
|
Future<UserInfoModel?> getUserInfo(String phoneNumber);
|
||||||
|
|
||||||
|
Future<void> submitUserInfo(Map<String, dynamic> userInfo);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,4 +47,13 @@ class AuthRemoteDataSourceImp extends AuthRemoteDataSource {
|
|||||||
);
|
);
|
||||||
return res.data;
|
return res.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<void> submitUserInfo(Map<String, dynamic> userInfo)async {
|
||||||
|
var res = await _httpClient.post(
|
||||||
|
'/steward-app-login/',
|
||||||
|
data: userInfo,
|
||||||
|
headers: {'Content-Type': 'application/json'},
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,4 +9,7 @@ abstract class AuthRepository {
|
|||||||
Future<bool> hasAuthenticated();
|
Future<bool> hasAuthenticated();
|
||||||
|
|
||||||
Future<UserInfoModel?> getUserInfo(String phoneNumber);
|
Future<UserInfoModel?> getUserInfo(String phoneNumber);
|
||||||
|
|
||||||
|
Future<void> submitUserInfo({required String phone,String? deviceName});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,4 +22,10 @@ class AuthRepositoryImpl implements AuthRepository {
|
|||||||
@override
|
@override
|
||||||
Future<UserInfoModel?> getUserInfo(String phoneNumber) async =>
|
Future<UserInfoModel?> getUserInfo(String phoneNumber) async =>
|
||||||
await authRemote.getUserInfo(phoneNumber);
|
await authRemote.getUserInfo(phoneNumber);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<void> submitUserInfo({required String phone, String? deviceName}) async {
|
||||||
|
var tmp = {'mobile': phone, 'device_name': deviceName};
|
||||||
|
await authRemote.submitUserInfo(tmp);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
import 'dart:io';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:rasadyar_chicken/data/common/dio_error_handler.dart';
|
import 'package:rasadyar_chicken/data/common/dio_error_handler.dart';
|
||||||
@@ -42,6 +43,7 @@ class AuthLogic extends GetxController with GetTickerProviderStateMixin {
|
|||||||
Rx<AuthType> authType = AuthType.useAndPass.obs;
|
Rx<AuthType> authType = AuthType.useAndPass.obs;
|
||||||
Rx<AuthStatus> authStatus = AuthStatus.init.obs;
|
Rx<AuthStatus> authStatus = AuthStatus.init.obs;
|
||||||
Rx<OtpStatus> otpStatus = OtpStatus.init.obs;
|
Rx<OtpStatus> otpStatus = OtpStatus.init.obs;
|
||||||
|
RxnString deviceName = RxnString(null);
|
||||||
|
|
||||||
RxInt secondsRemaining = 120.obs;
|
RxInt secondsRemaining = 120.obs;
|
||||||
Timer? _timer;
|
Timer? _timer;
|
||||||
@@ -62,6 +64,7 @@ class AuthLogic extends GetxController with GetTickerProviderStateMixin {
|
|||||||
textAnimation = CurvedAnimation(parent: _textAnimationController, curve: Curves.easeInOut);
|
textAnimation = CurvedAnimation(parent: _textAnimationController, curve: Curves.easeInOut);
|
||||||
|
|
||||||
initUserPassData();
|
initUserPassData();
|
||||||
|
getDeviceModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -128,6 +131,11 @@ class AuthLogic extends GetxController with GetTickerProviderStateMixin {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
authRepository.submitUserInfo(
|
||||||
|
phone: usernameController.value.text,
|
||||||
|
deviceName: deviceName.value,
|
||||||
|
);
|
||||||
|
|
||||||
if (tmpRoles!.length > 1) {
|
if (tmpRoles!.length > 1) {
|
||||||
Get.offAndToNamed(ChickenRoutes.role);
|
Get.offAndToNamed(ChickenRoutes.role);
|
||||||
} else {
|
} else {
|
||||||
@@ -176,4 +184,24 @@ class AuthLogic extends GetxController with GetTickerProviderStateMixin {
|
|||||||
rememberMe.value = true;
|
rememberMe.value = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<void> getDeviceModel() async {
|
||||||
|
final deviceInfo = DeviceInfoPlugin();
|
||||||
|
|
||||||
|
if (Platform.isAndroid) {
|
||||||
|
final info = await deviceInfo.androidInfo;
|
||||||
|
print('Device: ${info.manufacturer} ${info.model}');
|
||||||
|
print('Android version: ${info.version.release}');
|
||||||
|
deviceName.value =
|
||||||
|
'Device:${info.manufacturer} Model:${info.model} version ${info.version.release}';
|
||||||
|
} else if (Platform.isIOS) {
|
||||||
|
final info = await deviceInfo.iosInfo;
|
||||||
|
print('Device: ${info.utsname.machine} (${info.name})');
|
||||||
|
print('System version: ${info.systemVersion}');
|
||||||
|
deviceName.value =
|
||||||
|
'Device:${info.utsname.machine} Model:${info.model} version ${info.systemVersion}';
|
||||||
|
} else {
|
||||||
|
print('Unsupported platform');
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -977,10 +977,10 @@ packages:
|
|||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
name: logger
|
name: logger
|
||||||
sha256: "55d6c23a6c15db14920e037fe7e0dc32e7cdaf3b64b4b25df2d541b5b6b81c0c"
|
sha256: a7967e31b703831a893bbc3c3dd11db08126fe5f369b5c648a36f821979f5be3
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.6.1"
|
version: "2.6.2"
|
||||||
logging:
|
logging:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ dependencies:
|
|||||||
smooth_page_indicator: ^1.2.1
|
smooth_page_indicator: ^1.2.1
|
||||||
|
|
||||||
##Log
|
##Log
|
||||||
logger: ^2.6.1
|
logger: ^2.6.2
|
||||||
|
|
||||||
## reactive
|
## reactive
|
||||||
dartx: ^1.2.0
|
dartx: ^1.2.0
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
name: rasadyar_app
|
name: rasadyar_app
|
||||||
description: "A new Flutter project."
|
description: "A new Flutter project."
|
||||||
publish_to: 'none'
|
publish_to: 'none'
|
||||||
version: 1.3.17+14
|
version: 1.3.18+15
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ^3.9.2
|
sdk: ^3.9.2
|
||||||
|
|||||||
Reference in New Issue
Block a user