Sightline iPad Application KNOWLEDGE TRANSFER DOCUMENT

blareweyrΛογισμικό & κατασκευή λογ/κού

13 Δεκ 2013 (πριν από 3 χρόνια και 7 μήνες)

207 εμφανίσεις

















Sightline iPad Application


KNOWLEDGE TRANSFER DOCUMENT



Table of Contents

1.

Introduction

................................
................................
................................
.......................

3

2.

RhoHub

................................
................................
................................
................................
.

4

2.1.

Adding additional RhoHub users

................................
................................
......................

4

2.2.

RhoHub Administration

................................
................................
................................
.......

4

2.3.

RhoSync Console

................................
................................
................................
.....................

4

2.4.

RhoSync Deployment

................................
................................
................................
............

5

2.5.

RhoHub Git Repository

................................
................................
................................
.........

5

3.

iOS Provisioning Portal
................................
................................
................................
...

7

3.1.

Adding Users
................................
................................
................................
.............................

7

3.2.

Setup Development Profile

................................
................................
................................
.

7

3.3.

Setup Distribution Profile

................................
................................
................................
...

8

3.4.

Setup Xcode Code Signing

................................
................................
................................
....

8

4.

Development Environment

................................
................................
...........................

9

4.1.

Project Setup

................................
................................
................................
............................

9

4.2.

Xcode Project Structure
................................
................................
................................
........

9

4.3.

Objective C Client Setup

................................
................................
................................
.....

10

4.4.

RhoSync Application Structure

................................
................................
.......................

11

4.5.

Web Service Structure

................................
................................
................................
.......

12

4.6.

Running RhoSync Locally

................................
................................
................................
..

12

4.7.

Emulator Database

................................
................................
................................
..............

12

5.

Distribution

................................
................................
................................
.....................

13

5.1.

Creating an Enterprise Build

................................
................................
...........................

13

5.2.

Installing through iTunes

................................
................................
................................
.

13

5.3.

Distributing through TestFlight

................................
................................
.....................

13

5.4.

Distributing through a Website

................................
................................
......................

14

6.

Show Setup

................................
................................
................................
.......................

16

6.1.

Setup a SightLine Show Instance

................................
................................
....................

16

6.2.

Show and User Setup in Plasma

................................
................................
......................

16

7.

Dropbox
................................
................................
................................
.............................

17

8.

Resources

................................
................................
................................
.........................

17




1.

Introduction


The purpose of this document is to describe the processes needed to
support
SightLine. The contents of this document will be used by Freeman to provide
ongoing maintenance of the application and
it’s
underlying services.

2.

RhoHub


RhoHub
is a service provided by RhoMobile that offers

version control and a hosted
RhoSync

server.
The SightLine

code
is stored in

a RhoHub Git repository and
the
application connects

to a RhoSync server running on RhoHub
. The following
RhoHub projects are setup for SightLine:



freeman / FreemanIpad
-
DEV


freeman / FreemanIpad
-
QA


freeman / F
reemanIpad
-
PROD


2.1.

Adding

additional

RhoHub
users


Additional users may be added to the Freeman projects as collaborators.
Each
collaborator
must
create an account and
add a unique SSH public key to their
account. These keys provide read/write access to th
e project.

To add additional
collaborators
, follow the
instructions

at:

http://docs.rhomobile.com/rhohub/tutorial#setup


2.2.

RhoHub Administration


The following administration options are
availa
ble within the

RhoHub
projects
:


Live app

Leave Live App ON at all times.
Live App ON supports 1000 devices and a 5GB
Redis size.
Turning Live App OFF will limit th
e maximum number of
devices

to
10 and reduce the Redis size.


Heroku Logs

Displays real time RhoSync operations and logs.


2.3.

RhoSync Console


The console provides a web administration interface for RhoSync.
Access the
RhoSync Console by c
licking the link next to ‘Deployed:’
in the RhoHub
project
.
The default username is ‘rhoadm
in
’ and the password is empty.


Some of the i
mportant management options are:


Available

number of devices

Displays how many devices are registered. The limit is 1000 devices

when Live
App is on.


Users

Displays
current logged in users
. Selecting a user
provides

the ability to view
user stats, synced models, and delete the user
.

Selecting ‘user partition sources’
displays what data is currently synced to the Redis database for that user.
Deleting a user
will remove the user’s Redis database and
can incr
ease the
available number of devices.


Resque

Displays
RhoSync and Redis DB statistics
.


2.4.

RhoSync Deployment


The following outlines the steps necessary to redeploy the RhoSync service.


1.

Select the appropriate RhoHub project.

2.

Press the ‘Deploy’ button. DO
NOT select the ‘Undeploy’ button, as this
will cause issues with the RhoSync services. Undeploying the service will
remove vital backend settings set by RhoMobile for the project.


2.5.

RhoHub Git Repository


Each Freeman RhoHub
project

hosts two Git

repositories. Git is a version control
system that contains all the code revisions. The first repository contains the
Objective C and SightLine web service code. The second repository contains the
SightLine RhoSync code. Each repository is listed belo
w:


Objective C

/

Web Service Code

git@git.rhohub.com:freeman/FreemanIpad
-
DEV
-
rhodes.git

git@git.rhohub
.com:freeman/FreemanIpad
-
QA
-
rhodes.git

git@git.rhohub.com:freeman/FreemanIpad
-
PROD
-
rhodes.git


RhoSync Code

git@git.rhohub.com:freeman/FreemanIpad
-
DEV
-
rhosync.git

git@git.rhohub.com:freeman/FreemanIpad
-
QA
-
rhosyn
c.git

git@git.rhohub.com:freeman/FreemanIpad
-
PROD
-
rhosync.git



Git can either be used through the command line or through a GUI Git Tool.
Gitbox is a
recommended
free Git GUI
tool.
A brief overview of the steps
necessary to use Git is

listed below.


1.

Install and setup Git.

2.

Clone the Freeman Git repositories on your local machine. Example: ‘git
clone
g
it@git.rhohub.com:freeman/FreemanIpad
-
DEV
-
rhodes.git


3.

Edit code.

4.

Add changed files you wish to commit.

5.

Commit changes to your local repository.

6.

Push changes to the master repository.


The following steps describe how to merge code between Git repositories.

The
example
below
describes the merge process from DEV to QA.


1.

Pull the latest code from DEV and QA. In this example, the DEV code
exists

in a folder named FreemanIpad
-
DEV
-
rhosync and the QA code
exists
in a folder named FreemanIpad
-
QA
-
rhosync.

2.

cd
FreemanIpad
-
QA
-
rhosync

3.

git remote add devAlias ../FreemanIpad
-
DEV
-
rhosync && git fetch
devAlias

4.

git merge devAlias/master

5.

git push


The following resources provide
more
in
-
depth Git instructions:

http://book.git
-
scm.com/index.html

http://developer.apple.com/library/mac/#documentation/ToolsLanguages
/Conceptual/Xcode4UserG
uide/SCM/SCM.html



3.

iOS Provisioning Portal


The Apple iOS Provisioning Portal
allows developers to manage the steps necessary
to setup, test, and prepare their apps for distribution.

The portal can be accessed
through
: http://developer.apple.com/devcente
r/ios/


An enterprise account named Freeman Decor
ating Services, Inc. is setup.
The team
agent login credentials are:



Username: freeman company


Password: Freeman1!


3.1.

Adding Users


The team agent or admins can add additional developers to the enterprise
account. The following steps describe how add additional dev
elopers to the
development team.


1.

Login into the apple developer Member Center.

2.

Select the People tab.

3.

Select invitations.

4.

Send an invitation.

5.

The recipient will receive an email with instructions on how to accept the
invitation.


3.2.

Setup Development Profile


Developers need to setup a development certificate, register their device, and be
added to the development provisioning profile.
This is required in order to build
the Xcode project and run the application.
The follow
ing steps describe this
process.


1.

Nav
igate to the Certificates section of the provisioning portal

and press the
Development tab.

2.

Download and install the WWDR intermediate certificate if needed.

To
install, double
-
click on the file to
install

it into the Keychain Access program.

3.

Press Reques
t Certific
ate and follow the instructions to create a certificate for
your computer.

4.

Once issued, download and
double
-
click the file to install it into the Keychain
Access program.

5.

Navigate to the Devices section of the provisioning portal, press Add Devic
es,
and add your device.

6.

Navigate to the Provisioning section of the provisioning portal and press the
Development tab.

7.

Press Edit


Modify on the Freeman Enterprise Development profile.

8.

Select your certificate and device and press Submit.

This will add you to the
development provisioning profile.

9.

Once active, download and drag the file onto Xcode to install.


3.3.

Setup Distribution Profile


There should only be one distribution certificate and one distribution
provisioning profile

for the en
terprise account.
The following steps describe
setting up an environment for enterprise distribution.


1.

Navigate to the Certificates section of the provisioning portal and press the
Distribution tab.

2.

Download the ‘Freeman Decorating Services, Inc.’ certifi
cate.

3.

Navigate to the Provisioning section of the provisioning portal and press the
Distribution tab.

4.

Download the ‘Freeman Enterprise’ provisioning profile.

5.

Double click the certificate to install into the Keychain Access program.

6.

Drag the provisioning profile onto Xcode to install.

7.

Double click
the ‘enterprise_cert.p12’ private key

to install into the Keychain
Access program
.

The password is ‘Pariveda1’.

The private key certificate

is
located with the project hand off documents.


3.4.

Setup Xcode Code Signing


The Freeman Xcode project must
be
built and signed with either
the

Freeman
Enterprise D
evelopment
provisioning profile
or
Freeman Enterprise
Distribution

provisioning prof
ile.
In the Freeman Target Build Settings

within
Xcode
, set the Code Signing Identity
to either profile
. When debugging on the
device, the developer profile must be set. When creating an archive distribution
build, the distribution profile must be set.



4.

Development Environment

4.1.

Project Setup


1.

Install the la
test version of Xcode.

2.

Create a root folder to contain all the necessary project folders. The root
folder name should not include spaces. Folders inside the root folder must
be in the correct locations or relative paths inside the application will be
bro
ken.

3.

Clone
git@git.rhohub.com:freeman/FreemanIpad
-
DEV
-
rhodes.git

into the
root folder.

4.

Clone
git@git.
rhohub.com:freeman/FreemanIpad
-
DEV
-
rhosync.git

into the
root folder.

5.

Clone the additional QA and PROD repositories into the root folder.

6.

Create a folder named ‘Rhodes’ inside the root folder. Clone
h
ttps://github.com/rhomobile/rhodes.git

into the root/Rhodes folder.



4.2.

X
code
Project Structure


The
Freeman Xcode project

is structured as follows:


Classes

The Objective C
classes

are separated between Concierge and SightLine and are
structured as follows:


Application

Contains application level classes such as the application delegate, constants,
and enums.


Controllers

Contains classes responsible for the presentation layer.


Infrastructure

Contains database access repositories, login authentication class
es, and
utilities.


Models

Contains
models that map to the database entities.


db

Contains the SQLite database schema and triggers that create the database for
use with the RhoConnectClient.


Resources

Contains the applications images, views (screens), tu
torial, and dashboard
graphing files.


Frameworks

Contains the
required project frameworks, SQLite libraries, and the dashboard
graph library (CorePlot).


FreemanTests

Contains
unit tests

written
using the SenTestingKit framework. OCMock

is used
for creating and using mock objects.


RhoConnectClient

The RhoConnectClient project depende
ncy that is required to interface with
RhoSync.


4.3.

Objective C Client Setup


The
RhoSync Objective C

Client is setup in
RhoConnectEngine.m.

A singleton instan
ce of the engine is created on initial login and re
-
used
throughout the application.

A RhomModel instance must be registered with the
engine for each source adapter. RhomModels
contains CRUD operations to
interact with the SQLite database

and source adapters
.
A RhomModel is setup
in
the RhoConnectEngine
using

the following properties and methods.


name

The name property should match the source adapter class name and the schema
table name.


model_type

SightLine uses fixed schema models. W
ith a fixed schema model, each model has
a separate database table and each attribute exists as a column in the table. Set
the model_type to RMT_PROPERTY_FIXEDSCHEMA.


a
ssociations

Associations are similar to foreign keys and offer a means to automaticall
y
trigger sync updates for dependent objects.
Associations are set on the child
model using a dictionary
. The
dictionary
object is the parent model name and
the
dictionary
key is the parent primary key.


add_blob_attribute

method

Blob attributes declare that a model
syncs

images or binary objects. The blob
attribute’s value is downloaded separately from the rest of the data and stored
on the iPad file system. Blob setup is required
for

both the client and source
adapter.

A source adapter will automatically recognize a blob attribute when the
attributes name ends with ‘
-
rhoblob’. ‘
-
rhoblob’ should only be
appended

in the
source adapter and not
in the

RhomModel or database schema. An example is

SightLine image syncing
.
The SL_File source adapter declares a blob named
‘ImageUri
-
rhoblob’ and the RhomModel blob attribute is set to ‘ImageUri’.


synctype

All the Concierge Elite and SightLine
RhomModels

are registered
when the
engine is instantiated
.
The

model
sync type is se
t

to determine if the model
should sync or not
. Models that are required to sync should have a sync type of
‘incremental’. Models that are not supposed to sync should have a sync type of
‘none’.
A SQL statement is currently executed
to update each model
’s sync type
when the user changes betwee
n Concierge Elite and SightLine.


4.4.

RhoSync Application Structure


RhoSync is a synchronization framework integrating the SightLine iPad
application with Freeman web services.

A RhoSync application
written in Ruby
handles the synchronization between the two. The
following outlines the
SightLine RhoSync app
lication design.


a
pplication.rb

Handles user

and show

authentication. The username parameter is a pipe
-
delimitated string containing both the username and event

name.

Authentication is performed through the following steps:

1.

The username and password is authenticated through Plasma.

2.

A list of shows is retrieved for the user to determine if the user is authorized
for the event.

3.

The Event Id associated to the event

name is retrieved from the SightLine
database and cached. The event Id is required for all subsequent service
requests.


settings.yml

Contains each source adapter’s settings and endpoint configurations for the DEV,
QA, and PROD environments.

A poll_inte
rval is set for each source adapter. The
poll_interval is the minimum amount of time before RhoSync queries the
REST
services and updates Redis with the results.

Credentials to access

Concierge
Elite dashboard data are set for each environment. The credentials for
production are:


ce_username: crlogin


ce_password: crlogin


license.key


source adapters

The sources folder contains all the source adapters for SightLine

and Concierge
Elite. The source adapters contain CRUD operations that call
an

appropriate
REST service.

Each registered Objective C RhomModel requires a source adapter
to be created.



4.5.

Web Service Structure


The web service structure and design.



4.6.

Runni
ng RhoSync Locally


SightLine can be run against a local RhoSync instance when using the emulator.
To point the code to a local instance, change the sclient.sync_server path in the
RhoConnectEngine.m to:

http://localhost:9292/application


For instructions on setting up and running RhoSync locally, following the
instructions at:

http://docs.rhomobile.com/rhoconnect/install


4.7.

Emulator Database


Sig
htLine uses a SQLite database to store content. When using the emulator, the
local database can be accessed. SQLite Database Browser is a free tool that can
be used to access the database. The database path is:


~/Library/Application Support/iPhone
Simulator/(version)/Applications/(appID)/Documents/db/syncdbuser.sqlite



5.

Distribution

5.1.

Creating an Enterprise Build


The following outlines the step
s necessary to
create an enterprise
distribution
build of SightLine in Xcode.


1.

Set
your scheme to Freeman


iOS Device.

2.

In the Freeman Target Build Settings, set the Code Signing Identity to
the
Freeman Enterprise iPhone Distribution profile.

3.

In the RhoConnectClient Project Build Settings, set Skip Install to ‘YES’.

4.

Selec
t Archive from the Product menu.

5.

The Orga
nizer


Archive screen will display once the archive is done.

6.

Press Share.

7.

Select iOS App Store Package (.ipa).

8.

Select the iPhone Distribution identity matching the Freeman distribution
certificate.

9.

Select Next.

10.

Check ‘Save for Enterprise Distribution’.

11.

En
ter the A
pplication URL
and Title. The Application URL is the path that
the ipa file will be hosted at.

a.

If you are hosting from dropbox, then the URL would be
https://dl.dropbox.com/u/
[userID]
/app.
ipa

12.

Press Save.

13.

Two files will be generated: app.ipa and
app.plist.


5.2.

Installing through iTunes


Installing SightLine through iTunes requires the app.ipa file. The following steps
describe how to install the application through iTunes.


1.

Connect the iPad and open iTunes.

2.

Drag the app.ipa file to the App Library.

3.

Select the iPad device from Devices and select the Apps tab.

4.

The application should display under iPad Apps under the name
Freeman.

5.

Check the Freeman application.

6.

Press Apply.

7.

The Freeman SightLine application will sync to the device.


5.3.

Distributing through

TestFlight


The SightLine
builds

can be distributed to users using TestFlight by going to
http://www.testflightapp.com
.

TestFlight allows developers
to shar
e their
applications with users and should be used to

distribute the application while
still in beta. The

credentials for the Freeman TestFlight account are:


Email: Freeman.Ipad@gmail.com

Password: Freeman1


The following

steps walkthrou
gh the process
to register users in order for them
to download the
application.


1.

Login to the Freeman TestFlight Developer account.

2.

Press ‘Add Teammate’

3.

Under recruitment, press ‘Start Recruiting Testers’.

4.

Press ‘Update’ to setup a link where users can register to download the
application.

A recruitment link is already s
etup at
http://bit.ly/vcut88
.

5.

Distribute the recruitment link to users.

6.

Users should access the recruitment link and signup. Once signed up they
will need to login on their iPad and register their device through the
Da
shboard section.

7.

Once a user has signed up, a developer will have to approve the user.

8.

In the Freeman TestFlight Developer account,
press

the ‘Team’ tab.

9.

Press

‘Recruited’ under ‘Teammates’ and approve the user.


The following steps walkthrough the process

to add a new build and share it
with users.


1.

Login to the Freeman TestFlight Developer account.

2.

Select ‘Upload Build’.

3.

Upload the IPA file and enter the required fields.

4.

Press Next.

5.

Select the users that will have access to the application.

6.

Press Complete
.

7.

Authorized users can login to TestFlight on their iPad and install the
application.


5.4.

Distributing through a Website


SightLine can be installed by downloading the application from a website
.
The
Apple Enterprise licensing agreement requires the application to be hosted in a
secure area and users to be authorized before accessing the application.
The
following steps walkthrough the process of hosting the application on a website.


1.

Three files

are required to host the application on a website. The app.ipa,
app.plist, and
a webpage

with a hyperlink to download the application.

2.

The app.plist contain
s

the path that the app.ipa file will be hosted at. This
path was setup when creating the

enterpr
ise build. If the path

changes, the
path

can
be changed without creating a new build by manually editing the
URL in the app.plist.

3.

The hyperlink to download the application will point to the app.plist file. A
sample
hyperlink is below.

4.

Upload the files t
o a web host and add the hyperlink to the website.

5.

To download the application, login to the
webpage

on an iPad and select the
download hyperlink. The application will download and automatically
install.


Sample hyperlink:


<a

href="itms
-
services://?action=download
-
manifest&url=http://
freemanco
.com/download/
app
.plist">Install
SightLine

iPad App</a>




6.

Show Setup


The following outlines the steps necessary to setup a
new

show for use with
SightLine.

6.1.

Setup a SightLine
Show

Instanc
e


To set up a SightLine show, run the CREATE_SLEvent stored procedure against
the SightLine Production DB Table. Th
e following fields are required.


a.

EventName
-


b.

CeEventId
-


c.

DbServerName
-


d.

DbInstanceName
-


e.

DbIntegratedSecurityFlag

-


f.

DbUserName
-


g.

DbPassword
-


h.

ShowSiteServiceEndpoint
-



6.2.

Show and User Setup

in Plasma


Log into the Plasma portal, select the Administrator tab, and select Add New
Administrator. Enter the required information and select the appropriate show.




7.

Dropbox


SightLine

integrates Drop
box functionality using the Dropbox iOS SDK. The SDK
requires a Dropbox App to be created
using

a Dropbox developer account.


A Dropbox developer account is setup
for SightLine
and can be accessed at
https://www.dropbox.com/developers

by using the following credentials:


Email:
Freeman.Ipad@gmail.com

Password: Freeman1


A Dropbox app named ‘Freeman Ipad’ is setup

with

production status
and can be
viewed by pressing My Apps in the Dropbox Developers Portal.

8.

Resources



https://app.rhohub.com/

http://docs.rhomobile.com/

http://docs.rhomobile.com/rhoconnect/client
-
objc



http://book.git
-
scm.com/index.html
http://developer.apple.com/library/mac/#documentation/To
olsLanguages/Conceptual/Xcode4UserGuide/SCM/SCM.html