Skip to content

Commit

Permalink
Merge pull request #164 from cake-tech/release-4.2.4
Browse files Browse the repository at this point in the history
Release 4.2.4
  • Loading branch information
mkyq authored Jul 26, 2021
2 parents 68be906 + 41c27b2 commit a14ea3c
Show file tree
Hide file tree
Showing 81 changed files with 2,008 additions and 440 deletions.
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,8 @@ ios/Flutter/.last_build_id
/**/#**#

**/google-services.json
**/GoogleService-Info.plist
**/GoogleService-Info.plist


\#*\#
.\#*
10 changes: 6 additions & 4 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,9 @@ android {
release {
signingConfig signingConfigs.release

minifyEnabled true
useProguard true
shrinkResources false
minifyEnabled false
useProguard false

proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
Expand All @@ -85,8 +86,9 @@ flutter {

dependencies {
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
androidTestImplementation 'androidx.test:runner:1.3.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
implementation 'com.unstoppabledomains:resolution:1.13.0'
implementation 'com.google.firebase:firebase-core:19.0.0'
implementation 'com.google.firebase:firebase-messaging:19.0.0'
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,19 @@
import io.flutter.plugin.common.MethodChannel;

import android.os.AsyncTask;
import android.os.Build;
import android.os.Handler;
import android.os.Looper;

import com.unstoppabledomains.resolution.DomainResolution;
import com.unstoppabledomains.resolution.Resolution;

import java.security.SecureRandom;

public class MainActivity extends FlutterFragmentActivity {
final String UTILS_CHANNEL = "com.cake_wallet/native_utils";

final int UNSTOPPABLE_DOMAIN_MIN_VERSION_SDK = 24;

@Override
public void configureFlutterEngine(@NonNull FlutterEngine flutterEngine) {
GeneratedPluginRegistrant.registerWith(flutterEngine);
Expand All @@ -33,17 +38,44 @@ private void handle(@NonNull MethodCall call, @NonNull MethodChannel.Result resu
Handler handler = new Handler(Looper.getMainLooper());

try {
if (call.method.equals("sec_random")) {
int count = call.argument("count");
SecureRandom random = new SecureRandom();
byte bytes[] = new byte[count];
random.nextBytes(bytes);
handler.post(() -> result.success(bytes));
} else {
handler.post(() -> result.notImplemented());
switch (call.method) {
case "sec_random":
int count = call.argument("count");
SecureRandom random = new SecureRandom();
byte bytes[] = new byte[count];
random.nextBytes(bytes);
handler.post(() -> result.success(bytes));
break;
case "getUnstoppableDomainAddress":
int version = Build.VERSION.SDK_INT;
if (version >= UNSTOPPABLE_DOMAIN_MIN_VERSION_SDK) {
getUnstoppableDomainAddress(call, result);
} else {
handler.post(() -> result.success(""));
}
break;
default:
handler.post(() -> result.notImplemented());
}
} catch (Exception e) {
handler.post(() -> result.error("UNCAUGHT_ERROR", e.getMessage(), null));
}
}
}

private void getUnstoppableDomainAddress(@NonNull MethodCall call, @NonNull MethodChannel.Result result) {
DomainResolution resolution = new Resolution();
Handler handler = new Handler(Looper.getMainLooper());
String domain = call.argument("domain");
String ticker = call.argument("ticker");

AsyncTask.execute(() -> {
try {
String address = resolution.getAddress(domain, ticker);
handler.post(() -> result.success(address));
} catch (Exception e) {
System.out.println("Expected Address, but got " + e.getMessage());
handler.post(() -> result.success(""));
}
});
}
}
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ buildscript {
}

dependencies {
classpath 'com.android.tools.build:gradle:3.5.4'
classpath 'com.android.tools.build:gradle:4.1.3'
classpath 'com.google.gms:google-services:4.3.8'
}
}
Expand Down
4 changes: 2 additions & 2 deletions android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Fri Jun 23 08:50:38 CEST 2017
#Mon Apr 19 18:19:26 EEST 2021
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip
3 changes: 2 additions & 1 deletion 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'
source 'https://github.com/CocoaPods/Specs.git'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
Expand Down Expand Up @@ -36,6 +36,7 @@ target 'Runner' do

# Cake Wallet (Legacy)
pod 'CryptoSwift'
pod 'UnstoppableDomainsResolution', '~> 0.3.6'
pod 'Firebase/Messaging', '6.33.0'
end

Expand Down
16 changes: 15 additions & 1 deletion ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ PODS:
- Flutter
- MTBBarcodeScanner
- SwiftProtobuf
- BigInt (5.2.0)
- connectivity (0.0.1):
- Flutter
- Reachability
Expand Down Expand Up @@ -59,6 +60,8 @@ PODS:
- SwiftyGif
- esys_flutter_share (0.0.1):
- Flutter
- EthereumAddress (1.3.0):
- CryptoSwift (~> 1.0)
- file_picker (0.0.1):
- DKImagePickerController/PhotoGallery
- Flutter
Expand Down Expand Up @@ -150,6 +153,10 @@ PODS:
- Flutter
- SwiftProtobuf (1.12.0)
- SwiftyGif (5.3.0)
- UnstoppableDomainsResolution (0.3.6):
- BigInt
- CryptoSwift (~> 1.0)
- EthereumAddress (~> 1.3)
- url_launcher (0.0.1):
- Flutter
- webview_flutter (0.0.1):
Expand All @@ -174,14 +181,17 @@ DEPENDENCIES:
- permission_handler (from `.symlinks/plugins/permission_handler/ios`)
- share (from `.symlinks/plugins/share/ios`)
- shared_preferences (from `.symlinks/plugins/shared_preferences/ios`)
- UnstoppableDomainsResolution (~> 0.3.6)
- url_launcher (from `.symlinks/plugins/url_launcher/ios`)
- webview_flutter (from `.symlinks/plugins/webview_flutter/ios`)

SPEC REPOS:
https://github.com/CocoaPods/Specs.git:
- BigInt
- CryptoSwift
- DKImagePickerController
- DKPhotoGallery
- EthereumAddress
- Firebase
- FirebaseCore
- FirebaseCoreDiagnostics
Expand All @@ -198,6 +208,7 @@ SPEC REPOS:
- SDWebImage
- SwiftProtobuf
- SwiftyGif
- UnstoppableDomainsResolution

EXTERNAL SOURCES:
barcode_scan:
Expand Down Expand Up @@ -239,13 +250,15 @@ EXTERNAL SOURCES:

SPEC CHECKSUMS:
barcode_scan: a5c27959edfafaa0c771905bad0b29d6d39e4479
BigInt: f668a80089607f521586bbe29513d708491ef2f7
connectivity: c4130b2985d4ef6fd26f9702e886bd5260681467
CryptoSwift: 093499be1a94b0cae36e6c26b70870668cb56060
cw_monero: 78f369253cc913efc23db9cf6be81a11eaf40fe1
devicelocale: b22617f40038496deffba44747101255cee005b0
DKImagePickerController: b5eb7f7a388e4643264105d648d01f727110fc3d
DKPhotoGallery: fdfad5125a9fdda9cc57df834d49df790dbb4179
esys_flutter_share: 403498dab005b36ce1f8d7aff377e81f0621b0b4
EthereumAddress: 39fe8e11cf04e4e9902b55ae653dbc4e0aee5f30
file_picker: 3e6c3790de664ccf9b882732d9db5eaf6b8d4eb1
Firebase: 8db6f2d1b2c5e2984efba4949a145875a8f65fe5
firebase_core: 5d6a02f3d85acd5f8321c2d6d62877626a670659
Expand Down Expand Up @@ -273,9 +286,10 @@ SPEC CHECKSUMS:
shared_preferences: af6bfa751691cdc24be3045c43ec037377ada40d
SwiftProtobuf: 4ef85479c18ca85b5482b343df9c319c62bda699
SwiftyGif: e466e86c660d343357ab944a819a101c4127cb40
UnstoppableDomainsResolution: 63abb84858d3e91eb838a5bfa6f7e3c0e0593f24
url_launcher: 6fef411d543ceb26efce54b05a0a40bfd74cbbef
webview_flutter: 9f491a9b5a66f2573946a389b2677987b0ff8c0b

PODFILE CHECKSUM: f316539722a6f9dbb0d0f1065a27fa7ea38c6f88
PODFILE CHECKSUM: 82161cafcb98ddf3e6a0ff8149da3f656be3f1e3

COCOAPODS: 1.9.3
12 changes: 6 additions & 6 deletions ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = 49;
CURRENT_PROJECT_VERSION = 53;
DEVELOPMENT_TEAM = 32J6BB6VUS;
ENABLE_BITCODE = NO;
EXCLUDED_SOURCE_FILE_NAMES = "";
Expand All @@ -384,7 +384,7 @@
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
MARKETING_VERSION = 4.2.3;
MARKETING_VERSION = 4.2.4;
PRODUCT_BUNDLE_IDENTIFIER = com.fotolockr.cakewallet;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
Expand Down Expand Up @@ -510,7 +510,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = 49;
CURRENT_PROJECT_VERSION = 53;
DEVELOPMENT_TEAM = 32J6BB6VUS;
ENABLE_BITCODE = NO;
EXCLUDED_SOURCE_FILE_NAMES = "";
Expand All @@ -528,7 +528,7 @@
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
MARKETING_VERSION = 4.2.3;
MARKETING_VERSION = 4.2.4;
PRODUCT_BUNDLE_IDENTIFIER = com.fotolockr.cakewallet;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
Expand All @@ -546,7 +546,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = 49;
CURRENT_PROJECT_VERSION = 53;
DEVELOPMENT_TEAM = 32J6BB6VUS;
ENABLE_BITCODE = NO;
EXCLUDED_SOURCE_FILE_NAMES = "";
Expand All @@ -564,7 +564,7 @@
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
MARKETING_VERSION = 4.2.3;
MARKETING_VERSION = 4.2.4;
PRODUCT_BUNDLE_IDENTIFIER = com.fotolockr.cakewallet;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
Expand Down
28 changes: 27 additions & 1 deletion ios/Runner/AppDelegate.swift
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
import UIKit
import Flutter
import UnstoppableDomainsResolution

@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
lazy var resolution : Resolution? = {
return try? Resolution()
}()

override func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
Expand Down Expand Up @@ -60,7 +65,7 @@ import Flutter
let utilsChannel = FlutterMethodChannel(
name: "com.cake_wallet/native_utils",
binaryMessenger: controller.binaryMessenger)
utilsChannel.setMethodCallHandler({ (call: FlutterMethodCall, result: @escaping FlutterResult) -> Void in
utilsChannel.setMethodCallHandler({ [weak self] (call: FlutterMethodCall, result: @escaping FlutterResult) -> Void in
switch call.method {
case "sec_random":
guard let args = call.arguments as? Dictionary<String, Any>,
Expand All @@ -70,6 +75,27 @@ import Flutter
}

result(secRandom(count: count))
case "getUnstoppableDomainAddress":
guard let args = call.arguments as? Dictionary<String, String>,
let domain = args["domain"],
let ticker = args["ticker"],
let resolution = self?.resolution else {
result(nil)
return
}

resolution.addr(domain: domain, ticker: ticker) { addrResult in
var address : String = ""

switch addrResult {
case .success(let returnValue):
address = returnValue
case .failure(let error):
print("Expected Address, but got \(error)")
}

result(address)
}
default:
result(FlutterMethodNotImplemented)
}
Expand Down
4 changes: 4 additions & 0 deletions lib/bitcoin/bitcoin_commit_transaction_exception.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
class BitcoinCommitTransactionException implements Exception {
@override
String toString() => 'Transaction commit is failed.';
}
4 changes: 2 additions & 2 deletions lib/bitcoin/bitcoin_transaction_no_inputs_exception.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class BitcoinTransactionNoInputsException implements Exception {
@override
String toString() => 'No inputs for the transaction.';
}
String toString() => 'Not enough inputs available';
}
8 changes: 7 additions & 1 deletion lib/bitcoin/bitcoin_transaction_wrong_balance_exception.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
import 'package:cake_wallet/entities/crypto_currency.dart';

class BitcoinTransactionWrongBalanceException implements Exception {
BitcoinTransactionWrongBalanceException(this.currency);

final CryptoCurrency currency;

@override
String toString() => 'Wrong balance. Not enough BTC on your balance.';
String toString() => 'Wrong balance. Not enough ${currency.title} on your balance.';
}
8 changes: 7 additions & 1 deletion lib/bitcoin/bitcoin_unspent.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import 'package:cake_wallet/bitcoin/bitcoin_address_record.dart';

class BitcoinUnspent {
BitcoinUnspent(this.address, this.hash, this.value, this.vout);
BitcoinUnspent(this.address, this.hash, this.value, this.vout)
: isSending = true,
isFrozen = false,
note = '';

factory BitcoinUnspent.fromJSON(
BitcoinAddressRecord address, Map<String, dynamic> json) =>
Expand All @@ -15,4 +18,7 @@ class BitcoinUnspent {

bool get isP2wpkh =>
address.address.startsWith('bc') || address.address.startsWith('ltc');
bool isSending;
bool isFrozen;
String note;
}
Loading

0 comments on commit a14ea3c

Please sign in to comment.