Skip to content

Commit

Permalink
Merge pull request #32 from mymonero/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
devinpearson authored Apr 16, 2021
2 parents d1d8dd3 + d2b3b9c commit 0a7eb86
Show file tree
Hide file tree
Showing 12 changed files with 1,577 additions and 3,645 deletions.
6 changes: 3 additions & 3 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ android {
applicationId "com.mymonero.official_android_application"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 3
versionName "1.1.19"
versionCode 4
versionName "1.1.20"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
Expand Down Expand Up @@ -43,4 +43,4 @@ try {
}
} catch(Exception e) {
logger.warn("google-services.json not found, google-services plugin not applied. Push Notifications won't work")
}
}
8 changes: 6 additions & 2 deletions capacitor.config.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
{
"appId": "com.mymonero.android",
"appName": "MyMonero for Android",
"appId": "com.mymonero.official_android_application",
"appName": "MyMonero",
"bundledWebRuntime": false,
"npmClient": "npm",
"webDir": "browser_build",
"plugins": {
"SplashScreen": {
"launchShowDuration": 0
}
},
"server": {
"hostname": "com.mymonero.android",
"androidScheme": "https"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -409,8 +409,6 @@ class DocumentPersister extends DocumentPersister_Interface
// Promise to update collectionName index file

indexArray.push(id);
console.log("We would update our index with this obj");
console.log(indexArray);
let indexPromise = SecureStoragePlugin.set({ key: collectionName, value: JSON.stringify(indexArray) }).then(() => {
console.log("Saved successfully");
})
Expand Down Expand Up @@ -664,7 +662,7 @@ class DocumentPersister extends DocumentPersister_Interface
console.log("SecureStorage: invoked __updateDocumentWithId");
console.log(collectionName)
console.log(id)
console.log(updateString)
//console.log(updateString)

let keys = SecureStoragePlugin.keys().then(keys => {
let objectKey = collectionName + id;
Expand All @@ -676,7 +674,6 @@ class DocumentPersister extends DocumentPersister_Interface
5. save the new stringified object
*/
SecureStoragePlugin.get({ key: objectKey }).then(jsonString => {
console.log(jsonString);
// 1. complete
let obj = JSON.parse(jsonString.value);
// 2. complete
Expand Down Expand Up @@ -767,7 +764,7 @@ class DocumentPersister extends DocumentPersister_Interface
})
} else {
SecureStoragePlugin.remove({ key: collectionName }).then(() => {
//console.log(`Removed collection ${collectionName}`);
console.log(`Removed collection ${collectionName}`);
});
}
} else {
Expand Down Expand Up @@ -874,6 +871,11 @@ class DocumentPersister extends DocumentPersister_Interface
// fn(null, numRemoved)
// })
}
__deleteIndex(collectionName, fn) {
SecureStoragePlugin.remove({ key: collectionName }).then(() => {
console.log(`Removed collection ${collectionName}`);
});
}
// This only removes a specific collection's objects
__removeAllCollectionDocuments(collectionName, fn)
{
Expand Down
155 changes: 71 additions & 84 deletions local_modules/Exchange/Views/ExchangeContentView.web.js

Large diffs are not rendered by default.

17 changes: 3 additions & 14 deletions local_modules/MainWindow/Views/index.browser.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
object-src 'none';
font-src 'self' https://js.intercomcdn.com/fonts/;
img-src 'self' data: https://downloads.intercomcdn.com/i/o/ https://js.intercomcdn.com/images/ https://static.intercomassets.com/ https://www.google-analytics.com/r/collect https://www.google-analytics.com/collect https://stats.g.doubleclick.net/r/collect;
connect-src 'self' https://thingproxy.freeboard.io https://api.mymonero.com:8443 https://api-iam.intercom.io https://cloudflare-dns.com data: blob:;">
connect-src 'self' https://a.y.at https://api-dev.yat.rocks https://thingproxy.freeboard.io https://api.mymonero.com:8443 https://api-iam.intercom.io https://cloudflare-dns.com data: blob:;">
<!-- script-src of unsafe-eval required to load wasm files at present but actual eval is disabled in renderer_setup_utils -->
<meta name="apple-itunes-app" content="app-id=1372508199">

Expand Down Expand Up @@ -102,22 +102,11 @@
to { transform: rotate(359deg); }
}
</style>
<!-- <script>
(function(){var w=window;var ic=w.Intercom;if(typeof ic==="function"){ic('reattach_activator');ic('update',intercomSettings);}else{var d=document;var i=function(){i.c(arguments)};i.q=[];i.c=function(args){i.q.push(args)};w.Intercom=i;function l(){var s=d.createElement('script');s.type='text/javascript';s.async=true;s.src='https://widget.intercom.io/widget/' + w.INTERCOM__APP_ID;var x=d.getElementsByTagName('script')[0];x.parentNode.insertBefore(s,x);}if(w.attachEvent){w.attachEvent('onload',l);}else{w.addEventListener('load',l,false);}}})()
</script>
--> </head>

</head>
<body>
<div class="sp sp-circle" id="loading-spinner"></div>

<script type="text/javascript" src="mymonero-app-bundle.js?15"></script>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');

ga('create', 'UA-53312765-3', 'auto');
ga('send', 'pageview');
</script>
</body>
</html>
2 changes: 1 addition & 1 deletion local_modules/MainWindow/Views/index.browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ window.BootApp = function()
{ // implementing some methods to provide same API as electron
getVersion: function()
{
return "1.1.19" // TODO: read from config.. don't want to ship package.json with app though
return "1.1.20" // TODO: read from config.. don't want to ship package.json with app though
},
getName: function()
{
Expand Down
180 changes: 126 additions & 54 deletions local_modules/SendFundsTab/Views/SendFundsView_Base.web.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ import Currencies from '../../CcyConversionRates/Currencies';
import { Plugins } from '@capacitor/core';
const { CapacitorQRScanner } = Plugins;

import YatMoneroLookup from "@mymonero/mymonero-yat-lookup/index.esm"

let yatMoneroLookup = YatMoneroLookup.YatMoneroLookup();

import { BigInteger as JSBigInt } from '../../mymonero_libapp_js/mymonero-core-js/cryptonote_utils/biginteger'; // important: grab defined export

Expand Down Expand Up @@ -1630,6 +1633,11 @@ class SendFundsView extends View
//
function __proceedTo_generateSendTransaction()
{
let contact_payment_id = hasPickedAContact ? self.pickedContact.payment_id : undefined;
let cached_OAResolved_address = hasPickedAContact ? self.pickedContact.cached_OAResolved_XMR_address : undefined;
let contact_hasOpenAliasAddress = hasPickedAContact ? self.pickedContact.HasOpenAliasAddress() : undefined;
let contact_address = hasPickedAContact ? self.pickedContact.address : undefined;
console.log(self.isYatHandle);
wallet.SendFunds(
enteredAddressValue, // currency-ready wallet address, but not an OpenAlias address (resolve before calling)
resolvedAddress,
Expand All @@ -1639,67 +1647,77 @@ class SendFundsView extends View
resolvedAddress_fieldIsVisible,
manuallyEnteredPaymentID_fieldIsVisible,
resolvedPaymentID_fieldIsVisible,
//
hasPickedAContact ? self.pickedContact.payment_id : undefined,
hasPickedAContact ? self.pickedContact.cached_OAResolved_XMR_address : undefined,
hasPickedAContact ? self.pickedContact.HasOpenAliasAddress() : undefined,
hasPickedAContact ? self.pickedContact.address : undefined,
//
contact_payment_id,
cached_OAResolved_address,
contact_hasOpenAliasAddress,
contact_address,
"" + final_XMR_amount_Number,
sweeping, // when true, amount will be ignored
self._selected_simplePriority(),
//
function(str) // preSuccess_nonTerminal_statusUpdate_fn
{
self.validationMessageLayer.SetValidationError(str, true/*wantsXButtonHidden*/)
},
function()
{ // canceled_fn
self._dismissValidationMessageLayer()
_reEnableFormElements()
},
function(err, mockedTransaction)
preSuccess_nonTerminal_statusUpdate_fn,
cancelled_fn,
handleResponse_fn,
);
}

// What this is, is essentially a hack to provide feedback on the transaction based on messages returned from wallet.SendFunds
function preSuccess_nonTerminal_statusUpdate_fn(str)
{
self.validationMessageLayer.SetValidationError(str, true/*wantsXButtonHidden*/)
}

// This is for when a send is cancelled. This gets invoked on non-recoverable error
function cancelled_fn()
{ // canceled_fn
self._dismissValidationMessageLayer()
_reEnableFormElements()
}

// mocked transaction gets set in wallet.js
function handleResponse_fn(err, mockedTransaction)
{

if (err) {
_trampolineToReturnWithValidationErrorString(typeof err === 'string' ? err : err.message)
return
}
{ // now present a mocked transaction details view, and see if we need to present an "Add Contact From Sent" screen based on whether they sent w/o using a contact
const stateCachedTransaction = wallet.New_StateCachedTransaction(mockedTransaction); // for display
self.pushDetailsViewFor_transaction(wallet, stateCachedTransaction);
}
// TODO: Once we have properly developed Yat support for Contacts, remove this isYatHandle check to allow a user to save the Yat contact
if (self.isYatHandle == false) {
{
console.log("err", err)
if (err) {
_trampolineToReturnWithValidationErrorString(typeof err === 'string' ? err : err.message)
return
}
{ // now present a mocked transaction details view, and see if we need to present an "Add Contact From Sent" screen based on whether they sent w/o using a contact
const stateCachedTransaction = wallet.New_StateCachedTransaction(mockedTransaction); // for display
self.pushDetailsViewFor_transaction(wallet, stateCachedTransaction);
}
const this_pickedContact = hasPickedAContact == true ? self.pickedContact : null
self.__didSendWithPickedContact(
this_pickedContact,
enteredAddressValue_exists ? enteredAddressValue : null,
resolvedAddress_exists ? resolvedAddress : null,
mockedTransaction
);
}
}
{ // finally, clean up form
setTimeout(
function()
{
const this_pickedContact = hasPickedAContact == true ? self.pickedContact : null
self.__didSendWithPickedContact(
this_pickedContact,
enteredAddressValue_exists ? enteredAddressValue : null,
resolvedAddress_exists ? resolvedAddress : null,
mockedTransaction
);
}
{ // finally, clean up form
setTimeout(
function()
{
self._clearForm()
// and lastly, importantly, re-enable everything
_reEnableFormElements()
},
500 // after the navigation transition just above has taken place
)
}
{ // and fire off a request to have the wallet get the latest (real) tx records
setTimeout(
function()
{
wallet.hostPollingController._fetch_transactionHistory() // TODO: maybe fix up the API for this
}
)
self._clearForm()
// and lastly, importantly, re-enable everything
_reEnableFormElements()
},
500 // after the navigation transition just above has taken place
)
}
{ // and fire off a request to have the wallet get the latest (real) tx records
setTimeout(
function()
{
wallet.hostPollingController._fetch_transactionHistory() // TODO: maybe fix up the API for this
}
}
)
)
}
}

}
//
//
Expand Down Expand Up @@ -1898,6 +1916,60 @@ class SendFundsView extends View
return
}
}

// if enteredPossibleAddress length less than 7, check if it's a Yat
let hasEmojiCharacters = /\p{Extended_Pictographic}/u.test(enteredPossibleAddress)
if (hasEmojiCharacters) {

let isYat = yatMoneroLookup.isValidYatHandle(enteredPossibleAddress);
self.isYatHandle = isYat;
if (isYat) {
const lookup = yatMoneroLookup.lookupMoneroAddresses(enteredPossibleAddress).then((responseMap) => {
// Our library returns a map with between 0 and 2 keys
if (responseMap.size == 0) {
// no monero address
let errorString = `There is no Monero address associated with "${enteredPossibleAddress}"`
self.validationMessageLayer.SetValidationError(errorString);
} else if (responseMap.size == 1) {
// Either a Monero address or a Monero subaddress was found.
let iterator = responseMap.values();
let record = iterator.next();
self._displayResolvedAddress(record.value);
} else if (responseMap.size == 2) {
let moneroAddress = responseMap.get('0x1001');
self._displayResolvedAddress(moneroAddress);
}
}).catch((error) => {
// If the error status is defined, handle this error according to the HTTP error status code
if (typeof(error.response) !== "undefined" && typeof(error.response.status) !== "undefined") {
if (error.response.status == 404) {
// Yat not found
let errorString = `The Yat "${enteredPossibleAddress}" does not exist`
self.validationMessageLayer.SetValidationError(errorString);
return;
} else if (error.response.status >= 500) {
// Yat server / remote network device error encountered
let errorString = `The Yat server is responding with an error. Please try again later. Error: ${error.message}`
self.validationMessageLayer.SetValidationError(errorString);
} else {
// Response code that isn't 404 or a server error (>= 500) on their side
let errorString = `An unexpected error occurred when looking up the Yat Handle: ${error.message}`
self.validationMessageLayer.SetValidationError(errorString);
}
} else {
// Network connectivity issues -- could be offline / Yat server not responding
let errorString = `Unable to communicate with the Yat server. It may be down, or you may be experiencing internet connectivity issues. Error: ${error.message}`
self.validationMessageLayer.SetValidationError(errorString);
// If we don't have an error.response, our request failed because of a network error
}
});
} else {
// This conditional will run when a mixture of emoji and non-emoji characters are present in the address
let errorString = `"${enteredPossibleAddress}" is not a valid Yat handle. You may have input an emoji that is not part of the Yat emoji set, or a non-emoji character.`
self.validationMessageLayer.SetValidationError(errorString);
return;
}
}
//
self.cancelAny_requestHandle_for_oaResolution()
//
Expand Down
Loading

0 comments on commit 0a7eb86

Please sign in to comment.