Skip to content

Commit

Permalink
Merge branch 'development_cleanup_wallet_dao' into development_cleanu…
Browse files Browse the repository at this point in the history
…p_wallet_dao_wizard
  • Loading branch information
AhmedHanafy725 committed Sep 30, 2024
2 parents 186bd65 + 8b7c18c commit 28c3fa4
Show file tree
Hide file tree
Showing 64 changed files with 2,609 additions and 525 deletions.
3 changes: 2 additions & 1 deletion app/android/app/build_local
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
compileSdkVersion flutter.compileSdkVersion
// compileSdkVersion flutter.compileSdkVersion
compileSdkVersion 34
ndkVersion flutter.ndkVersion

sourceSets {
Expand Down
3 changes: 2 additions & 1 deletion app/android/app/build_production
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
compileSdkVersion flutter.compileSdkVersion
// compileSdkVersion flutter.compileSdkVersion
compileSdkVersion 34
ndkVersion flutter.ndkVersion

sourceSets {
Expand Down
3 changes: 2 additions & 1 deletion app/android/app/build_staging
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
compileSdkVersion flutter.compileSdkVersion
// compileSdkVersion flutter.compileSdkVersion
compileSdkVersion 34
ndkVersion flutter.ndkVersion

sourceSets {
Expand Down
3 changes: 2 additions & 1 deletion app/android/app/build_testing
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
compileSdkVersion flutter.compileSdkVersion
// compileSdkVersion flutter.compileSdkVersion
compileSdkVersion 34
ndkVersion flutter.ndkVersion

sourceSets {
Expand Down
2 changes: 1 addition & 1 deletion app/android/app/src/main/AndroidManifest_local
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<manifest xmlns:tools="http://schemas.android.com/tools" xmlns:android="http://schemas.android.com/apk/res/android" package="org.jimber.threebotlogin.local">
<application tools:replace="android:label" android:label="3Bot Local" android:icon="@mipmap/ic_launcher" android:usesCleartextTraffic="true">
<activity android:name=".MainActivity" android:exported="true" android:launchMode="singleTop" android:theme="@style/LaunchTheme" android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true" android:windowSoftInputMode="adjustResize">
android:hardwareAccelerated="true" android:windowSoftInputMode="adjustResize" android:enableOnBackInvokedCallback="false">
<meta-data android:name="io.flutter.embedding.android.NormalTheme" android:resource="@style/NormalTheme" />
<meta-data android:name="io.flutter.embedding.android.SplashScreenDrawable" android:resource="@drawable/launch_background" />
<intent-filter>
Expand Down
2 changes: 1 addition & 1 deletion app/android/app/src/main/AndroidManifest_production
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<manifest xmlns:tools="http://schemas.android.com/tools" xmlns:android="http://schemas.android.com/apk/res/android" package="org.jimber.threebotlogin">
<application tools:replace="android:label" android:label="Threefold Connect" android:icon="@mipmap/ic_launcher" android:usesCleartextTraffic="true">
<activity android:name=".MainActivity" android:exported="true" android:launchMode="singleTop" android:theme="@style/LaunchTheme" android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true" android:windowSoftInputMode="adjustResize">
android:hardwareAccelerated="true" android:windowSoftInputMode="adjustResize" android:enableOnBackInvokedCallback="false">
<meta-data android:name="io.flutter.embedding.android.NormalTheme" android:resource="@style/NormalTheme" />
<meta-data android:name="io.flutter.embedding.android.SplashScreenDrawable" android:resource="@drawable/launch_background" />
<intent-filter>
Expand Down
2 changes: 1 addition & 1 deletion app/android/app/src/main/AndroidManifest_staging
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<manifest xmlns:tools="http://schemas.android.com/tools" xmlns:android="http://schemas.android.com/apk/res/android" package="org.jimber.threebotlogin.staging">
<application tools:replace="android:label" android:label="3Bot Staging" android:icon="@mipmap/ic_launcher" android:usesCleartextTraffic="true">
<activity android:name=".MainActivity" android:exported="true" android:launchMode="singleTop" android:theme="@style/LaunchTheme" android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true" android:windowSoftInputMode="adjustResize">
android:hardwareAccelerated="true" android:windowSoftInputMode="adjustResize" android:enableOnBackInvokedCallback="false">
<meta-data android:name="io.flutter.embedding.android.NormalTheme" android:resource="@style/NormalTheme" />
<meta-data android:name="io.flutter.embedding.android.SplashScreenDrawable" android:resource="@drawable/launch_background" />
<intent-filter>
Expand Down
2 changes: 1 addition & 1 deletion app/android/app/src/main/AndroidManifest_testing
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<manifest xmlns:tools="http://schemas.android.com/tools" xmlns:android="http://schemas.android.com/apk/res/android" package="org.jimber.threebotlogin.testing">
<application tools:replace="android:label" android:label="3Bot Testing" android:icon="@mipmap/ic_launcher" android:usesCleartextTraffic="true">
<activity android:name=".MainActivity" android:exported="true" android:launchMode="singleTop" android:theme="@style/LaunchTheme" android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true" android:windowSoftInputMode="adjustResize">
android:hardwareAccelerated="true" android:windowSoftInputMode="adjustResize" android:enableOnBackInvokedCallback="false">
<meta-data android:name="io.flutter.embedding.android.NormalTheme" android:resource="@style/NormalTheme" />
<meta-data android:name="io.flutter.embedding.android.SplashScreenDrawable" android:resource="@drawable/launch_background" />
<intent-filter>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ class MainActivity: FlutterFragmentActivity() {
override fun configureFlutterEngine(flutterEngine: FlutterEngine) {
GeneratedPluginRegistrant.registerWith(flutterEngine)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ class MainActivity: FlutterFragmentActivity() {
override fun configureFlutterEngine(flutterEngine: FlutterEngine) {
GeneratedPluginRegistrant.registerWith(flutterEngine)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ class MainActivity: FlutterFragmentActivity() {
override fun configureFlutterEngine(flutterEngine: FlutterEngine) {
GeneratedPluginRegistrant.registerWith(flutterEngine)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ class MainActivity: FlutterFragmentActivity() {
override fun configureFlutterEngine(flutterEngine: FlutterEngine) {
GeneratedPluginRegistrant.registerWith(flutterEngine)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ class MainActivity: FlutterFragmentActivity() {
override fun configureFlutterEngine(flutterEngine: FlutterEngine) {
GeneratedPluginRegistrant.registerWith(flutterEngine)
}
}
}
Binary file added app/assets/tft_icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
42 changes: 42 additions & 0 deletions app/lib/apps/dao/dao.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import 'package:flutter/material.dart';
import 'package:threebotlogin/app.dart';
import 'package:threebotlogin/apps/farmers/farmers_user_data.dart';
import 'package:threebotlogin/events/events.dart';
import 'package:threebotlogin/events/go_home_event.dart';
import 'package:threebotlogin/screens/dao_screen.dart';

class Dao implements App {
static final Dao _singleton = Dao._internal();
static const Widget _daoWidget = DaoPage();

factory Dao() {
return _singleton;
}

Dao._internal();

@override
Future<Widget> widget() async {
return _daoWidget;
}

@override
void clearData() {
clearAllData();
}

@override
bool emailVerificationRequired() {
return false;
}

@override
bool pinRequired() {
return true;
}

@override
void back() {
Events().emit(GoHomeEvent());
}
}
8 changes: 4 additions & 4 deletions app/lib/apps/farmers/farmers.dart
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import 'package:flutter/material.dart';
import 'package:threebotlogin/app.dart';
import 'package:threebotlogin/apps/farmers/farmers_events.dart';
import 'package:threebotlogin/apps/farmers/farmers_user_data.dart';
import 'package:threebotlogin/apps/farmers/farmers_widget.dart';
import 'package:threebotlogin/events/events.dart';
import 'package:threebotlogin/events/go_home_event.dart';
import 'package:threebotlogin/screens/farm_screen.dart';

class Farmers implements App {
static final Farmers _singleton = Farmers._internal();
static const FarmersWidget _farmersWidget = FarmersWidget();
static const Widget _farmersWidget = FarmScreen();

factory Farmers() {
return _singleton;
Expand Down Expand Up @@ -37,6 +37,6 @@ class Farmers implements App {

@override
void back() {
Events().emit(FarmersBackEvent());
Events().emit(GoHomeEvent());
}
}
8 changes: 4 additions & 4 deletions app/lib/apps/wallet/wallet.dart
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import 'package:flutter/material.dart';
import 'package:threebotlogin/app.dart';
import 'package:threebotlogin/apps/wallet/wallet_events.dart';
import 'package:threebotlogin/apps/wallet/wallet_user_data.dart';
import 'package:threebotlogin/apps/wallet/wallet_widget.dart';
import 'package:threebotlogin/events/events.dart';
import 'package:threebotlogin/events/go_home_event.dart';
import 'package:threebotlogin/screens/wallets/wallet_screen.dart';

class Wallet implements App {
static final Wallet _singleton = Wallet._internal();
static const WalletWidget _walletWidget = WalletWidget();
static const Widget _walletWidget = WalletScreen();

factory Wallet() {
return _singleton;
Expand Down Expand Up @@ -37,6 +37,6 @@ class Wallet implements App {

@override
void back() {
Events().emit(WalletBackEvent());
Events().emit(GoHomeEvent());
}
}
6 changes: 3 additions & 3 deletions app/lib/jrouter.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import 'package:flutter/material.dart';
import 'package:threebotlogin/app.dart';
import 'package:threebotlogin/apps/chatbot/chatbot.dart';
import 'package:threebotlogin/apps/dao/dao.dart';
import 'package:threebotlogin/apps/wallet/wallet.dart';
import 'package:threebotlogin/screens/dao_screen.dart';
import 'package:threebotlogin/screens/identity_verification_screen.dart';
import 'package:threebotlogin/screens/preference_screen.dart';
import 'package:threebotlogin/screens/registered_screen.dart';
Expand Down Expand Up @@ -59,9 +59,9 @@ class JRouter {
path: '/dao',
name: 'Dao',
icon: Icons.how_to_vote_outlined,
view: const DaoPage(),
view: await Dao().widget(),
),
app: null),
app: Dao()),
AppInfo(
route: Route(
path: '/chatbot',
Expand Down
25 changes: 25 additions & 0 deletions app/lib/models/contact.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import 'package:threebotlogin/models/wallet.dart';

enum ContactOperation { Add, Edit }

class PkidContact {
PkidContact({
required this.name,
required this.address,
required this.type,
});
String name;
String address;
final ChainType type;

factory PkidContact.fromJson(Map<String, dynamic> json) {
return PkidContact(
name: json['name'],
address: json['address'],
type:
json['type'] == 'stellar' ? ChainType.Stellar : ChainType.TFChain);
}
toMap() {
return {'name': name, 'address': address, 'type': type.name.toLowerCase()};
}
}
17 changes: 7 additions & 10 deletions app/lib/models/wallet.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
enum WalletType { Native, Imported }
enum WalletType { NATIVE, IMPORTED }

enum ChainType { Stellar, TFChain }

class Wallet {
Wallet({
Expand Down Expand Up @@ -31,23 +33,18 @@ class PkidWallet {
String name;
final int index;
final String seed;
final WalletType type;
WalletType type;

factory PkidWallet.fromJson(Map<String, dynamic> json) {
return PkidWallet(
index: json["index"],
name: json['name'],
seed: json['seed'],
type:
json['type'] == 'NATIVE' ? WalletType.Native : WalletType.Imported);
json['type'] == 'NATIVE' ? WalletType.NATIVE : WalletType.IMPORTED);
}
toMap() {
return {
'name': name,
'index': index,
'seed': seed,
'type': type.toString()
};
return {'name': name, 'index': index, 'seed': seed, 'type': type.name};
}
}

Expand All @@ -60,7 +57,7 @@ class Transaction {
required this.to,
required this.asset,
required this.amount,
// required this.memo, // check how to get it
// required this.memo, //TODO: check how to get it (transaction link)
required this.type,
required this.status,
required this.date,
Expand Down
34 changes: 27 additions & 7 deletions app/lib/screens/dao_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,31 @@ class _DaoPageState extends State<DaoPage> {
setState(() {
loading = true;
});
// TODO: show error in case of failure
final proposals = await getProposals();
activeList.addAll(proposals['activeProposals']!);
inactiveList.addAll(proposals['inactiveProposals']!);
setState(() {
loading = false;
});
try {
final proposals = await getProposals();
activeList.addAll(proposals['activeProposals']!);
inactiveList.addAll(proposals['inactiveProposals']!);
} catch (e) {
print('Failed to load proposals due to $e');
if (context.mounted) {
final loadingProposalFailure = SnackBar(
content: Text(
'Failed to load proposals',
style: Theme.of(context)
.textTheme
.bodyMedium!
.copyWith(color: Theme.of(context).colorScheme.errorContainer),
),
duration: const Duration(seconds: 3),
);
ScaffoldMessenger.of(context).clearSnackBars();
ScaffoldMessenger.of(context).showSnackBar(loadingProposalFailure);
}
} finally {
setState(() {
loading = false;
});
}
}

@override
Expand Down Expand Up @@ -68,6 +86,8 @@ class _DaoPageState extends State<DaoPage> {
unselectedLabelColor:
Theme.of(context).colorScheme.onBackground,
dividerColor: Theme.of(context).scaffoldBackgroundColor,
labelStyle: Theme.of(context).textTheme.titleLarge,
unselectedLabelStyle: Theme.of(context).textTheme.titleMedium,
tabs: const [
Tab(text: 'Active'),
Tab(text: 'Executable'),
Expand Down
Loading

0 comments on commit 28c3fa4

Please sign in to comment.