#Orange trust badge iOS Reference
With the Orange trust badge, aka "Badge de confiance", give transparent informations and user control on personal data and help users to identify if your application has any sensitive features.
Orange trust badge displays how are handled the following data :
- Identity of the User
- Location
- Photos
- Contacts
- Usage data
- Calendar
- SMS
- Microphone
- Phone
- Body sensors
- Social Sharing
- In-app purchase
- Advertising
It also displays the following informations :
- Application's rating
- Data usage general description
- Help
- Privacy policy
It also :
- Works on iPhone and iPad using Autolayout (iPad Multitasking supported)
- Localized in 2 languages (English,French)
- Written in Swift 3.0 but works in Objective-C or Swift based Projects
- API hooks
- UI Customization
- iOS 8.0+
- Xcode 8.0+
- CocoaPods 1.0.1+
- If you find any bugs, please submit a bug report through Github and/or a pull request.
An example of integration is provided in OrangeTrustBadgeDemo project.
Embedded frameworks require a minimum deployment target of iOS 8
CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:
$ gem install cocoapods
CocoaPods 1.0.1+ is required to build OrangeTrustBadge.
To integrate OrangeTrustBadge into your Xcode project using CocoaPods, specify it in your Podfile
:
platform :ios, '8.0'
use_frameworks!
source 'https://github.com/CocoaPods/Specs.git'
pod 'OrangeTrustBadge'
Then, run the following command:
$ pod install
If you prefer not to use either of the aforementioned dependency managers, you can integrate OrangeTrustBadge into your project manually.
- Clone OrangeTrustBadge Repository by typing in your Terminal
$ git clone https://github.com/Orange-OpenSource/orange-trust-badge-ios.git
- Go into
orange-trust-badge-ios
directory by typing in Terminal
$ cd orange-trust-badge-ios/
- Then, run the following command:
$ pod install
- You should now be able to open
OrangeTrustBadge.xcworkspace
located at the same level ofOrangeTrustBadge.xcodeproj
. - Now we will build a FAT dynamic framework containing all architectures to make it run on Simulator as well as Real Devices (ARM,ARM64,i386 and x86_64). To do that, please select the appropriate target named
build-fat-framework
and start archiving it withProduct > Archive
(important to run "Archive" and not just Build/Run the target). - Once finished, the Finder should have opened a window containing a fresh build of the framework named
OrangeTrustBadge.framework
In your own Xcode project :
- In the tab bar at the top of that window, open the "General" panel.
- Drag and drop generated Framework into the "Embedded Binaries" section.
- If your project is not a Swift Project, go into "Build Settings" tab and find the parameter EMBEDDED_CONTENT_CONTAINS_SWIFT and set it to YES.
- Finally, find update the parameter value of "ENABLE_BITCODE" to "NO"
The
OrangeTrustBadge.framework
is automagically added as a target dependency, linked framework and embedded framework in a copy files build phase which is all you need to build on the simulator and a device.
- Don't forget to add a build phase to strip simulators architectures in case of a Release to avoid any issues when uploading your app to the AppStore. To do that, simply go into
Build Phases
Tab of your project, add aNew Run Script Phase
and put the script above into the textfield located under "/bin/sh". This new Run Script phase should be placed at the end of the phases list.
OUTPUT_DIR="${DWARF_DSYM_FOLDER_PATH}/strip"
rm -rf "$OUTPUT_DIR"
mkdir "$OUTPUT_DIR"
INPUT_FRAMEWORK_BINARY=`find ${DWARF_DSYM_FOLDER_PATH}/${FRAMEWORKS_FOLDER_PATH}/ -type f -name OrangeTrustBadge`
OUTPUT_FRAMEWORK_BINARY="${OUTPUT_DIR}/OrangeTrustBadge"
# remove simulator arch from the release
if [ "$CONFIGURATION" == "Release" ]; then
if [ "$CURRENT_ARCH" != "x86_64" ]; then
lipo "${INPUT_FRAMEWORK_BINARY}" -verify_arch x86_64
if [ $? == 0 ] ; then
REMOVE_ARCHS="-remove x86_64"
arch_found=true
fi
lipo "${INPUT_FRAMEWORK_BINARY}" -verify_arch i386
if [ $? == 0 ] ; then
REMOVE_ARCHS="${REMOVE_ARCHS} -remove i386"
arch_found=true
fi
if [ "$arch_found" == "true" ]; then
lipo ${REMOVE_ARCHS} "${INPUT_FRAMEWORK_BINARY}" -output "${OUTPUT_FRAMEWORK_BINARY}"
cp -f "${OUTPUT_FRAMEWORK_BINARY}" "${INPUT_FRAMEWORK_BINARY}"
rm -rf "$OUTPUT_DIR"
codesign --force --sign "${EXPANDED_CODE_SIGN_IDENTITY}" --timestamp=none --verbose `dirname ${INPUT_FRAMEWORK_BINARY}`
fi
fi
fi
- And that's it!
In swift
import OrangeTrustBadge
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
TrustBadgeManager.with(TrustBadgeConfig())
return true
}
or in Objective-C
#import "OrangeTrustBadge-Swift.h"
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[TrustBadgeManager with:[[TrustBadgeConfig alloc] init]];
return YES;
}
- create an IBAction connected to one of your interface element (e.g a button, a cell etc...).
- Instanciate OrangeTrustBadge storyboard with the following lines :
import OrangeTrustBadge
@IBAction func onButtonClicked(){
let storyboard = UIStoryboard(name: "OrangeTrustBadge", bundle: NSBundle(forClass: TrustBadgeManager.self))
if let viewController = storyboard.instantiateInitialViewController() {
self.navigationController?.presentViewController(viewController, animated: true, completion: nil)
}
}
That's it !
- Open your storyboard file and add a Storyboard reference object in it
- Click on newly created Storyboard Reference and go into Attribute inspector on the right panel
- In Storyboard field, select
OrangeTrustBadge
- In Bundle field, type
org.cocoapods.OrangeTrustBadge
- Finally, create a segue from the appropriate button or cell in your app and this Storyboard Reference (Some segue types might be unavailable since this component is using UISplitViewController - Try "Present Modally" to start)
That's it !
In order to localize properly the UI, OrangeTrustBadge is using standard iOS mechanisms. Concretly the SDK will take the current language setup on user's phone unless your app support this localization. English will be taken by Default.
To add a localization support, go to Project Level and add appropriate localization in "Info" Tab.
You can override every visible text using your own Localizable.strings file. To know which key you need to override, please see SDK 's Localization file.
OrangeTrustBadge can be customized in various ways
In this View are displayed two pre-defined sections showing TrustBadge Elements and their underlying status. Although it is required to have at least one item in the first section, you can fully customize the different sections using PreDefined or Custom Elements.
- A PreDefinedElement that is automagically setup for common cases
Note: If desired, you will be able to also customize the behavior of PreDefinedElements. Be sure to disengage automatic setup by setting the property shouldBeAutoConfigured to false. (e.g : aPreDefinedElement.shouldBeAutoConfigured = false)
In swift
let advertisingElement = PreDefinedElement(type: .Advertising)
advertisingElement.statusClosure = {() in return true}
config.mainElements.append(advertisingElement)
- A CustomElement on which you have full control of displayed informations
In swift
let myCustomElement = CustomElement(nameKey: "custom-element-name-key", descriptionKey: "custom-element-description-key", statusEnabledIconName: "custom-element-enabled-icon", statusDisabledIconName: "custom-element-disabled-icon")
myCustomElement.isConfigurable = false
myCustomElement.statusClosure = {() in return true}
config.otherElements.append(myCustomElement)
In this section you will find Standardized Terms ans conditions that can be replaced / updated according to your needs through Localization. If you want to add a section in this View, you just have to add a new Term instance :
In swift
let customTerm = Term(type: .Custom, titleKey: "term-custom-title", contentKey: "term-custom-content")
config.terms.append(customTerm)
You can even display Dailymotion videos explaining your policies using .Video TermType. Please fill in "contentKey" with the video ID from Dailymotion (ex: x3xwu6v ).
TrustBadgeElements and Terms descriptions may contains HTML code, with the following restriction :
- UTF-8 encoded
- no external resource (image, css, ...) can be used
When HTML is possible, there are 2 cases
- Full HTML : you must provide a HTML code WITH
<html>
and<body>
tags - Partial HTML : you must provide a HTML code WITHOUT
<html>
and<body>
tags
Descriptions should include a stylesheet named <span class="p">
.
You can provide to OrangeTrustBadge your own CSS file by placing a file named style.css in your application bundle.
In HTML
<!DOCTYPE html>
<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="content-type">
<style type="text/css">$$cssStylesheet$$</style>
</meta>
</head>
<body>
<h1>Aide</h1>
<p>Si besoin, votre application met à disposition cette adresse mail pour répondre à vos questions :</p>
<span class="p">
<!-- span.p is used for last paragraph, otherwise layount is broken-->
foo.bar@example.com
</span>
</body>
</html>
Some tokens will be available over time, but for the moment you can only use
OrangeTrustBadge is not requesting anything on the network unless you include videos in the Terms section. Videos are hosted on Dailymotion.com and connections made to this service are compliant with ATS policies.
OrangeTrustBadge was made with love by Orange
If you believe you have identified a security vulnerability with OrangeTrustBadge, you should report it as soon as possible on the bug tracker.
OrangeTrustBadge Copyright (C) 2016 Orange
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. See the License for the specific language governing permissions and limitations under the License.