diff --git a/config.xml b/config.xml index 738be59..c681a4b 100644 --- a/config.xml +++ b/config.xml @@ -1,5 +1,5 @@ - app 1point5 diff --git a/docs/1point5.sketch b/docs/1point5.sketch index 0c419cc..8ee3db5 100644 Binary files a/docs/1point5.sketch and b/docs/1point5.sketch differ diff --git a/package-lock.json b/package-lock.json index ccda56b..9b10048 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "app.onepointfive", - "version": "1.0.2", + "version": "1.0.3", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -3826,6 +3826,11 @@ "xml-escape": "^1.1.0" } }, + "cordova-plugin-badge": { + "version": "0.8.8", + "resolved": "https://registry.npmjs.org/cordova-plugin-badge/-/cordova-plugin-badge-0.8.8.tgz", + "integrity": "sha512-RhIBtd5xhD/iLnxjt35jvOae28oNW/wtMZBOmQR3Rf0y4wirvA1bpAZEhBoFqL+rZGhsd6ddOdQXdex1T0DRyQ==" + }, "cordova-plugin-ble-central": { "version": "1.2.5", "resolved": "https://registry.npmjs.org/cordova-plugin-ble-central/-/cordova-plugin-ble-central-1.2.5.tgz", @@ -3846,6 +3851,11 @@ "resolved": "https://registry.npmjs.org/cordova-plugin-dialogs/-/cordova-plugin-dialogs-2.0.2.tgz", "integrity": "sha512-FUHI6eEVeoz2VkxbF0P56QlUQLGzXcvw3i4xuXyM9gEct6Y+FA3Xzgl2pJTZcTg5wRqLWzN08kgNoHPkom15pw==" }, + "cordova-plugin-local-notification": { + "version": "0.9.0-beta.2", + "resolved": "https://registry.npmjs.org/cordova-plugin-local-notification/-/cordova-plugin-local-notification-0.9.0-beta.2.tgz", + "integrity": "sha512-63n77K1pt8dnbWnNR8QWETi9Glezi1bvNHvHWmGNIOv0xCb0phZnm+Ku49BQ+omwe8Z5voMvrA4I03SYPpv38w==" + }, "cordova-plugin-open-app-settings": { "version": "0.1.3", "resolved": "https://registry.npmjs.org/cordova-plugin-open-app-settings/-/cordova-plugin-open-app-settings-0.1.3.tgz", diff --git a/package.json b/package.json index 7122071..dba58fb 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,8 @@ "android:release": "cordova build --release android", "add-ios": "cordova platform add ios", "add-android": "cordova platform add android", - "postinstall": "npm run add-android && npm run add-ios" + "generate-icons": "node ./scripts/generate-notification-icon.js", + "postinstall": "npm run add-android && npm run add-ios && npm run generate-icons" }, "keywords": [ "un", @@ -40,10 +41,12 @@ "buefy": "^0.8.13", "cordova-android": "^8.1.0", "cordova-ios": "^5.1.1", + "cordova-plugin-badge": "^0.8.8", "cordova-plugin-ble-central": "^1.2.4", "cordova-plugin-bluetoothle": "^4.5.10", "cordova-plugin-device": "^2.0.3", "cordova-plugin-dialogs": "^2.0.2", + "cordova-plugin-local-notification": "^0.9.0-beta.2", "cordova-plugin-open-app-settings": "^0.1.3", "cordova-plugin-splashscreen": "^5.0.3", "cordova-plugin-statusbar": "^2.4.3", @@ -95,7 +98,8 @@ "cordova-plugin-splashscreen": {}, "cordova-plugin-open-app-settings": {}, "cordova-plugin-device": {}, - "cordova-plugin-bluetoothle": {} + "cordova-plugin-bluetoothle": {}, + "cordova-plugin-local-notification": {} }, "platforms": [ "android", diff --git a/public/notification.png b/public/notification.png new file mode 100644 index 0000000..70c7f7c Binary files /dev/null and b/public/notification.png differ diff --git a/scripts/generate-notification-icon.js b/scripts/generate-notification-icon.js new file mode 100644 index 0000000..17d1c60 --- /dev/null +++ b/scripts/generate-notification-icon.js @@ -0,0 +1,10 @@ +const fs = require('fs'); +(function () { + const dir = './platforms/android/app/src/main/res/drawable'; + if (!fs.existsSync(dir)) { + fs.mkdirSync(dir); + } + fs.createReadStream('./public/notification.png') + .pipe(fs.createWriteStream(dir + '/notification.png')); + console.log('done'); +})(); diff --git a/src/App.vue b/src/App.vue index 7fbc2c4..8c85438 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,47 +1,47 @@ - - diff --git a/src/components/UiScanOption.vue b/src/components/UiScanOption.vue new file mode 100644 index 0000000..ffd10f1 --- /dev/null +++ b/src/components/UiScanOption.vue @@ -0,0 +1,108 @@ + + + + + diff --git a/src/store/modules/device.store.ts b/src/store/modules/device.store.ts index b4c3711..aec190c 100644 --- a/src/store/modules/device.store.ts +++ b/src/store/modules/device.store.ts @@ -1,56 +1,5 @@ import { ActionTree, GetterTree, Module, MutationTree } from 'vuex'; -const devicesMock = [ - { - rssi: -60, - distance: 145, - isDanger: true, - name: '' - }, - { - rssi: -60, - distance: 145, - isDanger: true, - name: 'Moto e6' - }, - { - rssi: -60, - distance: 145, - isDanger: true, - name: 'Moto e6' - }, - { - rssi: -60, - distance: 145, - isDanger: true, - name: 'Moto e6' - }, - { - rssi: -60, - distance: 145, - isDanger: true, - name: 'Moto e6' - }, - { - rssi: -60, - distance: 145, - isDanger: true, - name: 'Moto e6' - }, - { - rssi: -60, - distance: 145, - isDanger: true, - name: 'Moto e6' - }, - { - rssi: -60, - distance: 145, - isDanger: true, - name: 'Moto e6' - } -]; - export const state: any = { devices: [], mute: false, @@ -59,8 +8,7 @@ export const state: any = { settings: false, vibration: false, scanAllDevices: true, - version: '1.0.4', - devicesMock: devicesMock + notification: true }; const getters: GetterTree = { @@ -71,6 +19,7 @@ const getters: GetterTree = { distance: state => state.distance, intro: state => state.intro, vibration: state => state.vibration, + notification: state => state.notification, scanAllDevices: state => state.scanAllDevices }; @@ -100,7 +49,7 @@ const mutations: MutationTree = { }, cleanDevices(state) { state.devices.forEach((d: any, index: number) => { - if (d.timestamp + 3000 < Date.now()) { + if (d.timestamp + 3000 < Date.now() && !d.excluded) { state.devices.splice(index, 1); } }); @@ -113,6 +62,12 @@ const mutations: MutationTree = { }, toggleScanAllDevices(state) { state.scanAllDevices = !state.scanAllDevices; + }, + updateScanAllDevices(state, v) { + state.scanAllDevices = v; + }, + toggleNotification(state) { + state.notification = !state.notification; } }; diff --git a/src/views/Settings.vue b/src/views/Settings.vue index c9aa377..09face1 100644 --- a/src/views/Settings.vue +++ b/src/views/Settings.vue @@ -16,22 +16,31 @@
  • Vibration {{ !vibration ? 'on' : 'off' }}
  • +
  • + + Notification + {{ notification ? 'on' : 'off' }} +
  • - 1point5 only + Only 1point5 {{ !scanAllDevices ? 'on' : 'off' }}
  • -
    @@ -95,10 +104,12 @@ @deviceStore.Getter('mute') mute!: boolean; @deviceStore.Getter('vibration') vibration!: boolean; @deviceStore.Getter('scanAllDevices') scanAllDevices!: boolean; + @deviceStore.Getter('notification') notification!: boolean; @deviceStore.Mutation('toggleMute') toggleMute!: void; @deviceStore.Mutation('toggleSettings') toggleSettings!: void; @deviceStore.Mutation('toggleVibration') toggleVibration!: void; @deviceStore.Mutation('toggleScanAllDevices') toggleScanAllDevices!: void; + @deviceStore.Mutation('toggleNotification') toggleNotification!: void; @Prop() bluetooth!: boolean; @@ -169,10 +180,11 @@ display: flex; margin-top: 2 * $margin; margin-bottom: 3 * $margin; + flex-wrap: wrap; li { - flex: 1; - margin: 0; + margin-bottom: 3 * $margin; + flex: 50%; display: flex; font-size: 14px; line-height: 18px; @@ -186,7 +198,7 @@ } .device-list-wrapper { - margin-top: 7 * $margin; + margin-top: 3 * $margin; &:before { width: 90%; @@ -215,9 +227,15 @@ .app { fill: $color-blue-0; + stroke: $color-blue-0; &.off { fill: $color-blue-4; + stroke: $color-blue-4;; } } + + .vibration { + stroke: $color-blue-4; + }