Skip to content

Instantly share code, notes, and snippets.

View marcel-ploch's full-sized avatar

Marcel Ploch marcel-ploch

View GitHub Profile
/// <reference path="../../../../references.d.ts" />
import {Injectable} from '@angular/core';
import * as application from 'application';
import {WebViewHeader} from './webview-header.abstract.service';
declare const NSHTTPCookie;
declare const NSDictionary;
@Injectable()
/// <reference path="../../../../references.d.ts" />
import {Injectable} from '@angular/core';
import * as application from 'application';
import {WebViewHeader} from './webview-header.abstract.service';
declare const android;
@Injectable()
export class AndroidWebviewHeader extends WebViewHeader {
@marcel-ploch
marcel-ploch / package.json
Created April 27, 2017 08:39
Original npm-watch Configuration
{
"watch":{
"run_android":{
"patterns":[
"app"
],
"extensions":"ts,html,scss",
"quiet":true
},
"run_ios":{
@marcel-ploch
marcel-ploch / package.json
Created April 27, 2017 08:40
Updated npm-watch Config with separate Tasks
{
"watch": {
"run_android": {
"patterns": [
"app"
],
"extensions": "ts,html,scss",
"quiet": true
},
"run_ios": {
import {Component} from '@angular/core';
import {DialogButtonPosition} from './modules/dialog/models/DialogButtonPosition.model';
import {DialogConfiguration} from './modules/dialog/models/DialogConfiguration.model';
import {DialogSettings} from './modules/dialog/models/DialogSettings.model';
import {Dialog} from './modules/dialog/services/Dialog.service';
@Component({ selector : 'tbody', templateUrl : './app.component.html', styleUrls : [ './app.component.css' ] })
export class AppComponent {
import {async, TestBed} from '@angular/core/testing';
import {AppComponent} from './app.component';
describe('AppComponent', () => {
beforeEach(async(() => {
TestBed
.configureTestingModule({
declarations: [AppComponent],
})
@marcel-ploch
marcel-ploch / web-view-ios.js
Created March 16, 2018 08:30
Änderungen an der Datei damit wieder Cookies in der WebView gesetzt werden
...
function WebView() {
var _this = _super.call(this) || this;
var configuration = WKWebViewConfiguration.new();
_this._delegate = WKNavigationDelegateImpl.initWithOwner(new WeakRef(_this));
var jScript
= 'var meta = document.createElement(\'meta\'); meta.setAttribute(\'name\', \'viewport\'); meta.setAttribute(\'content\', \'initial-scale=1.0\'); document.getElementsByTagName(\'head\')[0].appendChild(meta);';
var cookieScript = '';
@marcel-ploch
marcel-ploch / gist:e5b76be7784fc4f0c15ca33b71b11e44
Created September 21, 2018 13:54
Keyboard Events for IOs in NativeScript
// Keyboard up event on ios
if (application.ios) {
// First Event is Catched before the Keyboard Jumps Up
// We Save the Height of the Keyboard for the Positioning of the LayoutElement
application.ios.addNotificationObserver(UIKeyboardWillShowNotification, (event) => {
// console.log('WillShow', typeof event.userInfo, event.userInfo.valueForKey(UIKeyboardFrameEndUserInfoKey).CGRectValue.size.height);
// console.log(this.textView.ios.contentSize);
this.contentSizeStartValue = event.userInfo.valueForKey(UIKeyboardFrameEndUserInfoKey).CGRectValue.size.height + 10;
});
// Second Event is Catched when the Keyboard is Up to Reposition our Element
@marcel-ploch
marcel-ploch / keyboardevents.js
Last active October 11, 2019 10:40
Keyboard Events for IOs in NativeScript
// Keyboard up event on ios
if (application.ios) {
// First Event is Catched before the Keyboard Jumps Up
// We Save the Height of the Keyboard for the Positioning of the LayoutElement
application.ios.addNotificationObserver(UIKeyboardWillShowNotification, (event) => {
// console.log('WillShow', typeof event.userInfo, event.userInfo.valueForKey(UIKeyboardFrameEndUserInfoKey).CGRectValue.size.height);
// console.log(this.textView.ios.contentSize);
this.contentSizeStartValue = event.userInfo.valueForKey(UIKeyboardFrameEndUserInfoKey).CGRectValue.size.height + 10;
});
// Second Event is Catched when the Keyboard is Up to Reposition our Element
public textChanged(): void {
if (isIOS) {
if (this.textView) {
if (this.textView.ios.contentSize.height > (100)) {
this.textViewHeight = 100;
this.textHeight = this.textView.ios.contentSize.height = 100 + this.contentSizeStartValue
} else {
this.textViewHeight = this.textView.ios.contentSize.height;
this.textHeight = this.contentSizeStartValue + this.textView.ios.contentSize.height;
}