Skip to content
This repository

Integration request for trivial changes in Facebook.java #164

Closed
wants to merge 1 commit into from

4 participants

nsokolov James Smith Arthur Damm James Pearce
nsokolov

These changes intented to preventing WindowLeaked Exception
Also, access level modifiers were changed for DEFAULT_AUTH_ACTIVITY_CODE and validateAppSignatureForIntent to make them accesible from outside of SDK

nsokolov Changes intented to preventing WindowLeaked Exception
Also, access level modifiers were changed for DEFAULT_AUTH_ACTIVITY_CODE
and validateAppSignatureForIntent to make them accesible
from outside of SDK
004acc7
James Smith

Facebook: PLEASE merge these in to master, we're seeing hundreds of these exceptions in the wild. Thanks nsokolov!

Arthur Damm

Agreed, also dealing with these exceptions at orientation change.

James Pearce

This pull request was raised against a previous version of the Facebook SDK for Android.

In 2012, the SDK had a significant rewrite and relaunch, and we are closing issues and pull requests that predate that v3.0 release.

If you think this pull request is still relevant, please refactor it to apply to the supported SDK (currently v3.6). For more information, please see our Android developer center at https://developers.facebook.com/docs/android

Many thanks for using the Facebook Platform, and your support of this project.

James Pearce jamesgpearce closed this December 17, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

Jan 25, 2011
nsokolov Changes intented to preventing WindowLeaked Exception
Also, access level modifiers were changed for DEFAULT_AUTH_ACTIVITY_CODE
and validateAppSignatureForIntent to make them accesible
from outside of SDK
004acc7
This page is out of date. Refresh to see the latest.
23  facebook/src/com/facebook/android/Facebook.java 100644 → 100755
... ...
@@ -1,5 +1,6 @@
1 1
 /*
2 2
  * Copyright 2010 Facebook, Inc.
  3
+ * Copyright (C) 2010 Sony Ericsson Mobile Communications AB.
3 4
  *
4 5
  * Licensed under the Apache License, Version 2.0 (the "License");
5 6
  * you may not use this file except in compliance with the License.
@@ -59,7 +60,7 @@
59 60
     private static final String LOGIN = "oauth";
60 61
 
61 62
     // Used as default activityCode by authorize(). See authorize() below.
62  
-    private static final int DEFAULT_AUTH_ACTIVITY_CODE = 32665;
  63
+    public static final int DEFAULT_AUTH_ACTIVITY_CODE = 32665;
63 64
 
64 65
     // Facebook server endpoints: may be modified in a subclass for testing
65 66
     protected static String DIALOG_BASE_URL =
@@ -78,6 +79,7 @@
78 79
     private int mAuthActivityCode;
79 80
     private DialogListener mAuthDialogListener;
80 81
 
  82
+    private FbDialog mFbDialog = null;
81 83
     /**
82 84
      * Constructor for Facebook object.
83 85
      *
@@ -95,6 +97,18 @@ public Facebook(String appId) {
95 97
     }
96 98
 
97 99
     /**
  100
+     * Dismiss Facebook dialog.
  101
+     * This method can be called from Activity onDestroy method
  102
+     * to prevent leaks android.view.WindowLeaked in WindowManager.
  103
+     *
  104
+     */
  105
+    public void destroy() {
  106
+        if (mFbDialog != null) {
  107
+            mFbDialog.dismiss();
  108
+            mFbDialog = null;
  109
+        }
  110
+    }
  111
+    /**
98 112
      * Default authorize method. Grants only basic permissions.
99 113
      *
100 114
      * See authorize() below for @params.
@@ -250,7 +264,7 @@ private boolean startSingleSignOn(Activity activity, String applicationId,
250 264
      * @param validSignature
251 265
      * @return true if the app's signature matches the expected signature.
252 266
      */
253  
-    private boolean validateAppSignatureForIntent(Activity activity,
  267
+    public boolean validateAppSignatureForIntent(Activity activity,
254 268
             Intent intent) {
255 269
 
256 270
         ResolveInfo resolveInfo =
@@ -619,7 +633,10 @@ public void dialog(Context context, String action, Bundle parameters,
619 633
             Util.showAlert(context, "Error",
620 634
                     "Application requires permission to access the Internet");
621 635
         } else {
622  
-            new FbDialog(context, url, listener).show();
  636
+            if (mFbDialog == null) {
  637
+                mFbDialog = new FbDialog(context, url, listener);
  638
+            }
  639
+            mFbDialog.show();
623 640
         }
624 641
     }
625 642
 
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.