diff --git a/.env.development b/.env.development index ed9bc81..0f30272 100644 --- a/.env.development +++ b/.env.development @@ -1,4 +1,4 @@ -#VUE_APP_BADHAN_API_BASE_URL=http://localhost:3000 -VUE_APP_BADHAN_API_BASE_URL=https://badhan-web-test.herokuapp.com +VUE_APP_BADHAN_API_BASE_URL=http://localhost:3000 +#VUE_APP_BADHAN_API_BASE_URL=https://badhan-web-test.herokuapp.com VUE_APP_FRONTEND_BASE=http://localhost:8080/ NODE_ENV=development diff --git a/android/app/build.gradle b/android/app/build.gradle index 0da2e83..3fff8ba 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -6,8 +6,8 @@ android { applicationId "com.mmmbadhan" minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion - versionCode 69 - versionName "4.7.5" + versionCode 70 + versionName "4.7.6" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } buildTypes { @@ -48,4 +48,4 @@ try { } } catch(Exception e) { logger.warn("google-services.json not found, google-services plugin not applied. Push Notifications won't work") -} \ No newline at end of file +} diff --git a/src/App.vue b/src/App.vue index 247dc08..54643b5 100644 --- a/src/App.vue +++ b/src/App.vue @@ -28,6 +28,8 @@ import MessageBox from './components/MessageBox' import ConfirmationBox from './components/ConfirmationBox' import { myConsole } from './mixins/myConsole' +import { isAppVersionBackdated } from './mixins/helpers' + export default { name: 'app', data () { @@ -52,7 +54,6 @@ export default { ...mapGetters('frontendSettings', ['getSettings']) }, methods: { - ...mapActions('release', ['fetchtAppDetails']), ...mapActions('frontendSettings', ['fetchSettings']), ...mapMutations('confirmationBox', ['setConfirmationMessage']), @@ -70,8 +71,7 @@ export default { async versionCheck () { await this.fetchSettings() const googlePlayAppVersion = this.getSettings.version - - if (getIsNative() && googlePlayAppVersion !== await getLocalAppVersion()) { + if (getIsNative() && isAppVersionBackdated(await getLocalAppVersion(), googlePlayAppVersion)) { this.setConfirmationMessage({ confirmationMessage: 'New version ' + googlePlayAppVersion + ' available. Please download the latest update.', confirmationAction: () => { diff --git a/src/api/index.js b/src/api/index.js index 8fc5852..19349b6 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -268,13 +268,7 @@ const handleGETSearchV3 = async (payload) => { return e.response } } -const handleGETAppVersion = async () => { - try { - return await badhanAxios('/log/version') - } catch (e) { - return e.response - } -} + const handleGETStatistics = async () => { try { return await badhanAxios.get('/log/statistics') @@ -428,7 +422,13 @@ const handleGETActiveDonors = async (payload) => { return e.response } } - +const handleGETAppVersions = async () => { + try { + return await badhanAxios.get('/log/version/v5') + } catch (e) { + return e.response + } +} /// ///////////////////////FIREBASE API CALLS //////////////////////// const handleGETCredits = async () => { try { @@ -444,6 +444,7 @@ const handleGETFrontendSettings = async () => { return e.response } } + export { badhanAxios, firebaseAxios, @@ -470,7 +471,6 @@ export { handlePOSTDonations, handleGETDonors, handleGETSearchV3, - handleGETAppVersion, handleGETStatistics, handleDELETELogs, handleGETVolunteersAll, @@ -493,6 +493,7 @@ export { handlePOSTActiveDonors, handleDELETEActiveDonors, handleGETActiveDonors, + handleGETAppVersions, // firebase methods handleGETFrontendSettings diff --git a/src/mixins/helpers.js b/src/mixins/helpers.js index dc913cc..78d366a 100644 --- a/src/mixins/helpers.js +++ b/src/mixins/helpers.js @@ -45,3 +45,11 @@ export const directCall = (phoneNumber) => { export const fixBackSlash = (text) => { return text.replaceAll('/', '/') } + +export const isAppVersionBackdated = (appVersion, remoteVersion) => { + const appVersionSegments = appVersion.split('.') + const remoteVersionSegments = remoteVersion.split('.') + const appVersionNumber = parseInt(appVersionSegments[0]) * 10000 + parseInt(appVersionSegments[1]) * 100 + parseInt(appVersionSegments[2]) + const remoteVersionNumber = parseInt(remoteVersionSegments[0]) * 10000 + parseInt(remoteVersionSegments[1]) * 100 + parseInt(remoteVersionSegments[2]) + return remoteVersionNumber > appVersionNumber +} diff --git a/src/store/release.js b/src/store/release.js deleted file mode 100644 index 992c503..0000000 --- a/src/store/release.js +++ /dev/null @@ -1,47 +0,0 @@ -import { handleGETAppVersion } from '../api' - -const state = { - appDetailsLoader: false, - appVersion: null -} - -const getters = { - getAppDetailsLoader (state) { - return state.appDetailsLoader - }, - getAppVersion (state) { - return state.appVersion - } - -} -const mutations = { - setAppDetailsLoader (state) { - state.appDetailsLoader = true - }, - unsetAppDetailsLoader (state) { - state.appDetailsLoader = false - }, - setAppVersion (state, payload) { - state.appVersion = payload - } -} -const actions = { - async fetchtAppDetails ({ commit, getters, rootState, rootGetters, dispatch }) { - commit('setAppDetailsLoader') - const response = await handleGETAppVersion() - commit('unsetAppDetailsLoader') - if (response.status === 200) { - commit('setAppVersion', response.data.version) - } - return response - } -} - -export default { - state, - actions, - getters, - mutations, - namespaced: true - -} diff --git a/src/store/store.js b/src/store/store.js index cfb8fa6..3e69a52 100644 --- a/src/store/store.js +++ b/src/store/store.js @@ -9,7 +9,6 @@ import superadmin from './superadmin' import details from './details' import userDetails from './userDetails' import notification from './notification' -import release from './release' import statistics from './statistics' import consoleStore from './consoleStore' import messageBox from './messageBox' @@ -53,7 +52,6 @@ export const store = new Vuex.Store({ details, userDetails, notification, - release, statistics, consoleStore, messageBox, diff --git a/src/views/About.vue b/src/views/About.vue index 86edf70..e196fed 100644 --- a/src/views/About.vue +++ b/src/views/About.vue @@ -4,10 +4,36 @@ -

App Version on Google Play: {{ getGooglePlayAppVersion }}

-

Local App Version: {{ nativeAppVersion }}

-

Database: {{ $getEnvironmentName() }}

-

Last Updated: {{getBuildTime}}

+ + +
@@ -28,6 +54,7 @@ import readme from '../../README.md' import Container from '../components/Wrappers/Container' import { mapGetters } from 'vuex' import { getIsNative, getLocalAppVersion } from '../plugins/android_support' +import { handleGETAppVersions } from '../api' export default { name: 'About', @@ -52,13 +79,22 @@ export default { data () { return { text: readme, - nativeAppVersion: 'Web' + nativeAppVersion: 'Web', + versionLoaderFlag: false, + githubVersion: 'None', + githubLink: 'https://github.com' } }, async mounted () { if (getIsNative()) { this.nativeAppVersion = await getLocalAppVersion() } + this.versionLoaderFlag = true + const appVersionResponse = await handleGETAppVersions() + this.versionLoaderFlag = false + if (appVersionResponse.status !== 200) return + this.githubVersion = appVersionResponse.data.githubReleaseVersion + this.githubLink = appVersionResponse.data.githubReleaseDownloadURL } } diff --git a/src/views/SignInCover.vue b/src/views/SignInCover.vue index fe961b2..03ec518 100644 --- a/src/views/SignInCover.vue +++ b/src/views/SignInCover.vue @@ -30,9 +30,7 @@ > Badhan -

BUET Zone
- -

+

BUET Zone