feat: submit user login with app
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
sdk.dir=C:/Users/Housh11/AppData/Local/Android/Sdk
|
||||
flutter.sdk=C:\\src\\flutter
|
||||
flutter.buildMode=release
|
||||
flutter.versionName=1.3.16
|
||||
flutter.versionCode=13
|
||||
flutter.buildMode=debug
|
||||
flutter.versionName=1.3.17
|
||||
flutter.versionCode=14
|
||||
@@ -10,4 +10,6 @@ abstract class AuthRemoteDataSource {
|
||||
Future<bool> hasAuthenticated();
|
||||
|
||||
Future<UserInfoModel?> getUserInfo(String phoneNumber);
|
||||
|
||||
Future<void> submitUserInfo(Map<String, dynamic> userInfo);
|
||||
}
|
||||
|
||||
@@ -47,4 +47,13 @@ class AuthRemoteDataSourceImp extends AuthRemoteDataSource {
|
||||
);
|
||||
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<UserInfoModel?> getUserInfo(String phoneNumber);
|
||||
|
||||
Future<void> submitUserInfo({required String phone,String? deviceName});
|
||||
|
||||
}
|
||||
|
||||
@@ -22,4 +22,10 @@ class AuthRepositoryImpl implements AuthRepository {
|
||||
@override
|
||||
Future<UserInfoModel?> getUserInfo(String phoneNumber) async =>
|
||||
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:io';
|
||||
|
||||
import 'package:flutter/material.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<AuthStatus> authStatus = AuthStatus.init.obs;
|
||||
Rx<OtpStatus> otpStatus = OtpStatus.init.obs;
|
||||
RxnString deviceName = RxnString(null);
|
||||
|
||||
RxInt secondsRemaining = 120.obs;
|
||||
Timer? _timer;
|
||||
@@ -62,6 +64,7 @@ class AuthLogic extends GetxController with GetTickerProviderStateMixin {
|
||||
textAnimation = CurvedAnimation(parent: _textAnimationController, curve: Curves.easeInOut);
|
||||
|
||||
initUserPassData();
|
||||
getDeviceModel();
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -128,6 +131,11 @@ class AuthLogic extends GetxController with GetTickerProviderStateMixin {
|
||||
);
|
||||
}
|
||||
|
||||
authRepository.submitUserInfo(
|
||||
phone: usernameController.value.text,
|
||||
deviceName: deviceName.value,
|
||||
);
|
||||
|
||||
if (tmpRoles!.length > 1) {
|
||||
Get.offAndToNamed(ChickenRoutes.role);
|
||||
} else {
|
||||
@@ -176,4 +184,24 @@ class AuthLogic extends GetxController with GetTickerProviderStateMixin {
|
||||
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"
|
||||
description:
|
||||
name: logger
|
||||
sha256: "55d6c23a6c15db14920e037fe7e0dc32e7cdaf3b64b4b25df2d541b5b6b81c0c"
|
||||
sha256: a7967e31b703831a893bbc3c3dd11db08126fe5f369b5c648a36f821979f5be3
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.6.1"
|
||||
version: "2.6.2"
|
||||
logging:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
||||
@@ -29,7 +29,7 @@ dependencies:
|
||||
smooth_page_indicator: ^1.2.1
|
||||
|
||||
##Log
|
||||
logger: ^2.6.1
|
||||
logger: ^2.6.2
|
||||
|
||||
## reactive
|
||||
dartx: ^1.2.0
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
name: rasadyar_app
|
||||
description: "A new Flutter project."
|
||||
publish_to: 'none'
|
||||
version: 1.3.17+14
|
||||
version: 1.3.18+15
|
||||
|
||||
environment:
|
||||
sdk: ^3.9.2
|
||||
|
||||
Reference in New Issue
Block a user