Skip to content

Commit

Permalink
Updated the User experience of the android app (#1712)
Browse files Browse the repository at this point in the history
* Updated the User experience of the android app

* Added correct error message

* Updated the ios minimum version to 11

* Updated the dart sdk tests

* V1 and v2 improvements added.

* Removed unused tabs
  • Loading branch information
kjawadDeveloper2 committed Dec 21, 2022
1 parent ce8c5d7 commit fb730ef
Show file tree
Hide file tree
Showing 45 changed files with 515 additions and 425 deletions.
2 changes: 1 addition & 1 deletion dart_sdk/example/ios/Flutter/AppFrameworkInfo.plist
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@
<key>CFBundleVersion</key>
<string>1.0</string>
<key>MinimumOSVersion</key>
<string>9.0</string>
<string>11.0</string>
</dict>
</plist>
2 changes: 1 addition & 1 deletion dart_sdk/example/ios/Podfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Uncomment this line to define a global platform for your project
# platform :ios, '9.0'
# platform :ios, '11.0'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
Expand Down
16 changes: 8 additions & 8 deletions dart_sdk/example/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,27 @@ PODS:
- Flutter (1.0.0)
- uni_links (0.0.1):
- Flutter
- url_launcher (0.0.1):
- url_launcher_ios (0.0.1):
- Flutter

DEPENDENCIES:
- Flutter (from `Flutter`)
- uni_links (from `.symlinks/plugins/uni_links/ios`)
- url_launcher (from `.symlinks/plugins/url_launcher/ios`)
- url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`)

EXTERNAL SOURCES:
Flutter:
:path: Flutter
uni_links:
:path: ".symlinks/plugins/uni_links/ios"
url_launcher:
:path: ".symlinks/plugins/url_launcher/ios"
url_launcher_ios:
:path: ".symlinks/plugins/url_launcher_ios/ios"

SPEC CHECKSUMS:
Flutter: 50d75fe2f02b26cc09d224853bb45737f8b3214a
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
uni_links: d97da20c7701486ba192624d99bffaaffcfc298a
url_launcher: b6e016d912f04be9f5bf6e8e82dc599b7ba59649
url_launcher_ios: 839c58cdb4279282219f5e248c3321761ff3c4de

PODFILE CHECKSUM: aafe91acc616949ddb318b77800a7f51bffa2a4c
PODFILE CHECKSUM: ef19549a9bc3046e7bb7d2fab4d021637c0c58a3

COCOAPODS: 1.10.1
COCOAPODS: 1.11.3
8 changes: 4 additions & 4 deletions dart_sdk/example/ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@
97C146E61CF9000F007C117D /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 1020;
LastUpgradeCheck = 1300;
ORGANIZATIONNAME = "";
TargetAttributes = {
97C146ED1CF9000F007C117D = {
Expand Down Expand Up @@ -339,7 +339,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
Expand Down Expand Up @@ -417,7 +417,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
Expand Down Expand Up @@ -466,7 +466,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1020"
LastUpgradeVersion = "1300"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
2 changes: 2 additions & 0 deletions dart_sdk/example/ios/Runner/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,7 @@
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
<key>CADisableMinimumFrameDurationOnPhone</key>
<true/>
</dict>
</plist>
45 changes: 15 additions & 30 deletions dart_sdk/example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -199,11 +199,9 @@ class _MyHomePageState extends State<MyHomePage> {
log('From App $response', name: 'pylons_sdk');

if (response.success) {
ScaffoldMessenger.of(context)
.showSnackBar(const SnackBar(content: Text("Cookbook created")));
ScaffoldMessenger.of(context).showSnackBar(const SnackBar(content: Text("Cookbook created")));
} else {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text("Cookbook error : ${response.error}")));
ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text("Cookbook error : ${response.error}")));
}
}

Expand Down Expand Up @@ -242,11 +240,9 @@ class _MyHomePageState extends State<MyHomePage> {
log('From App $response', name: 'pylons_sdk');

if (response.success) {
ScaffoldMessenger.of(context)
.showSnackBar(const SnackBar(content: Text("Recipe created")));
ScaffoldMessenger.of(context).showSnackBar(const SnackBar(content: Text("Recipe created")));
} else {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text("Recipe error : ${response.error}")));
ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text("Recipe error : ${response.error}")));
}
}

Expand All @@ -262,11 +258,9 @@ class _MyHomePageState extends State<MyHomePage> {
log('From App $response', name: 'pylons_sdk');

if (response.success) {
ScaffoldMessenger.of(context)
.showSnackBar(const SnackBar(content: Text("Recipe executed")));
ScaffoldMessenger.of(context).showSnackBar(const SnackBar(content: Text("Recipe executed")));
} else {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text("Recipe error : ${response.error}")));
ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text("Recipe error : ${response.error}")));
}
}

Expand Down Expand Up @@ -305,11 +299,9 @@ class _MyHomePageState extends State<MyHomePage> {
log('From App $response', name: 'pylons_sdk');

if (response.success) {
ScaffoldMessenger.of(context)
.showSnackBar(const SnackBar(content: Text("Recipe updated")));
ScaffoldMessenger.of(context).showSnackBar(const SnackBar(content: Text("Recipe updated")));
} else {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text("Recipe update error : ${response.error}")));
ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text("Recipe update error : ${response.error}")));
}
}

Expand All @@ -329,11 +321,9 @@ class _MyHomePageState extends State<MyHomePage> {
log('From App $response', name: 'pylons_sdk');

if (response.success) {
ScaffoldMessenger.of(context)
.showSnackBar(const SnackBar(content: Text("Cookbook updated")));
ScaffoldMessenger.of(context).showSnackBar(const SnackBar(content: Text("Cookbook updated")));
} else {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text("Cookbook update error: ${response.error}")));
ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text("Cookbook update error: ${response.error}")));
}
}

Expand All @@ -354,32 +344,27 @@ class _MyHomePageState extends State<MyHomePage> {
}

void getRecipe() async {
var sdkResponse =
await PylonsWallet.instance.getRecipe(cookBookId, recipeId);
var sdkResponse = await PylonsWallet.instance.getRecipe(cookBookId, recipeId);
log(sdkResponse.toString(), name: 'pylons_sdk');
}

void getExecutionListByRecipe() async {
var sdkResponse = await PylonsWallet.instance
.getExecutionBasedOnRecipe(cookbookId: cookBookId, recipeId: recipeId);
var sdkResponse = await PylonsWallet.instance.getExecutionBasedOnRecipe(cookbookId: cookBookId, recipeId: recipeId);
log(sdkResponse.toString(), name: 'pylons_sdk');
}

void getItemListByOwner() async {
var sdkResponse =
await PylonsWallet.instance.getItemListByOwner(owner: ownerId);
var sdkResponse = await PylonsWallet.instance.getItemListByOwner(owner: ownerId);
log(sdkResponse.toString(), name: 'pylons_sdk');
}

void getItemById() async {
var sdkResponse = await PylonsWallet.instance
.getItemById(cookbookId: cookBookId, itemId: itemId);
var sdkResponse = await PylonsWallet.instance.getItemById(cookbookId: cookBookId, itemId: itemId);
log(sdkResponse.toString(), name: 'pylons_sdk');
}

void getExecutionById() async {
var sdkResponse =
await PylonsWallet.instance.getExecutionBasedOnId(id: executionId);
var sdkResponse = await PylonsWallet.instance.getExecutionBasedOnId(id: executionId);
log(sdkResponse.toString(), name: 'pylons_sdk');
}

Expand Down
2 changes: 1 addition & 1 deletion dart_sdk/lib/src/features/ipc/base/ipc_handler.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import 'package:pylons_sdk/src/features/models/sdk_ipc_response.dart';

abstract class IPCHandler {
void handler(SDKIPCResponse response);
void handler(SDKIPCResponse response, void Function(String key, SDKIPCResponse response) onHandlingComplete);
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ import 'package:pylons_sdk/src/core/constants/strings.dart';
import 'package:pylons_sdk/src/features/ipc/base/ipc_handler.dart';
import 'package:pylons_sdk/src/features/models/sdk_ipc_response.dart';
import 'package:pylons_sdk/src/generated/pylons/cookbook.pb.dart';
import 'package:pylons_sdk/src/pylons_wallet/response_fetcher/response_fetch.dart';

class CreateCookbookHandler implements IPCHandler {
@override
void handler(SDKIPCResponse<dynamic> response) {
void handler(
SDKIPCResponse<dynamic> response,
void Function(String key, SDKIPCResponse response) onHandlingComplete,
) {
final defaultResponse = SDKIPCResponse<Cookbook>(
success: response.success,
action: response.action,
Expand All @@ -25,6 +27,6 @@ class CreateCookbookHandler implements IPCHandler {
defaultResponse.errorCode = Strings.ERR_MALFORMED_COOKBOOK;
}

getResponseFetch().complete(key: Strings.TX_CREATE_COOKBOOK, sdkipcResponse: defaultResponse);
return onHandlingComplete(Strings.TX_CREATE_COOKBOOK, defaultResponse);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ import 'package:pylons_sdk/src/core/constants/strings.dart';
import 'package:pylons_sdk/src/features/ipc/base/ipc_handler.dart';
import 'package:pylons_sdk/src/features/models/sdk_ipc_response.dart';
import 'package:pylons_sdk/src/generated/pylons/recipe.pb.dart';
import 'package:pylons_sdk/src/pylons_wallet/response_fetcher/response_fetch.dart';

class CreateRecipeHandler implements IPCHandler {
@override
void handler(SDKIPCResponse<dynamic> response) {
void handler(
SDKIPCResponse<dynamic> response,
void Function(String key, SDKIPCResponse response) onHandlingComplete,
) {
print(response);
final defaultResponse = SDKIPCResponse<Recipe>(
success: response.success,
Expand All @@ -26,6 +28,6 @@ class CreateRecipeHandler implements IPCHandler {
defaultResponse.success = false;
}

getResponseFetch().complete(key: Strings.TX_CREATE_RECIPE, sdkipcResponse: defaultResponse);
return onHandlingComplete(Strings.TX_CREATE_RECIPE, defaultResponse);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@ import 'package:pylons_sdk/src/core/constants/strings.dart';
import 'package:pylons_sdk/src/features/ipc/base/ipc_handler.dart';
import 'package:pylons_sdk/src/features/models/sdk_ipc_response.dart';

import '../../../pylons_wallet/response_fetcher/response_fetch.dart';


class ExecuteRecipeHandler implements IPCHandler {
@override
void handler(SDKIPCResponse<dynamic> response) {
void handler(
SDKIPCResponse<dynamic> response,
void Function(String key, SDKIPCResponse response) onHandlingComplete,
) {
final defaultResponse = SDKIPCResponse<String>(
success: response.success,
action: response.action,
Expand All @@ -22,6 +25,7 @@ class ExecuteRecipeHandler implements IPCHandler {
defaultResponse.error = 'TX response parsing failed';
defaultResponse.errorCode = Strings.ERR_MALFORMED_EXECUTION;
}
getResponseFetch().complete(key: Strings.TX_EXECUTE_RECIPE, sdkipcResponse: defaultResponse);

return onHandlingComplete(Strings.TX_EXECUTE_RECIPE, defaultResponse);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@ import 'package:pylons_sdk/src/features/ipc/base/ipc_handler.dart';
import 'package:pylons_sdk/src/features/models/sdk_ipc_response.dart';
import 'package:pylons_sdk/src/generated/pylons/cookbook.pb.dart';

import '../../../pylons_wallet/response_fetcher/response_fetch.dart';

class GetCookbooksHandler implements IPCHandler {
@override
void handler(SDKIPCResponse<dynamic> response) {
void handler(
SDKIPCResponse<dynamic> response,
void Function(String key, SDKIPCResponse response) onHandlingComplete,
) {
final defaultResponse = SDKIPCResponse<Cookbook>(
success: response.success,
action: response.action,
Expand All @@ -26,6 +28,6 @@ class GetCookbooksHandler implements IPCHandler {
defaultResponse.errorCode = Strings.ERR_MALFORMED_COOKBOOK;
}

getResponseFetch().complete(key: Strings.GET_COOKBOOK, sdkipcResponse: defaultResponse);
return onHandlingComplete(Strings.GET_COOKBOOK, defaultResponse);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@ import 'package:pylons_sdk/src/features/ipc/base/ipc_handler.dart';
import 'package:pylons_sdk/src/features/models/sdk_ipc_response.dart';
import 'package:pylons_sdk/src/generated/pylons/execution.pb.dart';

import '../../../pylons_wallet/response_fetcher/response_fetch.dart';

class GetExecutionByIdHandler implements IPCHandler {
@override
void handler(SDKIPCResponse<dynamic> response) {
void handler(SDKIPCResponse<dynamic> response,
void Function(String key, SDKIPCResponse response) onHandlingComplete,
) {
final defaultResponse = SDKIPCResponse<Execution>(
success: response.success,
action: response.action,
Expand All @@ -26,6 +27,6 @@ class GetExecutionByIdHandler implements IPCHandler {
defaultResponse.success = false;
}

getResponseFetch().complete(key: Strings.GET_EXECUTION_BY_ID, sdkipcResponse: defaultResponse);
return onHandlingComplete(Strings.GET_EXECUTION_BY_ID, defaultResponse);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@ import 'package:pylons_sdk/src/features/ipc/base/ipc_handler.dart';
import 'package:pylons_sdk/src/features/models/execution_list_by_recipe_response.dart';
import 'package:pylons_sdk/src/features/models/sdk_ipc_response.dart';

import '../../../pylons_wallet/response_fetcher/response_fetch.dart';

class GetExecutionByRecipeHandler implements IPCHandler {
@override
void handler(SDKIPCResponse<dynamic> response) {
void handler(SDKIPCResponse<dynamic> response,
void Function(String key, SDKIPCResponse response) onHandlingComplete,
) {
final defaultResponse = SDKIPCResponse<ExecutionListByRecipeResponse>(
success: response.success,
action: response.action,
Expand All @@ -27,6 +28,6 @@ class GetExecutionByRecipeHandler implements IPCHandler {
defaultResponse.success = false;
}

getResponseFetch().complete(key: Strings.GET_EXECUTION_BY_RECIPE_ID, sdkipcResponse: defaultResponse);
return onHandlingComplete(Strings.GET_EXECUTION_BY_RECIPE_ID, defaultResponse);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@ import 'package:pylons_sdk/src/features/ipc/base/ipc_handler.dart';
import 'package:pylons_sdk/src/features/models/sdk_ipc_response.dart';
import 'package:pylons_sdk/src/generated/pylons/item.pb.dart';

import '../../../pylons_wallet/response_fetcher/response_fetch.dart';

class GetItemByIdHandler implements IPCHandler {
@override
void handler(SDKIPCResponse<dynamic> response) {
void handler(
SDKIPCResponse<dynamic> response,
void Function(String key, SDKIPCResponse response) onHandlingComplete,
) {
final defaultResponse = SDKIPCResponse<Item>(
success: response.success,
action: response.action,
Expand All @@ -19,16 +21,14 @@ class GetItemByIdHandler implements IPCHandler {

try {
if (response.success) {
defaultResponse.data = Item.create()
..mergeFromProto3Json(jsonDecode(response.data));
defaultResponse.data = Item.create()..mergeFromProto3Json(jsonDecode(response.data));
}
} on FormatException catch (_) {
defaultResponse.error = _.message;
defaultResponse.errorCode = Strings.ERR_MALFORMED_ITEM;
defaultResponse.success = false;
}

getResponseFetch().complete(key: Strings.GET_ITEM_BY_ID, sdkipcResponse: defaultResponse);

return onHandlingComplete(Strings.GET_ITEM_BY_ID, defaultResponse);
}
}
Loading

0 comments on commit fb730ef

Please sign in to comment.