@@ 11-46 (lines=36) @@ | ||
8 | use Godbout\Alfred\Time\Menus\Menu; |
|
9 | use Godbout\Alfred\Workflow\ScriptFilter; |
|
10 | ||
11 | class SetupAccountIdSave extends Menu |
|
12 | { |
|
13 | public static function scriptFilter() |
|
14 | { |
|
15 | self::saveAccountId(); |
|
16 | ||
17 | ScriptFilter::add( |
|
18 | self::accountIdSaved(), |
|
19 | self::back() |
|
20 | ); |
|
21 | } |
|
22 | ||
23 | private static function saveAccountId() |
|
24 | { |
|
25 | Workflow::getConfig()->write('harvest.account_id', getenv('harvest_account_id')); |
|
26 | } |
|
27 | ||
28 | private static function accountIdSaved() |
|
29 | { |
|
30 | return Item::create() |
|
31 | ->title('Account ID SAVED!') |
|
32 | ->subtitle('You can just press Enter.') |
|
33 | ->icon(Icon::create('resources/icons/harvest.png')) |
|
34 | ->arg('do') |
|
35 | ->variable('timer_action', 'exit'); |
|
36 | } |
|
37 | ||
38 | private static function back() |
|
39 | { |
|
40 | return Item::create() |
|
41 | ->title('Back') |
|
42 | ->subtitle('Go back to Harvest credentials options') |
|
43 | ->arg('harvest_setup_credentials') |
|
44 | ->icon(Icon::create('resources/icons/harvest.png')); |
|
45 | } |
|
46 | } |
|
47 |
@@ 11-46 (lines=36) @@ | ||
8 | use Godbout\Alfred\Time\Menus\Menu; |
|
9 | use Godbout\Alfred\Workflow\ScriptFilter; |
|
10 | ||
11 | class SetupApitokenSave extends Menu |
|
12 | { |
|
13 | public static function scriptFilter() |
|
14 | { |
|
15 | self::saveApitoken(); |
|
16 | ||
17 | ScriptFilter::add( |
|
18 | self::apitokenSaved(), |
|
19 | self::back() |
|
20 | ); |
|
21 | } |
|
22 | ||
23 | private static function saveApitoken() |
|
24 | { |
|
25 | Workflow::getConfig()->write('harvest.api_token', getenv('harvest_apitoken')); |
|
26 | } |
|
27 | ||
28 | private static function apitokenSaved() |
|
29 | { |
|
30 | return Item::create() |
|
31 | ->title('API TOKEN SAVED!') |
|
32 | ->subtitle('You can just press Enter.') |
|
33 | ->icon(Icon::create('resources/icons/harvest.png')) |
|
34 | ->arg('do') |
|
35 | ->variable('timer_action', 'exit'); |
|
36 | } |
|
37 | ||
38 | private static function back() |
|
39 | { |
|
40 | return Item::create() |
|
41 | ->title('Back') |
|
42 | ->subtitle('Go back to Harvest Setup') |
|
43 | ->arg('harvest_setup_credentials') |
|
44 | ->icon(Icon::create('resources/icons/harvest.png')); |
|
45 | } |
|
46 | } |
|
47 |
@@ 11-46 (lines=36) @@ | ||
8 | use Godbout\Alfred\Time\Menus\Menu; |
|
9 | use Godbout\Alfred\Workflow\ScriptFilter; |
|
10 | ||
11 | class SetupApikeySave extends Menu |
|
12 | { |
|
13 | public static function scriptFilter() |
|
14 | { |
|
15 | self::saveApikey(); |
|
16 | ||
17 | ScriptFilter::add( |
|
18 | self::apikeySaved(), |
|
19 | self::back() |
|
20 | ); |
|
21 | } |
|
22 | ||
23 | private static function saveApikey() |
|
24 | { |
|
25 | Workflow::getConfig()->write('toggl.api_token', getenv('toggl_apikey')); |
|
26 | } |
|
27 | ||
28 | private static function apikeySaved() |
|
29 | { |
|
30 | return Item::create() |
|
31 | ->title('API KEY SAVED!') |
|
32 | ->subtitle('You can just press Enter.') |
|
33 | ->icon(Icon::create('resources/icons/toggl.png')) |
|
34 | ->arg('do') |
|
35 | ->variable('timer_action', 'exit'); |
|
36 | } |
|
37 | ||
38 | private static function back() |
|
39 | { |
|
40 | return Item::create() |
|
41 | ->title('Back') |
|
42 | ->subtitle('Go back to Toggl Setup') |
|
43 | ->arg('toggl_setup') |
|
44 | ->icon(Icon::create('resources/icons/toggl.png')); |
|
45 | } |
|
46 | } |
|
47 |