diff --git a/mobile/ios/DeightonAR/Info.plist b/mobile/ios/DeightonAR/Info.plist index 5c4bf03..f0f6f32 100644 --- a/mobile/ios/DeightonAR/Info.plist +++ b/mobile/ios/DeightonAR/Info.plist @@ -21,7 +21,7 @@ CFBundleSignature ???? CFBundleVersion - 20180407.3 + 20180408.0 LSRequiresIPhoneOS NSAppTransportSecurity diff --git a/mobile/src/API.js b/mobile/src/API.js index d4f7092..156a0c0 100644 --- a/mobile/src/API.js +++ b/mobile/src/API.js @@ -2,21 +2,14 @@ import EventEmitter from "eventemitter3" import io from "socket.io-client" import { AsyncStorage } from "react-native" -const authTokenName = "AuthToken" -const backendName = "backendName" +const authTokenKeyName = "AuthToken" +const backendKeyName = "BackendName" -let baseURL = null -let apiPath = null -// -if (__DEV__) { - const localIPAddr = process.env.LOCAL_IP_ADDR - - baseURL = `http://${localIPAddr || "localhost"}:3001` - apiPath = "" -} else { - baseURL = "https://dar.kss.us.com" - apiPath = "/api" -} +// if (__DEV__) { +// const localIPAddr = process.env.LOCAL_IP_ADDR +// baseURL = `http://${localIPAddr || "localhost"}:3001` +// apiPath = "" +// } class NetworkError extends Error { constructor(message) { @@ -48,16 +41,20 @@ class API extends EventEmitter { super() this.user = { pending: true } - AsyncStorage.getItem(backendName) - .then((backend) => { - this.backend = backend - }) - .catch((err) => { - this.backend = "normal" - AsyncStorage.setItem(backendName, this.backend) - }) + // AsyncStorage.getItem(backendKeyName) + // .then((backend) => { + // this.backend = backend + // }) + // .catch((err) => { + // this.backend = "normal" + // AsyncStorage.setItem(backendKeyName, this.backend) + // }) - AsyncStorage.getItem(authTokenName) + this.backendName = "normal" + this.baseURL = "https://dar.kss.us.com" + this.apiPath = "/api" + + AsyncStorage.getItem(authTokenKeyName) .then((token) => { if (!token) { return Promise.reject() @@ -72,7 +69,7 @@ class API extends EventEmitter { this.emit("login") }) .catch((err) => { - AsyncStorage.removeItem(authTokenName) + AsyncStorage.removeItem(authTokenKeyName) this.token = null this.user = {} this.socket = null @@ -81,8 +78,8 @@ class API extends EventEmitter { } connectSocket() { - this.socket = io(baseURL, { - path: apiPath + "/socketio", + this.socket = io(this.baseURL, { + path: this.apiPath + "/socketio", query: { auth_token: this.token, }, @@ -117,14 +114,14 @@ class API extends EventEmitter { } get backend() { - return this.backend + return this.backendName } makeImageUrl(id, size) { if (id) { - return apiPath + "/assets/" + id + "?access_token=" + this.token + return this.apiPath + "/assets/" + id + "?access_token=" + this.token } else if (size && size.width && size.height) { - return `${apiPath}/placeholders/${size.width}x${ + return `${this.apiPath}/placeholders/${size.width}x${ size.height }?access_token=${this.token}` } else { @@ -133,7 +130,9 @@ class API extends EventEmitter { } makeAssetUrl(id) { - return id ? apiPath + "/assets/" + id + "?access_token=" + this.token : null + return id + ? this.apiPath + "/assets/" + id + "?access_token=" + this.token + : null } static makeParams(params) { @@ -169,7 +168,7 @@ class API extends EventEmitter { } } fetchOptions.headers = headers - fetch(this.apiURL + path, fetchOptions) + fetch(this.baseURL + this.apiPath + path, fetchOptions) .then((res) => { return Promise.all([ Promise.resolve(res), @@ -221,7 +220,7 @@ class API extends EventEmitter { } if (remember) { - AsyncStorage.setItem(authTokenName, token) + AsyncStorage.setItem(authTokenKeyName, token) } this.token = token this.user = response.body @@ -237,7 +236,7 @@ class API extends EventEmitter { logout() { let cb = () => { // Regardless of response, always logout in the client - AsyncStorage.removeItem(authTokenName) + AsyncStorage.removeItem(authTokenKeyName) this.token = null this.user = {} this.disconnectSocket() diff --git a/mobile/src/Auth/Login.js b/mobile/src/Auth/Login.js index a9b3590..571f56e 100644 --- a/mobile/src/Auth/Login.js +++ b/mobile/src/Auth/Login.js @@ -173,7 +173,7 @@ export class Login extends React.Component { color: "lightgray", fontSize: 10, }}> - {versionInfo.version} + {versionInfo.fullVersion} - - + + ) } return ( - - - - - + + + + + {headerButtonsLeft} {headerButtonsRight} @@ -94,21 +107,62 @@ export class App extends Component { - - - - - - ()} /> - ()} /> - ()} /> - ()} /> - ()} /> + + + + + + ( + + )} + /> + ( + + )} + /> + ( + + )} + /> + ( + + )} + /> + ( + + )} + /> - - {'v' + versionInfo.version} {versionInfo.copyright} + + + {"v" + versionInfo.fullVersion} {versionInfo.copyright} + diff --git a/website/src/version.js b/website/src/version.js index 99c5cc3..a112728 100644 --- a/website/src/version.js +++ b/website/src/version.js @@ -1,6 +1,6 @@ export const versionInfo = { version: '1.0.0', - fullVersion: '1.0.0-20180407.3', + fullVersion: '1.0.0-20180408.0', title: 'Deighton AR System', copyright: '© 2018, Kingston Software Solutions.', supportEmail: 'support@kss.us.com',