This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Directive, ElementRef, Input, OnDestroy } from '@angular/core'; | |
import { fromEvent, merge, Observable, ReplaySubject } from 'rxjs'; | |
import { debounceTime } from 'rxjs/operators'; | |
import { Color } from 'tns-core-modules/color'; | |
import * as knownColors from 'tns-core-modules/color/known-colors'; | |
import { isAndroid, isIOS, screen } from 'tns-core-modules/platform'; | |
import { View } from 'tns-core-modules/ui/core/view'; | |
/** | |
* Directive for adding a drop shadow to an element. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Directive, ElementRef, Input } from '@angular/core'; | |
import { Label } from 'tns-core-modules/ui/label'; | |
/** | |
* Make sure the layout is updated then the Label's text is changed. | |
*/ | |
@Directive({ | |
// tslint:disable-next-line:directive-selector | |
selector: 'Label[text]', | |
}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
realpath() { | |
[[ $1 = /* ]] && echo "$1" || (cd "$PWD/${1#./}" && echo $PWD); | |
} | |
apply_patch() { | |
PATCH=$1 | |
patch -p0 -N --dry-run --silent -i $PATCH 2>&1 > /dev/null | |
if [[ $? -eq 0 ]]; then | |
patch -p0 -N --silent -i $PATCH |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { TranslateLoader, TranslateModule } from '@ngx-translate/core'; | |
import * as fs from 'tns-core-modules/file-system'; | |
@Injectable() | |
export class NSTranslateLoader extends TranslateLoader { | |
public getTranslation(lang: string) { | |
return fromPromise(fs.File.fromPath(fs.path.join(fs.knownFolders.currentApp().path, `/assets/i18n/`, `${lang}.json`)).readText('UTF-8')) | |
.map((text: string) => JSON.parse(text)); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// this import should be first in order to load some required settings (like globals and reflect-metadata) | |
import { platformNativeScriptDynamic } from "nativescript-angular/platform"; | |
import { AppModule } from "./app.module"; | |
import './tslib.nativescript'; // <-- ADD THIS LINE | |
// A traditional NativeScript application starts by initializing global objects, setting up global CSS rules, creating, and navigating to the main page. | |
// Angular applications need to take care of their own initialization: modules, components, directives, routes, DI providers. | |
// A NativeScript Angular app needs to make both paradigms work together, so we provide a wrapper platform object, platformNativeScriptDynamic, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Directive, ElementRef, Input, OnInit, OnChanges } from '@angular/core'; | |
import { Label } from 'ui/label'; | |
@Directive({ | |
selector: '[maxLines]', | |
}) | |
export class LabelMaxLinesDirective implements OnInit, OnChanges { | |
@Input('maxLines') public maxLines: number = 1; | |
public get nativeView(): Label { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Pipe, PipeTransform, NgZone } from '@angular/core'; | |
import { Observable } from 'rxjs/Observable'; | |
import { ImageSource, fromResource } from 'image-source'; | |
import { Cache } from 'ui/image-cache'; | |
import { isFileOrResourcePath, isDataURI } from 'utils/utils'; | |
let cache = new Cache(); | |
cache.placeholder = fromResource('placeholder'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
key1 : { | |
subkey1 : 1, | |
subkey2 : 2 | |
}, | |
key2 : { | |
subkey1 : 1, | |
subkey2 : 2 | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"key1" : { | |
"subkey1" : 1, | |
"subkey2" : 2 | |
}, | |
"key2" : { | |
"subkey1" : 1, | |
"subkey2" : 2 | |
} | |
} |