1
- import { initRegionalBluelink } from 'lib/bluelink'
2
- import { getConfig , deleteConfig } from 'config'
3
- import { deleteWidgetCache } from 'widget'
4
- import { loadTintedIcons } from './lib/util'
5
1
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
+
7
5
; ( async ( ) => {
8
6
if ( config . runsWithSiri || config . runsInWidget ) {
9
7
return
10
8
}
11
- const blConfig = getConfig ( )
12
- const bl = await initRegionalBluelink ( blConfig )
13
-
14
- await loadTintedIcons ( )
15
9
16
10
const { present } = getTable < {
17
11
foo : string
@@ -23,11 +17,11 @@ import { Bluelink } from 'lib/bluelink-regions/base'
23
17
defaultState : {
24
18
foo : 'foobar' ,
25
19
} ,
26
- render : ( ) => [ Spacer ( { rowHeight : 200 } ) , reset ( bl ) ] ,
20
+ render : ( ) => [ Spacer ( { rowHeight : 200 } ) , reset ( ) ] ,
27
21
} )
28
22
} ) ( )
29
23
30
- function reset ( bl : Bluelink | Bluelink | undefined ) {
24
+ function reset ( ) {
31
25
return Div (
32
26
[
33
27
P ( 'Click me to Reset All Settings?' , {
@@ -41,18 +35,9 @@ function reset(bl: Bluelink | Bluelink | undefined) {
41
35
destructiveConfirm ( 'Confirm Setting Reset - ALL settings/data will be removed' , {
42
36
confirmButtonTitle : 'Delete all Settings/Data' ,
43
37
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 )
54
40
}
55
- Script . complete ( )
56
41
} ,
57
42
} )
58
43
} ,
0 commit comments