Make the mygpx dialog set up the tokens first
authorAndy Allan <gravitystorm@gmail.com>
Mon, 11 Oct 2010 17:04:04 +0000 (17:04 +0000)
committerAndy Allan <gravitystorm@gmail.com>
Mon, 11 Oct 2010 17:04:04 +0000 (17:04 +0000)
net/systemeD/potlatch2/mygpx/MyGpxDialog.mxml
net/systemeD/potlatch2/save/SaveManager.as

index 7ec0bde..bb7ae51 100644 (file)
     import mx.core.Application;
 
     import net.systemeD.halcyon.connection.*;
+    import net.systemeD.potlatch2.save.*;
 
     public function init():void {
         PopUpManager.addPopUp(this, Application(Application.application), true);
         PopUpManager.centerPopUp(this);
         this.addEventListener(CloseEvent.CLOSE, myGpxDialog_close);
-
-        // store whether the user has seen the help dialog before
-        var obj:SharedObject = SharedObject.getLocal("user_state");
-        obj.setProperty("help_shown","true");
     }
 
     private function myGpxDialog_close(evt:CloseEvent):void {
@@ -27,8 +24,9 @@
     }
 
     private function fetchList():void {
+        SaveManager.getAccessSorted();
         Connection.getConnectionInstance().fetchUserTraces();
-        results.text="yes";
+        results.text="fetching...";
     }
               ]]>
   </mx:Script>
index 6a3843b..1a72797 100644 (file)
@@ -18,6 +18,17 @@ package net.systemeD.potlatch2.save {
             instance.save(instance.saveData);
         }
 
+        public static function getAccessSorted():void {
+            // hacky hack of pond-like clarity
+            instance.save(instance.doNothing);
+        }
+
+        private function doNothing():void {
+            //hack hacky hack hack. Please look the other way...
+            Connection.getConnectionInstance().setAppID(consumer);
+            Connection.getConnectionInstance().setAuthToken(accessToken);
+        }
+
         private function save(callback:Function):void {
             if ( consumer == null )
                 consumer = getConsumer();
@@ -29,7 +40,7 @@ package net.systemeD.potlatch2.save {
             else
                 callback();
         }
-    
+
         private function getAccessToken():OAuthToken {
             var key:String = Connection.getParam("oauth_token", null);
             var secret:String = Connection.getParam("oauth_token_secret", null);