Skip to content

Commit 9138565

Browse files
image-picker & image file upload added
1 parent decca6b commit 9138565

File tree

72 files changed

+1808
-42
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+1808
-42
lines changed

README.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Code taken from course.
1919
* App to view and book places to stay. All places listed on the 'discover.page' and clicking on an item navigates to a place detail page using the place id in the browser.
2020
* Places are displayed under 2 list option: 'ALL PLACES' and 'BOOKABLE PLACES'. The first place is displayed using an ion-card, the remaining places are displayed using a list with a thumbnail image. There is code to prevent the user from being able to book their own places, using a userId matching function.
2121
* Places can be booked, listed and cancelled.
22-
* New places can be added. The location of the new place is chosen using google maps and is stored in the Places array to be displayed in the template using data-binding.
22+
* New places can be added. The location of the new place is chosen using google maps and is stored in the Places array to be displayed in the template using data-binding. A photo can be taken to add to the new Place description. If there is no camera then there is a file upload button to save a jpeg image.
2323
* Burger side panel added with links to the discover places listings, your bookings and a logout button.
2424
* Bottom menu with 2 links to 'Discover' (default page upon loading) and 'Offers' that lists all the places available.
2525

@@ -33,14 +33,15 @@ Code taken from course.
3333
* [Ionic v5.0.0](https://ionicframework.com/)
3434
* [Angular v8.1.2](https://angular.io/)
3535
* [Ionic/angular v 4.7.1](https://ionicframework.com/)
36-
* [RxJS](https://angular.io/guide/rx-library)
36+
* [RxJS v6.5.1](https://angular.io/guide/rx-library)
3737
* [Google Firebase](https://firebase.google.com)
3838
* [Google Maps Javascript API](https://developers.google.com/maps/documentation/javascript/tutorial)
39+
* [Capacitor v1.1.1](https://capacitor.ionicframework.com/)
3940

4041
## Setup
4142

42-
* To start the server on _localhost://8100_ type: 'ionic serve'
43-
* Build: tba
43+
* To start the server on _localhost://8100_ type: `ionic serve`
44+
* Build for Android app: `ionic capacitor run android`
4445

4546
## Code Examples (taken from Udemy course with my comments added)
4647

@@ -88,6 +89,8 @@ private getGoogleMaps(): Promise<any> {
8889
* Bookings can be cancelled from booking.page.
8990
* Place details can be edited (as long as user id matches) using a neat button that slides from the right.
9091
* [Google Maps Javascript API](https://developers.google.com/maps/documentation/javascript/tutorial) map-modal added to new-offer page. Clicking on 'SELECT LOCATION' will open Google Maps at a fixed location. Address of place extracted from Google Maps data and stored in Places database.
92+
* [Capacitor Geolocation API](https://capacitor.ionicframework.com/docs/apis/geolocation) used to provide current location.
93+
* [Capacitor Camera API](https://capacitor.ionicframework.com/docs/apis/camera) used to provide camera functionality.
9194

9295
## Status & To-do list
9396

android/.gitignore

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
# NPM renames .gitignore to .npmignore
2+
# In order to prevent that, we remove the initial "."
3+
# And the CLI then renames it
4+
5+
# Using Android gitignore template: https://github.com/github/gitignore/blob/master/Android.gitignore
6+
7+
# Built application files
8+
*.apk
9+
*.ap_
10+
*.aab
11+
12+
# Files for the ART/Dalvik VM
13+
*.dex
14+
15+
# Java class files
16+
*.class
17+
18+
# Generated files
19+
bin/
20+
gen/
21+
out/
22+
release/
23+
24+
# Gradle files
25+
.gradle/
26+
build/
27+
28+
# Local configuration file (sdk path, etc)
29+
local.properties
30+
31+
# Proguard folder generated by Eclipse
32+
proguard/
33+
34+
# Log Files
35+
*.log
36+
37+
# Android Studio Navigation editor temp files
38+
.navigation/
39+
40+
# Android Studio captures folder
41+
captures/
42+
43+
# IntelliJ
44+
*.iml
45+
.idea/workspace.xml
46+
.idea/tasks.xml
47+
.idea/gradle.xml
48+
.idea/assetWizardSettings.xml
49+
.idea/dictionaries
50+
.idea/libraries
51+
# Android Studio 3 in .gitignore file.
52+
.idea/caches
53+
.idea/modules.xml
54+
# Comment next line if keeping position of elements in Navigation Editor is relevant for you
55+
.idea/navEditor.xml
56+
57+
# Keystore files
58+
# Uncomment the following lines if you do not want to check your keystore files in.
59+
#*.jks
60+
#*.keystore
61+
62+
# External native build folder generated in Android Studio 2.2 and later
63+
.externalNativeBuild
64+
65+
# Freeline
66+
freeline.py
67+
freeline/
68+
freeline_project_description.json
69+
70+
# fastlane
71+
fastlane/report.xml
72+
fastlane/Preview.html
73+
fastlane/screenshots
74+
fastlane/test_output
75+
fastlane/readme.md
76+
77+
# Version control
78+
vcs.xml
79+
80+
# lint
81+
lint/intermediates/
82+
lint/generated/
83+
lint/outputs/
84+
lint/tmp/
85+
# lint/reports/
86+
87+
# Cordova plugins for Capacitor
88+
capacitor-cordova-android-plugins
89+
90+
# Copied web assets
91+
app/src/main/assets/public

android/app/.npmignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/build/*
2+
!/build/.npmkeep

android/app/build.gradle

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
apply plugin: 'com.android.application'
2+
3+
android {
4+
compileSdkVersion 28
5+
defaultConfig {
6+
applicationId "io.ionic.starter"
7+
minSdkVersion 21
8+
targetSdkVersion 28
9+
versionCode 1
10+
versionName "1.0"
11+
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
12+
}
13+
buildTypes {
14+
release {
15+
minifyEnabled false
16+
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
17+
}
18+
}
19+
}
20+
21+
repositories {
22+
maven {
23+
url "https://dl.bintray.com/ionic-team/capacitor"
24+
}
25+
flatDir{
26+
dirs '../capacitor-cordova-android-plugins/src/main/libs', 'libs'
27+
}
28+
}
29+
30+
dependencies {
31+
implementation fileTree(include: ['*.jar'], dir: 'libs')
32+
implementation 'com.android.support:appcompat-v7:28.0.0'
33+
implementation project(':capacitor-android')
34+
testImplementation 'junit:junit:4.12'
35+
androidTestImplementation 'com.android.support.test:runner:1.0.2'
36+
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
37+
implementation project(':capacitor-cordova-android-plugins')
38+
}
39+
40+
apply from: 'capacitor.build.gradle'
41+
42+
try {
43+
def servicesJSON = file('google-services.json')
44+
if (servicesJSON.text) {
45+
apply plugin: 'com.google.gms.google-services'
46+
}
47+
} catch(Exception e) {
48+
logger.warn("google-services.json not found, google-services plugin not applied. Push Notifications won't work")
49+
}

android/app/capacitor.build.gradle

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// DO NOT EDIT THIS FILE! IT IS GENERATED EACH TIME "capacitor update" IS RUN
2+
3+
android {
4+
compileOptions {
5+
sourceCompatibility JavaVersion.VERSION_1_8
6+
targetCompatibility JavaVersion.VERSION_1_8
7+
}
8+
}
9+
10+
apply from: "../capacitor-cordova-android-plugins/cordova.variables.gradle"
11+
dependencies {
12+
13+
14+
}
15+
16+
17+
if (hasProperty('postBuildExtras')) {
18+
postBuildExtras()
19+
}

android/app/proguard-rules.pro

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Add project specific ProGuard rules here.
2+
# You can control the set of applied configuration files using the
3+
# proguardFiles setting in build.gradle.
4+
#
5+
# For more details, see
6+
# http://developer.android.com/guide/developing/tools/proguard.html
7+
8+
# If your project uses WebView with JS, uncomment the following
9+
# and specify the fully qualified class name to the JavaScript interface
10+
# class:
11+
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12+
# public *;
13+
#}
14+
15+
# Uncomment this to preserve the line number information for
16+
# debugging stack traces.
17+
#-keepattributes SourceFile,LineNumberTable
18+
19+
# If you keep the line number information, uncomment this to
20+
# hide the original source file name.
21+
#-renamesourcefileattribute SourceFile
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package com.getcapacitor.myapp;
2+
3+
import android.content.Context;
4+
import android.support.test.InstrumentationRegistry;
5+
import android.support.test.runner.AndroidJUnit4;
6+
7+
import org.junit.Test;
8+
import org.junit.runner.RunWith;
9+
10+
import static org.junit.Assert.*;
11+
12+
/**
13+
* Instrumented test, which will execute on an Android device.
14+
*
15+
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
16+
*/
17+
@RunWith(AndroidJUnit4.class)
18+
public class ExampleInstrumentedTest {
19+
@Test
20+
public void useAppContext() throws Exception {
21+
// Context of the app under test.
22+
Context appContext = InstrumentationRegistry.getTargetContext();
23+
24+
assertEquals("com.getcapacitor.app", appContext.getPackageName());
25+
}
26+
}
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
package="io.ionic.starter">
4+
5+
<application
6+
android:allowBackup="true"
7+
android:icon="@mipmap/ic_launcher"
8+
android:label="@string/app_name"
9+
android:roundIcon="@mipmap/ic_launcher_round"
10+
android:supportsRtl="true"
11+
android:theme="@style/AppTheme">
12+
13+
<activity
14+
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale"
15+
android:name="io.ionic.starter.MainActivity"
16+
android:label="@string/title_activity_main"
17+
android:theme="@style/AppTheme.NoActionBarLaunch"
18+
android:launchMode="singleTask">
19+
20+
<intent-filter>
21+
<action android:name="android.intent.action.MAIN" />
22+
<category android:name="android.intent.category.LAUNCHER" />
23+
</intent-filter>
24+
25+
<intent-filter>
26+
<action android:name="android.intent.action.VIEW" />
27+
<category android:name="android.intent.category.DEFAULT" />
28+
<category android:name="android.intent.category.BROWSABLE" />
29+
<data android:scheme="@string/custom_url_scheme" />
30+
</intent-filter>
31+
32+
</activity>
33+
34+
<provider
35+
android:name="android.support.v4.content.FileProvider"
36+
android:authorities="${applicationId}.fileprovider"
37+
android:exported="false"
38+
android:grantUriPermissions="true">
39+
<meta-data
40+
android:name="android.support.FILE_PROVIDER_PATHS"
41+
android:resource="@xml/file_paths"></meta-data>
42+
</provider>
43+
</application>
44+
45+
<!-- Permissions -->
46+
47+
<uses-permission android:name="android.permission.INTERNET" />
48+
<!-- Camera, Photos, input file -->
49+
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
50+
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
51+
<!-- Geolocation API -->
52+
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
53+
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
54+
<uses-feature android:name="android.hardware.location.gps" />
55+
<!-- Network API -->
56+
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
57+
<!-- Navigator.getUserMedia -->
58+
<!-- Video -->
59+
<uses-permission android:name="android.permission.CAMERA" />
60+
<!-- Audio -->
61+
<uses-permission android:name="android.permission.RECORD_AUDIO" />
62+
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/>
63+
</manifest>
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"appId": "io.ionic.starter",
3+
"appName": "ionic-angular-project",
4+
"bundledWebRuntime": false,
5+
"npmClient": "npm",
6+
"webDir": "www"
7+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package io.ionic.starter;
2+
3+
import android.os.Bundle;
4+
5+
import com.getcapacitor.BridgeActivity;
6+
import com.getcapacitor.Plugin;
7+
8+
import java.util.ArrayList;
9+
10+
public class MainActivity extends BridgeActivity {
11+
@Override
12+
public void onCreate(Bundle savedInstanceState) {
13+
super.onCreate(savedInstanceState);
14+
15+
// Initializes the Bridge
16+
this.init(savedInstanceState, new ArrayList<Class<? extends Plugin>>() {{
17+
// Additional plugins you've installed go here
18+
// Ex: add(TotallyAwesomePlugin.class);
19+
}});
20+
}
21+
}

0 commit comments

Comments
 (0)