Skip to content

Commit

Permalink
Merge pull request #1 from tripleblindmarket/develop
Browse files Browse the repository at this point in the history
Merge Latest Develop
  • Loading branch information
harshvitra authored Mar 19, 2020
2 parents 30b0f43 + 48f34c2 commit eefb772
Show file tree
Hide file tree
Showing 51 changed files with 15,497 additions and 315 deletions.
28 changes: 28 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,34 @@ code releases.
* A team member will review the pull request, request change or approve and
merge into the `develop` branch.
## Reviewing Pull Requests
* Open the PR on Github. At the top of the PR page is a number which identifies it -123 and the name of the author's branch -branch-name. Copy down both of these.
* Open git bash and ensure your working directory is clean by running ```git status```
* Get a copy of the PR by typing ```git fetch upstream pull/<id>/head:<new local branch>```. In this example you would type git fetch upstream pull/123/head:branch-name
* Now that you have a copy of the branch, switch to it using ```git checkout branch-name```. Your directory will now be an exact copy of the PR. Be sure to tell the author about any bugs or suggestions, as you cannot add your own changes to a pull request directly.
* When you are done checking out their work, use ```git checkout master``` to return to your local version
### Git Aliases to help with pull request reviews
Aliases are shortcuts that you can define in git bash (or linux/mac) that reduces typing and minimizes errors. The following commands create two aliases, one for grabbing a PR and switching to that branch. The other one deletes the branch.
Copy/paste each line (one at a time) to gitbash or terminal window.
```git config --global --add alias.pr '!f() { git fetch -fu ${2:-upstream} refs/pull/$1/head:pr/$1 && git checkout pr/$1; }; f'```
and
```git config --global --add alias.pr-clean '!git checkout master ; git for-each-ref refs/heads/pr/* --format="%(refname)" | while read ref ; do branch=${ref#refs/heads/} ; git branch -D $branch ; done'```
Once created the aliases are used as shown below.
* To pull a pull request: ```git pr <id>``` to use the example above git pr 123
* To delete all the pull requests created locally: ```git pr-clean```
# Additional Resources
* [General GitHub documentation](http://help.github.com/)
Expand Down
121 changes: 121 additions & 0 deletions .github/workflows/ios.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
name: Android and iOS build on MacOS

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
build:
runs-on: macOS-latest
steps:
- uses: actions/checkout@master

- name: Set XCode Version
run: sudo xcode-select -s /Applications/Xcode_11.app

- name: Installing Homebrew
run: /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

- name: Installing Java 8
run: brew tap adoptopenjdk/openjdk && brew cask install adoptopenjdk/openjdk/adoptopenjdk8

- name: Installing Gradle
run: brew install gradle

- name: Installing Android Studio
run: brew cask install android-sdk

- name: Setting Variables
run: |
export GRADLE_HOME=/usr/local/opt/gradle
export ANDROID_HOME=/usr/local/share/android-sdk
export PATH=$GRADLE_HOME/bin:$PATH
export PATH=$ANDROID_HOME/tools:$PATH
export PATH=$ANDROID_HOME/platform-tools:$PATH
- name: Updating SDK Manager
run: sdkmanager --update

- name: List available packages for Debug
run: sdkmanager --list

- name: Download Buildtools 28.0.3
run: (echo y; echo y; echo y;) | sdkmanager "build-tools;28.0.3"

- name: Download Android 28
run: (echo y; echo y; echo y;) | sdkmanager "platforms;android-28"

- name: Download Android Platform Tools
run: (echo y; echo y; echo y;) | sdkmanager "platform-tools"

- name: Download Support Library Android M2
run: (echo y; echo y; echo y;) | sdkmanager "extras;android;m2repository"

- name: Download Support Library Google M2
run: (echo y; echo y; echo y;) | sdkmanager "extras;google;m2repository"

- name: Download Support Library Solver for ConstraintLayout 1.0.2
run: (echo y; echo y; echo y;) | sdkmanager "extras;m2repository;com;android;support;constraint;constraint-layout;1.0.2"

- name: Download Support Library ConstraintLayout for Android 1.0.2
run: (echo y; echo y; echo y;) | sdkmanager "extras;m2repository;com;android;support;constraint;constraint-layout-solver;1.0.2"

- name: Download Android SDK Command line tools
run: (echo y; echo y; echo y;) | sdkmanager "cmdline-tools;latest"

- name: Download Google Services
run: (echo y; echo y; echo y;) | sdkmanager "extras;google;google_play_services"

- name: Download System Image Default
run: (echo y; echo y; echo y;) | sdkmanager "system-images;android-28;default;x86_64"

- name: Download System Image Google APIs
run: (echo y; echo y; echo y;) | sdkmanager "system-images;android-28;google_apis;x86_64"

- name: List current SDK Install
run: sdkmanager --list

- name: Adding Build tools to Path
run: export PATH=$ANDROID_HOME/build-tools/$(ls -tr $ANDROID_HOME/build-tools/ | tail -1):$PATH

# This is ugly but it is the only thing that seems to work.
- name: Accepting Android license
run: (echo y; echo y; echo y; echo y; echo y; echo y) | $ANDROID_HOME/tools/bin/sdkmanager --licenses

- name: Installing CocoaPods
run: gem install cocoapods

- name: Update Pods
run: pod repo update
working-directory: ./ios

- name: Yarn Install
run: yarn install

- name: Pod Install
run: pod install
working-directory: ./ios

- name: Asset Directory
run: mkdir -p ./android/app/src/main/assets

- name: Building React Native Bundle Android
run: npx react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res

- name: Building React Native Bundle iOS
run: npx react-native bundle --dev false --entry-file index.js --bundle-output ios/main.jsbundle --platform ios


# - name: Checking Gradle dependencies
# run: ./gradlew check
# working-directory: ./android

# - name: Android Build
# run: ./gradlew build
# working-directory: ./android

# - name: iOS Build
# run: xcodebuild -workspace PrivateKit.xcworkspace -configuration Release -scheme PrivateKit

4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,8 @@ android {
applicationId "edu.mit.privatekit"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 5
versionName "0.5"
versionCode 7
versionName "0.5.2"
}
splits {
abi {
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
42 changes: 40 additions & 2 deletions app/Entry.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,61 @@ import React, {Component } from 'react';

import {NavigationContainer} from '@react-navigation/native';
import {createStackNavigator} from '@react-navigation/stack';

import {SafeAreaView} from 'react-native';
import LocationTracking from './views/LocationTracking';
import Welcome from './views/Welcome';
import NewsScreen from './views/News';
import ExportScreen from './views/Export';
import ImportScreen from './views/Import';
import Slider from './views/welcomeScreens/Slider';
import {GetStoreData, SetStoreData} from './helpers/General';

const Stack = createStackNavigator();

class Entry extends Component {
constructor(props) {
super(props);
this.state={
initialRouteName:''
}
}

componentDidMount(){
GetStoreData('PARTICIPATE')
.then(isParticipating => {
console.log(isParticipating);
this.setState({
initialRouteName:isParticipating
})
})
.catch(error => console.log(error))
}

render() {
return (
<NavigationContainer>
<Stack.Navigator initialRouteName="WelcomeScreen ">
<SafeAreaView style={{flex:1}}>
<Stack.Navigator initialRouteName='InitialScreen'>
{this.state.initialRouteName === 'true' ? (
<Stack.Screen
name="InitialScreen"
component={LocationTracking}
options={{headerShown:false}}
/>
):(
<Stack.Screen
name="InitialScreen"
component={Slider}
options={{headerShown:false}}
/>
)}
<Stack.Screen
name="Slider"
component={Slider}
options={{headerShown:false}}
/>


<Stack.Screen
name="WelcomeScreen"
component={Welcome}
Expand All @@ -46,6 +83,7 @@ class Entry extends Component {
options={{headerShown:false}}
/>
</Stack.Navigator>
</SafeAreaView>
</NavigationContainer>
)
}
Expand Down
Binary file added app/assets/fonts/OpenSans-Bold.ttf
Binary file not shown.
Binary file added app/assets/fonts/OpenSans-BoldItalic.ttf
Binary file not shown.
Binary file added app/assets/fonts/OpenSans-ExtraBold.ttf
Binary file not shown.
Binary file added app/assets/fonts/OpenSans-ExtraBoldItalic.ttf
Binary file not shown.
Binary file added app/assets/fonts/OpenSans-Italic.ttf
Binary file not shown.
Binary file added app/assets/fonts/OpenSans-Light.ttf
Binary file not shown.
Binary file added app/assets/fonts/OpenSans-LightItalic.ttf
Binary file not shown.
Binary file added app/assets/fonts/OpenSans-Regular.ttf
Binary file not shown.
Binary file added app/assets/fonts/OpenSans-SemiBold.ttf
Binary file not shown.
Binary file added app/assets/fonts/OpenSans-SemiBoldItalic.ttf
Binary file not shown.
Binary file added app/assets/images/PKLogo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/assets/images/backArrow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/assets/images/export.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/assets/images/newspaper.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
File renamed without changes
Binary file added app/assets/images/welcome1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/assets/images/www.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions app/helpers/GoogleTakeOutAutoImport.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ export async function SearchAndImport(googleLocationJSON) {
console.log('Unzipping', Math.trunc(progress * 100), '%');
});

// TODO: RNFS.DownloadDirectoryPath is not defined on iOS.
// Find out how to access Downloads folder.
if (!RNFS.DownloadDirectoryPath) {
return;
}

RNFS.readDir(RNFS.DownloadDirectoryPath)
.then((result) => {
console.log('Checking Downloads Folder');
Expand Down
50 changes: 50 additions & 0 deletions app/helpers/convertPointsToString.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
export function convertPointsToString(count){

// For testing Manually override count
// count = 3000

// Get minutes
let tot_mins = count * 5;

// Calculate days
var days = (tot_mins / 60/ 24);
var rdays = Math.floor(days);

// Calculate Hours
var hours = (days - rdays) * 24;
var rhours = Math.floor(hours);

// Calculate Minutes
var minutes = (hours - rhours) * 60;
var rminutes = Math.round(minutes);

if(rdays > 0){
if(rdays > 1){
if(rhours > 1){
return rdays + " days, " + rhours + " hours and " + rminutes + " minutes.";
}
else{
return rdays + " days, " + rhours + " hour and " + rminutes + " minutes.";
}
}
else{
if(rhours > 1){
return rdays + " day, " + rhours + " hours and " + rminutes + " minutes.";
}
else{
return rdays + " day, " + rhours + " hour and " + rminutes + " minutes.";
}
}
}
else if(rhours > 0 ){
if(rhours > 1){
return rhours + " hours and " + rminutes + " minutes.";
}
else{
return rhours + " hour and " + rminutes + " minutes.";
}
}
else{
return rminutes + " minutes.";
}
}
2 changes: 1 addition & 1 deletion app/services/LocationService.js
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ export default class LocationServices {
static optOut(nav) {
BackgroundGeolocation.removeAllListeners();
SetStoreData('PARTICIPATE', 'false').then(() =>
nav.navigate('WelcomeScreen', {})
nav.navigate('LocationTrackingScreen', {})
)
}
}
Loading

0 comments on commit eefb772

Please sign in to comment.