Skip to content

Commit 8124db9

Browse files
committed
Canada - change of "from" header in API - seemingly as backend API changed....
1 parent 28f6236 commit 8124db9

File tree

3 files changed

+10
-24
lines changed

3 files changed

+10
-24
lines changed

src/config.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ export interface FlattenedConfig {
3434
vin: string | undefined
3535
}
3636

37-
const SUPPORTED_REGIONS = ['canada', 'usa']
37+
const SUPPORTED_REGIONS = ['canada']
38+
// const SUPPORTED_REGIONS = ['canada', 'usa']
3839
const SUPPORTED_MANUFACTURERS = ['Hyundai', 'Kia']
3940

4041
const DEFAULT_TEMPS = {

src/lib/bluelink-regions/canada.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export class BluelinkCanada extends Bluelink {
2424
: DEFAULT_API_DOMAIN
2525
this.statusCheckInterval = statusCheckInterval || DEFAULT_STATUS_CHECK_INTERVAL
2626
this.additionalHeaders = {
27-
from: 'SPA',
27+
from: 'CWP',
2828
language: '0',
2929
offset: `-${new Date().getTimezoneOffset() / 60}`,
3030
}

src/reset.ts

Lines changed: 7 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,11 @@
1-
import { initRegionalBluelink } from 'lib/bluelink'
2-
import { getConfig, deleteConfig } from 'config'
3-
import { deleteWidgetCache } from 'widget'
4-
import { loadTintedIcons } from './lib/util'
51
import { Spacer, getTable, Div, P, destructiveConfirm } from './lib/scriptable-utils'
6-
import { Bluelink } from 'lib/bluelink-regions/base'
2+
3+
const keychain_keys = ['egmp-bluelink-config', 'egmp-bluelink-cache', 'egmp-bluelink-widget']
4+
75
;(async () => {
86
if (config.runsWithSiri || config.runsInWidget) {
97
return
108
}
11-
const blConfig = getConfig()
12-
const bl = await initRegionalBluelink(blConfig)
13-
14-
await loadTintedIcons()
159

1610
const { present } = getTable<{
1711
foo: string
@@ -23,11 +17,11 @@ import { Bluelink } from 'lib/bluelink-regions/base'
2317
defaultState: {
2418
foo: 'foobar',
2519
},
26-
render: () => [Spacer({ rowHeight: 200 }), reset(bl)],
20+
render: () => [Spacer({ rowHeight: 200 }), reset()],
2721
})
2822
})()
2923

30-
function reset(bl: Bluelink | Bluelink | undefined) {
24+
function reset() {
3125
return Div(
3226
[
3327
P('Click me to Reset All Settings?', {
@@ -41,18 +35,9 @@ function reset(bl: Bluelink | Bluelink | undefined) {
4135
destructiveConfirm('Confirm Setting Reset - ALL settings/data will be removed', {
4236
confirmButtonTitle: 'Delete all Settings/Data',
4337
onConfirm: () => {
44-
if (bl) bl.deleteCache()
45-
try {
46-
deleteConfig()
47-
} catch {
48-
// do nothing it if fails as it didnt exist
49-
}
50-
try {
51-
deleteWidgetCache()
52-
} catch {
53-
// do nothing it if fails as it didnt exist
38+
for (const key of keychain_keys) {
39+
if (Keychain.contains(key)) Keychain.remove(key)
5440
}
55-
Script.complete()
5641
},
5742
})
5843
},

0 commit comments

Comments
 (0)