Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?xml version="1.0" encoding="utf-8"?>
- <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
- xmlns:mx="library://ns.adobe.com/flex/mx"
- xmlns:s="library://ns.adobe.com/flex/spark"
- xmlns:views="org.bigbluebutton.main.views.*"
- xmlns:maps="org.bigbluebutton.main.maps.*"
- xmlns:mate="http://mate.asfusion.com/"
- pageTitle="Cloudpe+"
- preinitialize="init(event)"
- splashScreenImage="@Embed('src/org/bigbluebutton/common/assets/images/logo.png')"
- applicationComplete="appComplete()"
- activate="onActivateApp(event)"
- deactivate="onDeactivateApp(event)">
- <!-- Place non-visual elements (e.g., services, value objects) here -->
- <fx:Declarations>
- <maps:ApplicationEventMap/>
- <mate:Listener type="{BBBEvent.LOGIN_EVENT}"
- method="handleLoginEvent"/>
- <mate:Listener type="{BBBEvent.FAIL_TO_JOIN_EVENT}"
- method="handleFailJoinEvent"/>
- <mate:Listener type="{BBBEvent.RECEIVED_PUBLIC_CHAT_MESSAGE_EVENT}"
- method="handleReceivedPublicChatMessageEvent"/>
- <mate:Listener type="{BBBEvent.ADDED_LISTENER}"
- method="handleAddedListenerEvent"/>
- <mate:Listener type="{BBBEvent.PRESENTATION_CONVERTED}"
- method="handlePresentationConversion"/>
- <mate:Listener type="{BBBEvent.VIDEO_STARTED}"
- method="videoHasStarted"/>
- <mate:Listener type="{BBBEvent.CLOSE_APPLICATION}"
- method="closeApplication"/>
- </fx:Declarations>
- <fx:Script>
- <![CDATA[
- import com.asfusion.mate.events.Dispatcher;
- import flash.net.navigateToURL;
- import mx.events.FlexEvent;
- import mx.managers.HistoryManager;
- import mx.managers.IDragManager;
- import spark.components.Button;
- import spark.components.Label;
- import org.bigbluebutton.common.LogUtil;
- import org.bigbluebutton.core.BBB;
- import org.bigbluebutton.core.managers.UserManager;
- import org.bigbluebutton.main.events.BBBEvent;
- import org.bigbluebutton.main.events.BackButtonEvent;
- import org.bigbluebutton.main.events.TryLoginEvent;
- import org.bigbluebutton.main.model.ConfigParameters;
- import org.bigbluebutton.util.i18n.ResourceUtil;
- private var module1:ChatModule;
- private var module2:ListenersModule;
- private var module3:PhoneModule;
- private var module4:PresentModule;
- private var module5:ViewersModule;
- private var module6:WhiteboardModule;
- private var configParameters:ConfigParameters = new ConfigParameters(function ():void {
- });
- private var langResources:ResourceUtil = ResourceUtil.getInstance();
- public var joinUrl:String = "";
- public var logoutUrl:String = "";
- /**
- * Thse two lines are workaround for this. (ralam - Nov 8, 2008)
- * http://gregjessup.com/flex-3-advanceddatagrid-cannot-convert-mxmanagersdragmanagerimpl-to-mxmanagersidragmanager/
- * http://butterfliesandbugs.wordpress.com/2007/10/25/workaround-for-error-when-loading-popups-from-modules/
- */
- private var iDragManager:IDragManager;
- /** another workaround - for this issue: https://bugs.adobe.com/jira/browse/SDK-13121*/
- private var hist:HistoryManager;
- private var globalDispatcher:Dispatcher = new Dispatcher();
- // Login test // flag to indicate if we successfully logged in
- private static var _applicationHostAddress:String;
- // Chat test
- // Voice test
- private static var didUserJoin:Boolean = false;
- // Presentation test
- // Video test
- private static var myStage:Stage;
- private static var HOME_PAGE:String = "http://meet.cloudpe.com";
- public static function get applicationHostAddress():String {
- return BigBlueButton._applicationHostAddress;
- }
- protected function init(event:FlexEvent):void {
- preventBackKeyDown();
- this.systemManager.loaderInfo.uncaughtErrorEvents.addEventListener(UncaughtErrorEvent.UNCAUGHT_ERROR, handleFailJoinEvent);
- NativeApplication.nativeApplication.addEventListener(InvokeEvent.INVOKE, onInvoke);
- NativeApplication.nativeApplication.systemIdleMode = SystemIdleMode.KEEP_AWAKE;
- }
- private function onDeactivateApp(event:Event):void {
- mobileShell.handleDeactivateEvent();
- }
- private function onActivateApp(event:Event):void {
- mobileShell.activateScreen();
- }
- private function preventBackKeyDown():void {
- // Add device event listeners
- systemManager.stage.addEventListener(KeyboardEvent.KEY_DOWN, deviceKeyDownHandler);
- systemManager.stage.addEventListener(KeyboardEvent.KEY_UP, deviceKeyUpHandler);
- }
- private static function deviceKeyDownHandler(event:KeyboardEvent):void {
- var key:uint = event.keyCode;
- // We want to prevent the default down behavior for back key if
- // the navigator has a view to pop back to
- if (key == Keyboard.BACK) {
- event.preventDefault();
- }
- }
- /**
- * Called when the application's hardware back key is pressed
- * by the user.
- */
- private function deviceKeyUpHandler(event:KeyboardEvent):void {
- var key:uint = event.keyCode;
- if (key == Keyboard.BACK)
- globalDispatcher.dispatchEvent(new BackButtonEvent(BackButtonEvent.BACK_BUTTON_EVENT));
- }
- private static function handleLoginEvent(event:BBBEvent):void {
- LogUtil.debug(" Received loggedin event");
- var isLoggedIn:Boolean = true;
- LogUtil.debug(" Received loggedin event " + isLoggedIn.toString());
- }
- private static function handleReceivedPublicChatMessageEvent(event:BBBEvent):void {
- var chatTestSucceeded:Boolean = false;
- var chatMessageSent:String = "";
- if (event.message.search(chatMessageSent) != -1)
- chatTestSucceeded = true;
- }
- private static function handleAddedListenerEvent(event:BBBEvent):void {
- didUserJoin = true;
- }
- private static function handlePresentationConversion(event:Event):void {
- var didPresentationConvert:Boolean = true;
- }
- private static function appComplete():void {
- // mobileShell.lockOrientation();
- }
- private static function videoHasStarted(e:Event):void {
- var didVideoStart:Boolean = true;
- }
- private function onInvoke(event:InvokeEvent):void {
- if (configParameters.testmode) {
- // test apk
- logoutUrl = configParameters.logoutUrl;
- joinUrl = configParameters.testJoinUrl;
- setHostAddress(joinUrl);
- BBB.initConfigManager();
- globalDispatcher.dispatchEvent(new TryLoginEvent(TryLoginEvent.TRY_LOGIN_EVENT));
- }
- else {
- // Production apk
- if (event.arguments[0]) {
- joinUrl = event.arguments[0].replace("cloudpe://", "http://");
- setHostAddress(joinUrl);
- BBB.initConfigManager();
- globalDispatcher.dispatchEvent(new TryLoginEvent(TryLoginEvent.TRY_LOGIN_EVENT));
- }
- else if (!didUserJoin) {
- navigateToURL(new URLRequest(HOME_PAGE));
- }
- }
- }
- private function handleFailJoinEvent(e:Event):void {
- //Only handle IOError and BBBEvent.FAIL_TO_JOIN_EVENT
- if (e is UncaughtErrorEvent) {
- var error:Object = e["error"];
- LogUtil.error(error.message);
- return;
- }
- meetingEndHandler();
- }
- private function meetingEndHandler():void {
- mobileShell.visible = false;
- var gap:Number = height / 7;
- var notice:Label = new Label();
- notice.setStyle("textAlign", "center");
- notice.setStyle("fontWeight", "bold");
- notice.setStyle("fontSize", 28);
- notice.text = langResources.getString("bbb.logout.meetingended");
- notice.width = width;
- notice.x = width / 2 - notice.width / 2;
- notice.y = height / 2 - gap / 2;
- addElement(notice);
- var redirectBtn:Button = new Button();
- redirectBtn.setStyle("fontSize", 28);
- redirectBtn.label = langResources.getString("bbb.logout.selectOtherMeeting");
- redirectBtn.width = notice.width * 3 / 4;
- redirectBtn.height = 50;
- addElement(redirectBtn);
- redirectBtn.x = width / 2 - redirectBtn.width / 2;
- redirectBtn.y = notice.y + redirectBtn.height / 2 + gap / 2;
- redirectBtn.addEventListener(MouseEvent.CLICK, function ():void {
- if (UserManager.getInstance().getConference().logOutUrl != "") {
- HOME_PAGE = UserManager.getInstance().getConference().logOutUrl;
- }
- navigateToURL(new URLRequest(HOME_PAGE));
- var delay:Timer = new Timer(100);
- delay.start();
- delay.addEventListener(TimerEvent.TIMER, function ():void {
- delay.stop();
- NativeApplication.nativeApplication.exit(0);
- });
- });
- }
- private static function setHostAddress(url:String):void {
- var search:Array = url.split("/");
- BigBlueButton._applicationHostAddress = search[2];
- }
- private function closeApplication(e:Event):void {
- meetingEndHandler();
- }
- ]]>
- </fx:Script>
- <views:MobileApplicationView id="mobileShell"/>
- </s:Application>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement