Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
B
Breeze
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
3
Issues
3
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DeStream-public
Breeze
Commits
8ae7ee4f
Commit
8ae7ee4f
authored
Aug 06, 2018
by
Paul Herbert
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
2100 - Breeze ICO updates. Introduced monitor and serialDisposable. Now complete
parent
9c83482d
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
73 additions
and
55 deletions
+73
-55
advanced.component.ts
Breeze.UI/src/app/wallet/advanced/advanced.component.ts
+24
-52
monitor.ts
Breeze.UI/src/app/wallet/advanced/monitor.ts
+30
-0
serialDisposable.ts
Breeze.UI/src/app/wallet/advanced/serialDisposable.ts
+15
-0
history.component.ts
Breeze.UI/src/app/wallet/history/history.component.ts
+3
-2
tsconfig.json
Breeze.UI/tsconfig.json
+1
-1
No files found.
Breeze.UI/src/app/wallet/advanced/advanced.component.ts
View file @
8ae7ee4f
import
{
Component
,
OnInit
,
OnDestroy
}
from
'@angular/core'
;
import
{
Component
,
OnInit
,
OnDestroy
}
from
'@angular/core'
;
import
{
Subscription
}
from
'rxJs/Subscription'
;
import
{
FormGroup
,
Validators
,
FormBuilder
,
AbstractControl
}
from
'@angular/forms'
;
import
{
FormGroup
,
Validators
,
FormBuilder
,
AbstractControl
}
from
'@angular/forms'
;
import
{
NgbDateStruct
}
from
'@ng-bootstrap/ng-bootstrap'
;
import
{
NgbDateStruct
}
from
'@ng-bootstrap/ng-bootstrap'
;
import
'./monitor'
;
import
{
AdvancedService
}
from
'./advanced.service'
;
import
{
AdvancedService
}
from
'./advanced.service'
;
import
{
LoadingState
}
from
'./loadingState'
;
import
{
LoadingState
}
from
'./loadingState'
;
import
{
SerialDisposable
}
from
'./serialDisposable'
;
@
Component
({
@
Component
({
selector
:
'app-advanced'
,
selector
:
'app-advanced'
,
...
@@ -13,9 +14,9 @@ import { LoadingState } from './loadingState';
...
@@ -13,9 +14,9 @@ import { LoadingState } from './loadingState';
})
})
export
class
AdvancedComponent
implements
OnInit
,
OnDestroy
{
export
class
AdvancedComponent
implements
OnInit
,
OnDestroy
{
private
addressCount
=
""
;
private
addressCount
=
""
;
private
extPubKeySubs
:
Subscription
;
private
extPubKeySubs
=
new
SerialDisposable
()
;
private
generateAddressesSubs
:
Subscription
;
private
generateAddressesSubs
=
new
SerialDisposable
()
;
private
resyncSubs
:
Subscription
;
private
resyncSubs
=
new
SerialDisposable
()
;
private
addresses
=
new
Array
<
string
>
();
private
addresses
=
new
Array
<
string
>
();
private
resyncActioned
=
false
;
private
resyncActioned
=
false
;
...
@@ -42,47 +43,25 @@ export class AdvancedComponent implements OnInit, OnDestroy {
...
@@ -42,47 +43,25 @@ export class AdvancedComponent implements OnInit, OnDestroy {
this
.
loadExtPubKey
();
this
.
loadExtPubKey
();
}
}
public
generateAddresses
()
{
resync
()
{
this
.
addresses
=
new
Array
<
string
>
();
this
.
resyncActioned
=
true
;
this
.
generateAddressesLoadingState
.
loading
=
true
;
if
(
this
.
generateAddressesSubs
)
{
this
.
generateAddressesSubs
.
unsubscribe
();
}
this
.
generateAddressesSubs
=
this
.
advancedService
.
generateAddresses
(
Number
(
this
.
addressCount
))
.
subscribe
(
x
=>
this
.
onGenerateAddresses
(
x
),
_
=>
this
.
generateAddressesLoadingState
.
errored
=
true
);
}
public
resync
()
{
if
(
this
.
resyncSubs
)
{
this
.
resyncSubs
.
unsubscribe
();
}
this
.
resyncLoadingState
.
loading
=
this
.
resyncActioned
=
true
;
const
date
=
new
Date
(
this
.
resyncDate
.
year
,
this
.
resyncDate
.
month
-
1
,
this
.
resyncDate
.
day
);
const
date
=
new
Date
(
this
.
resyncDate
.
year
,
this
.
resyncDate
.
month
-
1
,
this
.
resyncDate
.
day
);
this
.
resyncSubs
=
this
.
advancedService
.
resyncFromDate
(
date
)
this
.
resyncSubs
.
disposable
=
this
.
advancedService
.
resyncFromDate
(
date
)
.
subscribe
(
_
=>
this
.
onResync
(),
.
monitor
(
this
.
resyncLoadingState
)
_
=>
this
.
resyncLoadingState
.
errored
=
true
);
.
subscribe
();
}
private
loadExtPubKey
()
{
this
.
extPubKeyLoadingState
.
loading
=
true
;
this
.
extPubKeySubs
=
this
.
advancedService
.
getExtPubKey
()
.
subscribe
(
x
=>
this
.
onExtPubKey
(
x
),
_
=>
this
.
extPubKeyLoadingState
.
errored
=
true
);
}
}
private
onExtPubKey
(
key
:
string
)
{
generateAddresses
()
{
this
.
extPubKey
=
key
;
this
.
addresses
=
[];
this
.
extPubKeyLoadingState
.
loading
=
false
;
this
.
generateAddressesSubs
.
disposable
=
this
.
advancedService
.
generateAddresses
(
Number
(
this
.
addressCount
))
.
monitor
(
this
.
generateAddressesLoadingState
)
.
subscribe
(
x
=>
this
.
addresses
=
x
);
}
}
private
onGenerateAddresses
(
addresses
:
string
[])
{
private
loadExtPubKey
()
{
this
.
generateAddressesLoadingState
.
loading
=
false
;
this
.
extPubKeySubs
.
disposable
=
this
.
advancedService
.
getExtPubKey
()
this
.
addresses
=
addresses
;
.
monitor
(
this
.
extPubKeyLoadingState
)
}
.
subscribe
(
x
=>
this
.
extPubKey
=
x
);
private
onResync
()
{
this
.
resyncLoadingState
.
loading
=
false
;
}
}
private
registerFormControls
()
{
private
registerFormControls
()
{
...
@@ -102,20 +81,13 @@ export class AdvancedComponent implements OnInit, OnDestroy {
...
@@ -102,20 +81,13 @@ export class AdvancedComponent implements OnInit, OnDestroy {
private
setResyncDates
()
{
private
setResyncDates
()
{
const
now
=
new
Date
();
const
now
=
new
Date
();
this
.
maxResyncDate
=
{
year
:
now
.
getFullYear
(),
month
:
now
.
getMonth
()
+
1
,
day
:
now
.
getDate
()
}
this
.
maxResyncDate
=
{
year
:
now
.
getFullYear
(),
month
:
now
.
getMonth
()
+
1
,
day
:
now
.
getDate
()
}
this
.
minResyncDate
=
{
year
:
now
.
getFullYear
(),
month
:
1
,
day
:
1
}
this
.
minResyncDate
=
{
year
:
now
.
getFullYear
(),
month
:
1
,
day
:
1
}
}
}
ngOnDestroy
()
{
ngOnDestroy
()
{
if
(
this
.
extPubKeySubs
)
{
this
.
extPubKeySubs
.
dispose
();
this
.
extPubKeySubs
.
unsubscribe
();
this
.
generateAddressesSubs
.
dispose
();
}
this
.
resyncSubs
.
dispose
();
if
(
this
.
generateAddressesSubs
)
{
this
.
generateAddressesSubs
.
unsubscribe
();
}
if
(
this
.
resyncSubs
)
{
this
.
resyncSubs
.
unsubscribe
();
}
}
}
}
}
Breeze.UI/src/app/wallet/advanced/monitor.ts
0 → 100644
View file @
8ae7ee4f
import
{
Observable
}
from
'rxjs/Observable'
;
import
{
LoadingState
}
from
'./loadingState'
;
function
monitor
<
T
>
(
this
:
Observable
<
T
>
,
loadingState
:
LoadingState
):
Observable
<
T
>
{
return
Observable
.
create
(
observer
=>
{
loadingState
.
loading
=
true
;
loadingState
.
errored
=
false
;
const
subs
=
this
.
subscribe
(
x
=>
{
loadingState
.
loading
=
false
;
observer
.
next
(
x
);
},
e
=>
{
loadingState
.
loading
=
false
;
loadingState
.
errored
=
true
;
observer
.
error
(
e
);
},
()
=>
{
loadingState
.
loading
=
false
;
observer
.
complete
();
});
return
()
=>
subs
.
unsubscribe
();
});
};
Observable
.
prototype
.
monitor
=
monitor
;
declare
module
'rxjs/Observable'
{
interface
Observable
<
T
>
{
monitor
:
typeof
monitor
;
}
}
Breeze.UI/src/app/wallet/advanced/serialDisposable.ts
0 → 100644
View file @
8ae7ee4f
import
{
Subscription
}
from
'rxJs/Subscription'
;
export
class
SerialDisposable
{
private
subscription
:
Subscription
;
set
disposable
(
value
:
Subscription
)
{
this
.
dispose
();
this
.
subscription
=
value
;
}
public
dispose
()
{
if
(
this
.
subscription
)
{
this
.
subscription
.
unsubscribe
();
this
.
subscription
=
null
;
}
}
}
\ No newline at end of file
Breeze.UI/src/app/wallet/history/history.component.ts
View file @
8ae7ee4f
...
@@ -48,8 +48,9 @@ export class HistoryComponent {
...
@@ -48,8 +48,9 @@ export class HistoryComponent {
.
subscribe
(
.
subscribe
(
response
=>
{
response
=>
{
if
(
response
.
status
>=
200
&&
response
.
status
<
400
)
{
if
(
response
.
status
>=
200
&&
response
.
status
<
400
)
{
if
(
response
.
json
().
transactionsHistory
.
length
>
0
)
{
const
json
=
response
.
json
();
historyResponse
=
response
.
json
().
transactionsHistory
;
if
(
json
&&
json
.
transactionsHistory
)
{
historyResponse
=
json
.
transactionsHistory
;
this
.
getTransactionInfo
(
historyResponse
);
this
.
getTransactionInfo
(
historyResponse
);
}
}
}
}
...
...
Breeze.UI/tsconfig.json
View file @
8ae7ee4f
...
@@ -17,7 +17,7 @@
...
@@ -17,7 +17,7 @@
},
},
"types"
:
[
"types"
:
[
"node"
,
"node"
,
"jasmine"
"jasmine"
,
],
],
"typeRoots"
:
[
"typeRoots"
:
[
"node_modules/@types"
"node_modules/@types"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment