Skip to content

Commit

Permalink
Recursively call the account creation api for the set username
Browse files Browse the repository at this point in the history
  • Loading branch information
kjawadDeveloper2 committed Mar 21, 2024
1 parent ef21f2a commit ab8099b
Show file tree
Hide file tree
Showing 19 changed files with 162 additions and 110 deletions.
4 changes: 2 additions & 2 deletions dart_sdk/example/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
compileSdkVersion 31
compileSdkVersion 34

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
Expand All @@ -45,7 +45,7 @@ android {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.pylons.example"
minSdkVersion 16
targetSdkVersion 30
targetSdkVersion 33
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
Expand Down
4 changes: 2 additions & 2 deletions easel/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ apply plugin: 'com.google.firebase.crashlytics'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
compileSdkVersion 33
compileSdkVersion 34

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
Expand All @@ -47,7 +47,7 @@ android {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "tech.pylons.easel"
minSdkVersion 21
targetSdkVersion 32
targetSdkVersion 33
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName

Expand Down
4 changes: 2 additions & 2 deletions easel/android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
buildscript {
ext.kotlin_version = '1.6.10'
ext.kotlin_version = '1.9.22'
repositories {
google()
mavenCentral()
Expand All @@ -26,6 +26,6 @@ subprojects {
project.evaluationDependsOn(':app')
}

task clean(type: Delete) {
tasks.register("clean", Delete) {
delete rootProject.buildDir
}
4 changes: 2 additions & 2 deletions easel/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ dependencies:
audio_video_progress_bar: ^1.0.0
auto_size_text: 3.0.0
bottom_drawer: ^0.0.5
cached_network_image: ^3.1.0
cached_network_image:
collection: ^1.16.0
cupertino_icons: ^1.0.2
dartz: ^0.10.0
Expand Down Expand Up @@ -71,7 +71,7 @@ dependencies:
provider: ^6.0.1
pylons_sdk:
path: ../dart_sdk
share_plus: ^7.0.1 # Used for sharing the NFT link.
share_plus:
shared_preferences: ^2.0.8
shimmer_animation: 2.1.0+1
sqflite: ^2.0.3+1
Expand Down
4 changes: 2 additions & 2 deletions testapp-flutter/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ if (keystorePropertiesFile.exists()) {
}

android {
compileSdkVersion 31
compileSdkVersion 34

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
Expand All @@ -51,7 +51,7 @@ android {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "tech.pylons.testapp_flutter"
minSdkVersion 16
targetSdkVersion 31
targetSdkVersion 33
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
Expand Down
2 changes: 1 addition & 1 deletion wallet/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.firebase.crashlytics'

android {
compileSdkVersion 33
compileSdkVersion 34


compileOptions {
Expand Down
2 changes: 1 addition & 1 deletion wallet/android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
buildscript {
ext.kotlin_version = '1.7.10'
ext.kotlin_version = '1.9.22'
repositories {
google()
mavenCentral()
Expand Down
1 change: 1 addition & 0 deletions wallet/devtools_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
extensions:
4 changes: 4 additions & 0 deletions wallet/ios/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ post_install do |installer|
config.build_settings['SWIFT_VERSION'] = '5.0' # required by simple_permission
config.build_settings['ENABLE_BITCODE'] = 'NO'
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '13.0'
xcconfig_path = config.base_configuration_reference.real_path
xcconfig = File.read(xcconfig_path)
xcconfig_mod = xcconfig.gsub(/DT_TOOLCHAIN_DIR/, "TOOLCHAIN_DIR")
File.open(xcconfig_path, "w") { |file| file << xcconfig_mod }

# Here are some configurations automatically generated by flutter

Expand Down
20 changes: 19 additions & 1 deletion wallet/ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@
9705A1C41CF9048500538489 /* Embed Frameworks */,
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
CF928C1E0DCFC5A4D6CA1CDA /* [CP] Embed Pods Frameworks */,
A9B35EDB27B07E6A1784FF19 /* [CP] Copy Pods Resources */,
);
buildRules = (
);
Expand All @@ -188,7 +189,7 @@
97C146E61CF9000F007C117D /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 1300;
LastUpgradeCheck = 1430;
ORGANIZATIONNAME = "";
TargetAttributes = {
97C146ED1CF9000F007C117D = {
Expand Down Expand Up @@ -301,6 +302,23 @@
shellPath = /bin/sh;
shellScript = "\necho \"${CONFIGURATION}\"\necho \"${GOOGLE_SERVICE_PATH}\"\n\ncp -r \"${GOOGLE_SERVICE_PATH}\" \"${PROJECT_DIR}/Runner/GoogleService-Info.plist\"\n\necho \"Plist copied\"\n\n\nPLIST_DESTINATION=${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.app\necho \"Will copy ${GOOGLE_SERVICE_PATH} to final destination: ${PLIST_DESTINATION}\"\n\n\necho \"Using ${GOOGLE_SERVICE_PATH}\"\ncp \"${GOOGLE_SERVICE_PATH}\" \"${PLIST_DESTINATION}\"\n";
};
A9B35EDB27B07E6A1784FF19 /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-input-files.xcfilelist",
);
name = "[CP] Copy Pods Resources";
outputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-output-files.xcfilelist",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources.sh\"\n";
showEnvVarsInLog = 0;
};
CF928C1E0DCFC5A4D6CA1CDA /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
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 = "1300"
LastUpgradeVersion = "1430"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
60 changes: 19 additions & 41 deletions wallet/lib/components/user_image_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,14 @@ abstract class UserImageWidget extends StatelessWidget {
return defaultVal;
}

file = File.fromUri(Uri.parse(imageEither.getOrElse(() =>
''))); // todo? - does this work when the URI points to a network file?
file = File.fromUri(
Uri.parse(imageEither.getOrElse(() => ''))); // todo? - does this work when the URI points to a network file?

return FileImage(file);
}

@visibleForTesting
static void setToFile(
int filesizeLimit, String uriKey, File? file, BuildContext context) {
static void setToFile(int filesizeLimit, String uriKey, File? file, BuildContext context) {
final userBanner = GetIt.I.get<UserBannerViewModel>();
userBanner.setToFile(filesizeLimit, uriKey, file, context);
}
Expand All @@ -53,17 +52,15 @@ abstract class UserImageWidget extends StatelessWidget {
class UserAvatarWidget extends UserImageWidget {
final double radius;
@visibleForTesting
static const filesizeLimit =
1024 * 1024 * 4; // 4MB (this should always divide cleanly)
static const filesizeLimit = 1024 * 1024 * 4; // 4MB (this should always divide cleanly)
@visibleForTesting
static const resolutionLimitX = 2048;
@visibleForTesting
static const resolutionLimitY = 2048;
@visibleForTesting
static const uriKey = "pylons_avatar_file_uri";
@visibleForTesting
static svg.Svg defaultImage =
svg.Svg(Assets.images.svg.userAvatar); // todo: sensible default avatar
static svg.Svg defaultImage = svg.Svg(Assets.images.svg.userAvatar); // todo: sensible default avatar

const UserAvatarWidget({this.radius = 20});

Expand Down Expand Up @@ -95,35 +92,26 @@ class UserAvatarPickerWidget extends UserAvatarWidget {

@override
Widget build(BuildContext context) {
return StatefulBuilder(builder:
(BuildContext context, void Function(void Function()) setState) {
return StatefulBuilder(builder: (BuildContext context, void Function(void Function()) setState) {
return GestureDetector(
onTap: () async {
final userInfoProvider = context.read<UserInfoProvider>();
final file = await pickImageFromGallery(
UserAvatarWidget.resolutionLimitX.toDouble(),
UserAvatarWidget.resolutionLimitY.toDouble(),
kImageQuality,
context);
final file = await pickImageFromGallery(UserAvatarWidget.resolutionLimitX.toDouble(),
UserAvatarWidget.resolutionLimitY.toDouble(), kImageQuality, context);

if (file == null) {
return;
}

final newImagePathEither = await GetIt.I
.get<Repository>()
.saveImageInLocalDirectory(file.path);
final newImagePathEither = await GetIt.I.get<Repository>().saveImageInLocalDirectory(file.path);

if (newImagePathEither.isLeft()) {
return;
}

// ignore: use_build_context_synchronously
UserImageWidget.setToFile(
UserAvatarWidget.filesizeLimit,
UserAvatarWidget.uriKey,
File(newImagePathEither.getOrElse(() => '')),
context);
UserImageWidget.setToFile(UserAvatarWidget.filesizeLimit, UserAvatarWidget.uriKey,
File(newImagePathEither.getOrElse(() => '')), context);

userInfoProvider.onImageChange();

Expand All @@ -143,8 +131,7 @@ class UserAvatarPickerWidget extends UserAvatarWidget {
class UserBannerWidget extends UserImageWidget {
final double height;
@visibleForTesting
static const filesizeLimit =
1024 * 1024 * 4; // 4MB (this should always divide cleanly)
static const filesizeLimit = 1024 * 1024 * 4; // 4MB (this should always divide cleanly)
@visibleForTesting
static const resolutionLimitX = 2048;
@visibleForTesting
Expand All @@ -162,8 +149,7 @@ class UserBannerWidget extends UserImageWidget {
return ChangeNotifierProvider.value(
value: userBannerViewModel,
builder: (context, child) {
return Consumer<UserBannerViewModel>(
builder: (context, viewModel, child) {
return Consumer<UserBannerViewModel>(builder: (context, viewModel, child) {
return Container(
height: height,
decoration: BoxDecoration(
Expand Down Expand Up @@ -214,33 +200,25 @@ class UserBannerPickerWidget extends UserBannerWidget {
@override
Widget build(BuildContext context) {
final viewModel = context.watch<HomeProvider>();
return StatefulBuilder(builder:
(BuildContext context, void Function(void Function()) setState) {
return StatefulBuilder(builder: (BuildContext context, void Function(void Function()) setState) {
return InkResponse(
onTap: () async {
final file = await pickImageFromGallery(
UserBannerWidget.resolutionLimitX.toDouble(),
UserBannerWidget.resolutionLimitY.toDouble(),
kImageQuality,
context);
final file = await pickImageFromGallery(UserBannerWidget.resolutionLimitX.toDouble(),
UserBannerWidget.resolutionLimitY.toDouble(), kImageQuality, context);

if (file == null) {
return;
}

final newImagePathEither =
await repository.saveImageInLocalDirectory(file.path);
final newImagePathEither = await repository.saveImageInLocalDirectory(file.path);

if (newImagePathEither.isLeft()) {
return;
}

// ignore: use_build_context_synchronously
UserImageWidget.setToFile(
UserBannerWidget.filesizeLimit,
UserBannerWidget.uriKey,
File(newImagePathEither.getOrElse(() => '')),
context);
UserImageWidget.setToFile(UserBannerWidget.filesizeLimit, UserBannerWidget.uriKey,
File(newImagePathEither.getOrElse(() => '')), context);

final int brightness = getBrightness(file);
final bool isBannerDark = getIsBannerDark(brightness);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@ import 'package:pylons_wallet/utils/extension.dart';

import '../../generated/locale_keys.g.dart';

TextStyle _titleTextStyle = TextStyle(color: AppColors.kBlack, fontFamily: kUniversalFontFamily, fontWeight: FontWeight.bold, fontSize: 20.sp);
TextStyle _titleTextStyle =
TextStyle(color: AppColors.kBlack, fontFamily: kUniversalFontFamily, fontWeight: FontWeight.bold, fontSize: 20.sp);

class LocalTransactionDetailScreen extends StatefulWidget {
const LocalTransactionDetailScreen({super.key});
const LocalTransactionDetailScreen({super.key, required this.localTransactionModel});

final LocalTransactionModel localTransactionModel;
@override
State<LocalTransactionDetailScreen> createState() => _LocalTransactionDetailScreenState();
}
Expand Down Expand Up @@ -121,7 +123,9 @@ class _LocalTransactionDetailScreenState extends State<LocalTransactionDetailScr
child: AutoSizeText(
getFormattedPrice(args),
style: TextStyle(
color: getTxTypeFlag(txType: args.status.toTransactionStatusEnum()) ? AppColors.kDarkGreen : AppColors.kDarkRed,
color: getTxTypeFlag(txType: args.status.toTransactionStatusEnum())
? AppColors.kDarkGreen
: AppColors.kDarkRed,
fontFamily: kUniversalFontFamily,
fontSize: 15.sp,
fontWeight: FontWeight.bold),
Expand All @@ -138,16 +142,20 @@ class _LocalTransactionDetailScreenState extends State<LocalTransactionDetailScr
if (txArgs.status.toTransactionStatusEnum() == TransactionStatus.Success && txArgs.transactionHash.isNotEmpty) {
return {
"txId".tr(): txArgs.transactionHash,
LocaleKeys.transaction_date.tr(): DateFormat('MMM dd, yyyy').format(DateTime.fromMillisecondsSinceEpoch(txArgs.dateTime)),
LocaleKeys.transaction_time.tr(): "${DateFormat('HH:mm').format(DateTime.fromMillisecondsSinceEpoch(txArgs.dateTime).toUtc())} UTC",
LocaleKeys.transaction_date.tr():
DateFormat('MMM dd, yyyy').format(DateTime.fromMillisecondsSinceEpoch(txArgs.dateTime)),
LocaleKeys.transaction_time.tr():
"${DateFormat('HH:mm').format(DateTime.fromMillisecondsSinceEpoch(txArgs.dateTime).toUtc())} UTC",
LocaleKeys.currency.tr(): txArgs.transactionCurrency,
LocaleKeys.price.tr(): txArgs.transactionPrice,
};
}

return {
LocaleKeys.transaction_date.tr(): DateFormat('MMM dd, yyyy').format(DateTime.fromMillisecondsSinceEpoch(txArgs.dateTime)),
LocaleKeys.transaction_time.tr(): "${DateFormat('HH:mm').format(DateTime.fromMillisecondsSinceEpoch(txArgs.dateTime).toUtc())} UTC",
LocaleKeys.transaction_date.tr():
DateFormat('MMM dd, yyyy').format(DateTime.fromMillisecondsSinceEpoch(txArgs.dateTime)),
LocaleKeys.transaction_time.tr():
"${DateFormat('HH:mm').format(DateTime.fromMillisecondsSinceEpoch(txArgs.dateTime).toUtc())} UTC",
LocaleKeys.currency.tr(): txArgs.transactionCurrency,
LocaleKeys.price.tr(): txArgs.transactionPrice,
};
Expand All @@ -165,7 +173,8 @@ class _LocalTransactionDetailScreenState extends State<LocalTransactionDetailScr
children: [
Text(key, style: _titleTextStyle.copyWith(fontSize: 13.sp, fontWeight: FontWeight.w600)),
SizedBox(height: 20.h),
Text(value.trimString(stringTrimConstantMax), style: _titleTextStyle.copyWith(fontSize: 13.sp, fontWeight: FontWeight.bold, color: AppColors.kBlack)),
Text(value.trimString(stringTrimConstantMax),
style: _titleTextStyle.copyWith(fontSize: 13.sp, fontWeight: FontWeight.bold, color: AppColors.kBlack)),
],
);
}
Expand Down Expand Up @@ -236,7 +245,6 @@ class _LocalTransactionDetailScreenState extends State<LocalTransactionDetailScr

@override
Widget build(BuildContext context) {
final args = ModalRoute.of(context)!.settings.arguments! as LocalTransactionModel;
return Scaffold(
body: Stack(
children: [
Expand Down Expand Up @@ -265,12 +273,12 @@ class _LocalTransactionDetailScreenState extends State<LocalTransactionDetailScr
],
),
SizedBox(height: 20.h),
buildErrorHeader(status: args.status.toTransactionStatusEnum()),
buildNFTDetailHeader(args: args),
buildTxDetailBody(txArgs: args),
buildErrorHeader(status: widget.localTransactionModel.status.toTransactionStatusEnum()),
buildNFTDetailHeader(args: widget.localTransactionModel),
buildTxDetailBody(txArgs: widget.localTransactionModel),
],
),
buildPageFooterButtons(txModel: args),
buildPageFooterButtons(txModel: widget.localTransactionModel),
],
),
);
Expand Down
Loading

0 comments on commit ab8099b

Please sign in to comment.