Skip to content

Commit

Permalink
release
Browse files Browse the repository at this point in the history
  • Loading branch information
DenisDemyanko committed Oct 22, 2020
1 parent bc69dd5 commit 67d7ec8
Show file tree
Hide file tree
Showing 20 changed files with 310 additions and 145 deletions.
16 changes: 8 additions & 8 deletions BeamWallet.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -4418,7 +4418,7 @@
CLANG_WARN_ENUM_CONVERSION = NO;
CODE_SIGN_ENTITLEMENTS = Resources/BeamWallet.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 9;
CURRENT_PROJECT_VERSION = 5;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEVELOPMENT_TEAM = KNU2R94BJK;
ENABLE_BITCODE = NO;
Expand Down Expand Up @@ -4452,7 +4452,7 @@
"$(PROJECT_DIR)",
"$(PROJECT_DIR)/Frameworks/boost",
);
MARKETING_VERSION = 5.0;
MARKETING_VERSION = 5.1;
OTHER_LDFLAGS = (
"$(inherited)",
"-ObjC",
Expand Down Expand Up @@ -4493,7 +4493,7 @@
CLANG_WARN_ENUM_CONVERSION = NO;
CODE_SIGN_ENTITLEMENTS = Resources/BeamWallet.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 9;
CURRENT_PROJECT_VERSION = 5;
DEVELOPMENT_TEAM = KNU2R94BJK;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
Expand Down Expand Up @@ -4526,7 +4526,7 @@
"$(PROJECT_DIR)",
"$(PROJECT_DIR)/Frameworks/boost",
);
MARKETING_VERSION = 5.0;
MARKETING_VERSION = 5.1;
OTHER_LDFLAGS = (
"$(inherited)",
"-ObjC",
Expand Down Expand Up @@ -4568,7 +4568,7 @@
CODE_SIGN_ENTITLEMENTS = Resources/BeamWalletTestNet.entitlements;
CODE_SIGN_IDENTITY = "iPhone Developer";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
CURRENT_PROJECT_VERSION = 10;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEVELOPMENT_TEAM = KNU2R94BJK;
ENABLE_BITCODE = NO;
Expand Down Expand Up @@ -4646,7 +4646,7 @@
CODE_SIGN_ENTITLEMENTS = Resources/BeamWalletTestNet.entitlements;
CODE_SIGN_IDENTITY = "iPhone Developer";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
CURRENT_PROJECT_VERSION = 10;
DEVELOPMENT_TEAM = KNU2R94BJK;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
Expand Down Expand Up @@ -4731,7 +4731,7 @@
CODE_SIGN_ENTITLEMENTS = Resources/BeamWalletMasterNet.entitlements;
CODE_SIGN_IDENTITY = "iPhone Developer";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 43;
CURRENT_PROJECT_VERSION = 55;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEVELOPMENT_TEAM = KNU2R94BJK;
ENABLE_BITCODE = NO;
Expand Down Expand Up @@ -4808,7 +4808,7 @@
CODE_SIGN_ENTITLEMENTS = Resources/BeamWalletMasterNet.entitlements;
CODE_SIGN_IDENTITY = "iPhone Developer";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 43;
CURRENT_PROJECT_VERSION = 55;
DEVELOPMENT_TEAM = KNU2R94BJK;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
Expand Down
60 changes: 21 additions & 39 deletions BeamWallet/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -86,27 +86,27 @@ class AppDelegate: UIResponder, UIApplicationDelegate {


if let crash = UserDefaults.standard.string(forKey: "crash"), let crash_name = UserDefaults.standard.string(forKey: "crash_name") {

self.window?.rootViewController?.confirmAlert(title: Localizable.shared.strings.crash_title, message: Localizable.shared.strings.crash_message, cancelTitle: Localizable.shared.strings.crash_positive, confirmTitle: Localizable.shared.strings.crash_negative, cancelHandler: { _ in

var name = "";

if Settings.sharedManager().target == Mainnet {
name = "GoogleServiceMain"
}
else if Settings.sharedManager().target == Testnet {
name = "GoogleServiceTest"
}
else if Settings.sharedManager().target == Masternet {
name = "GoogleServiceMaster"

var name = "";

if Settings.sharedManager().target == Mainnet {
name = "GoogleServiceMain"
}
else if Settings.sharedManager().target == Testnet {
name = "GoogleServiceTest"
}
else if Settings.sharedManager().target == Masternet {
name = "GoogleServiceMaster"
}

if let filePath = Bundle.main.path(forResource: name, ofType: "plist") {
if let options = FirebaseOptions(contentsOfFile: filePath) {
FirebaseApp.configure(options: options)
}
//
// if let filePath = Bundle.main.path(forResource: name, ofType: "plist") {
// if let options = FirebaseOptions(contentsOfFile: filePath) {
// FirebaseApp.configure(options: options)
// }
// }

}

self.window?.rootViewController?.confirmAlert(title: Localizable.shared.strings.crash_title, message: Localizable.shared.strings.crash_message, cancelTitle: Localizable.shared.strings.crash_positive, confirmTitle: Localizable.shared.strings.crash_negative, cancelHandler: { _ in

let ex = ExceptionModel.init(name:crash_name, reason:crash)
ex.stackTrace = []

Expand All @@ -124,25 +124,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
if #available(iOS 13.0, *) {
window?.overrideUserInterfaceStyle = Settings.sharedManager().isDarkMode ? .dark : .light
}

var name = "";

if Settings.sharedManager().target == Mainnet {
name = "GoogleServiceMain"
}
else if Settings.sharedManager().target == Testnet {
name = "GoogleServiceTest"
}
else if Settings.sharedManager().target == Masternet {
name = "GoogleServiceMaster"
}


if let filePath = Bundle.main.path(forResource: name, ofType: "plist") {
if let options = FirebaseOptions(contentsOfFile: filePath) {
FirebaseApp.configure(options: options)
}
}


return true
}
Expand Down
5 changes: 3 additions & 2 deletions BeamWallet/BeamSDK/AppModel.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ typedef int BMRestoreType;

typedef void(^NewAddressGeneratedBlock)(BMAddress* _Nullable address, NSError* _Nullable error);
typedef void(^ExportOwnerKey)(NSString * _Nonnull key);
typedef void(^FeecalculatedBlock)(uint64_t fee);
typedef void(^FeecalculatedBlock)(uint64_t fee, double change, uint64_t shieldedInputsFee);

@interface AppModel : NSObject

Expand Down Expand Up @@ -188,7 +188,7 @@ typedef void(^FeecalculatedBlock)(uint64_t fee);
-(void)prepareDeleteAddress:(BMAddress*_Nonnull)address removeTransactions:(BOOL)removeTransactions;
-(void)cancelDeleteAddress:(NSString*_Nonnull)address;
-(void)deletePreparedAddresses:(NSString*_Nonnull)address;
-(void)addContact:(NSString*_Nonnull)addressId name:(NSString*_Nonnull)name categories:(NSArray*_Nonnull)categories;
-(void)addContact:(NSString*_Nonnull)addressId name:(NSString*_Nonnull)name categories:(NSArray*_Nonnull)categories identidy:(NSString*_Nullable)identidy;
-(BMAddress*_Nullable)findAddressByID:(NSString*_Nonnull)ID;
-(BMAddress*_Nullable)findAddressByName:(NSString*_Nonnull)name;

Expand All @@ -207,6 +207,7 @@ typedef void(^FeecalculatedBlock)(uint64_t fee);
-(double)remaining:(double)amount fee:(double)fee;
-(BMTransactionParameters*_Nonnull)getTransactionParameters:(NSString*_Nonnull)token;
-(void)calculateFee:(double)amount fee:(double)fee isShielded:(BOOL) isShielded result:(FeecalculatedBlock _Nonnull )block;
-(void)calculateFee2:(double)amount fee:(double)fee isShielded:(BOOL) isShielded result:(FeecalculatedBlock _Nonnull )block;

// logs
-(NSString*_Nonnull)getZipLogs ;
Expand Down
51 changes: 44 additions & 7 deletions BeamWallet/BeamSDK/AppModel.mm
Original file line number Diff line number Diff line change
Expand Up @@ -296,10 +296,8 @@ -(void)changeNotifications {
-(void)setWalletStatus:(BMWalletStatus *)walletStatus {
_walletStatus = walletStatus;

dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
[[NSUserDefaults standardUserDefaults] setObject:[NSKeyedArchiver archivedDataWithRootObject:self->_walletStatus] forKey:walletStatusKey];
[[NSUserDefaults standardUserDefaults] synchronize];
});
[[NSUserDefaults standardUserDefaults] setObject:[NSKeyedArchiver archivedDataWithRootObject:self->_walletStatus] forKey:walletStatusKey];
[[NSUserDefaults standardUserDefaults] synchronize];
}

#pragma mark - Exchange
Expand Down Expand Up @@ -868,6 +866,12 @@ -(void)changeNodeAddress {
}

-(BOOL)isMyAddress:(NSString*_Nullable)address {
if ([self isToken:address])
{
BMTransactionParameters *params = [self getTransactionParameters:address];
address = params.address;
}

for (BMAddress *add in _walletAddresses) {
if ([add.walletId isEqualToString:address]) {
return YES;
Expand Down Expand Up @@ -1127,6 +1131,10 @@ -(BOOL)isValidAddress:(NSString*_Nullable)address {
return NO;
}

if (address.length < 15) {
return NO;
}

return [self isAddress:address] || [self isToken:address];
}

Expand Down Expand Up @@ -1232,7 +1240,8 @@ -(void)setContactComment:(NSString*)comment toAddress:(NSString*_Nonnull)address
_address.m_category = addresses[i].m_category;
_address.m_walletID = walletID;
_address.m_createTime = NSDate.date.timeIntervalSince1970;

_address.m_Identity = addresses[i].m_Identity;

try{
wallet->getAsync()->saveAddress(_address, false);
}
Expand Down Expand Up @@ -1571,11 +1580,16 @@ -(void)editCategoryAddress:(BMAddress*_Nonnull)address {
WalletID walletID(Zero);
if (walletID.FromHex(address.walletId.string))
{
bool isValid = false;
auto buf = from_hex(contact.address.identity.string, &isValid);
PeerID m_Identity = Blob(buf);

WalletAddress _address;
_address.m_label = address.label.string;
_address.m_category = [address.categories componentsJoinedByString:@","].string;
_address.m_walletID = walletID;
_address.m_createTime = NSDate.date.timeIntervalSince1970;
_address.m_Identity = m_Identity;
walletDb->saveAddress(_address);
}
}
Expand Down Expand Up @@ -1604,10 +1618,15 @@ -(void)editAddress:(BMAddress*_Nonnull)address {
WalletID walletID(Zero);
if (walletID.FromHex(address.walletId.string))
{
bool isValid = false;
auto buf = from_hex(contact.address.identity.string, &isValid);
PeerID m_Identity = Blob(buf);

WalletAddress _address;
_address.m_label = address.label.string;
_address.m_category = [address.categories componentsJoinedByString:@","].string;
_address.m_walletID = walletID;
_address.m_Identity = m_Identity;
_address.m_createTime = NSDate.date.timeIntervalSince1970;
walletDb->saveAddress(_address);
}
Expand Down Expand Up @@ -1657,6 +1676,8 @@ -(void)editAddress:(BMAddress*_Nonnull)address {
}
}

// NSString *s = [NSString stringWithUTF8String:to_string(addresses[i].m_Identity).c_str()];

wallet->getAsync()->saveAddress(addresses[i], true);

break;
Expand Down Expand Up @@ -1685,15 +1706,21 @@ -(NSString*_Nonnull)generateQRCodeString:(NSString*_Nonnull)address amount:(NSSt
return qrString;
}

-(void)addContact:(NSString*_Nonnull)addressId name:(NSString*_Nonnull)name categories:(NSArray*_Nonnull)categories {
-(void)addContact:(NSString*_Nonnull)addressId name:(NSString*_Nonnull)name categories:(NSArray*_Nonnull)categories identidy:(NSString*_Nullable)identidy {

WalletID walletID(Zero);
if (walletID.FromHex(addressId.string))
{
{
WalletAddress address;
address.m_label = name.string;
address.m_category = [categories componentsJoinedByString:@","].string;
address.m_walletID = walletID;
if (identidy!=nil) {
bool isValid = false;
auto buf = from_hex(identidy.string, &isValid);
PeerID m_Identity = Blob(buf);
address.m_Identity = m_Identity;
}
address.m_createTime = NSDate.date.timeIntervalSince1970;
walletDb->saveAddress(address);
}
Expand Down Expand Up @@ -1864,6 +1891,16 @@ -(void)calculateFee:(double)amount fee:(double)fee isShielded:(BOOL) isShielded
wallet->getAsync()->calcShieldedCoinSelectionInfo(bAmount, bFee, isShielded);
}

-(void)calculateFee2:(double)amount fee:(double)fee isShielded:(BOOL) isShielded result:(FeecalculatedBlock _Nonnull )block {

self.feecalculatedBlock = block;

Amount bAmount = round(amount * Rules::Coin);
Amount bFee = fee;

wallet->getAsync()->calcShieldedCoinSelectionInfo(bAmount, bFee, isShielded);
}

-(NSString*)sendError:(double)amount fee:(double)fee checkMinAmount:(BOOL)check {

Amount bAmount = round(amount * Rules::Coin);
Expand Down
11 changes: 9 additions & 2 deletions BeamWallet/BeamSDK/Objects/BMTransaction.m
Original file line number Diff line number Diff line change
Expand Up @@ -601,7 +601,12 @@ -(NSString*)textDetails {
}
else if(_isIncome)
{
sender = [NSString stringWithFormat:@"%@\n%@",[[@"contact" localized]uppercaseString], _senderAddress];
if (self.enumType == BMTransactionTypePushTransaction) {
sender = [NSString stringWithFormat:@"%@\n%@",[[@"contact" localized]uppercaseString], [@"shielded_pool" localized]];
}
else {
sender = [NSString stringWithFormat:@"%@\n%@",[[@"contact" localized]uppercaseString], _senderAddress];
}
receiver = [NSString stringWithFormat:@"%@\n%@",[[@"my_address" localized]uppercaseString], _receiverAddress];
}
else{
Expand All @@ -618,7 +623,9 @@ -(NSString*)textDetails {
[details addObject:amount];
[details addObject:sender];
[details addObject:receiver];
[details addObject:fee];
if (_realFee > 0) {
[details addObject:fee];
}
[details addObject:trid];

if(_identity.length > 0){
Expand Down
11 changes: 10 additions & 1 deletion BeamWallet/BeamSDK/WalletModel.mm
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,7 @@
address.label = [NSString stringWithUTF8String:walletAddr.m_label.c_str()];
address.walletId = [NSString stringWithUTF8String:to_string(walletAddr.m_walletID).c_str()];
address.categories = (categories.length == 0 ? [NSMutableArray new] : [NSMutableArray arrayWithArray:[categories componentsSeparatedByString:@","]]);
address.identity = [NSString stringWithUTF8String:to_string(walletAddr.m_Identity).c_str()];

BMContact *contact = [[BMContact alloc] init];
contact.address = address;
Expand Down Expand Up @@ -1102,7 +1103,15 @@
void WalletModel::onShieldedCoinsSelectionCalculated(const ShieldedCoinsSelectionInfo& selectionRes)
{
auto result = selectionRes.minimalFee;
[AppModel sharedManager].feecalculatedBlock(result);
auto change = selectionRes.change;
auto shieldedInputsFee = selectionRes.shieldedInputsFee;

// if (change > 0) {
// change = change + selectionRes.selectedFee; //+ selectionRes.requestedFee;
// }
double amount = double(int64_t(change)) / Rules::Coin;

[AppModel sharedManager].feecalculatedBlock(result, amount, shieldedInputsFee);

NSLog(@"onShieldedCoinsSelectionCalculated");
}
Expand Down
Loading

0 comments on commit 67d7ec8

Please sign in to comment.