mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
chore: working android build
This commit is contained in:
@@ -58,6 +58,8 @@ export const hasListeners = (<any>global).NativeScriptGlobals.events.hasListener
|
||||
let app: iOSApplication | AndroidApplication;
|
||||
export function setApplication(instance: iOSApplication | AndroidApplication): void {
|
||||
app = instance;
|
||||
// signal when the application instance is ready globally
|
||||
(<any>global).NativeScriptGlobals.appInstanceReady = true;
|
||||
}
|
||||
|
||||
export function livesync(rootView: View, context?: ModuleContext) {
|
||||
|
||||
@@ -1,15 +1,16 @@
|
||||
// Types.
|
||||
import { AndroidApplication as AndroidApplicationDefinition } from '.';
|
||||
import { AndroidActivityBackPressedEventData, AndroidActivityBundleEventData, AndroidActivityEventData, AndroidActivityNewIntentEventData, AndroidActivityRequestPermissionsEventData, AndroidActivityResultEventData, ApplicationEventData, CssChangedEventData, OrientationChangedEventData, SystemAppearanceChangedEventData } from './application-interfaces';
|
||||
import { View } from '../ui/core/view';
|
||||
import { NavigationEntry, AndroidActivityCallbacks } from '../ui/frame/frame-interfaces';
|
||||
import { Observable } from '../data/observable';
|
||||
|
||||
// Use requires to ensure order of imports is maintained
|
||||
const appCommon = require('./application-common');
|
||||
// First reexport so that app module is initialized.
|
||||
export * from './application-common';
|
||||
|
||||
import { View } from '../ui/core/view';
|
||||
import { NavigationEntry, AndroidActivityCallbacks } from '../ui/frame/frame-interfaces';
|
||||
import { Observable } from '../data/observable';
|
||||
|
||||
import { profile } from '../profiling';
|
||||
|
||||
const ActivityCreated = 'activityCreated';
|
||||
@@ -482,6 +483,20 @@ function ensureBroadCastReceiverClass() {
|
||||
return;
|
||||
}
|
||||
|
||||
const BroadcastReceiver = (<any>android.content.BroadcastReceiver).extend({
|
||||
init(onReceiveCallback: (context: android.content.Context, intent: android.content.Intent) => void) {
|
||||
// super();
|
||||
this._onReceiveCallback = onReceiveCallback;
|
||||
|
||||
// return global.__native(this);
|
||||
},
|
||||
_onReceiveCallback(context: android.content.Context, intent: android.content.Intent) {
|
||||
if (this._onReceiveCallback) {
|
||||
this._onReceiveCallback(context, intent);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
// @NativeClass
|
||||
// class BroadcastReceiver extends android.content.BroadcastReceiver {
|
||||
// private _onReceiveCallback: (context: android.content.Context, intent: android.content.Intent) => void;
|
||||
@@ -499,20 +514,20 @@ function ensureBroadCastReceiverClass() {
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
var BroadcastReceiver = (function (_super) {
|
||||
__extends(BroadcastReceiver, _super);
|
||||
function BroadcastReceiver(onReceiveCallback) {
|
||||
var _this = _super.call(this) || this;
|
||||
_this._onReceiveCallback = onReceiveCallback;
|
||||
return global.__native(_this);
|
||||
}
|
||||
BroadcastReceiver.prototype.onReceive = function (context, intent) {
|
||||
if (this._onReceiveCallback) {
|
||||
this._onReceiveCallback(context, intent);
|
||||
}
|
||||
};
|
||||
return BroadcastReceiver;
|
||||
})(android.content.BroadcastReceiver);
|
||||
// var BroadcastReceiver = (function (_super) {
|
||||
// __extends(BroadcastReceiver, _super);
|
||||
// function BroadcastReceiver(onReceiveCallback) {
|
||||
// var _this = _super.call(this) || this;
|
||||
// _this._onReceiveCallback = onReceiveCallback;
|
||||
// return global.__native(_this);
|
||||
// }
|
||||
// BroadcastReceiver.prototype.onReceive = function (context, intent) {
|
||||
// if (this._onReceiveCallback) {
|
||||
// this._onReceiveCallback(context, intent);
|
||||
// }
|
||||
// };
|
||||
// return BroadcastReceiver;
|
||||
// })(android.content.BroadcastReceiver);
|
||||
|
||||
BroadcastReceiverClass = BroadcastReceiver;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user