Skip to content

Commit

Permalink
Merge pull request #2 from modos189/up
Browse files Browse the repository at this point in the history
  • Loading branch information
modos189 authored Aug 17, 2023
2 parents 7940328 + fec01bc commit 50c6bd4
Show file tree
Hide file tree
Showing 13 changed files with 88 additions and 11,906 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
${{ runner.os }}-yarn-
- name: Install six
run: pip install six
run: python3 -m pip install six

- name: Install NativeScript
run: |
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,5 @@ typings/
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json

package-lock.json
6 changes: 3 additions & 3 deletions App_Resources/Android/app.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@

android {
defaultConfig {
minSdkVersion 19
compileSdkVersion = 31
targetSdkVersion = 31
minSdkVersion 23
compileSdkVersion 33
targetSdkVersion 33
generatedDensities = []
}
aaptOptions {
Expand Down
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# IITC Prime

New IITC mobile app

## Getting started

How to prepare your environment to work with NativeScript is described here: https://docs.nativescript.org/environment-setup.html

## Usage

Build apk for Android:
`tns build android`

Run the app on Android:
`tns run android`

Run Vue DevTools:
`npx vue-devtools`
4 changes: 2 additions & 2 deletions app/app.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//@license magnet:?xt=urn:btih:1f739d935676111cfff4b4693e3816e664797050&dn=gpl-3.0.txt GPL-v3

import VueDevtools from 'nativescript-vue-devtools'
// import VueDevtools from 'nativescript-vue-devtools'
import Vue from 'nativescript-vue'

import Main from '~/components/Main'
Expand All @@ -20,7 +20,7 @@ Vue.use(CanvasSVG);

import store from './store';

Vue.use(VueDevtools, { host: '192.168.42.10' })
// Vue.use(VueDevtools, { host: '192.168.42.10' })
Vue.config.silent = false;

new Vue({
Expand Down
13 changes: 9 additions & 4 deletions app/components/AppWebView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
viewPortSize="width=device-width, initial-scale=1.0"
domStorage=true
@loaded="webViewLoaded"
@loadStarted="loadStarted"
@loadFinished="loadFinished"
@shouldOverrideUrlLoading="shouldOverrideUrlLoading"
@JSBridge="JSBridge"
Expand Down Expand Up @@ -101,13 +102,14 @@
}
},
async loadStarted(args) {
await this.$store.dispatch('setIsWebViewLoadFinished', false);
},
async loadFinished(args) {
await injectBridgeIITC(webview);
const iitc_code = await storage.get("release_iitc_code").then(obj => obj["release_iitc_code"]);
await webview.executeJavaScript(iitc_code);
await injectIITCPrimeResources(webview);
await this.$store.dispatch('setIsWebViewLoadFinished', true);
}
},
Expand All @@ -119,6 +121,9 @@
this.store_unsubscribe = this.$store.subscribeAction({
after: async (action, state) => {
switch (action.type) {
case "setInjectPlugin":
await webview.executeJavaScript(action.payload['code']);
break;
case "setActiveBaseLayer":
await webview.executeJavaScript(showLayer(action.payload, true));
break;
Expand Down
32 changes: 27 additions & 5 deletions app/components/Main.vue
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@
return {
status_bar_height: 0,
navigation_bar_height: 0,
show_top_padding: false
show_top_padding: false,
store_unsubscribe: function() {}
}
},
components: { AppWebView, AppBar, ProgressBar },
Expand Down Expand Up @@ -86,10 +87,26 @@
async created() {
console.log("IITC create event fired");
const manager = new Manager({
storage: storage
});
await manager.run()
const params = {
storage: storage,
message: (message, args) => {
console.log("Message for user:");
console.log(message+", args: "+args);
},
progressbar: is_show => {
if (is_show) {
console.log("Show progress bar");
} else {
console.log("Hide progress bar");
}
},
inject_plugin: (p) => {
this.$store.dispatch('setInjectPlugin', p);
}
};
const manager = new Manager(params);
manager.run().then();
if (Application.android) {
Application.android.on(AndroidApplication.activityBackPressedEvent, (args) => {
Expand All @@ -103,6 +120,11 @@
this.store_unsubscribe = this.$store.subscribeAction({
after: async (action, state) => {
switch (action.type) {
case "setIsWebViewLoadFinished":
if (action.payload) {
await manager.inject();
}
break;
case "setCurrentPane":
this.show_top_padding = !["all", "faction", "alerts", "info", "map"].includes(action.payload);
break;
Expand Down
151 changes: 0 additions & 151 deletions app/helpers.js

This file was deleted.

6 changes: 6 additions & 0 deletions app/store/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ export default {
setIsOpenedBottomSheet({commit}, status) {
commit('setIsOpenedBottomSheet', status);
},
setIsWebViewLoadFinished({commit}, status) {
commit('setIsWebViewLoadFinished', status);
},

addPane({commit}, pane) {
commit('addPane', pane);
Expand Down Expand Up @@ -39,5 +42,8 @@ export default {
},
setLocation({commit}, property) {
commit('setLocation', property);
},
setInjectPlugin({commit}, property) {
commit('setInjectPlugin', property);
}
}
2 changes: 2 additions & 0 deletions app/store/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const store = new Vuex.Store({
state: {
appbar_width: 100,
is_opened_bottom_sheet: false,
is_webview_load_finished: false,

panes: [
{name: "all", label: "All", icon: "mdi-list"},
Expand All @@ -28,6 +29,7 @@ const store = new Vuex.Store({
overlay_layers: [],
progress: 0,
location: {lat: 0, lng: 0, accuracy: 0, is_target: false},
injectPlugin: {}
},
mutations,
actions,
Expand Down
10 changes: 8 additions & 2 deletions app/store/mutations.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ export default {
setIsOpenedBottomSheet(state, status) {
state.is_opened_bottom_sheet = status;
},
setIsWebViewLoadFinished(state, status) {
state.is_webview_load_finished = status;
},

addPane(state, pane) {
state.panes.push(pane);
Expand All @@ -29,7 +32,10 @@ export default {
setProgress(state, progress) {
state.progress = progress;
},
setLocation(state, progress) {
state.location = progress;
setLocation(state, location) {
state.location = location;
},
setInjectPlugin(state, injectPlugin) {
state.injectPlugin = injectPlugin;
}
}
Loading

0 comments on commit 50c6bd4

Please sign in to comment.