Browse Source

fixed ota updates

chase 2 years ago
parent
commit
b974b6a4fd

+ 2 - 2
ios/cnpmobile.xcodeproj/project.pbxproj

@@ -426,7 +426,7 @@
 				INFOPLIST_FILE = cnpmobile/Info.plist;
 				IPHONEOS_DEPLOYMENT_TARGET = 13.0;
 				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
-				MARKETING_VERSION = 0.1.4;
+				MARKETING_VERSION = 0.1.6;
 				OTHER_LDFLAGS = (
 					"$(inherited)",
 					"-ObjC",
@@ -458,7 +458,7 @@
 				INFOPLIST_FILE = cnpmobile/Info.plist;
 				IPHONEOS_DEPLOYMENT_TARGET = 13.0;
 				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
-				MARKETING_VERSION = 0.1.4;
+				MARKETING_VERSION = 0.1.6;
 				OTHER_LDFLAGS = (
 					"$(inherited)",
 					"-ObjC",

+ 1 - 0
package.json

@@ -2,6 +2,7 @@
   "scripts": {
     "start": "expo start --dev-client",
     "android": "react-native run-android",
+    "build:ios": "react-native bundle --entry-file='index.js' --bundle-output='./ios/main.jsbundle' --dev=false --platform='ios'",
     "ios": "react-native run-ios",
     "web": "expo start --web",
     "eject": "expo eject",

+ 18 - 15
src/components/Atlas.tsx

@@ -26,6 +26,7 @@ import { authStore } from '../libs/auth/AuthStore';
 import { API_URL } from '../utils/RequestUtils';
 import {reportAxiosError} from '../libs/auth/core'
 import * as Updates from 'expo-updates'
+import { Manifest, UpdateCheckResult } from 'expo-updates';
 
 export enum TokenState {
   CheckingToken,
@@ -45,7 +46,7 @@ const Atlas : React.FC = () => {
    */
   const [checkingToken, setCheckingToken] = useState<boolean>(true);
   const { refreshAccessToken } = useAuth();
-  const [updatesDismissed, setUpdatesDismissed] = useState<boolean>(false)
+  const updateDismissed = useRef<boolean>(false)
   const [fontsLoaded, error] = useFonts({
     RacingSansOne_400Regular
   });
@@ -53,21 +54,23 @@ const Atlas : React.FC = () => {
     useEffect(() => {
       const timer = setInterval(async () => {
         const update = await Updates.checkForUpdateAsync()
-        if (update.isAvailable && !updatesDismissed) {
-          Alert.alert('Update Available', 'An update is available. Would you like to update now?', [
-            {"text": "Yes", "onPress": async () => {
-              await Updates.fetchUpdateAsync()
-              await Updates.reloadAsync()
-            }},
-            {"text": "No", "onPress": () => {
-              setUpdatesDismissed(true)
-              Alert.alert('Update Available', 'Update dismissed, you can always revisit it in settings', [
-                {"text": "OK"}
-              ])
-            }}
-          ])
+        if (update.isAvailable && !updateDismissed.current) {
+          updateDismissed.current = true
+          setTimeout(() => {
+            Alert.alert('Update Available', 'An update is available. Would you like to update now?', [
+              {"text": "Yes", "onPress": async () => {
+                await Updates.fetchUpdateAsync()
+                await Updates.reloadAsync()
+              }},
+              {"text": "No", "onPress": () => {
+                Alert.alert('Update Available', 'Update dismissed, you can always revisit it in settings', [
+                  {"text": "OK"}
+                ])
+              }}
+            ])
+          }, 1000);
         }
-      }, 3000)
+      }, 5000)
       return () => clearInterval(timer)
     }, [])
 

+ 1 - 1
src/components/Auth/Intro.tsx

@@ -121,7 +121,7 @@ const Intro : React.FC<IntroProps> = ({navigation}) => {
                     <Text style={styles.title} >Click & Push</Text>
                 </View>
                 <View style={styles.btnContainer}>
-                    <PrimaryButton text="Login test" onPress={login}/>
+                    <PrimaryButton text="Login" onPress={login}/>
                     <SecondaryButton text="Create account" onPress={goToRegistration} />
                 </View>
             </View> :

+ 1 - 1
src/utils/RequestUtils.ts

@@ -25,4 +25,4 @@ import Config from 'react-native-config'
  * Change the api url here
  */
 //export const API_URL = 'http://192.168.3.81:8000'
-export const API_URL = "https://staging.clicknpush.ca"
+export const API_URL = "https://app.clicknpush.ca"

+ 21 - 1
yarn.lock

@@ -4861,6 +4861,13 @@
   "resolved" "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz"
   "version" "2.2.0"
 
+"bindings@^1.5.0":
+  "integrity" "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ=="
+  "resolved" "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz"
+  "version" "1.5.0"
+  dependencies:
+    "file-uri-to-path" "1.0.0"
+
 "bl@^4.0.3", "bl@^4.1.0":
   "integrity" "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w=="
   "resolved" "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz"
@@ -8316,6 +8323,19 @@
   "resolved" "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz"
   "version" "1.0.0"
 
+"fsevents@^1.2.7":
+  "integrity" "sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw=="
+  "resolved" "https://registry.npmjs.org/fsevents/-/fsevents-1.2.13.tgz"
+  "version" "1.2.13"
+  dependencies:
+    "bindings" "^1.5.0"
+    "nan" "^2.12.1"
+
+"fsevents@^2.1.2", "fsevents@~2.3.2":
+  "integrity" "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA=="
+  "resolved" "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz"
+  "version" "2.3.2"
+
 "function-bind@^1.1.1":
   "integrity" "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A=="
   "resolved" "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz"
@@ -11507,7 +11527,7 @@
     "object-assign" "^4.0.1"
     "thenify-all" "^1.0.0"
 
-"nan@^2.14.2":
+"nan@^2.12.1", "nan@^2.14.2":
   "integrity" "sha512-8ZtvEnA2c5aYCZYd1cvgdnU6cqwixRoYg70xPLWUws5ORTa/lnw+u4amixRS/Ac5U5mQVgp9pnlSUnbNWFaWZQ=="
   "resolved" "https://registry.npmjs.org/nan/-/nan-2.15.0.tgz"
   "version" "2.15.0"