Skip to content

Commit

Permalink
remove any reference to cordova
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianovide committed May 21, 2021
1 parent bb061f5 commit 746ac99
Show file tree
Hide file tree
Showing 16 changed files with 61 additions and 436 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ typings/
build
serviceAccountKey.json
scripts/tmp.jpg
cordova-app/www

.DS_Store

Expand Down
70 changes: 0 additions & 70 deletions bin/geovation-photos-update.js

This file was deleted.

1 change: 0 additions & 1 deletion gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,5 @@ typings/
build
serviceAccountKey.json
scripts/tmp.jpg
cordova-app/www

.DS_Store
18 changes: 0 additions & 18 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,6 @@
!function (n, e) { var t, o, i, c = [], f = { passive: !0, capture: !0 }, r = new Date, a = "pointerup", u = "pointercancel"; function p(n, c) { t || (t = c, o = n, i = new Date, w(e), s()) } function s() { o >= 0 && o < i - r && (c.forEach(function (n) { n(o, t) }), c = []) } function l(t) { if (t.cancelable) { var o = (t.timeStamp > 1e12 ? new Date : performance.now()) - t.timeStamp; "pointerdown" == t.type ? function (t, o) { function i() { p(t, o), r() } function c() { r() } function r() { e(a, i, f), e(u, c, f) } n(a, i, f), n(u, c, f) }(o, t) : p(o, t) } } function w(n) { ["click", "mousedown", "keydown", "touchstart", "pointerdown"].forEach(function (e) { n(e, l, f) }) } w(n), self.perfMetrics = self.perfMetrics || {}, self.perfMetrics.onFirstInputDelay = function (n) { c.push(n), s() } }(addEventListener, removeEventListener);
</script>
<script src="%PUBLIC_URL%/first-input-delay.min.js"></script>
<!--
Customize this policy to fit your own app's needs. For more guidance, see:
https://github.com/apache/cordova-plugin-whitelist/blob/master/README.md#content-security-policy
Some notes:
* gap: is required only on iOS (when using UIWebView) and is needed for JS->native communication
* https://ssl.gstatic.com is required only on Android and is needed for TalkBack to function properly
* Disables use of inline scripts in order to mitigate risk of XSS vulnerabilities. To change this:
* Enable inline JS: add 'unsafe-inline' to default-src
-->

<meta http-equiv="Content-Security-Policy" content="
default-src * blob: data: gap://ready https://ssl.gstatic.com 'unsafe-eval' 'unsafe-inline' file://* blob:;
Expand All @@ -47,15 +38,6 @@
frame-src * blob: gap://ready;
img-src * 'self' data: content: blob: 'unsafe-inline';">

<script>
const isCordovaApp = document.URL.indexOf('http://') === -1 && document.URL.indexOf('https://') === -1;
if (isCordovaApp) {
let script = document.createElement('script');
script.type = 'text/javascript';
script.src = 'cordova.js';
document.head.appendChild(script);
}
</script>

<meta name="format-detection" content="telephone=no">
<meta name="msapplication-tap-highlight" content="no">
Expand Down
70 changes: 12 additions & 58 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import SwipeTutorialPage from "./components/common/SwipeTutorialPage";
import PhotoPage from "./components/PhotoPage";
import ProfilePage from "./components/ProfilePage";
import Map from "./components/MapPage/Map";
import CustomPhotoDialog from "./components/CustomPhotoDialog";
import ModeratorPage from "./components/ModeratorPage";
import OwnPhotosPage from "./components/OwnPhotosPage";
import LoginFirebase from "./components/LoginFirebase";
Expand Down Expand Up @@ -71,7 +70,6 @@ class App extends Component {
geojson: null,
stats: null,
srcType: null,
cordovaMetadata: {},
dialogOpen: false,
confirmDialogOpen: false,
usersLeaderboard: [],
Expand Down Expand Up @@ -473,13 +471,8 @@ class App extends Component {
"Before adding photos, you must be logged into your account.",
});
} else {
if (window.cordova) {
console.log("Opening cordova dialog");
this.setState({ openPhotoDialog: true });
} else {
console.log("Clicking on photo");
this.domRefInput.current.click();
}
console.log("Clicking on photo");
this.domRefInput.current.click();
}
};

Expand All @@ -489,38 +482,6 @@ class App extends Component {
}
};

handlePhotoDialogClose = (dialogSelectedValue) => {
this.setState({ openPhotoDialog: false });
if (dialogSelectedValue) {
const Camera = navigator.camera;
const srcType =
dialogSelectedValue === "CAMERA"
? Camera.PictureSourceType.CAMERA
: Camera.PictureSourceType.PHOTOLIBRARY;

this.setState({
srcType: dialogSelectedValue === "CAMERA" ? "camera" : "filesystem",
});
Camera.getPicture(
(imageUri) => {
const file = JSON.parse(imageUri);
const cordovaMetadata = JSON.parse(file.json_metadata);
this.setState({ cordovaMetadata });
this.openPhotoPage(file.filename);
},
(message) => {
console.log("Failed because: ", message);
},
{
quality: 50,
destinationType: Camera.DestinationType.FILE_URI,
sourceType: srcType,
correctOrientation: true,
}
);
}
};

handleWelcomePageClose = () => {
this.setState({ welcomeShown: true });
localStorage.setItem("welcomeShown", true);
Expand Down Expand Up @@ -870,7 +831,6 @@ class App extends Component {
gpsLocation={this.state.location}
online={this.state.online}
srcType={this.state.srcType}
cordovaMetadata={this.state.cordovaMetadata}
fields={fields}
handleClose={history.goBack}
handleRetakeClick={this.handleCameraClick}
Expand Down Expand Up @@ -977,23 +937,17 @@ class App extends Component {
message="Connecting to our servers..."
/>

{window.cordova ? (
<CustomPhotoDialog
open={this.state.openPhotoDialog}
onClose={this.handlePhotoDialogClose}
<RootRef rootRef={this.domRefInput}>
<input
className="hidden"
type="file"
accept="image/*"
id={"fileInput"}
onChange={this.openFile}
onClick={(e) => (e.target.value = null)}
/>
) : (
<RootRef rootRef={this.domRefInput}>
<input
className="hidden"
type="file"
accept="image/*"
id={"fileInput"}
onChange={this.openFile}
onClick={(e) => (e.target.value = null)}
/>
</RootRef>
)}
</RootRef>


<Login
open={this.state.loginLogoutDialogOpen && !this.state.user}
Expand Down
60 changes: 0 additions & 60 deletions src/components/CustomPhotoDialog.js

This file was deleted.

7 changes: 1 addition & 6 deletions src/components/DrawerContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import { withStyles } from "@material-ui/core/styles";
import config from "../custom/config";
import utils from "../utils";
import "./DrawerContainer.scss";
import { isIphoneWithNotchAndCordova, isIphoneAndCordova } from "../utils";

const placeholderImage =
process.env.PUBLIC_URL + "/images/geovation-banner.svg";
Expand Down Expand Up @@ -89,11 +88,7 @@ class DrawerContainer extends Component {
>
<div
style={{
paddingTop: isIphoneWithNotchAndCordova()
? "env(safe-area-inset-top)"
: isIphoneAndCordova
? this.props.theme.spacing(1.5)
: null,
paddingTop: null,
}}
/>
{user && (
Expand Down
12 changes: 2 additions & 10 deletions src/components/EmailVerifiedDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ import { withStyles } from "@material-ui/core/styles";

import { authFirebase } from "features/firebase";

import { isIphoneWithNotchAndCordova, isIphoneAndCordova } from "../utils";

const styles = (theme) => ({
typography: {
...theme.mixins.gutters(),
Expand All @@ -39,16 +37,10 @@ const styles = (theme) => ({
margin: theme.spacing(1.5),
},
notchTop: {
paddingTop: isIphoneWithNotchAndCordova()
? "env(safe-area-inset-top)"
: isIphoneAndCordova
? theme.spacing(1.5)
: null,
paddingTop: null,
},
notchBottom: {
paddingBottom: isIphoneWithNotchAndCordova()
? "env(safe-area-inset-bottom)"
: 0,
paddingBottom: 0,
},
});

Expand Down
11 changes: 2 additions & 9 deletions src/components/FeedbackReports/FeedbackDetailsPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,11 @@ import CircularProgress from "@material-ui/core/CircularProgress";

import { dbFirebase } from "features/firebase";

import { isIphoneWithNotchAndCordova, isIphoneAndCordova } from "../../utils";
import config from "../../custom/config";

const styles = theme => ({
notchTop: {
paddingTop: isIphoneWithNotchAndCordova()
? "env(safe-area-inset-top)"
: isIphoneAndCordova
? theme.spacing(1.5)
: null
paddingTop: null
},
iconButton: {
marginRight: theme.spacing(2)
Expand All @@ -35,9 +30,7 @@ const styles = theme => ({
margin: theme.spacing(1.5)
},
notchBottom: {
paddingBottom: isIphoneWithNotchAndCordova()
? "env(safe-area-inset-bottom)"
: 0
paddingBottom: 0
}
});

Expand Down
Loading

0 comments on commit 746ac99

Please sign in to comment.