Skip to content

Commit

Permalink
chore: finished move to new repo template
Browse files Browse the repository at this point in the history
  • Loading branch information
farfromrefug committed Jan 5, 2023
1 parent 3b09a7f commit 19b569f
Show file tree
Hide file tree
Showing 83 changed files with 120 additions and 840 deletions.
9 changes: 0 additions & 9 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,2 @@
{
"xml.fileAssociations": [
{
"systemId": "/Volumes/data/dev/nativescript/nativescript-background-gps/schema/tns.xsd",
"pattern": "**/**/*.xml"
}
],
"files.exclude": {
"schema": true
}
}
8 changes: 7 additions & 1 deletion demo-snippets/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
"private": true,
"version": "0.0.1",
"dependencies": {
"@nativescript-community/gps": "file:../packages/gps"
"@nativescript-community/gps": "3.1.8"
},
"nativescript": {
"platforms": {
"android": "2.3.0",
"ios": "2.3.0"
}
}
}
6 changes: 6 additions & 0 deletions demo-snippets/platforms/android/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-feature android:name="android.hardware.location.gps" />
</manifest>
Binary file added demo-snippets/platforms/android/template_snippet.aar
Binary file not shown.
13 changes: 11 additions & 2 deletions demo/app/App_Resources/iOS/Info.plist → demo-snippets/platforms/ios/Info.plist
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@
<true/>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIRequiresFullScreen</key>
<true/>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
Expand All @@ -43,5 +41,16 @@
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true />
</dict>
<key>UIBackgroundModes</key>
<array>
<string>audio</string>
</array>
<key>NSMicrophoneUsageDescription</key>
<string>The Audio Recorder needs to access your Microphone to record.</string>
</dict>
</plist>
163 changes: 65 additions & 98 deletions demo-snippets/vue/Basic.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,23 @@
</ActionBar>

<StackLayout>
<Label :text="message" class="message" textWrap="true"/>
<Label :text="message" class="message" textWrap="true" />

<ListView :items="gpsPoints">
<ListView.itemTemplate>
<Label :text="item.name" />
</ListView.itemTemplate>
</ListView>
</StackLayout>
<ListView :items="gpsPoints">
<v-template>
<Label :text="item.name" />
</v-template>
</ListView>
</StackLayout>
</Page>
</template>

<script lang="typescript">
import { ObservableArray } from '@nativescript/core/data/observable-array';
<script lang="ts">
import Vue from 'vue';
import { ObservableArray } from '@nativescript/core';
import { GPS } from '@nativescript-community/gps';
const gps = new GPS();
export default {
export default Vue.extend({
mounted() {
this.gpsPoints = new ObservableArray([]);
gps.on(GPS.gps_status_event, (e) => {
Expand All @@ -36,76 +37,73 @@ export default {
}).then((watchId) => (this.watchId = watchId));
})
.catch(this.error);
},
computed: {
message() {
return 'Blank {N}-Vue app';
},
items() {
return new Array(100).fill({ title: 'My profile' });
destroyed() {
if (this.watchId) {
console.log('clearWatch');
gps.clearWatch(this.watchId);
}
},
data:function( ) {
data() {
return {
message:'Tracking location',
gpsPoints:[]
}
watchId: null,
message: 'Tracking location',
gpsPoints: []
};
},
methods: {
enableLocation() {
if (!gps.isEnabled()) {
console.log('Location not enabled, requesting.');
return gps.authorize(true).then(() => gps.enable());
} else {
return Promise.resolve(true);
}
},
enableLocation() {
if (!gps.isEnabled()) {
console.log('Location not enabled, requesting.');
return gps.authorize(true).then(() => gps.enable());
} else {
return Promise.resolve(true);
}
},
getLocation() {
if (gps.isEnabled()) {
return gps.getCurrentLocation({
minimumUpdateTime: 1000
});
}
return Promise.reject('Geolocation not enabled.');
},
getLocation() {
if (gps.isEnabled()) {
return gps.getCurrentLocation({
minimumUpdateTime: 1000
});
}
return Promise.reject('Geolocation not enabled.');
},
locationReceived (position: any) {
console.log('GPS Update Received');
// {
// "latitude": 33.52077361638753,
// "longitude": -111.89930240833577,
// "altitude": 384.0000915527344,
// "horizontalAccuracy": 65,
// "verticalAccuracy": 10,
// "speed": -1,
// "direction": -1,
// "timestamp": "2016-10-04T00:22:59.316Z",
// "ios": {}
// }
locationReceived(position: any) {
console.log('GPS Update Received');
// {
// "latitude": 33.52077361638753,
// "longitude": -111.89930240833577,
// "altitude": 384.0000915527344,
// "horizontalAccuracy": 65,
// "verticalAccuracy": 10,
// "speed": -1,
// "direction": -1,
// "timestamp": "2016-10-04T00:22:59.316Z",
// "ios": {}
// }
console.log(JSON.stringify(position));
console.log(JSON.stringify(position.latitude));
console.log(JSON.stringify(position.longitude));
console.log(JSON.stringify(position));
console.log(JSON.stringify(position.latitude));
console.log(JSON.stringify(position.longitude));
const gpsTime: Date = new Date(position.timestamp);
const logTime: Date = new Date();
const difference: number = (logTime.getTime() - gpsTime.getTime()) / 1000;
this.message = `last location:${difference},${position.latitude},${position.longitude}`;
this.gpsPoints.unshift({ name: gpsTime });
},
const gpsTime: Date = new Date(position.timestamp);
const logTime: Date = new Date();
const difference: number = (logTime.getTime() - gpsTime.getTime()) / 1000;
this.message = `last location:${difference},${position.latitude},${position.longitude}`;
this.gpsPoints.unshift({ name: gpsTime });
},
error(err) {
console.log('Error: ' + JSON.stringify(err));
},
error(err) {
alert(err);
},
formatDate(date: Date) {
return date.getHours() + ':' + date.getMinutes() + ':' + date.getSeconds();
}
formatDate(date: Date) {
return date.getHours() + ':' + date.getMinutes() + ':' + date.getSeconds();
}
}
};
});
</script>

<style scoped lang="scss">
Expand All @@ -117,35 +115,4 @@ Button {
background-color: #42b883;
color: white;
}
.avatar {
background-color: #42b883;
border-radius: 40;
height: 80;
vertical-align: middle;
Label {
vertical-align: middle;
horizontal-align: center;
font-size: 30;
color: white;
}
}
.drawer {
Button {
background-color: transparent;
margin: 0;
padding: 0;
border-color: #ccc;
z-index: 0;
border-width: 0 0 0.5 0;
color: #222222;
text-align: left;
padding-left: 25;
height: 50;
font-size: 14;
}
Button:highlighted {
background-color: #eeeeee;
color: #222222;
}
}
</style>
16 changes: 0 additions & 16 deletions demo/app/App_Resources/Android/app.gradle

This file was deleted.

38 changes: 0 additions & 38 deletions demo/app/App_Resources/Android/src/main/AndroidManifest.xml

This file was deleted.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

This file was deleted.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

This file was deleted.

23 changes: 0 additions & 23 deletions demo/app/App_Resources/Android/src/main/res/values-v21/styles.xml

This file was deleted.

7 changes: 0 additions & 7 deletions demo/app/App_Resources/Android/src/main/res/values/colors.xml

This file was deleted.

Loading

0 comments on commit 19b569f

Please sign in to comment.