Skip to content

Commit bf994a5

Browse files
committedApr 22, 2020
updated to latest version of capacitor and ionic/react
1 parent 60e4989 commit bf994a5

File tree

12 files changed

+7126
-5072
lines changed

12 files changed

+7126
-5072
lines changed
 

‎capacitor.config.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@
33
"appName": "reactionicfb",
44
"bundledWebRuntime": false,
55
"npmClient": "npm",
6-
"webDir": "build"
6+
"webDir": "build",
7+
"cordova": {}
78
}

‎ionic.config.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"name": "reactionicfb",
3+
"integrations": {
4+
"capacitor": {}
5+
},
6+
"type": "react"
7+
}
8+

‎ios/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
App/build
66
App/Pods
77
App/public
8+
App/Podfile.lock
89
xcuserdata
910

1011
# Cordova plugins for Capacitor

‎ios/App/App.xcodeproj/project.pbxproj

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@
127127
TargetAttributes = {
128128
504EC3031FED79650016851F = {
129129
CreatedOnToolsVersion = 9.2;
130+
LastSwiftMigration = 1100;
130131
ProvisioningStyle = Automatic;
131132
};
132133
};
@@ -190,18 +191,13 @@
190191
files = (
191192
);
192193
inputPaths = (
193-
"${SRCROOT}/Pods/Target Support Files/Pods-App/Pods-App-frameworks.sh",
194-
"${BUILT_PRODUCTS_DIR}/Capacitor/Capacitor.framework",
195-
"${BUILT_PRODUCTS_DIR}/CapacitorCordova/Cordova.framework",
196194
);
197195
name = "[CP] Embed Pods Frameworks";
198196
outputPaths = (
199-
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Capacitor.framework",
200-
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Cordova.framework",
201197
);
202198
runOnlyForDeploymentPostprocessing = 0;
203199
shellPath = /bin/sh;
204-
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-App/Pods-App-frameworks.sh\"\n";
200+
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-App/Pods-App-frameworks.sh\"\n";
205201
showEnvVarsInLog = 0;
206202
};
207203
/* End PBXShellScriptBuildPhase section */
@@ -357,7 +353,7 @@
357353
PRODUCT_BUNDLE_IDENTIFIER = com.aks.reactionicfb;
358354
PRODUCT_NAME = "$(TARGET_NAME)";
359355
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG USE_PUSH";
360-
SWIFT_VERSION = 4.2;
356+
SWIFT_VERSION = 5.0;
361357
TARGETED_DEVICE_FAMILY = "1,2";
362358
};
363359
name = Debug;
@@ -374,7 +370,7 @@
374370
PRODUCT_BUNDLE_IDENTIFIER = com.aks.reactionicfb;
375371
PRODUCT_NAME = "$(TARGET_NAME)";
376372
SWIFT_ACTIVE_COMPILATION_CONDITIONS = USE_PUSH;
377-
SWIFT_VERSION = 4.2;
373+
SWIFT_VERSION = 5.0;
378374
TARGETED_DEVICE_FAMILY = "1,2";
379375
};
380376
name = Release;

‎ios/App/App/capacitor.config.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@
33
"appName": "reactionicfb",
44
"bundledWebRuntime": false,
55
"npmClient": "npm",
6-
"webDir": "build"
6+
"webDir": "build",
7+
"cordova": {}
78
}

‎ios/App/App/config.xml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<?xml version='1.0' encoding='utf-8'?>
2-
<widget version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
2+
<widget version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
33
<access origin="*" />
44

5-
</widget>
5+
6+
</widget>

‎ios/App/Podfile

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
platform :ios, '11.0'
22
use_frameworks!
33

4-
# workaround to avoid Xcode 10 caching of Pods that requires
4+
# workaround to avoid Xcode caching of Pods that requires
55
# Product -> Clean Build Folder after new Cordova plugins installed
66
# Requires CocoaPods 1.6 or newer
7-
install! 'cocoapods',
8-
# :disable_input_output_paths => true
7+
install! 'cocoapods', :disable_input_output_paths => true
98

109
def capacitor_pods
1110
# Automatic Capacitor Pod dependencies, do not delete

‎ios/App/Podfile.lock

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PODS:
2-
- Capacitor (1.0.0-beta.23):
3-
- CapacitorCordova (= 1.0.0-beta.23)
4-
- CapacitorCordova (1.0.0-beta.23)
2+
- Capacitor (2.0.1):
3+
- CapacitorCordova (= 2.0.1)
4+
- CapacitorCordova (2.0.1)
55

66
DEPENDENCIES:
77
- "Capacitor (from `../../node_modules/@capacitor/ios`)"
@@ -14,9 +14,9 @@ EXTERNAL SOURCES:
1414
:path: "../../node_modules/@capacitor/ios"
1515

1616
SPEC CHECKSUMS:
17-
Capacitor: b6d4babf85504642196d8fe1c73a6f3d439fa9b0
18-
CapacitorCordova: 07a15ab2a299d8d275463c6cafa49062e128aedd
17+
Capacitor: 893baa42b33635ddf23d29d23d2a7f33f7c08bc7
18+
CapacitorCordova: 9fee2eb6780331b6ff09710d6a7d1f2e4707f1b9
1919

20-
PODFILE CHECKSUM: f8b6f0374a33d3b2bb9de734569411be27010db4
20+
PODFILE CHECKSUM: fb75b5ffc60ff2a7ae6a369fac21a8cbd40a9ff8
2121

22-
COCOAPODS: 1.5.3
22+
COCOAPODS: 1.9.0.beta.3

‎package-lock.json

Lines changed: 7030 additions & 4990 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json

Lines changed: 29 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,32 @@
33
"version": "0.1.0",
44
"private": true,
55
"dependencies": {
6-
"@ionic/react": "0.0.6",
7-
"@capacitor/cli": "^1.0.0-beta.24",
8-
"@capacitor/core": "^1.0.0-beta.24",
9-
"@capacitor/ios": "^1.0.0-beta.24",
10-
"@firebase/app-types": "^0.3.10",
11-
"@firebase/util": "^0.2.25",
12-
"firebase": "^6.3.5",
13-
"mobx": "^5.13.0",
14-
"mobx-react": "^6.1.3",
15-
"react": "^16.8.6",
16-
"react-dom": "^16.8.6",
17-
"react-redux": "^7.0.3",
18-
"react-router": "^5.0.1",
19-
"react-router-dom": "^5.0.1",
20-
"react-scripts": "3.0.0"
6+
"@capacitor/core": "2.0.1",
7+
"@capacitor/ios": "^2.0.1",
8+
"@ionic/react": "^5.0.7",
9+
"@ionic/react-router": "^5.0.7",
10+
"@testing-library/jest-dom": "^4.2.4",
11+
"@testing-library/react": "^9.4.0",
12+
"@testing-library/user-event": "^8.0.3",
13+
"@types/jest": "^24.0.25",
14+
"@types/node": "^12.12.24",
15+
"@types/react": "^16.9.17",
16+
"@types/react-dom": "^16.9.4",
17+
"@types/react-router": "^5.1.4",
18+
"@types/react-router-dom": "^5.1.3",
19+
"firebase": "^7.14.1",
20+
"ionicons": "^5.0.0",
21+
"mobx": "^5.15.4",
22+
"mobx-react": "^6.2.2",
23+
"overmind": "^23.0.1",
24+
"overmind-react": "^24.0.1",
25+
"react": "^16.13.0",
26+
"react-dom": "^16.13.0",
27+
"react-hook-form": "^5.5.0",
28+
"react-router": "^5.1.2",
29+
"react-router-dom": "^5.1.2",
30+
"react-scripts": "3.4.1",
31+
"typescript": "3.8.3"
2132
},
2233
"scripts": {
2334
"start": "react-scripts start",
@@ -39,5 +50,8 @@
3950
"last 1 firefox version",
4051
"last 1 safari version"
4152
]
53+
},
54+
"devDependencies": {
55+
"@capacitor/cli": "2.0.1"
4256
}
4357
}

‎src/App.js

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
11
import React, { Component } from "react";
22
import { Route, Switch, Redirect } from "react-router-dom";
33

4-
import {
5-
IonApp,
6-
IonRouterOutlet,
7-
IonSpinner,
8-
IonReactRouter
9-
} from "@ionic/react";
4+
import { IonApp, IonRouterOutlet, IonSpinner } from "@ionic/react";
5+
import { IonReactRouter } from "@ionic/react-router";
106

117
import PrivateRoute from "./components/PrivateRoute";
128
import HomePage from "./pages/HomePage";
@@ -23,7 +19,7 @@ class App extends Component {
2319
position: "absolute",
2420
left: "50%",
2521
top: "50%",
26-
transform: "translate(-50%, -50%)"
22+
transform: "translate(-50%, -50%)",
2723
}}
2824
>
2925
<IonSpinner name="circles" />

‎src/store/firebaseService.js

Lines changed: 35 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ if (!firebase.apps.length) {
1717
/**
1818
* so this function is called when the authentication state changes
1919
* in the application, a side effect of that is that we need to get
20-
* the rest of the user data from the user collection, that is
20+
* the rest of the user data from the user collection, that is
2121
* done with the _handleAuthedUser callback
2222
*/
23-
export const authCheck = async _handleAuthedUser => {
24-
return new Promise(resolve => {
23+
export const authCheck = async (_handleAuthedUser) => {
24+
return new Promise((resolve) => {
2525
// Listen for authentication state to change.
26-
firebase.auth().onAuthStateChanged(async user => {
26+
firebase.auth().onAuthStateChanged(async (user) => {
2727
if (user != null) {
2828
console.log("We are authenticated now!");
2929

@@ -63,12 +63,12 @@ export const logOut = () => {
6363
* @param {*} userInfo.email
6464
* @param {*} userInfo.password
6565
*/
66-
export const registerUser = userInfo => {
66+
export const registerUser = (userInfo) => {
6767
console.log("in registerUser");
6868
return firebase
6969
.auth()
7070
.createUserWithEmailAndPassword(userInfo.email, userInfo.password)
71-
.then(newUser => {
71+
.then((newUser) => {
7272
let { email, firstName, lastName } = userInfo;
7373

7474
return firebase
@@ -78,10 +78,10 @@ export const registerUser = userInfo => {
7878
.set({
7979
email,
8080
firstName,
81-
lastName
81+
lastName,
8282
})
8383
.then(() => {
84-
return { ...newUser, firstName, lastName };
84+
return { ...newUser.user, firstName, lastName };
8585
});
8686
});
8787
};
@@ -93,27 +93,24 @@ export const getUserProfile = () => {
9393
let user = firebase.auth().currentUser;
9494
console.log(user);
9595

96-
var userRef = firebase
97-
.firestore()
98-
.collection("users")
99-
.doc(user.uid);
96+
var userRef = firebase.firestore().collection("users").doc(user.uid);
10097

10198
return userRef
10299
.get()
103-
.then(doc => {
100+
.then((doc) => {
104101
if (doc.exists) {
105102
console.log("Document data:", doc.data());
106103
return {
107104
...doc.data(),
108-
id: user.uid
105+
id: user.uid,
109106
};
110107
} else {
111108
// doc.data() will be undefined in this case
112109
console.log("No such document!", user.uid);
113110
return null;
114111
}
115112
})
116-
.catch(error => {
113+
.catch((error) => {
117114
console.log("Error getting document:", error);
118115
});
119116
};
@@ -132,17 +129,17 @@ export const queryObjectCollection = ({ collection }) => {
132129
collectionRef
133130
//.where('owner', '==', currentUserId)
134131
.get()
135-
.then(querySnapshot => {
136-
querySnapshot.forEach(doc => {
132+
.then((querySnapshot) => {
133+
querySnapshot.forEach((doc) => {
137134
// doc.data() is never undefined for query doc snapshots
138135
results.push({
139136
id: doc.id,
140-
...doc.data()
137+
...doc.data(),
141138
});
142139
});
143140
return results;
144141
})
145-
.catch(error => {
142+
.catch((error) => {
146143
console.log("Error getting documents: ", error);
147144
return error;
148145
})
@@ -163,58 +160,58 @@ export const addObjectToCollection = ({ collection, objectData }) => {
163160
owner: currentUserId,
164161
content: { ...objectData },
165162
created: new Date().getTime(),
166-
updated: new Date().getTime()
163+
updated: new Date().getTime(),
167164
})
168165
.then(
169-
async doc => {
166+
async (doc) => {
170167
console.log(`addObjectToCollection ${collection} ${doc}`);
171168

172169
let docData = await getByRef(doc);
173170
return docData;
174171
},
175-
error => {
172+
(error) => {
176173
console.log(`ERROR: addObjectToCollection ${collection} ${error}`);
177174
return error;
178175
}
179176
)
180-
.catch(e => {
177+
.catch((e) => {
181178
console.log(`ERROR: addObjectToCollection ${collection} ${e}`);
182179
return e;
183180
});
184181
};
185182

186-
187183
/**
188184
*
189-
* @param {*} collection - name of collection
185+
* @param {*} collection - name of collection
190186
* @param {*} objectId - id of data to remove from the collection
191187
*/
192188
export const removeObjectFromCollection = ({ collection, objectId }) => {
193189
let currentUserId = firebase.auth().currentUser.uid;
194190
let collectionRef = firebase.firestore().collection(collection);
195191

196-
return collectionRef.doc(objectId).delete()
192+
return collectionRef
193+
.doc(objectId)
194+
.delete()
197195
.then(
198-
async doc => {
196+
async (doc) => {
199197
console.log(`removeObjectFromCollection ${collection} ${objectId}`);
200198
return true;
201199
},
202-
error => {
200+
(error) => {
203201
console.log(`ERROR: removeObjectFromCollection ${collection} ${error}`);
204202
return error;
205203
}
206204
)
207-
.catch(e => {
205+
.catch((e) => {
208206
console.log(`ERROR: removeObjectFromCollection ${collection} ${e}`);
209207
return e;
210208
});
211209
};
212210

213-
214-
export const getByRef = _documentRef => {
211+
export const getByRef = (_documentRef) => {
215212
return _documentRef
216213
.get()
217-
.then(doc => {
214+
.then((doc) => {
218215
if (doc.exists) {
219216
return { ...doc.data(), id: _documentRef.id };
220217
} else {
@@ -223,7 +220,7 @@ export const getByRef = _documentRef => {
223220
return null;
224221
}
225222
})
226-
.catch(error => {
223+
.catch((error) => {
227224
console.log("Error getting document:", error);
228225
return error;
229226
});
@@ -233,7 +230,7 @@ export const getByRef = _documentRef => {
233230
*
234231
* @param {*} blob
235232
*/
236-
export const uploadImage = blob => {
233+
export const uploadImage = (blob) => {
237234
return new Promise((resolve, reject) => {
238235
let currentUserId = firebase.auth().currentUser.uid;
239236
const ref = firebase
@@ -245,18 +242,18 @@ export const uploadImage = blob => {
245242

246243
task.on(
247244
firebase.storage.TaskEvent.STATE_CHANGED,
248-
snapshot =>
245+
(snapshot) =>
249246
console.log((snapshot.bytesTransferred / snapshot.totalBytes) * 100),
250-
error => {
247+
(error) => {
251248
console.log("error", error);
252249
return reject(error);
253250
},
254-
result => {
251+
(result) => {
255252
return resolve({
256253
url: task.snapshot.downloadURL,
257254
contentType: task.snapshot.metadata.contentType,
258255
name: task.snapshot.metadata.name,
259-
size: task.snapshot.metadata.size
256+
size: task.snapshot.metadata.size,
260257
});
261258
}
262259
);

0 commit comments

Comments
 (0)
Please sign in to comment.