Skip to content

Instantly share code, notes, and snippets.

async storeAccountInfo(username, password) {
await storage.ready();
await storage.set('username', username);
const cleanup = [];
if ((await touchId.encrypt()).withFingerprint) {
const [, secureStorage] = await Promise.all([
storage.set('usingTouchId', true),
secureStorage = await secureStorageFactory.create(),
]);
await secureStorage.set('password', password);
// as a test function callback
it('removes username', inject([Storage], async storage => {
await storage.set('username', 'test user');
await storage.clear();
expect(await storage.get('username').toBeNull();
}));
// Make an API asynchronous
// In this example, we mock an iOS Keychain class. All operations
// are async (I/O), so when we use this mock in our tests, we
// want the operations to act async even though it's not needed
// for the class to work
class KeychainMock {
store: [],
async get(key) {
return this.store[key] || null;
}
diff --git a/src/app/password/password.component.ts b/src/app/password/password.component.ts
index b430b39..d45eba9 100644
--- a/src/app/password/password.component.ts
+++ b/src/app/password/password.component.ts
@@ -1,5 +1,5 @@
-import { Component, ViewChild, Input, Output, forwardRef, EventEmitter } from '@angular/core';
-import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';
+import { Component, ViewChild, Input, Output, EventEmitter } from '@angular/core';
+import { FormControl } from '@angular/forms';
 
diff --git a/src/app/password/password.component.ts b/src/app/password/password.component.ts
index b430b39..d45eba9 100644
--- a/src/app/password/password.component.ts
+++ b/src/app/password/password.component.ts
@@ -1,5 +1,5 @@
-import { Component, ViewChild, Input, Output, forwardRef, EventEmitter } from '@angular/core';
-import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';
+import { Component, ViewChild, Input, Output, EventEmitter } from '@angular/core';
+import { FormControl } from '@angular/forms';
const Foo = function () {}
Foo.prototype.bar = "bar",
Foo.prototype.arrow = () => {
console.log(this.bar);
};
Foo.prototype.fn = function () {
console.log(this.bar);
};
Foo.prototype.handyArrow = function () {
process.nextTick(() => console.log(this.bar));
/**
* Explanation of the issue causing login to break. This was fixed by
* https://github.com/Mobiquity/TCP_Mobile/pull/514/files
*
* The functional change is that the `.mergeMap` and `.catch` are chained to the
* inner Observable returned to `.switchMap`. Nothing is chained to `.switchMap`
*
* Originally, `.catch` was chained to `.switchMap`. This causes the Observable
* to complete when `.catch` is reached. ngrx/effects will not resubscribe in
* this case which may actually be a bug on their end, although this would be
import { Observable } from 'rxjs/Observable';
import 'rxjs/add/observable/interval';
import 'rxjs/add/operator/switchMap';
import 'rxjs/add/operator/map';
import 'rxjs/add/operator/mapTo';
// This observable is subscribed to and emits observables
Observable.interval(1000)
import { Observable } from 'rxjs/Observable';
import 'rxjs/add/observable/interval';
import 'rxjs/add/operator/switchMap';
import 'rxjs/add/operator/map';
import 'rxjs/add/operator/mapTo';
Observable.interval(1000)
.switchMap(() => Observable.interval(100))
import { Observable } from 'rxjs/Observable';
import { of } from 'rxjs/Observable/of';
import 'rxjs/add/observable/from';
import 'rxjs/add/operator/switch';
import 'rxjs/add/operator/first';
const addresses = [
{name: "a", primary: false},