Skip to content

Commit dd7a48f

Browse files
authored
Merge pull request #14 from modos189/feat/settings
Implement app settings
2 parents 41c9cb4 + 0ac528a commit dd7a48f

32 files changed

+3038
-76
lines changed

app/app.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,15 @@ import WebViewPlugin from '@nativescript-community/ui-webview/vue';
1010
import { CheckBox } from '@nstudio/nativescript-checkbox';
1111
import CollectionView from '@nativescript-community/ui-collectionview/vue';
1212
import RipplePlugin from '@nativescript-community/ui-material-ripple/vue';
13+
import { ImageCacheIt } from '@triniwiz/nativescript-image-cache-it';
1314

1415
import Main from '~/components/Main'
1516
import store from './store';
1617
import { initializeTracing } from './app-trace';
1718

1819
// Initialize app logging
1920
initializeTracing();
21+
ImageCacheIt.enableAutoMM();
2022

2123
FontIcon.paths = {
2224
'fa': './assets/css/Font-Awesome.css',
@@ -35,6 +37,7 @@ Vue.use(CollectionView);
3537
Vue.use(RipplePlugin);
3638

3739
Vue.registerElement('HTMLLabel', () => require('@nativescript-community/ui-label').Label);
40+
Vue.registerElement('ImageCacheIt', () => require('@triniwiz/nativescript-image-cache-it').ImageCacheIt);
3841
Vue.registerElement(
3942
'CheckBox',
4043
() => CheckBox,

app/app.scss

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@ $state-focus: rgba(255, 255, 255, 0.12);
4040
$state-pressed: rgba(255, 255, 255, 0.16);
4141
$state-drag: rgba(255, 255, 255, 0.16);
4242

43+
$state-success: #43a047;
44+
$state-error: #e53935;
45+
$state-disabled: #888;
46+
47+
4348
// Elevation overlay (for depth effect)
4449
$elevation-level1: rgba(255, 255, 255, 0.05);
4550
$elevation-level2: rgba(255, 255, 255, 0.08);
761 Bytes
Loading

app/components/AppWebView.vue

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,16 @@ import { injectBridgeIITC, router } from "@/utils/bridge";
2121
import { injectIITCPrimeResources } from "~/utils/iitc-prime-resources";
2222
import { injectDebugBridge } from "@/utils/debug-bridge";
2323
import BaseWebView from './BaseWebView.vue';
24-
import { INGRESS_INTEL_MAP } from "@/utils/url-config";
25-
import {changePortalHighlights, showLayer, switchToPane} from "@/utils/events-to-iitc";
24+
import { INGRESS_INTEL_MAP, addViewportParam } from "@/utils/url-config";
25+
import {
26+
changePortalHighlights,
27+
showLayer,
28+
switchToPane,
29+
setView,
30+
userLocationLocate,
31+
userLocationUpdate,
32+
userLocationOrientation,
33+
} from "@/utils/events-to-iitc";
2634
2735
export default {
2836
name: 'AppWebView',
@@ -33,12 +41,15 @@ export default {
3341
3442
data() {
3543
return {
36-
store_unsubscribe: () => {},
37-
intelMapUrl: INGRESS_INTEL_MAP
44+
store_unsubscribe: () => {}
3845
}
3946
},
4047
4148
computed: {
49+
intelMapUrl() {
50+
return addViewportParam(INGRESS_INTEL_MAP);
51+
},
52+
4253
webview() {
4354
return this.$refs.baseWebView?.webview;
4455
}
@@ -115,6 +126,19 @@ export default {
115126
case "navigation/setCurrentPane":
116127
await webview.executeJavaScript(switchToPane(action.payload));
117128
break;
129+
case "map/locateMapOnce":
130+
await webview.executeJavaScript(setView(action.payload.lat, action.payload.lng, action.payload.persistentZoom));
131+
break;
132+
case "map/userLocationLocate":
133+
const { lat, lng, accuracy, persistentZoom } = action.payload;
134+
await webview.executeJavaScript(userLocationLocate(lat, lng, accuracy, persistentZoom));
135+
break;
136+
case "map/setLocation":
137+
await webview.executeJavaScript(userLocationUpdate(action.payload.lat, action.payload.lng));
138+
break;
139+
case "map/userLocationOrientation":
140+
await webview.executeJavaScript(userLocationOrientation(action.payload.direction));
141+
break;
118142
}
119143
}
120144
});

app/components/Main.vue

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,8 @@
5151
<script>
5252
import { AndroidApplication, Application } from "@nativescript/core";
5353
import { keyboardOpening } from '@bezlepkin/nativescript-keyboard-opening';
54-
import { Manager } from 'lib-iitc-manager';
55-
import storage from "~/utils/storage";
5654
import { layoutService } from '~/utils/layout-service';
55+
import UserLocation from "@/utils/user-location";
5756
5857
import AppWebView from './AppWebView';
5958
import ProgressBar from './ProgressBar';
@@ -94,6 +93,7 @@ export default {
9493
removeLayoutListener: null,
9594
keyboard: null,
9695
isKeyboardOpen: false,
96+
userLocation: null,
9797
}
9898
},
9999
@@ -173,16 +173,8 @@ export default {
173173
}
174174
},
175175
176-
setupManager() {
177-
const manager = new Manager({
178-
storage,
179-
message: (message, args) => console.log(`Message: ${message}, args: ${args}`),
180-
progressbar: is_show => console.log(`Progress bar: ${is_show ? 'show' : 'hide'}`),
181-
inject_plugin: (p) => this.$store.dispatch('map/setInjectPlugin', p)
182-
});
183-
184-
manager.run();
185-
return manager;
176+
async setupManager() {
177+
await this.$store.dispatch('manager/run');
186178
},
187179
188180
setupAndroidBackHandler() {
@@ -212,7 +204,10 @@ export default {
212204
},
213205
214206
async created() {
215-
const manager = this.setupManager();
207+
// Initialize app settings
208+
await this.$store.dispatch('settings/initSettings');
209+
210+
this.setupManager().then();
216211
this.setupAndroidBackHandler();
217212
218213
// Initialize layout service with default dimensions
@@ -228,6 +223,8 @@ export default {
228223
// Update store with initial values
229224
this.updateStoreLayout(layoutService.dimensions);
230225
226+
this.userLocation = new UserLocation();
227+
231228
// Subscribe to layout changes
232229
this.removeLayoutListener = layoutService.addLayoutChangeListener(this.handleLayoutChanged.bind(this));
233230
@@ -241,7 +238,12 @@ export default {
241238
switch (action.type) {
242239
case "ui/setWebviewLoadStatus":
243240
if (action.payload) {
244-
await manager.inject();
241+
await this.$store.dispatch('manager/inject');
242+
}
243+
break;
244+
case "map/triggerUserLocate":
245+
if (this.userLocation) {
246+
await this.userLocation.locate();
245247
}
246248
break;
247249
}
@@ -263,6 +265,10 @@ export default {
263265
this.keyboard.off('opened');
264266
this.keyboard.off('closed');
265267
}
268+
269+
if (this.userLocation) {
270+
this.userLocation.stopTracking();
271+
}
266272
}
267273
};
268274
</script>

app/components/Settings/AboutView.vue

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
//@license magnet:?xt=urn:btih:1f739d935676111cfff4b4693e3816e664797050&dn=gpl-3.0.txt GPL-v3
2+
3+
<template>
4+
<SettingsBase title="About IITC Prime">
5+
<StackLayout class="about-container">
6+
<Label class="app-name" text="IITC Prime" />
7+
<Label class="app-version" :text="'Version: ' + appVersion" />
8+
9+
<Label class="app-description" textWrap="true">
10+
IITC Prime is a mobile client for Ingress Intel Total Conversion that provides an enhanced interface for the Ingress Intel Map.
11+
</Label>
12+
</StackLayout>
13+
</SettingsBase>
14+
</template>
15+
16+
<script>
17+
import SettingsBase from './SettingsBase';
18+
import * as appVersion from '@nativescript/appversion';
19+
20+
export default {
21+
name: 'AboutView',
22+
23+
components: {
24+
SettingsBase
25+
},
26+
27+
data() {
28+
return {
29+
appVersion: 'Loading...'
30+
};
31+
},
32+
33+
created() {
34+
// Get app version
35+
this.loadAppVersion();
36+
},
37+
38+
methods: {
39+
loadAppVersion() {
40+
try {
41+
this.appVersion = appVersion.getVersionNameSync();
42+
} catch (error) {
43+
console.error('Error loading app version:', error);
44+
this.appVersion = 'Unknown';
45+
}
46+
}
47+
}
48+
};
49+
</script>
50+
51+
<style scoped lang="scss">
52+
@import '@/app';
53+
54+
.about-container {
55+
padding: 24;
56+
text-align: center;
57+
}
58+
59+
.app-logo {
60+
height: 100;
61+
margin-bottom: 24;
62+
}
63+
64+
.app-name {
65+
font-size: 24;
66+
font-weight: bold;
67+
color: $on-surface;
68+
margin-bottom: 8;
69+
}
70+
71+
.app-version {
72+
font-size: 16;
73+
color: $surface-variant;
74+
margin-bottom: 24;
75+
}
76+
77+
.app-description {
78+
font-size: 14;
79+
color: $on-surface;
80+
text-align: center;
81+
margin-bottom: 24;
82+
}
83+
</style>

0 commit comments

Comments
 (0)