Skip to content

Commit

Permalink
Merge pull request #66 from hansemannn/MOD-2297
Browse files Browse the repository at this point in the history
[MOD-2297] Retain Ti-SDK < 5.5.0 compatibility
  • Loading branch information
cheekiatng authored Sep 13, 2016
2 parents d61c433 + 0ebaca2 commit b5d5aa1
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 18 deletions.
21 changes: 20 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ To enable the use of Facebook dialogs (e.g., Login, Share), you also need to inc
</array>
```

For iOS9 and titanium 5.0.0.GA and above, App Transport Security is disabled by default so you don't need these keys.
For iOS 9+ and Titanium 5.0.0.GA and above, App Transport Security is disabled by default so you don't need these keys.
If you choose to enable it, you have to set the following keys and values in tiapp.xml:
```xml
<key>NSAppTransportSecurity</key>
Expand Down Expand Up @@ -92,6 +92,25 @@ If you choose to enable it, you have to set the following keys and values in tia
</dict>
```

For iOS 10+ and Titanium 5.5.0.GA and above, to log in using Facebook on iOS Simulator , you now must include an entitlements
file that enables Keychain Sharing Capabilities. While the entitlements file is not necessary for device build (it is self-generated),
it won't affect anything in your build. To do so, create a `/platform/ios/<name>.entitlements` file (replace <name> with the name
element in tiapp.xml) with this content:

```xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>keychain-access-groups</key>
<array>
<!-- APP_ID same as the id value in the tiapp.xml file -->
<string>$(AppIdentifierPrefix)APP_ID</string>
</array>
</dict>
</plist>
```

On the android platform, in tiapp.xml or AndroidManifest.xml you must declare the following inside the \<application\> node
```xml
<activity android:name="com.facebook.FacebookActivity" android:theme="@android:style/Theme.Translucent.NoTitleBar" android:label="YourAppName" android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation" />
Expand Down
8 changes: 5 additions & 3 deletions apidoc/Facebook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@ description: |
* Sharing content using Facebook dialogs or the [Like button](Modules.Facebook.LikeButton).
**Using Facebook module with iOS 10 and Xcode 8**
To log in using Facebook, we now have to include an entitlements file that enables Keychain Sharing
Capabilities. To do so, create a `/platform/ios/<appname>.entitlements` file with this content
**Using Ti.Facebook with iOS 10 and Xcode 8**
To log in using Facebook on iOS Simulator, you now must include an entitlements file that enables Keychain
Sharing Capabilities. While the entitlements file is not necessary for device build (it is self-generated),
it won't affect anything in your build. To do so, create a `/platform/ios/<name>.entitlements` file (replace
<name> with the name element in tiapp.xml) with this content:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
Expand Down
17 changes: 5 additions & 12 deletions ios/Classes/FacebookModule.m
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ -(void)handleRelaunch:(NSNotification *)notification

-(void)resumed:(id)note
{
// NSLog(@"[DEBUG] facebook resumed");
[self handleRelaunch:nil];
[FBSDKAppEvents activateApp];
}

Expand Down Expand Up @@ -91,16 +91,6 @@ -(void)shutdown:(id)sender
[super shutdown:sender];
}

-(void)suspend:(id)sender
{
// NSLog(@"[DEBUG] facebook suspend");
}

-(void)paused:(id)sender
{
// NSLog(@"[DEBUG] facebook paused");
}

#pragma mark Auth Internals

- (void)populateUserDetails {
Expand Down Expand Up @@ -445,7 +435,10 @@ -(void)initialize:(id)args
[nc addObserver:self selector:@selector(accessTokenChanged:) name:FBSDKAccessTokenDidChangeNotification object:nil];
[nc addObserver:self selector:@selector(activateApp:) name:UIApplicationDidFinishLaunchingNotification object:nil];
[nc addObserver:self selector:@selector(currentProfileChanged:) name:FBSDKProfileDidChangeNotification object:nil];
[nc addObserver:self selector:@selector(handleRelaunch:) name:kTiApplicationLaunchedFromURL object:nil];

// Only triggered by Titanium SDK 5.5.0+
// Older SDK's get notified by the `resumed:` delegate
[nc addObserver:self selector:@selector(handleRelaunch:) name:@"TiApplicationLaunchedFromURL" object:nil];

if ([FBSDKAccessToken currentAccessToken] == nil) {
[self activateApp:nil];
Expand Down
2 changes: 1 addition & 1 deletion ios/manifest
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# this is your module manifest and used by Titanium
# during compilation, packaging, distribution, etc.
#
version: 5.2.5
version: 5.2.6
apiversion: 2
description: Allows Facebook integration for Titanium apps
author: Mark Mokryn, Ng Chee Kiat and Hans Knoechel
Expand Down
2 changes: 1 addition & 1 deletion ios/module.xcconfig
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

//
// How to add a Framework (example)
FRAMEWORK_SEARCH_PATHS=$(SRCROOT)/../../modules/iphone/facebook/5.2.5/platform "~/Library/Application Support/Titanium/modules/iphone/facebook/5.2.5/platform"
FRAMEWORK_SEARCH_PATHS=$(SRCROOT)/../../modules/iphone/facebook/5.2.6/platform "~/Library/Application Support/Titanium/modules/iphone/facebook/5.2.6/platform"
OTHER_LDFLAGS=$(inherited) -framework Social -framework FBSDKCoreKit -framework FBSDKLoginKit -framework FBSDKShareKit -framework FBSDKMessengerShareKit -framework Bolts
//
// OTHER_LDFLAGS=$(inherited) -framework Foo
Expand Down

0 comments on commit b5d5aa1

Please sign in to comment.