Skip to content

Commit

Permalink
feat: basic implementation of the pylons sdk
Browse files Browse the repository at this point in the history
  • Loading branch information
AhsanRns committed May 10, 2024
1 parent b74e160 commit 927304e
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 8 deletions.
5 changes: 2 additions & 3 deletions evently/lib/evently_provider.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'dart:io';
import 'package:evently/main.dart';
import 'package:evently/models/denom.dart';
import 'package:evently/models/events.dart';
import 'package:evently/models/picked_file_model.dart';
import 'package:evently/repository/repository.dart';
import 'package:evently/utils/constants.dart';
Expand All @@ -11,7 +12,6 @@ import 'package:flutter/widgets.dart';
import 'package:injectable/injectable.dart';
import 'package:pylons_sdk/low_level.dart';

import 'models/events.dart';

enum FreeDrop { yes, no, unselected }

Expand Down Expand Up @@ -195,14 +195,13 @@ class EventlyProvider extends ChangeNotifier {

_recipeId = repository.autoGenerateEventlyId();


return Future.value(true);
}

/// send createCookBook tx message to the wallet app
/// return true or false depending on the response from the wallet app
Future<bool> createCookbook() async {
_cookbookId = repository.autoGenerateEventlyId();
_cookbookId = repository.autoGenerateCookbookId();
final cookBook1 = Cookbook(
creator: "",
id: _cookbookId,
Expand Down
13 changes: 11 additions & 2 deletions evently/lib/repository/repository.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ abstract class Repository {

/// This method will generate evently Id for the event
/// Output: [String] the id of the Event that is going to be added in the recipe
String autoGenerateEventlyId();
String autoGenerateCookbookId();

/// This method will save the username of the cookbook generator
/// Input: [username] the username of the user who created the cookbook
Expand All @@ -29,6 +29,10 @@ abstract class Repository {
/// This method will get the username of the cookbook generator
/// Output: [String] returns whether the operation is successful or not
String getCookBookGeneratorUsername();

/// This method will generate easel Id for the NFT
/// Output: [String] the id of the NFT that is going to be added in the recipe
String autoGenerateEventlyId();
}

@LazySingleton(as: Repository)
Expand All @@ -53,7 +57,7 @@ class RepositoryImp implements Repository {
}

@override
String autoGenerateEventlyId() => localDataSource.autoGenerateEventlyId();
String autoGenerateCookbookId() => localDataSource.autoGenerateCookbookId();

@override
Future<bool> saveCookBookGeneratorUsername(String username) {
Expand All @@ -70,4 +74,9 @@ class RepositoryImp implements Repository {
return localDataSource.getCookBookGeneratorUsername();
}

@override
String autoGenerateEventlyId() {
return localDataSource.autoGenerateEventlyId();
}

}
17 changes: 14 additions & 3 deletions evently/lib/services/datasources/local_datasource.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import 'package:shared_preferences/shared_preferences.dart';
abstract class LocalDataSource {
/// This method will generate Evently Id for the Event
/// Output: [String] the id of the Event that is going to be added in the recipe
String autoGenerateEventlyId();
String autoGenerateCookbookId();

/// This method will save the username of the cookbook generator
/// Input: [username] the username of the user who created the cookbook
Expand All @@ -20,6 +20,10 @@ abstract class LocalDataSource {
/// This method will get the username of the cookbook generator
/// Output: [String] returns whether the operation is successful or not
String getCookBookGeneratorUsername();

/// This method will generate easel Id for the NFT
/// Output: [String] the id of the NFT that is going to be added in the recipe
String autoGenerateEventlyId();
}

@LazySingleton(as: LocalDataSource)
Expand All @@ -29,8 +33,8 @@ class LocalDataSourceImpl extends LocalDataSource {
final SharedPreferences sharedPreferences;

@override
String autoGenerateEventlyId() {
final String cookbookId = "Event_Recipe_auto_recipe_${getFullDateTime()}";
String autoGenerateCookbookId() {
final String cookbookId = "Evently_CookBook_auto_cookbook_${getFullDateTime()}";
return cookbookId;
}

Expand All @@ -52,4 +56,11 @@ class LocalDataSourceImpl extends LocalDataSource {
return sharedPreferences.getString(kUsername) ?? '';
}

/// auto generates easelID string
/// returns easelId
@override
String autoGenerateEventlyId() {
final String cookbookId = "Evently_Recipe_auto_recipe_${getFullDateTime()}";
return cookbookId;
}
}

0 comments on commit 927304e

Please sign in to comment.