Skip to content

Commit

Permalink
Merge pull request #102 from ERahnen/master
Browse files Browse the repository at this point in the history
Adding Foursquare capabilities
  • Loading branch information
pelegri committed Apr 23, 2013
2 parents e2a9735 + d419c48 commit 000886f
Show file tree
Hide file tree
Showing 6 changed files with 600 additions and 53 deletions.
17 changes: 15 additions & 2 deletions socialinvocation/ReadMe.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
socialinvocation - Invoking Twitter, Facebook, and LinkedIn
socialinvocation - Invoking Twitter, Facebook, LinkedIn, and Foursquare
========================================================================

The socialinvocation sample shows developers how to invoke Twitter, Facebook, and LinkedIn with all the supported invocation parameters. In order to invoke each of these apps the user must have an account with each app and be logged in on the device.
The socialinvocation sample shows developers how to invoke Twitter, Facebook, LinkedIn, and Foursquare with all the supported invocation parameters. In order to invoke each of these apps the user must have an account with each app and be logged in on the device.

The socialinvocation app demonstrates the following:

Expand Down Expand Up @@ -31,3 +31,16 @@ LinkedIn
- Compose a LinkedIn update
- Invoke LinkedIn to a hardcoded profile. Note that the developer will need to add the public LinkedIn profile URL that they wish to invoke (none is provided by default). It will be of the form: www.linkedin.com/pub/firstname-lastname/xx/yyy/zzz/

Foursquare

- Add friends to Foursquare from your Contacts
- Search for a venue in Foursquare, either in the app or using the Foursquare card
- Invoke Foursquare to view or update your profile
- Invoke Foursquare to view your current/suggested friends
- Invoke Foursquare to view Page suggestions
- Invoke Foursquare to view a venue/check-in/someone's profile
- Invoke Foursquare to see what's nearby (Explore)
- SSO into Foursquare



203 changes: 184 additions & 19 deletions socialinvocation/assets/main.qml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/* Copyright (c) 2013 Research In Motion Limited.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Expand Down Expand Up @@ -39,7 +39,6 @@ TabbedPane {
}
}
]

GeneralBlock {
id: generalShare
}
Expand Down Expand Up @@ -91,15 +90,14 @@ TabbedPane {
uri: _dirPaths.asset + "images/MissScarlett.png"
}
}
//! [1]
//! [1]
]
titleBar: TitleBar {
title: qsTr("Social Invocation - Facebook")
}
GeneralBlock {
id: fbShare
statusLabel: qsTr("Set your Facebook Status")

Divider {
}

Expand Down Expand Up @@ -142,8 +140,7 @@ TabbedPane {
Button {
text: qsTr("GO!")
onClicked: {
_socialInvocation.invoke("com.rim.bb.app.facebook", "bb.action.OPEN",
fbGroup.selectedValue, txtFBProfile.text)
_socialInvocation.invoke("com.rim.bb.app.facebook", "bb.action.OPEN", fbGroup.selectedValue, txtFBProfile.text)
}
verticalAlignment: VerticalAlignment.Center
layoutProperties: StackLayoutProperties {
Expand All @@ -152,10 +149,8 @@ TabbedPane {
}
//! [2]
}

Divider {
}

Label {
text: qsTr("Share an image on Facebook")
textStyle.fontWeight: FontWeight.Bold
Expand Down Expand Up @@ -213,7 +208,7 @@ TabbedPane {
uri: _dirPaths.camera + "IMG_00000004.jpg"
}
}
//! [4]
//! [4]
]
titleBar: TitleBar {
title: qsTr("Social Invocation - Twitter")
Expand Down Expand Up @@ -243,8 +238,7 @@ TabbedPane {
Button {
text: qsTr("GO!")
onClicked: {
_socialInvocation.invoke("com.twitter.urihandler", "bb.action.VIEW",
"", "twitter:connect:" + txtProfile.text)
_socialInvocation.invoke("com.twitter.urihandler", "bb.action.VIEW", "", "twitter:connect:" + txtProfile.text)
}
verticalAlignment: VerticalAlignment.Center
layoutProperties: StackLayoutProperties {
Expand Down Expand Up @@ -275,8 +269,7 @@ TabbedPane {
Button {
text: qsTr("GO!")
onClicked: {
_socialInvocation.invoke("com.twitter.urihandler", "bb.action.VIEW",
"", "twitter:search:" + txtSearch.text)
_socialInvocation.invoke("com.twitter.urihandler", "bb.action.VIEW", "", "twitter:search:" + txtSearch.text)
}
verticalAlignment: VerticalAlignment.Center
layoutProperties: StackLayoutProperties {
Expand All @@ -285,7 +278,6 @@ TabbedPane {
}
//! [6]
}

Label {
text: qsTr("Share an image on Twitter")
textStyle.fontWeight: FontWeight.Bold
Expand Down Expand Up @@ -335,11 +327,10 @@ TabbedPane {
// LinkedIn will display a permission error.
//
// Add your LinkedIn URL to the fourth parameter below
_socialInvocation.invoke("com.linkedin.urihandler", "bb.action.VIEW",
"", "linkedin:contact:" + "")
_socialInvocation.invoke("com.linkedin.urihandler", "bb.action.VIEW", "", "linkedin:contact:" + "")
}
}
//! [8]
//! [8]
]
titleBar: TitleBar {
title: qsTr("Social Invocation - LinkedIn")
Expand All @@ -350,4 +341,178 @@ TabbedPane {
}
}
}
Tab {
title: qsTr("Foursquare")
Page {
actions: [
//! [9]
// Foursquare - invoke to update profile
ActionItem {
ActionBar.placement: ActionBarPlacement.OnBar
title: qsTr("Update Profile")
onTriggered: {
_socialInvocation.invoke("com.foursquare.blackberry.uri", "bb.action.OPEN", "", "foursquare://users/self/update")
}
},

// Foursquare - invoke to view profile
ActionItem {
ActionBar.placement: ActionBarPlacement.OnBar
title: qsTr("View Profile")
onTriggered: {
_socialInvocation.invoke("com.foursquare.blackberry.uri", "bb.action.OPEN", "", "foursquare://users/self")
}
},

// Foursquare - invoke to Friend Requests
ActionItem {
ActionBar.placement: ActionBarPlacement.OnBar
title: qsTr("View Friend Requests")
onTriggered: {
_socialInvocation.invoke("com.foursquare.blackberry.uri", "bb.action.OPEN", "", "foursquare://users/requests")
}
},

// Foursquare - invoke to Friend Suggestions
ActionItem {
title: qsTr("View Friend Suggestions")
onTriggered: {
_socialInvocation.invoke("com.foursquare.blackberry.uri", "bb.action.OPEN", "", "foursquare://users/suggest?type=friend")
}
},

// Foursquare - invoke to Page Suggestions
ActionItem {
title: qsTr("View Page Suggestions")
onTriggered: {
_socialInvocation.invoke("com.foursquare.blackberry.uri", "bb.action.OPEN", "", "foursquare://users/suggest?type=page")
}
},

// Foursquare - invoke to Explore Venues
ActionItem {
title: qsTr("Explore")
onTriggered: {
_socialInvocation.invoke("com.foursquare.blackberry.uri", "bb.action.OPEN", "", "foursquare://venues/explore")
}
},

// Foursquare - invoke to a specific venue
// Instructions on determining the venue ID can be found here:
// http://support.foursquare.com/entries/211232-How-do-I-find-the-venue-URL-
ActionItem {
title: qsTr("View Venue")
onTriggered: {
_socialInvocation.invoke("com.foursquare.blackberry.uri", "bb.action.OPEN", "", "foursquare://venues/4b7b1529f964a5206b502fe3")
}
},

// Foursquare - invoke to a specific check-in
ActionItem {
title: qsTr("View Check-in")
onTriggered: {
// URI format is "foursquare://checkins/" + check-in ID
//
// Please note that you must be Foursquare friends with the
// person whose check-in you wish to view. Otherwise Foursquare
// will display a permission error.
//
// Add your check-in ID to the fourth parameter below
_socialInvocation.invoke("com.foursquare.blackberry.uri", "bb.action.OPEN", "", "foursquare://checkins/" + "")
}
},

// Foursquare - invoke to view someone's profile
// The user's userid is sent as a parameter. Your userid
// can be found on your Foursquare Settings Page
ActionItem {
ActionBar.placement: ActionBarPlacement.OnBar
title: qsTr("View Jesse's Profile")
onTriggered: {
_socialInvocation.invoke("com.foursquare.blackberry.uri", "bb.action.OPEN", "", "foursquare://users/452591")
}
},
// Foursquare - SSO
ActionItem {
title: qsTr("Allow SSO")
onTriggered: {
_socialInvocation.onSSO()
}
}

//! [9]
]
titleBar: TitleBar {
title: qsTr("Social Invocation - Foursquare")
}
Container {
leftPadding: 20.0
rightPadding: 20.0
topPadding: 20.0
bottomPadding: 20.0
Label {
text: qsTr("Add Friends")
textStyle.fontWeight: FontWeight.Bold
}
Container {
layout: StackLayout {
orientation: LayoutOrientation.LeftToRight
}

// Implemented as a dropdown to easily add additional options
// when supported
DropDown {
title: "Find Friends From:"
enabled: true
id: ddSearch
Option {
text: "Contacts"
value: "phonebook"
selected: true
}

verticalAlignment: VerticalAlignment.Center
layoutProperties: StackLayoutProperties {
spaceQuota: 0.75
}
}
Button {
text: qsTr("GO!")
onClicked: {
_socialInvocation.invoke("com.foursquare.blackberry.uri", "bb.action.OPEN", "", "foursquare://users/addfriends?from=" + ddSearch.selectedValue)
}
verticalAlignment: VerticalAlignment.Center
layoutProperties: StackLayoutProperties {
spaceQuota: 0.25
}
}
}
Label {
text: qsTr("Search Foursquare")
textStyle.fontWeight: FontWeight.Bold
}
TextField {
id: txtVenue
hintText: qsTr("Enter Venue Name")
}
Container {
layout: StackLayout {
orientation: LayoutOrientation.LeftToRight
}
Button {
text: qsTr("Search Card")
onClicked: {
_socialInvocation.invokeFoursquareVenueCard(txtVenue.text)
}
}
Button {
text: qsTr("Invoke App")
onClicked: {
_socialInvocation.invoke("com.foursquare.blackberry.uri", "bb.action.OPEN", "", "foursquare://venues/search?query=" + txtVenue.text)
}
}
}
}
}
}
}
1 change: 1 addition & 0 deletions socialinvocation/socialinvocation.pro
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ APP_NAME = socialinvocation

CONFIG += qt warn_on cascades10
LIBS += -lbbsystem
LIBS += -lbbdata

include(config.pri)
Loading

0 comments on commit 000886f

Please sign in to comment.