[snackr] r129 committed - OptionsPopup now appears with the Google Reader tab selected when Goog...

0 views
Skip to first unread message

codesite...@google.com

unread,
Jun 4, 2010, 7:40:46 PM6/4/10
to snackr-...@googlegroups.com
Revision: 129
Author: robadams
Date: Fri Jun 4 16:40:24 2010
Log: OptionsPopup now appears with the Google Reader tab selected when
Google Reader authentication fails at startup. Also started on some code to
make the Captcha bit work.
http://code.google.com/p/snackr/source/detail?r=129

Added:
/trunk/Snackr/.settings/com.adobe.flexbuilder.project.prefs
Modified:
/trunk/Snackr/.actionScriptProperties
/trunk/Snackr/.flexProperties
/trunk/Snackr/.project
/trunk/Snackr/src/model/feeds/readers/GoogleReaderSynchronizer.as
/trunk/Snackr/src/model/feeds/readers/SynchronizerEvent.as
/trunk/Snackr/src/ui/popups/OptionsPopup.mxml
/trunk/Snackr/src/ui/windows/SnackrMainWindow.mxml

=======================================
--- /dev/null
+++ /trunk/Snackr/.settings/com.adobe.flexbuilder.project.prefs Fri Jun 4
16:40:24 2010
@@ -0,0 +1,4 @@
+#Thu Jun 03 14:01:08 PDT 2010
+eclipse.preferences.version=1
+upgradeSDK/fb4=Flex 3.5
+useFlex3CompatibilityMode/fb4=true
=======================================
--- /trunk/Snackr/.actionScriptProperties Sun Jul 6 21:47:24 2008
+++ /trunk/Snackr/.actionScriptProperties Fri Jun 4 16:40:24 2010
@@ -1,20 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
-<actionScriptProperties mainApplicationPath="Snackr.mxml" version="3">
-<compiler additionalCompilerArguments="-locale en_US"
copyDependentFiles="true" enableModuleDebug="true"
generateAccessible="false" htmlExpressInstall="true" htmlGenerate="false"
htmlHistoryManagement="false" htmlPlayerVersion="9.0.28"
htmlPlayerVersionCheck="true" outputFolderPath="bin-debug"
sourceFolderPath="src" strict="true" useApolloConfig="true"
verifyDigests="true" warn="true">
-<compilerSourcePath/>
-<libraryPath defaultLinkType="1">
-<libraryPathEntry kind="4" path=""/>
-<libraryPathEntry kind="1" linkType="1" path="libs"/>
-</libraryPath>
-<sourceAttachmentPath/>
-</compiler>
-<applications>
-<application path="Snackr.mxml"/>
-<application path="TestHarness.mxml"/>
-<application path="QueryGoogleReader.mxml"/>
-<application path="FixPendingOpsTable.mxml"/>
-<application path="UnitTests.mxml"/>
-</applications>
-<modules/>
-<buildCSSFiles/>
+<actionScriptProperties mainApplicationPath="Snackr.mxml"
projectUUID="512c88b8-e2b5-4042-bd85-ed8a0402fae2" version="6">
+ <compiler additionalCompilerArguments="-locale en_US"
autoRSLOrdering="false" copyDependentFiles="true" flex3CompatMode="true"
fteInMXComponents="false" generateAccessible="false"
htmlExpressInstall="true" htmlGenerate="false"
htmlHistoryManagement="false" htmlPlayerVersionCheck="true"
includeNetmonSwc="false" outputFolderPath="bin-debug"
sourceFolderPath="src" strict="true" targetPlayerVersion="0.0.0"
useApolloConfig="true" useDebugRSLSwfs="true" verifyDigests="true"
warn="true">
+ <compilerSourcePath/>
+ <libraryPath defaultLinkType="1">
+ <libraryPathEntry kind="4" path=""/>
+ <libraryPathEntry kind="1" linkType="1" path="libs"/>
+ </libraryPath>
+ <sourceAttachmentPath>
+ <sourceAttachmentPathEntry kind="3" linkType="1"
path="${PROJECT_FRAMEWORKS}/libs/datavisualization.swc"
sourcepath="${PROJECT_FRAMEWORKS}/projects/datavisualization/src"
useDefaultLinkType="false"/>
+ </sourceAttachmentPath>
+ </compiler>
+ <applications>
+ <application path="Snackr.mxml">
+ <airExcludes/>
+ </application>
+ <application path="TestHarness.mxml">
+ <airExcludes/>
+ </application>
+ <application path="QueryGoogleReader.mxml">
+ <airExcludes/>
+ </application>
+ <application path="FixPendingOpsTable.mxml">
+ <airExcludes/>
+ </application>
+ <application path="UnitTests.mxml">
+ <airExcludes/>
+ </application>
+ </applications>
+ <modules/>
+ <buildCSSFiles/>
</actionScriptProperties>
=======================================
--- /trunk/Snackr/.flexProperties Sun Jul 6 21:47:24 2008
+++ /trunk/Snackr/.flexProperties Fri Jun 4 16:40:24 2010
@@ -1,2 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?>
-<flexProperties flexServerType="0" toolCompile="true"
useServerFlexSDK="false" version="1"/>
+<flexProperties enableServiceManager="false" flexServerFeatures="0"
flexServerType="0" toolCompile="true" useServerFlexSDK="false" version="1"/>
=======================================
--- /trunk/Snackr/.project Wed Jun 4 21:23:40 2008
+++ /trunk/Snackr/.project Fri Jun 4 16:40:24 2010
@@ -6,17 +6,18 @@
</projects>
<buildSpec>
<buildCommand>
- <name>com.adobe.flexbuilder.project.flexbuilder</name>
+ <name>com.adobe.flexbuilder.project.apollobuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
- <name>com.adobe.flexbuilder.apollo.apollobuilder</name>
+ <name>com.adobe.flexbuilder.project.flexbuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
+ <nature>com.adobe.flexbuilder.project.apollonature</nature>
<nature>com.adobe.flexbuilder.apollo.apollonature</nature>
<nature>com.adobe.flexbuilder.project.flexnature</nature>
<nature>com.adobe.flexbuilder.project.actionscriptnature</nature>
=======================================
--- /trunk/Snackr/src/model/feeds/readers/GoogleReaderSynchronizer.as Wed
May 19 11:27:00 2010
+++ /trunk/Snackr/src/model/feeds/readers/GoogleReaderSynchronizer.as Fri
Jun 4 16:40:24 2010
@@ -104,14 +104,26 @@
});
authConnection.addEventListener(IOErrorEvent.IO_ERROR, function
handleAuthFaultEvent(event: IOErrorEvent): void {
Logger.instance.log("GoogleReaderSynchronizer: Authentication failed:
event:" + event, Logger.SEVERITY_NORMAL);
+ Logger.instance.log("GoogleReaderSynchronizer: Authentication failed:
event.target.data:" + event.target.data, Logger.SEVERITY_DEBUG);
connected = false;
- dispatchEvent(new SynchronizerEvent(SynchronizerEvent.AUTH_FAILURE));
+ var responseVars: URLVariables = new URLVariables(event.target.data);
+ if(responseVars.Error == "CaptchaRequired") {
+ var syncEvent:SynchronizerEvent = new
SynchronizerEvent(SynchronizerEvent.AUTH_CAPTCHA_CHALLENGE);
+ syncEvent.captchaToken = responseVars.CaptchaToken;
+ syncEvent.captchaURL = responseVars.CaptchaUrl;
+ dispatchEvent(syncEvent);
+ }
+ else {
+ dispatchEvent(new SynchronizerEvent(SynchronizerEvent.AUTH_FAILURE));
+ }
});
authConnection.addEventListener(HTTPStatusEvent.HTTP_STATUS, function
handleAuthStatusEvent(event: HTTPStatusEvent) : void {
Logger.instance.log("GoogleReaderSynchronizer: response status: " +
event, Logger.SEVERITY_DEBUG);
+ Logger.instance.log("GoogleReaderSynchronizer: response status:
event.target.data:" + event.target.data, Logger.SEVERITY_DEBUG);
connected = false;
- if(event.status == AUTH_BAD_CREDENTIALS_STATUS_CODE)
+ if(event.status == AUTH_BAD_CREDENTIALS_STATUS_CODE) {
dispatchEvent(new
SynchronizerEvent(SynchronizerEvent.AUTH_BAD_CREDENTIALS));
+ }
});
authConnection.load(authRequest);
}
=======================================
--- /trunk/Snackr/src/model/feeds/readers/SynchronizerEvent.as Wed May 19
11:27:00 2010
+++ /trunk/Snackr/src/model/feeds/readers/SynchronizerEvent.as Fri Jun 4
16:40:24 2010
@@ -36,6 +36,8 @@
public static const AUTH_BAD_CREDENTIALS: String = "authBadCredentials";
public static const AUTH_FAILURE: String = "authFailure";
public static const AUTH_CAPTCHA_CHALLENGE: String
= "authCaptchaChallenge";
+ public var captchaToken: String;
+ public var captchaURL: String;

public function SynchronizerEvent(type:String)
{
=======================================
--- /trunk/Snackr/src/ui/popups/OptionsPopup.mxml Sat Nov 15 16:49:36 2008
+++ /trunk/Snackr/src/ui/popups/OptionsPopup.mxml Fri Jun 4 16:40:24 2010
@@ -33,25 +33,34 @@
creationComplete="handleCreationComplete(event)"
deactivate="handleDeactivate(event)" xmlns:utils="ui.utils.*">
<mx:Script>
<![CDATA[
- import mx.collections.Sort;
import flash.utils.getQualifiedClassName;
- import model.logger.Logger;
+
+ import model.feeds.Feed;
+ import model.feeds.FeedModel;
+ import model.feeds.readers.NullFeedReaderSynchronizer;
import model.feeds.readers.ReaderSynchronizerManager;
import model.feeds.readers.SynchronizerEvent;
- import mx.collections.ArrayCollection;
- import ui.utils.UIUtils;
- import mx.events.PropertyChangeEvent;
- import mx.events.EffectEvent;
+ import model.logger.Logger;
import model.options.OptionChangeEvent;
import model.options.OptionsModel;
- import ui.ticker.Ticker;
- import mx.managers.PopUpManager;
+ import model.utils.FeedUtils;
+
+ import mx.collections.ArrayCollection;
+ import mx.collections.Sort;
import mx.controls.Alert;
import mx.events.CloseEvent;
+ import mx.events.EffectEvent;
+ import mx.events.PropertyChangeEvent;
+ import mx.managers.PopUpManager;
+
+ import ui.ticker.Ticker;
import ui.utils.UIUtils;
- import model.feeds.Feed;
- import model.feeds.FeedModel;
- import model.utils.FeedUtils;
+
+
+ public static const FEEDS_TAB:String = "feedsTab";
+ public static const GOOGLE_READER_TAB:String = "googleReaderTab";
+ public static const PREFERENCES_TAB:String = "preferencesTab";
+ public static const ABOUT_TAB:String = "aboutTab";

private var _feedModel: FeedModel = null;
private var _optionsModel: OptionsModel = null;
@@ -73,6 +82,23 @@
public function set optionsModel(value: OptionsModel): void {
_optionsModel = value;
}
+
+ public function switchTab(tab:String): void {
+ switch(tab) {
+ case FEEDS_TAB:
+ tabs.selectedIndex = 0;
+ break;
+ case GOOGLE_READER_TAB:
+ tabs.selectedIndex = 1;
+ break;
+ case PREFERENCES_TAB:
+ tabs.selectedIndex = 2;
+ break;
+ case ABOUT_TAB:
+ tabs.selectedIndex = 3;
+ break;
+ }
+ }

override protected function handleCreationComplete(event: Event): void {
super.handleCreationComplete(event);
@@ -88,14 +114,21 @@

// Hack. If I don't do this, the Feeds tab shows up as "Fee..." when
the popup opens.
// Setting the selected index seems to cause it to relayout properly.
+ var currentlySelected:int = tabs.selectedIndex;
tabs.selectedIndex = 1;
tabs.validateNow();
- tabs.selectedIndex = 0;
+ tabs.selectedIndex = currentlySelected;

var initialSort: Sort = new Sort();
initialSort.compareFunction = caseInsensitiveCompare;
feedModel.feeds.sort = initialSort;
feedModel.feeds.refresh();
+
+ if(_optionsModel.getValue(OptionsModel.OPTION_READER_ENABLED) == "1"
&& ReaderSynchronizerManager.reader is NullFeedReaderSynchronizer)
+ badPasswordText.visible = true;
+
+ //currentState = "CaptchaDisplayed";
+
}

private function handleOptionChange(event: OptionChangeEvent): void {
@@ -569,9 +602,27 @@
_optionsModel.setValue(OptionsModel.OPTION_READER_PASSWORD,
passwordInput.text);
}
}
+
+ private function handleCaptchaInputCommit(event:Event): void {
+ readerCredentialsUnchecked = true;
+ }

]]>
</mx:Script>
+ <states>
+ <mx:State name="CaptchaDisplayed">
+ <mx:AddChild relativeTo="{googleReaderTab}">
+ <mx:Image left="col4:10" y="158" width="200" height="70"
id="captchaImage" />
+ <mx:TextInput left="col4:10" y="228" width="170" id="captchaInput"
valueCommit="handleCaptchaInputCommit(event)" />
+ </mx:AddChild>
+ <mx:SetProperty target="{connectButton}" name="y" value="262" />
+ <mx:SetProperty target="{authenticatingSpinner}" name="y" value="288" />
+ <mx:SetProperty target="{authenticatingLabel}" name="y" value="296" />
+ <mx:SetProperty target="{connectedLabel}" name="y" value="296" />
+ <mx:SetProperty target="{badPasswordText}" name="y" value="296" />
+ <mx:SetProperty target="{badConnectionText}" name="y" value="296" />
+ </mx:State>
+ </states>
<popupChildren>
<mx:Button id="closeButton" styleName="closeButton" width="16"
height="16" y="9" right="8" click="handleCloseClick()"/>
<mx:TabNavigator id="tabs" top="10" bottom="10" left="10" right="10"
creationPolicy="all">
@@ -641,7 +692,7 @@
<mx:htmlText>
<![CDATA[<b>The user name and password did not match.</b>
If you forgot your user name or password, visit <a
href="https://www.google.com/accounts/ManageAccount"><font
color="#ADD8E6">Google Accounts</font></a>
-and select "I cannot access my account" from underneath the sign in box.
+and select the link underneath the sign in box.
]]>
</mx:htmlText>
</mx:Text>
=======================================
--- /trunk/Snackr/src/ui/windows/SnackrMainWindow.mxml Sat Nov 15 16:49:36
2008
+++ /trunk/Snackr/src/ui/windows/SnackrMainWindow.mxml Fri Jun 4 16:40:24
2010
@@ -46,57 +46,50 @@
alwaysInFront="true" rightClick="handleRightClick(event)"
click="handleClick(event)" xmlns:utils="ui.utils.*">
<mx:Script>
<![CDATA[
- // In addition to being the main window, this acts as the main
controller for the
- // application. In general, individual components such as the ticker
and the
- // detail popup are relatively generic; this main application pulls
data from the
- // models, pushes it into the UI, and handles events from the
subcomponents.
- //
- // Currently, not everything is really that cleanly factored--a number
of the popups
- // talk directly to the FeedModel, for convenience. However, most
subcomponents don't
- // depend directly on the OptionsModel--instead, this main app listens
to option
- // changes, then sets appropriate properties on the subcomponents.
-
- import ui.popups.GettingStartedPopup;
+ import flash.display.Screen;
+ import flash.net.navigateToURL;
+
+ import model.feeds.Feed;
+ import model.feeds.FeedItem;
+ import model.feeds.FeedModel;
import model.feeds.FeedModelEvent;
- import mx.events.CloseEvent;
- import ui.popups.AddFeedPopup;
- import ui.utils.UIUtils;
- import ui.utils.AnimateRectProperty;
- import model.logger.Logger;
+ import model.feeds.readers.GoogleReaderSynchronizer;
+ import model.feeds.readers.IFeedReaderSynchronizer;
+ import model.feeds.readers.NullFeedReaderSynchronizer;
+ import model.feeds.readers.ReaderSynchronizerManager;
+ import model.feeds.readers.SynchronizerEvent;
import model.logger.LogEvent;
+ import model.logger.Logger;
+ import model.options.OptionChangeEvent;
+ import model.options.OptionsModel;
+
+ import mx.collections.ArrayCollection;
+ import mx.controls.Alert;
+ import mx.effects.Move;
+ import mx.effects.easing.Cubic;
+ import mx.events.CloseEvent;
+ import mx.events.EffectEvent;
+ import mx.events.FlexEvent;
+ import mx.managers.CursorManagerPriority;
import mx.rpc.events.FaultEvent;
- import ui.popups.UpdatePopup;
import mx.rpc.events.ResultEvent;
import mx.rpc.http.HTTPService;
- import flash.net.navigateToURL;
- import mx.events.EffectEvent;
- import mx.effects.easing.Cubic;
- import ui.utils.AnimateRectProperty;
- import mx.effects.Move;
- import ui.popups.Popup;
- import model.options.OptionChangeEvent;
- import model.options.OptionsModel;
+
import ui.overlays.MessageOverlay;
- import mx.controls.Alert;
- import ui.popups.OptionsPopup;
- import ui.utils.UIUtils;
+ import ui.popups.AddFeedPopup;
import ui.popups.DetailPopup;
- import ui.ticker.TickerItemClickEvent;
- import ui.ticker.TickerItem;
- import model.feeds.FeedItem;
- import model.feeds.Feed;
- import model.feeds.FeedModel;
- import mx.collections.ArrayCollection;
- import flash.display.Screen;
+ import ui.popups.DetailPopupManager;
+ import ui.popups.GettingStartedPopup;
+ import ui.popups.OptionsPopup;
+ import ui.popups.Popup;
import ui.popups.StarredItemsPopup;
+ import ui.popups.UpdatePopup;
+ import ui.ticker.TickerItem;
+ import ui.ticker.TickerItemClickEvent;
import ui.ticker.TickerItemData;
- import model.feeds.readers.SynchronizerEvent;
- import model.feeds.readers.ReaderSynchronizerManager;
- import model.feeds.readers.GoogleReaderSynchronizer;
- import model.feeds.readers.IFeedReaderSynchronizer;
- import model.feeds.readers.NullFeedReaderSynchronizer;
- import ui.popups.DetailPopupManager;
- import mx.managers.CursorManagerPriority;
+ import ui.utils.AnimateRectProperty;
+ import ui.utils.UIUtils;
+

/**
* Default height of the ticker (including the tab).
@@ -393,6 +386,7 @@
});

ReaderSynchronizerManager.reader.addEventListener(SynchronizerEvent.AUTH_BAD_CREDENTIALS,
function authenticationFailure(event: SynchronizerEvent) : void {
ReaderSynchronizerManager.initializeNullReaderSynchronizer();
+ doShowOptions(OptionsPopup.GOOGLE_READER_TAB);
});

ReaderSynchronizerManager.reader.authenticate(_optionsModel.getValue(OptionsModel.OPTION_READER_USER_NAME),
_optionsModel.getValue(OptionsModel.OPTION_READER_PASSWORD));
@@ -971,13 +965,13 @@
* Handler for the Options button on the ticker tab.
*/
private function handleOptionsClick(): void {
- doShowOptions();
+ doShowOptions(OptionsPopup.FEEDS_TAB);
}

/**
* Opens the Options popup.
*/
- private function doShowOptions(): void {
+ private function doShowOptions(initialTab:String): void {
if (_optionsPopup != null) {
_optionsPopup.doClose();
_optionsPopup = null;
@@ -986,6 +980,10 @@
DetailPopupManager.instance.closePopups();

var options: OptionsPopup = new OptionsPopup();
+ options.addEventListener(FlexEvent.CREATION_COMPLETE, function
handleTabSwitch(event:Event) : void {
+ options.switchTab(initialTab);
+ });
+
options.currentScreen = currentScreen;
options.feedModel = _feedModel;
options.optionsModel = _optionsModel;

Reply all
Reply to author
Forward
0 new messages