Skip to content

Commit

Permalink
Now queueing console messages if weaveTrace is called before
Browse files Browse the repository at this point in the history
initialization.
Mobile app now associated with *.weave URLs and receiving invoke event.
  • Loading branch information
adufilie committed Oct 9, 2012
1 parent cab4fac commit 3f900f7
Show file tree
Hide file tree
Showing 3 changed files with 164 additions and 34 deletions.
17 changes: 14 additions & 3 deletions WeaveMobileClient/src/MobileConsole.mxml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@
along with Weave. If not, see <http://www.gnu.org/licenses/>.
-->
<s:VGroup xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark" width="100%" height="100%" implements="weave.api.core.ILinkableObject">
xmlns:s="library://ns.adobe.com/flex/spark"
implements="weave.api.core.ILinkableObject"
width="100%" height="100%"
creationComplete="setInstance(this);">
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
Expand Down Expand Up @@ -52,10 +55,20 @@
private static var _weaveTraceImpl:Function = weaveTraceImpl;
private static var _instance:MobileConsole;
private static var _queuedTraceArgs:Array = [];
private static function setInstance(instance:MobileConsole):void
{
_instance = instance;
for each (var args:Array in _queuedTraceArgs)
mobileTrace.apply(null, args);
}
public static function mobileTrace(...args):void
{
if (!_instance)
{
_queuedTraceArgs.push(args);
return;
}
_instance.consoleTrace.apply(null, args);
}
Expand All @@ -76,8 +89,6 @@
{
super.childrenCreated();
_instance = this;
compiler.includeLibraries(GlobalLib, WeaveAPI, ObjectUtil, WeaveAPI.SessionManager, FlexGlobals);
getCallbackCollection(WeaveAPI.ErrorManager).addImmediateCallback(this, handleError);
Expand Down
160 changes: 136 additions & 24 deletions WeaveMobileClient/src/WeaveMobileClient-app.xml
Original file line number Diff line number Diff line change
Expand Up @@ -143,36 +143,38 @@

<!-- Whether the application can be launched when the user clicks a link in a web browser.
Optional. Default false. -->
<!-- <allowBrowserInvocation></allowBrowserInvocation> -->
<allowBrowserInvocation>true</allowBrowserInvocation>

<!-- Listing of file types for which the application can register. Optional. -->
<!-- <fileTypes> -->
<!-- <fileTypes> -->

<!-- Defines one file type. Optional. -->
<!-- <fileType> -->
<!-- <fileType> -->

<!-- The name that the system displays for the registered file type. Required. -->
<!-- <name></name> -->
<!-- <name>weave.WeaveFile</name> -->

<!-- The extension to register. Required. -->
<!-- <extension></extension> -->
<!-- <extension>weave</extension> -->

<!-- The description of the file type. Optional. -->
<!-- <description></description> -->
<!-- <description>Weave File</description> -->

<!-- The MIME content type. -->
<!-- <contentType></contentType> -->
<!-- <contentType>application/octet-stream</contentType> -->

<!-- The icon to display for the file type. Optional. -->
<!-- <icon>
<!--
<icon>
<image16x16></image16x16>
<image32x32></image32x32>
<image48x48></image48x48>
<image128x128></image128x128>
</icon> -->
</icon>
-->

<!-- </fileType> -->
<!-- </fileTypes> -->
<!-- </fileType> -->
<!-- </fileTypes> -->

<!-- iOS specific capabilities -->
<!-- <iPhone> -->
Expand Down Expand Up @@ -222,22 +224,132 @@
<manifestAdditions><![CDATA[
<manifest android:installLocation="auto">
<!--See the Adobe AIR documentation for more information about setting Google Android permissions-->
<!--Removing the permission android.permission.INTERNET will have the side effect
of preventing you from debugging your application on your device-->
<!--Removing the permission android.permission.INTERNET will have the side effect of preventing you from debugging your application on your device-->
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<!--<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>-->
<!--<uses-permission android:name="android.permission.READ_PHONE_STATE"/>-->
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<!--The DISABLE_KEYGUARD and WAKE_LOCK permissions should be toggled together
in order to access AIR's SystemIdleMode APIs-->
<uses-permission android:name="android.permission.DISABLE_KEYGUARD"/>
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<!--<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>-->
<!--The DISABLE_KEYGUARD and WAKE_LOCK permissions should be toggled together in order to access AIR's SystemIdleMode APIs-->
<!--<uses-permission android:name="android.permission.DISABLE_KEYGUARD"/>-->
<!--<uses-permission android:name="android.permission.WAKE_LOCK"/>-->
<!--<uses-permission android:name="android.permission.CAMERA"/>-->
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
<!--The ACCESS_NETWORK_STATE and ACCESS_WIFI_STATE permissions should be toggled
together in order to use AIR's NetworkInfo APIs-->
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<!--<uses-permission android:name="android.permission.RECORD_AUDIO"/>-->
<!--The ACCESS_NETWORK_STATE and ACCESS_WIFI_STATE permissions should be toggled together in order to use AIR's NetworkInfo APIs-->
<!--<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>-->
<!--<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>-->
<!--
http://help.adobe.com/en_US/air/build/WSfffb011ac560372f-5d0f4f25128cc9cd0cb-7ffc.html#WS2d929364fa0b81373f2c6cba12a3522f10c-8000
http://stackoverflow.com/questions/8903443/android-file-associations
-->
<application>
<activity>
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<action android:name="android.intent.action.EDIT" />
<action android:name="android.intent.action.PICK" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="file" />
<data android:scheme="http" />
<data android:scheme="https" />
<data android:host="*" />
<data android:pathPattern=".*\.weave" />
</intent-filter>
<!--
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<action android:name="android.intent.action.EDIT" />
<action android:name="android.intent.action.PICK" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:mimeType="application/*" />
<data android:pathPattern=".*\.weave" />
</intent-filter>
-->
<!--
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<action android:name="android.intent.action.EDIT" />
<action android:name="android.intent.action.PICK" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:mimeType="*/*" />
<data android:pathPattern="*.weave" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:mimeType="message/rfc822" android:scheme="http" />
<data android:mimeType="multipart/related" android:scheme="http" />
<data android:mimeType="message/rfc822" android:scheme="https" />
<data android:mimeType="multipart/related" android:scheme="https" />
</intent-filter>
-->
<!-- handle http requests without mimetypes -->
<!-- <intent-filter> -->
<!-- <action android:name="android.intent.action.VIEW" /> -->
<!-- <category android:name="android.intent.category.DEFAULT" /> -->
<!-- <category android:name="android.intent.category.BROWSABLE" /> -->
<!-- <data android:scheme="http" android:host="*" android:pathPattern=".*\\.weave" /> -->
<!-- <data android:scheme="https" android:host="*" android:pathPattern=".*\\.weave" /> -->
<!-- </intent-filter> -->
<!-- Handle intent from a file browser app -->
<!-- <intent-filter> -->
<!-- <action android:name="android.intent.action.VIEW" /> -->
<!-- <category android:name="android.intent.category.DEFAULT" /> -->
<!-- <category android:name="android.intent.category.BROWSABLE" /> -->
<!-- <data android:scheme="file" android:host="*" android:pathPattern=".*\\.weave" /> -->
<!-- </intent-filter> -->
</activity>
</application>
<!--
<intent-filter
android:icon='@drawable/ic_launcher'
android:label='Weave File'
android:priority='1'>
<action android:name="android.intent.action.VIEW" />
<action android:name="android.intent.action.EDIT" />
<action android:name="android.intent.action.PICK" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:mimeType="*/*" />
<data android:pathPattern="*.weave" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="http" android:host="*" android:pathPattern=".*\\.weave" />
<data android:scheme="https" android:host="*" android:pathPattern=".*\\.weave" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:mimeType="message/rfc822" android:scheme="http" />
<data android:mimeType="multipart/related" android:scheme="http" />
<data android:mimeType="message/rfc822" android:scheme="https" />
<data android:mimeType="multipart/related" android:scheme="https" />
</intent-filter>
-->
</manifest>
]]></manifestAdditions>
Expand Down
21 changes: 14 additions & 7 deletions WeaveMobileClient/src/WeaveMobileClient.mxml
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,15 @@
<s:Label id="logo" text="Weave" color="0x808080" width="100%" height="100%" textAlign="center" verticalAlign="middle" fontSize="64"/>
<fx:Script>
<![CDATA[
import flash.utils.setTimeout;
import mx.events.ResizeEvent;
import mx.utils.ObjectUtil;
import spark.layouts.TileLayout;
import spark.layouts.TileOrientation;
import spark.layouts.VerticalLayout;
import spark.layouts.supportClasses.LayoutBase;
import weave.Weave;
import weave.api.WeaveAPI;
import weave.api.ui.ILinkableLayoutManager;
import weave.core.UIUtils;
import weave.resources._MobileDemo;
import weave.ui.BasicLinkableLayoutManager;
import weave.ui.WeavePodLayoutManager;
// reference classes here so they get included in the app build
Expand All @@ -55,6 +49,9 @@
{
if (event.type != Event.ENTER_FRAME)
{
var na:NativeApplication = NativeApplication.nativeApplication;
if (na)
na.addEventListener(InvokeEvent.INVOKE, handleInvoke);
addEventListener(Event.ENTER_FRAME, init);
return;
Expand Down Expand Up @@ -91,6 +88,16 @@
Weave.root.requestObject('console', MobileConsole, false);
}
private function handleInvoke(event:InvokeEvent):void
{
weaveTrace(ObjectUtil.toString(event));
if (event.arguments.length > 0)
{
weaveTrace('URL is: ' + event.arguments[0]);
}
}
public var event:Event;
public function set scale(value:Number):void { main.scale.value = value; }
protected function stage_resizeHandler(event:Event):void
Expand Down

0 comments on commit 3f900f7

Please sign in to comment.