You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"To ensure the best experience, please move the app to the Applications folder. If the app is not inside the Applications folder, please set up the launch agent manually by clicking the button."
80
+
)
81
+
}
82
+
}
83
+
84
+
return.none
85
+
41
86
case.setupLaunchAgentIfNeeded:
42
87
return.run { send in
43
88
#if DEBUG
44
89
// do not auto install on debug build
45
90
#else
46
-
Task{
47
-
do{
48
-
tryawaitLaunchAgentManager()
49
-
.setupLaunchAgentForTheFirstTimeIfNeeded()
50
-
}catch{
51
-
toast(error.localizedDescription,.error)
52
-
}
91
+
do{
92
+
tryawaitLaunchAgentManager()
93
+
.setupLaunchAgentForTheFirstTimeIfNeeded()
94
+
}catch{
95
+
toast(error.localizedDescription,.error)
53
96
}
54
97
#endif
55
98
awaitsend(.reloadStatus)
56
99
}
57
100
101
+
case.setupLaunchAgentClicked:
102
+
ifSelf.bundleIsInApplicationsFolder {
103
+
return.run { send in
104
+
awaitsend(.setupLaunchAgent)
105
+
}
106
+
}
107
+
108
+
state.alert =.init {
109
+
TextState("Setup Launch Agent")
110
+
} actions:{
111
+
ButtonState(action:.install){
112
+
TextState("Setup")
113
+
}
114
+
115
+
ButtonState(action:.moveToApplications){
116
+
TextState("Move to Applications Folder")
117
+
}
118
+
119
+
ButtonState(role:.cancel){
120
+
TextState("Cancel")
121
+
}
122
+
} message:{
123
+
TextState(
124
+
"It's recommended to move the app into the Applications folder. But you can still keep it in the current folder and install the launch agent to ~/Library/LaunchAgents."
125
+
)
126
+
}
127
+
128
+
return.none
129
+
130
+
case.removeLaunchAgentClicked:
131
+
return.run { send in
132
+
do{
133
+
tryawaitLaunchAgentManager().removeLaunchAgent()
134
+
awaitsend(.finishRemoveLaunchAgent)
135
+
}catch{
136
+
toast(error.localizedDescription,.error)
137
+
}
138
+
awaitsend(.reloadStatus)
139
+
}
140
+
141
+
case.reloadLaunchAgentClicked:
142
+
return.run { send in
143
+
do{
144
+
tryawaitLaunchAgentManager().reloadLaunchAgent()
145
+
awaitsend(.finishReloadLaunchAgent)
146
+
}catch{
147
+
toast(error.localizedDescription,.error)
148
+
}
149
+
awaitsend(.reloadStatus)
150
+
}
151
+
152
+
case.setupLaunchAgent:
153
+
return.run { send in
154
+
do{
155
+
tryawaitLaunchAgentManager().setupLaunchAgent()
156
+
awaitsend(.finishSetupLaunchAgent)
157
+
}catch{
158
+
toast(error.localizedDescription,.error)
159
+
}
160
+
awaitsend(.reloadStatus)
161
+
}
162
+
163
+
case.finishSetupLaunchAgent:
164
+
state.alert =.init {
165
+
TextState("Launch Agent Installed")
166
+
} actions:{
167
+
ButtonState{
168
+
TextState("OK")
169
+
}
170
+
} message:{
171
+
TextState(
172
+
"The launch agent has been installed. Please restart the app."
0 commit comments