Skip to content

Commit

Permalink
[#147805691] Add MixPanel support (#25)
Browse files Browse the repository at this point in the history
* [#147805691] Add MixPanel support

* [#147805691] Improve MixPanel support, from code review

* [#148019251] Add analytics for app state changes (#28)

* [#148019251] Add analytics for app state changes

* [#148019251] Improve analytics for app state changes, from code review

* [#148019251] Improve naming and types for app state changes, from code review
  • Loading branch information
gesposito authored and cloudify committed Jul 10, 2017
1 parent 41217a4 commit dde43b9
Show file tree
Hide file tree
Showing 29 changed files with 658 additions and 159 deletions.
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,14 @@ DerivedData
*.xcuserstate
project.xcworkspace

# CocoaPods
#
# We recommend against adding the Pods directory to your .gitignore. However
# you should judge for yourself, the pros and cons are mentioned at:
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
#
Pods/

# Android/IntelliJ
#
build/
Expand All @@ -37,6 +45,9 @@ node_modules/
npm-debug.log
yarn-error.log

# App Config
js/config.js

# BUCK
buck-out/
\.buckd/
Expand Down
26 changes: 23 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,18 +80,30 @@ La versione di node usata nel progetto [è questa](https://github.com/teamdigita

Per la gestione delle dipendenze usiamo [Yarn](https://yarnpkg.com/lang/en/).

#### rbenv

Alcune dipendenze (es. CocoaPods) sono installate tramite [rbenv](https://github.com/rbenv/rbenv).

#### React Native

Seguire [il tutorial](https://facebook.github.io/react-native/docs/getting-started.html) per il proprio sistema operativo.
Seguire [il tutorial (Building Projects with Native Code)](https://facebook.github.io/react-native/docs/getting-started.html) per il proprio sistema operativo.

Se si dispone di un sistema macOS è possibile seguire sia il tutorial per iOS che per Android. Se invece si dispone di un sistema Linux o Windows sarà possibile instalalre solo l'ambiente di sviluppo per Android.
Se si dispone di un sistema macOS è possibile seguire sia il tutorial per iOS che per Android. Se invece si dispone di un sistema Linux o Windows sarà possibile installare solo l'ambiente di sviluppo per Android.

### Compilazione (dev)

Per prima cosa installiamo le librerie usate dal progetto:

```
$ cd ItaliaApp
$ nodenv install
$ rbenv install
$ gem install bundler
$ bundle install
$ pod install
$ yarn
```

Expand All @@ -107,7 +119,15 @@ Oppure su iOS:
$ react-native run-ios
```

### Release
Nota: L'app utilizza [CocoaPods](https://cocoapods.org/), il progetto da eseguire è quindi `ItaliaApp.xcworkspace` anzichè `ItaliaApp.xcodeproj` (`run-ios` lo rileva automaticamente)

### Configurazione
```
$ cp js/config.example.js js/config.js
```
Inseriamo il MixPanel token

### Compilazione (release)

Per il rilascio dell'app sugli store usiamo Fastlane.

Expand Down
2 changes: 2 additions & 0 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,8 @@ android {
}

dependencies {
compile project(':react-native-sha256')
compile project(':react-native-mixpanel')
compile fileTree(dir: "libs", include: ["*.jar"])
compile "com.android.support:appcompat-v7:23.0.1"
compile "com.facebook.react:react-native:+" // From node_modules
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import android.app.Application;

import com.facebook.react.ReactApplication;
import com.sha256lib.Sha256Package;
import com.kevinejohn.RNMixpanel.RNMixpanel;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.react.shell.MainReactPackage;
Expand All @@ -22,7 +24,9 @@ public boolean getUseDeveloperSupport() {
@Override
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage()
new MainReactPackage(),
new Sha256Package(),
new RNMixpanel()
);
}
};
Expand Down
4 changes: 4 additions & 0 deletions android/settings.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
rootProject.name = 'ItaliaApp'
include ':react-native-sha256'
project(':react-native-sha256').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-sha256/android')
include ':react-native-mixpanel'
project(':react-native-mixpanel').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-mixpanel/android')

include ':app'
145 changes: 144 additions & 1 deletion ios/ItaliaApp.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions ios/ItaliaApp.xcworkspace/contents.xcworkspacedata

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

214 changes: 107 additions & 107 deletions ios/ItaliaApp/Info.plist
Original file line number Diff line number Diff line change
@@ -1,110 +1,110 @@
<?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>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
<string>ItaliaApp</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>0.1</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>13</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>localhost</key>
<dict>
<key>NSExceptionAllowsInsecureHTTPLoads</key>
<true/>
</dict>
<key>teamdigitale.it</key>
<dict>
<key>NSIncludesSubdomains</key>
<true/>
</dict>
</dict>
</dict>
<key>NSLocationWhenInUseUsageDescription</key>
<string></string>
<key>UIAppFonts</key>
<array>
<string>TitilliumWeb-Black.ttf</string>
<string>TitilliumWeb-Bold.ttf</string>
<string>TitilliumWeb-BoldItalic.ttf</string>
<string>TitilliumWeb-ExtraLight.ttf</string>
<string>TitilliumWeb-ExtraLightItalic.ttf</string>
<string>TitilliumWeb-Italic.ttf</string>
<string>TitilliumWeb-Light.ttf</string>
<string>TitilliumWeb-LightItalic.ttf</string>
<string>TitilliumWeb-Regular.ttf</string>
<string>TitilliumWeb-SemiBold.ttf</string>
<string>TitilliumWeb-SemiBoldItalic.ttf</string>
<string>Andale Mono.ttf</string>
<string>Arial Black.ttf</string>
<string>Arial.ttf</string>
<string>Comic Sans MS.ttf</string>
<string>Courier New.ttf</string>
<string>Entypo.ttf</string>
<string>EvilIcons.ttf</string>
<string>FontAwesome.ttf</string>
<string>Foundation.ttf</string>
<string>Georgia.ttf</string>
<string>Ionicons.ttf</string>
<string>MaterialIcons.ttf</string>
<string>Microsoft Sans Serif.ttf</string>
<string>Octicons.ttf</string>
<string>Roboto_medium.ttf</string>
<string>Roboto.ttf</string>
<string>rubicon-icon-font.ttf</string>
<string>Rubik-Black.ttf</string>
<string>Rubik-BlackItalic.ttf</string>
<string>Rubik-Bold.ttf</string>
<string>Rubik-BoldItalic.ttf</string>
<string>Rubik-Italic.ttf</string>
<string>Rubik-Light.ttf</string>
<string>Rubik-LightItalic.ttf</string>
<string>Rubik-Medium.ttf</string>
<string>Rubik-MediumItalic.ttf</string>
<string>Rubik-Regular.ttf</string>
<string>SanFrancisco.ttf</string>
<string>SanFranciscoBold.ttf</string>
<string>SanFranciscoThin.ttf</string>
<string>SF-UI-Text-Regular.otf</string>
<string>Skia.ttf</string>
<string>Times New Roman.ttf</string>
<string>Zocial.ttf</string>
</array>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
</dict>
</plist>
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
<string>ItaliaApp</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>0.1</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>12</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>localhost</key>
<dict>
<key>NSExceptionAllowsInsecureHTTPLoads</key>
<true/>
</dict>
<key>teamdigitale.it</key>
<dict>
<key>NSIncludesSubdomains</key>
<true/>
</dict>
</dict>
</dict>
<key>NSLocationWhenInUseUsageDescription</key>
<string/>
<key>UIAppFonts</key>
<array>
<string>TitilliumWeb-Black.ttf</string>
<string>TitilliumWeb-Bold.ttf</string>
<string>TitilliumWeb-BoldItalic.ttf</string>
<string>TitilliumWeb-ExtraLight.ttf</string>
<string>TitilliumWeb-ExtraLightItalic.ttf</string>
<string>TitilliumWeb-Italic.ttf</string>
<string>TitilliumWeb-Light.ttf</string>
<string>TitilliumWeb-LightItalic.ttf</string>
<string>TitilliumWeb-Regular.ttf</string>
<string>TitilliumWeb-SemiBold.ttf</string>
<string>TitilliumWeb-SemiBoldItalic.ttf</string>
<string>Andale Mono.ttf</string>
<string>Arial Black.ttf</string>
<string>Arial.ttf</string>
<string>Comic Sans MS.ttf</string>
<string>Courier New.ttf</string>
<string>Entypo.ttf</string>
<string>EvilIcons.ttf</string>
<string>FontAwesome.ttf</string>
<string>Foundation.ttf</string>
<string>Georgia.ttf</string>
<string>Ionicons.ttf</string>
<string>MaterialIcons.ttf</string>
<string>Microsoft Sans Serif.ttf</string>
<string>Octicons.ttf</string>
<string>Roboto_medium.ttf</string>
<string>Roboto.ttf</string>
<string>rubicon-icon-font.ttf</string>
<string>Rubik-Black.ttf</string>
<string>Rubik-BlackItalic.ttf</string>
<string>Rubik-Bold.ttf</string>
<string>Rubik-BoldItalic.ttf</string>
<string>Rubik-Italic.ttf</string>
<string>Rubik-Light.ttf</string>
<string>Rubik-LightItalic.ttf</string>
<string>Rubik-Medium.ttf</string>
<string>Rubik-MediumItalic.ttf</string>
<string>Rubik-Regular.ttf</string>
<string>SanFrancisco.ttf</string>
<string>SanFranciscoBold.ttf</string>
<string>SanFranciscoThin.ttf</string>
<string>SF-UI-Text-Regular.otf</string>
<string>Skia.ttf</string>
<string>Times New Roman.ttf</string>
<string>Zocial.ttf</string>
</array>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
</dict>
</plist>
3 changes: 3 additions & 0 deletions ios/Podfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
target 'ItaliaApp' do
pod 'Mixpanel'
end
12 changes: 12 additions & 0 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
PODS:
- Mixpanel (3.1.8)

DEPENDENCIES:
- Mixpanel

SPEC CHECKSUMS:
Mixpanel: 1e04a58533472e5675ea0a476af02ee8751aaa08

PODFILE CHECKSUM: 1cd94c23b0e1bee7956ffd2a34c72e4aa08b7e8e

COCOAPODS: 1.2.1
21 changes: 21 additions & 0 deletions js/actions/appState.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/**
* Defines actions related to React Native's `AppState` changes.
*
* @flow
*/

import type { ApplicationState, ApplicationStateAction } from './types'

const APPLICATION_STATE_CHANGE_ACTION = 'APPLICATION_STATE_CHANGE_ACTION'

function appStateChange(appState: ApplicationState): ApplicationStateAction {
return {
type: APPLICATION_STATE_CHANGE_ACTION,
name: appState,
}
}

module.exports = {
APPLICATION_STATE_CHANGE_ACTION,
appStateChange,
}
4 changes: 3 additions & 1 deletion js/actions/index.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
/**
* Aggregates all the actions available to components.
*
*
* @flow
*/

'use strict'

import loginActions from './login'
import userActions from './user'
import appStateActions from './appState'

module.exports = {
...loginActions,
...userActions,
...appStateActions,
}
Loading

0 comments on commit dde43b9

Please sign in to comment.