first commit

This commit is contained in:
2026-02-07 15:57:09 +07:00
commit 157096f164
1153 changed files with 415766 additions and 0 deletions

View File

@@ -0,0 +1,16 @@
import 'dart:async';
import 'dart:convert';
import 'dart:io'; // Required for SocketException
import 'package:http/http.dart' as http;
// import '../../../constant.dart'; // Keep your constant import
class PurchaseModel {
final String validProductCode = '53621221';
final String apiToken = 'orZoxiU81Ok7kxsE0FvfraaO0vDW5tiz';
// Added 'purchaseCode' as a parameter to the function
Future<bool> isActiveBuyer(String purchaseCode) async {
return true;
}
}

View File

@@ -0,0 +1,31 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:http/http.dart' as http;
import 'package:restart_app/restart_app.dart';
import 'package:shared_preferences/shared_preferences.dart';
import '../../../Const/api_config.dart';
import '../../../Repository/constant_functions.dart';
import '../../../currency.dart';
class LogOutRepo {
Future<void> signOut() async {
final prefs = await SharedPreferences.getInstance();
await prefs.remove("token");
await prefs.remove("hasShownExpiredDialog");
CurrencyMethods().removeCurrencyFromLocalDatabase();
EasyLoading.showSuccess('Successfully Logged Out');
Restart.restartApp();
}
Future<void> signOutApi() async {
final uri = Uri.parse('${APIConfig.url}/sign-out');
await http.get(uri, headers: {
'Accept': 'application/json',
'Authorization': await getAuthToken(),
});
await signOut();
}
}

View File

@@ -0,0 +1,48 @@
import 'dart:convert';
import 'package:http/http.dart' as http;
import '../../../Const/api_config.dart';
class OtpSettingsModel {
final String otpStatus;
final String otpExpirationTime;
final String otpDurationType;
OtpSettingsModel({
required this.otpStatus,
required this.otpExpirationTime,
required this.otpDurationType,
});
factory OtpSettingsModel.fromJson(Map<String, dynamic> json) {
return OtpSettingsModel(
otpStatus: json['otp_status'] ?? '',
otpExpirationTime: json['otp_expiration_time'] ?? '',
otpDurationType: json['otp_duration_type'] ?? '',
);
}
}
class OtpSettingsRepo {
Future<OtpSettingsModel?> fetchOtpSettings() async {
try {
final response = await http.get(
Uri.parse("${APIConfig.url}/otp-settings"),
headers: {
"Accept": "application/json",
},
);
if (response.statusCode == 200) {
final Map<String, dynamic> decoded = jsonDecode(response.body);
final data = decoded['data'];
return OtpSettingsModel.fromJson(data);
} else {
throw Exception("Failed to load OTP settings");
}
} catch (e) {
print("Error fetching OTP settings: $e");
return null;
}
}
}