Skip to content

Commit 1bf5aa3

Browse files
author
dfeng99
committed
some revised features.
1 parent 6a56898 commit 1bf5aa3

10 files changed

Lines changed: 337 additions & 188 deletions

File tree

sample_clients/ANE-Push-Notification/actionscript/src/com/xflying/ane/AirPushNotification/PushNotification.as

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
package com.xflying.ane.AirPushNotification
22
{
33
import flash.events.EventDispatcher;
4+
import flash.events.StageOrientationEvent;
45
import flash.events.StatusEvent;
56
import flash.events.InvokeEvent;
67
import flash.external.ExtensionContext;
78
import flash.system.Capabilities;
8-
import flash.filesystem.File;
99
import flash.desktop.NativeApplication;
10-
1110
import com.xflying.ane.AirPushNotification.PushNotificationEvent;
12-
13-
public class PushNotification extends EventDispatcher
11+
import mx.core.FlexGlobals;
12+
13+
public class PushNotification extends EventDispatcher
1414
{
1515
private const LOG:String = "[PushNotification-as3]";
1616
private const iOS:Boolean = Capabilities.version.indexOf('IOS') >= 0 ? true : false;
@@ -27,9 +27,20 @@ package com.xflying.ane.AirPushNotification
2727
private static var extCtx:ExtensionContext = null;
2828

2929
private static var _instance:PushNotification;
30+
31+
private var _orientation:String = "rotatedRight";
3032

3133
private var _isInitialized:Boolean=false;
32-
34+
35+
public function set orientation(ori:String):void{
36+
_orientation = ori;
37+
if(iOS)
38+
extCtx.call("setMessageOrientation", ori);
39+
}
40+
41+
public function get orientation():String {
42+
return _orientation;
43+
}
3344

3445
public function PushNotification()
3546
{
@@ -43,6 +54,7 @@ package com.xflying.ane.AirPushNotification
4354
if (extCtx != null)
4455
{
4556
extCtx.addEventListener(StatusEvent.STATUS, onStatus);
57+
FlexGlobals.topLevelApplication.stage.addEventListener(StageOrientationEvent.ORIENTATION_CHANGE, stageOrientationChangingHandler);
4658
_isInitialized = true;
4759
} else
4860
{
@@ -124,7 +136,7 @@ package com.xflying.ane.AirPushNotification
124136
}
125137
}
126138

127-
public function showNotificationsForground(title:String, body:String, goURL:String):void{
139+
public function showNotificationsForground(title:String, body:String, goURL:String = null):void{
128140
if (iOS && this.notificationsEnabled)
129141
{
130142
extCtx.call("showNotificationsForground", title, body, goURL);
@@ -203,6 +215,11 @@ package com.xflying.ane.AirPushNotification
203215
extCtx.call("fetchStarterNotification");
204216
}
205217

218+
private function stageOrientationChangingHandler(e:StageOrientationEvent):void{
219+
orientation = e.afterOrientation;
220+
trace(LOG, "set push message orientation to",orientation);
221+
}
222+
206223
// public function storeTrackingNotifUrl(url:String):void
207224
// {
208225
// if (this.isInitialized)
@@ -355,6 +372,6 @@ package com.xflying.ane.AirPushNotification
355372
}
356373
}
357374
}
358-
375+
359376
}
360377
}

sample_clients/ANE-Push-Notification/android/build.gradle

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@ buildscript {
33

44
repositories {
55
jcenter()
6+
google()
67
}
78

89
dependencies {
9-
classpath 'com.android.tools.build:gradle:2.3.3'
10+
classpath 'com.android.tools.build:gradle:3.3.2'
1011
// NOTE: Do not place your application dependencies here; they belong
1112
// in the individual module build.gradle files
1213
classpath 'com.google.gms:google-services:3.1.1'
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#Thu Aug 17 17:44:16 CST 2017
1+
#Tue Jul 02 07:55:43 CST 2019
22
distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip

sample_clients/ANE-Push-Notification/android/gradlew.bat

Lines changed: 84 additions & 84 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)