Skip to content

Commit

Permalink
A lot of goodness. No more hard crashes.
Browse files Browse the repository at this point in the history
  • Loading branch information
ksred committed Aug 18, 2016
1 parent 7500780 commit 81af504
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 16 deletions.
1 change: 1 addition & 0 deletions AddContactView.js
Expand Up @@ -116,6 +116,7 @@ var AddContactView = React.createClass({

<ListView
dataSource={this.state.dataSource}
enableEmptySections={true}
renderRow={(rowData) =>
<View
style={styles.global.contactItem}>
Expand Down
23 changes: 22 additions & 1 deletion MainAccountView.js
Expand Up @@ -67,12 +67,33 @@ var MainAccountView = React.createClass({
// Update Main Account
let userUpdate = db.objects('Account');
var userAccountUpdate = userUpdate.filtered('AccountNumber == $0', userAccountDetails.AccountNumber);
console.log("User from response:");
console.log(userAccountDetails);
console.log("UserAccountNumber from response:");
console.log(userAccountDetails.AccountNumber);
console.log("User from DB:");
console.log(userAccountUpdate);
//var userAccountUpdate = userUpdate.slice(0,1).first;
if (userAccountUpdate.length == 0) {
// @FIXME There are cases where the user stored in the accounts table and the user sent to log in
// are two different users. Find the cause and fix. For now we throw an error and send the user out
alert("Account stored in database is not the same as login!");
actions.login({ type: "reset" });
// Delete all other accounts for now
let accounts = db.objects('Account');
db.delete(accounts);
let contacts = db.objects('Contacts');
db.delete(contacts);
let transactions = db.objects('Transactions');
db.delete(transactions);
let auth = db.objects('AccountAuth');
db.delete(auth);
let authToken = db.objects('AccountToken');
db.delete(authToken);
let accountMeta = db.objects('AccountMeta');
db.delete(accountMeta);
let deviceToken = db.objects('DeviceToken');
db.delete(deviceToken);
Actions.login({ type: "reset" });
return;
}

Expand Down
4 changes: 2 additions & 2 deletions TransactionView.js
Expand Up @@ -111,8 +111,8 @@ var TransactionView = React.createClass({

render: function() {

//let marker = { latitude: this.props.data.Lat, longitude: this.props.data.Lon };
let marker = { latitude: 37.7749, longitude: -122.4194 };
let marker = { latitude: this.props.data.Lat, longitude: this.props.data.Lon };
//let marker = { latitude: 37.7749, longitude: -122.4194 };
console.log(marker);

return (
Expand Down
12 changes: 6 additions & 6 deletions ios/BVNK.xcodeproj/project.pbxproj
Expand Up @@ -787,8 +787,8 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
CODE_SIGN_ENTITLEMENTS = BVNK/BVNK.entitlements;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_IDENTITY = "iPhone Developer: Kyle Redelinghuys (M484F68P27)";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer: Kyle Redelinghuys (M484F68P27)";
DEAD_CODE_STRIPPING = NO;
HEADER_SEARCH_PATHS = (
"$(inherited)",
Expand All @@ -807,7 +807,7 @@
);
PRODUCT_BUNDLE_IDENTIFIER = "co.bvnk.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = BVNK;
PROVISIONING_PROFILE = "";
PROVISIONING_PROFILE = "ea9b07e0-aca6-4e70-a7b7-fa7b292f0d6e";
TARGETED_DEVICE_FAMILY = 1;
VALIDATE_PRODUCT = NO;
};
Expand All @@ -819,8 +819,8 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
CODE_SIGN_ENTITLEMENTS = BVNK/BVNK.entitlements;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_IDENTITY = "iPhone Developer: Kyle Redelinghuys (M484F68P27)";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer: Kyle Redelinghuys (M484F68P27)";
DEAD_CODE_STRIPPING = NO;
HEADER_SEARCH_PATHS = (
"$(inherited)",
Expand All @@ -840,7 +840,7 @@
);
PRODUCT_BUNDLE_IDENTIFIER = "co.bvnk.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = BVNK;
PROVISIONING_PROFILE = "";
PROVISIONING_PROFILE = "ea9b07e0-aca6-4e70-a7b7-fa7b292f0d6e";
TARGETED_DEVICE_FAMILY = 1;
VALIDATE_PRODUCT = YES;
};
Expand Down
2 changes: 1 addition & 1 deletion ios/BVNK/Info.plist
Expand Up @@ -19,7 +19,7 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>4</string>
<string>5</string>
<key>LSApplicationCategoryType</key>
<string></string>
<key>LSRequiresIPhoneOS</key>
Expand Down
12 changes: 6 additions & 6 deletions libs/RealmDB.js
Expand Up @@ -11,9 +11,9 @@ const Realm = require('realm');
const AccountSchema = {
name: 'Account',
properties: {
AccountNumber: { type: 'string' , indexed: true },
BankNumber: 'string',
AccountHolderName: 'string',
AccountNumber: { type: 'string' , indexed: true, optional: true, default: '' },
BankNumber: { type: 'string', optional: true, default: '' },
AccountHolderName: { type: 'string', optional: true, default: '' },
AccountBalance: { type: 'float', optional: true, default: 0 }, // Decimal
Overdraft: { type: 'float', optional: true, default: 0 },
AvailableBalance: { type: 'float', optional: true, default: 0 },
Expand All @@ -23,7 +23,7 @@ const AccountSchema = {
const AccountAuthSchema = {
name: 'AccountAuth',
properties: {
AccountNumber: { type: 'string', indexed: true },
AccountNumber: { type: 'string', indexed: true, optional: true, default: '' },
Password: { type: 'string', optional: true, default: '' },
Timestamp: { type: 'int', optional: true, default: '' },
}
Expand Down Expand Up @@ -82,13 +82,13 @@ const TransactionsSchema = {
const ContactsSchema = {
name: 'Contacts',
properties: {
ContactName: { type: 'string', indexed: true },
ContactName: { type: 'string', indexed: true, optional: true, default: '' },
ContactAccountNumber: { type: 'string', optional: true, default: '' },
ContactBankNumber: { type: 'string', optional: true, default: '' },
ContactEmailAddress: { type: 'string', optional: true, default: '' },
}
};

let realm = new Realm({ schema: [ AccountSchema, AccountMetaSchema, AccountAuthSchema, AccountTokenSchema, DeviceTokenSchema, TransactionsSchema, ContactsSchema ], schemaVersion: 18 });
let realm = new Realm({ schema: [ AccountSchema, AccountMetaSchema, AccountAuthSchema, AccountTokenSchema, DeviceTokenSchema, TransactionsSchema, ContactsSchema ], schemaVersion: 20 });

module.exports = realm;

0 comments on commit 81af504

Please sign in to comment.