Skip to content

Commit

Permalink
prepa 1.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
byackee committed Nov 25, 2024
1 parent 828fcba commit 0bfd5ab
Show file tree
Hide file tree
Showing 17 changed files with 394 additions and 90 deletions.
142 changes: 71 additions & 71 deletions ios/Runner/Info.plist
Original file line number Diff line number Diff line change
@@ -1,75 +1,75 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CADisableMinimumFrameDurationOnPhone</key>
<true/>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleDisplayName</key>
<string>Realt Apps</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>realt_apps</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>$(FLUTTER_BUILD_NAME)</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>$(FLUTTER_BUILD_NUMBER)</string>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>https</string>
</array>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSCameraUsageDescription</key>
<string>This app needs access to the camera to scan QR codes for adding wallet addresses.</string>
<key>NSDocumentsFolderUsageDescription</key>
<string>Nous avons besoin d'accéder à vos documents pour sauvegarder et charger les fichiers.</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>Cette application utilise la bibliothèque de photos pour permettre aux utilisateurs de sélectionner et d'envoyer des images.</string>
<key>UIApplicationSupportsIndirectInputEvents</key>
<true/>
<key>NSLocationWhenInUseUsageDescription</key>
<string>This app requires access to your location to provide location-based services.</string>
<key>UIBackgroundModes</key>
<array>
<string>processing</string>
<string>remote-notification</string>
<string>fetch</string>
</array>
<key>BGTaskSchedulerPermittedIdentifiers</key>
<array>
<string>com.example.realtApps.backgroundtask</string>
</array>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>UIStatusBarHidden</key>
<false/>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
</dict>
<dict>
<key>CADisableMinimumFrameDurationOnPhone</key>
<true/>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleDisplayName</key>
<string>Realt Apps</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>realt_apps</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>$(FLUTTER_BUILD_NAME)</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>$(FLUTTER_BUILD_NUMBER)</string>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>https</string>
</array>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSCameraUsageDescription</key>
<string>This app needs access to the camera to scan QR codes for adding wallet addresses.</string>
<key>NSDocumentsFolderUsageDescription</key>
<string>Nous avons besoin d'accéder à vos documents pour sauvegarder et charger les fichiers.</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>Cette application utilise la bibliothèque de photos pour permettre aux utilisateurs de sélectionner et d'envoyer des images.</string>
<key>UIApplicationSupportsIndirectInputEvents</key>
<true/>
<key>NSLocationWhenInUseUsageDescription</key>
<string>This app requires access to your location to provide location-based services.</string>
<key>UIBackgroundModes</key>
<array>
<string>processing</string>
<string>remote-notification</string>
<string>fetch</string>
</array>
<key>BGTaskSchedulerPermittedIdentifiers</key>
<array>
<string>com.example.realtApps.backgroundtask</string>
</array>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>UIStatusBarHidden</key>
<false/>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
</dict>
</plist>
79 changes: 79 additions & 0 deletions lib/api/api_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -673,4 +673,83 @@ class ApiService {
return [];
}
}

static Future<List<dynamic>> fetchTokenVolumes({bool forceFetch = false}) async {
logger.i("apiService: fetchTokenVolumes -> Lancement de la requête");

var box = Hive.box('realTokens');
final lastFetchTime = box.get('lastTokenVolumesFetchTime');
final DateTime now = DateTime.now();

// Vérifiez si le cache est valide
if (!forceFetch && lastFetchTime != null) {
final DateTime lastFetch = DateTime.parse(lastFetchTime);
if (now.difference(lastFetch) < Parameters.apiCacheDuration) {
final cachedData = box.get('cachedTokenVolumesData');
if (cachedData != null) {
logger.i("apiService: fetchTokenVolumes -> Requête annulée, cache valide");
return json.decode(cachedData);
}
}
}

// Définition des variables pour la requête GraphQL
const List<String> stables = [
"0xe91d153e0b41518a2ce8dd3d7944fa863463a97d",
"0xddafbb505ad214d7b80b1f830fccc89b60fb7a83",
"0x7349c9eaa538e118725a6130e0f8341509b9f8a0"
];
final String limitDate = DateTime.now().subtract(Duration(days: 30)).toIso8601String().split('T').first;

// Envoyer la requête GraphQL
final response = await http.post(
Uri.parse(Parameters.yamUrl),
headers: {'Content-Type': 'application/json'},
body: json.encode({
"query": '''
query GetTokenVolumes(\$stables: [String!], \$limitDate: String!) {
tokens(first: 1000) {
id
decimals
volumes(where: { token_in: \$stables }) {
token {
decimals
}
volumeDays(orderBy: date, orderDirection: desc, where: { date_gte: \$limitDate }) {
date
quantity
volume
}
}
}
}
''',
"variables": {
"stables": stables,
"limitDate": limitDate,
}
}),
);

if (response.statusCode == 200) {
logger.i("apiService: fetchTokenVolumes -> Requête lancée avec succès");

final decodedResponse = json.decode(response.body);
if (decodedResponse['data'] != null && decodedResponse['data']['tokens'] != null) {
final List<dynamic> tokens = decodedResponse['data']['tokens'];

// Mettre les données dans le cache
box.put('cachedTokenVolumesData', json.encode(tokens));
box.put('lastTokenVolumesFetchTime', now.toIso8601String());
box.put('lastExecutionTime_TokenVolumes', now.toIso8601String());

return tokens;
} else {
logger.w("apiService: fetchTokenVolumes -> Aucune donnée disponible");
return [];
}
} else {
throw Exception('apiService: fetchTokenVolumes -> Échec de la requête');
}
}
}
Loading

0 comments on commit 0bfd5ab

Please sign in to comment.