@sprucelabs/spruce-calendar-components 25.5.1 → 25.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -272,7 +272,9 @@ class CalendarViewController extends CoreCalendarViewController {
272
272
  });
273
273
  }
274
274
  render() {
275
- return Object.assign(Object.assign({}, super.render()), { onLongPressEvent: () => this.getDevice().vibrate(), onLongPressView: () => this.getDevice().vibrate() });
275
+ var _a, _b;
276
+ const model = super.render();
277
+ return Object.assign(Object.assign({}, model), { onLongPressEvent: () => this.getDevice().vibrate(), onLongPressView: () => this.getDevice().vibrate(), shouldEnableSwipeNav: ((_b = (_a = model.people) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) === 1 });
276
278
  }
277
279
  }
278
280
  CalendarViewController.id = 'calendar';
@@ -29,6 +29,7 @@ export default class RootSkillViewController extends AbstractSkillViewController
29
29
  protected remoteVc: RemoteViewControllerFactory;
30
30
  protected draftEvent?: CalendarEvent;
31
31
  private loadEventInterval?;
32
+ private shouldIgnoreNextDeselectEvent;
32
33
  constructor(options: ViewControllerOptions);
33
34
  getScope: () => ScopeFlag[];
34
35
  private createToolBeltStates;
@@ -18,6 +18,7 @@ import { RootToolBeltState } from '../toolBelt/states/RootToolBeltState.js';
18
18
  class RootSkillViewController extends AbstractSkillViewController {
19
19
  constructor(options) {
20
20
  super(options);
21
+ this.shouldIgnoreNextDeselectEvent = false;
21
22
  this.getScope = () => ['employed', 'location'];
22
23
  this.toolBeltVc = this.ToolBeltVc();
23
24
  this.calendarVc = this.CalendarVc();
@@ -215,7 +216,9 @@ class RootSkillViewController extends AbstractSkillViewController {
215
216
  }
216
217
  handleDeselectEvent() {
217
218
  return __awaiter(this, void 0, void 0, function* () {
218
- if (this.calendarVc.getIsSwappingEvent()) {
219
+ if (this.shouldIgnoreNextDeselectEvent ||
220
+ this.calendarVc.getIsSwappingEvent()) {
221
+ this.shouldIgnoreNextDeselectEvent = false;
219
222
  return;
220
223
  }
221
224
  yield this.resetToRootState();
@@ -231,8 +234,8 @@ class RootSkillViewController extends AbstractSkillViewController {
231
234
  this.makeDateSelectMatchSelectedDateFromCalendar();
232
235
  this.syncPeopleOnCalendar();
233
236
  yield this.transitionPromise;
234
- yield this.events.reset();
235
237
  yield this.calendarVc.deselectEvent();
238
+ yield this.events.reset();
236
239
  delete this.transitionPromise;
237
240
  });
238
241
  }
@@ -258,6 +261,9 @@ class RootSkillViewController extends AbstractSkillViewController {
258
261
  var _a, _b;
259
262
  return __awaiter(this, void 0, void 0, function* () {
260
263
  const { event } = options;
264
+ if (this.events.getSelectedEvent()) {
265
+ this.shouldIgnoreNextDeselectEvent = true;
266
+ }
261
267
  yield this.events.selectEvent(event.id);
262
268
  this.toolBeltVc.open({ shouldStayOpen: true });
263
269
  try {
@@ -470,6 +476,7 @@ class RootSkillViewController extends AbstractSkillViewController {
470
476
  }
471
477
  loadEvents(options) {
472
478
  return __awaiter(this, void 0, void 0, function* () {
479
+ console.log('loading events');
473
480
  this.loadEventsPromise = this._loadEvents(options);
474
481
  yield this.loadEventsPromise;
475
482
  });
@@ -60,9 +60,10 @@ class EventTitleToolViewController extends AbstractViewController {
60
60
  }
61
61
  handleUpdateContext(context) {
62
62
  return __awaiter(this, void 0, void 0, function* () {
63
+ const firstBlock = context.event.timeBlocks[0];
63
64
  yield this.formVc.setValues({
64
- title: context.event.timeBlocks[0].title,
65
- subtitle: context.event.timeBlocks[0].subtitle,
65
+ title: firstBlock.title,
66
+ subtitle: firstBlock.subtitle,
66
67
  });
67
68
  });
68
69
  }
@@ -29,6 +29,7 @@ export default class RootSkillViewController extends AbstractSkillViewController
29
29
  protected remoteVc: RemoteViewControllerFactory;
30
30
  protected draftEvent?: CalendarEvent;
31
31
  private loadEventInterval?;
32
+ private shouldIgnoreNextDeselectEvent;
32
33
  constructor(options: ViewControllerOptions);
33
34
  getScope: () => ScopeFlag[];
34
35
  private createToolBeltStates;
@@ -14,6 +14,7 @@ const RootToolBeltState_1 = require("../toolBelt/states/RootToolBeltState");
14
14
  class RootSkillViewController extends heartwood_view_controllers_1.AbstractSkillViewController {
15
15
  constructor(options) {
16
16
  super(options);
17
+ this.shouldIgnoreNextDeselectEvent = false;
17
18
  this.getScope = () => ['employed', 'location'];
18
19
  this.toolBeltVc = this.ToolBeltVc();
19
20
  this.calendarVc = this.CalendarVc();
@@ -190,7 +191,9 @@ class RootSkillViewController extends heartwood_view_controllers_1.AbstractSkill
190
191
  return (_a = this.calendarVc.getStartDate()) !== null && _a !== void 0 ? _a : this.dates.date();
191
192
  }
192
193
  async handleDeselectEvent() {
193
- if (this.calendarVc.getIsSwappingEvent()) {
194
+ if (this.shouldIgnoreNextDeselectEvent ||
195
+ this.calendarVc.getIsSwappingEvent()) {
196
+ this.shouldIgnoreNextDeselectEvent = false;
194
197
  return;
195
198
  }
196
199
  await this.resetToRootState();
@@ -204,8 +207,8 @@ class RootSkillViewController extends heartwood_view_controllers_1.AbstractSkill
204
207
  this.makeDateSelectMatchSelectedDateFromCalendar();
205
208
  this.syncPeopleOnCalendar();
206
209
  await this.transitionPromise;
207
- await this.events.reset();
208
210
  await this.calendarVc.deselectEvent();
211
+ await this.events.reset();
209
212
  delete this.transitionPromise;
210
213
  }
211
214
  ToolBeltVc() {
@@ -227,6 +230,9 @@ class RootSkillViewController extends heartwood_view_controllers_1.AbstractSkill
227
230
  async handleClickEvent(options) {
228
231
  var _a, _b;
229
232
  const { event } = options;
233
+ if (this.events.getSelectedEvent()) {
234
+ this.shouldIgnoreNextDeselectEvent = true;
235
+ }
230
236
  await this.events.selectEvent(event.id);
231
237
  this.toolBeltVc.open({ shouldStayOpen: true });
232
238
  try {
@@ -411,6 +417,7 @@ class RootSkillViewController extends heartwood_view_controllers_1.AbstractSkill
411
417
  this.calendarVc.setTimezoneOffsetMs(offset * 60 * 1000);
412
418
  }
413
419
  async loadEvents(options) {
420
+ console.log('loading events');
414
421
  this.loadEventsPromise = this._loadEvents(options);
415
422
  await this.loadEventsPromise;
416
423
  }
@@ -50,9 +50,10 @@ class EventTitleToolViewController extends heartwood_view_controllers_1.Abstract
50
50
  });
51
51
  }
52
52
  async handleUpdateContext(context) {
53
+ const firstBlock = context.event.timeBlocks[0];
53
54
  await this.formVc.setValues({
54
- title: context.event.timeBlocks[0].title,
55
- subtitle: context.event.timeBlocks[0].subtitle,
55
+ title: firstBlock.title,
56
+ subtitle: firstBlock.subtitle,
56
57
  });
57
58
  }
58
59
  getFormVc() {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sprucelabs/spruce-calendar-components",
3
3
  "description": "Calendar components for working with calendars and Sprucebot.",
4
- "version": "25.5.1",
4
+ "version": "25.5.2",
5
5
  "skill": {
6
6
  "namespace": "calendar"
7
7
  },