35 lines
967 B
Dart
35 lines
967 B
Dart
import '../models/otp_response_model.dart';
|
|
|
|
abstract class AuthRemoteDataSource {
|
|
Future<OtpResponseModel> sendOTP(String phoneNumber);
|
|
Future<bool> verifyOTP(String otpCode, String phoneNumber);
|
|
}
|
|
|
|
class AuthRemoteDataSourceImpl implements AuthRemoteDataSource {
|
|
@override
|
|
Future<OtpResponseModel> sendOTP(String phoneNumber) async {
|
|
await Future.delayed(const Duration(seconds: 1));
|
|
|
|
return OtpResponseModel(
|
|
timeStamp: DateTime.now().millisecondsSinceEpoch.toString(),
|
|
timeDue: DateTime.now().add(const Duration(minutes: 2)).millisecondsSinceEpoch.toString(),
|
|
phoneNumber: phoneNumber,
|
|
);
|
|
}
|
|
|
|
@override
|
|
Future<bool> verifyOTP(String otpCode, String phoneNumber) async {
|
|
await Future.delayed(const Duration(seconds: 1));
|
|
|
|
if (otpCode.length == 5) {
|
|
return true;
|
|
}
|
|
|
|
if (otpCode == "1234" || otpCode == "0000" || otpCode == "12345") {
|
|
return true;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
}
|