@symbiote-native/calendar 0.1.0
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.
- package/LICENSE +21 -0
- package/README.md +189 -0
- package/build/angular/index.d.ts +3 -0
- package/build/angular/index.js +3 -0
- package/build/angular/services/calendar-permissions.service/index.d.ts +5 -0
- package/build/angular/services/calendar-permissions.service/index.js +60 -0
- package/build/angular/services/reminders-permissions.service/index.d.ts +5 -0
- package/build/angular/services/reminders-permissions.service/index.js +60 -0
- package/build/core/attendee.d.ts +9 -0
- package/build/core/attendee.js +28 -0
- package/build/core/calendar-permission-api.d.ts +9 -0
- package/build/core/calendar-permission-api.js +9 -0
- package/build/core/calendar.d.ts +34 -0
- package/build/core/calendar.js +118 -0
- package/build/core/enums.d.ts +141 -0
- package/build/core/enums.js +157 -0
- package/build/core/event.d.ts +14 -0
- package/build/core/event.js +40 -0
- package/build/core/index.d.ts +6 -0
- package/build/core/index.js +6 -0
- package/build/core/native-module.d.ts +154 -0
- package/build/core/native-module.js +3 -0
- package/build/core/reminder.d.ts +10 -0
- package/build/core/reminder.js +34 -0
- package/build/core/types.d.ts +184 -0
- package/build/core/types.js +1 -0
- package/build/core/utils.d.ts +7 -0
- package/build/core/utils.js +29 -0
- package/build/legacy/calendar.d.ts +23 -0
- package/build/legacy/calendar.js +261 -0
- package/build/legacy/enums.d.ts +1 -0
- package/build/legacy/enums.js +2 -0
- package/build/legacy/index.d.ts +5 -0
- package/build/legacy/index.js +5 -0
- package/build/legacy/native-module.d.ts +39 -0
- package/build/legacy/native-module.js +3 -0
- package/build/legacy/permissions.d.ts +9 -0
- package/build/legacy/permissions.js +33 -0
- package/build/legacy/reminders.d.ts +6 -0
- package/build/legacy/reminders.js +56 -0
- package/build/legacy/types.d.ts +147 -0
- package/build/legacy/types.js +1 -0
- package/build/react/index.d.ts +3 -0
- package/build/react/index.js +3 -0
- package/build/react/use-calendar-permissions.d.ts +10 -0
- package/build/react/use-calendar-permissions.js +7 -0
- package/build/react/use-reminders-permissions.d.ts +8 -0
- package/build/react/use-reminders-permissions.js +10 -0
- package/build/solid/index.d.ts +3 -0
- package/build/solid/index.js +3 -0
- package/build/solid/use-calendar-permissions.d.ts +11 -0
- package/build/solid/use-calendar-permissions.js +7 -0
- package/build/solid/use-reminders-permissions.d.ts +9 -0
- package/build/solid/use-reminders-permissions.js +10 -0
- package/build/svelte/index.d.ts +3 -0
- package/build/svelte/index.js +3 -0
- package/build/svelte/use-calendar-permissions.svelte.d.ts +10 -0
- package/build/svelte/use-calendar-permissions.svelte.js +7 -0
- package/build/svelte/use-reminders-permissions.svelte.d.ts +8 -0
- package/build/svelte/use-reminders-permissions.svelte.js +10 -0
- package/build/vue/index.d.ts +3 -0
- package/build/vue/index.js +3 -0
- package/build/vue/use-calendar-permissions.d.ts +11 -0
- package/build/vue/use-calendar-permissions.js +7 -0
- package/build/vue/use-reminders-permissions.d.ts +9 -0
- package/build/vue/use-reminders-permissions.js +10 -0
- package/build-ngc/angular/index.d.ts +3 -0
- package/build-ngc/angular/index.js +4 -0
- package/build-ngc/angular/index.js.map +1 -0
- package/build-ngc/angular/services/calendar-permissions.service/index.d.ts +8 -0
- package/build-ngc/angular/services/calendar-permissions.service/index.js +17 -0
- package/build-ngc/angular/services/calendar-permissions.service/index.js.map +1 -0
- package/build-ngc/angular/services/reminders-permissions.service/index.d.ts +8 -0
- package/build-ngc/angular/services/reminders-permissions.service/index.js +17 -0
- package/build-ngc/angular/services/reminders-permissions.service/index.js.map +1 -0
- package/build-ngc/core/attendee.d.ts +9 -0
- package/build-ngc/core/attendee.js +29 -0
- package/build-ngc/core/attendee.js.map +1 -0
- package/build-ngc/core/calendar-permission-api.d.ts +9 -0
- package/build-ngc/core/calendar-permission-api.js +10 -0
- package/build-ngc/core/calendar-permission-api.js.map +1 -0
- package/build-ngc/core/calendar.d.ts +34 -0
- package/build-ngc/core/calendar.js +119 -0
- package/build-ngc/core/calendar.js.map +1 -0
- package/build-ngc/core/enums.d.ts +141 -0
- package/build-ngc/core/enums.js +158 -0
- package/build-ngc/core/enums.js.map +1 -0
- package/build-ngc/core/event.d.ts +14 -0
- package/build-ngc/core/event.js +41 -0
- package/build-ngc/core/event.js.map +1 -0
- package/build-ngc/core/index.d.ts +6 -0
- package/build-ngc/core/index.js +7 -0
- package/build-ngc/core/index.js.map +1 -0
- package/build-ngc/core/native-module.d.ts +154 -0
- package/build-ngc/core/native-module.js +4 -0
- package/build-ngc/core/native-module.js.map +1 -0
- package/build-ngc/core/reminder.d.ts +10 -0
- package/build-ngc/core/reminder.js +35 -0
- package/build-ngc/core/reminder.js.map +1 -0
- package/build-ngc/core/types.d.ts +184 -0
- package/build-ngc/core/types.js +2 -0
- package/build-ngc/core/types.js.map +1 -0
- package/build-ngc/core/utils.d.ts +7 -0
- package/build-ngc/core/utils.js +30 -0
- package/build-ngc/core/utils.js.map +1 -0
- package/native-link.json +29 -0
- package/package.json +155 -0
- package/src/angular/index.ts +3 -0
- package/src/angular/services/calendar-permissions.service/index.ts +19 -0
- package/src/angular/services/reminders-permissions.service/index.ts +16 -0
- package/src/core/attendee.ts +43 -0
- package/src/core/calendar-permission-api.ts +16 -0
- package/src/core/calendar.ts +197 -0
- package/src/core/enums.ts +156 -0
- package/src/core/event.ts +70 -0
- package/src/core/index.ts +18 -0
- package/src/core/native-module.ts +212 -0
- package/src/core/reminder.ts +52 -0
- package/src/core/types.ts +209 -0
- package/src/core/utils.ts +39 -0
- package/src/legacy/calendar.ts +401 -0
- package/src/legacy/enums.ts +2 -0
- package/src/legacy/index.ts +5 -0
- package/src/legacy/native-module.ts +77 -0
- package/src/legacy/permissions.ts +47 -0
- package/src/legacy/reminders.ts +98 -0
- package/src/legacy/types.ts +183 -0
- package/src/react/index.ts +3 -0
- package/src/react/use-calendar-permissions.ts +25 -0
- package/src/react/use-reminders-permissions.ts +25 -0
- package/src/solid/index.ts +3 -0
- package/src/solid/use-calendar-permissions.ts +26 -0
- package/src/solid/use-reminders-permissions.ts +26 -0
- package/src/svelte/index.ts +3 -0
- package/src/svelte/svelte-ambient.d.ts +3 -0
- package/src/svelte/svelte-compile.test-helper.ts +7 -0
- package/src/svelte/use-calendar-permissions.svelte.ts +25 -0
- package/src/svelte/use-reminders-permissions.svelte.ts +25 -0
- package/src/vue/index.ts +3 -0
- package/src/vue/use-calendar-permissions.ts +26 -0
- package/src/vue/use-reminders-permissions.ts +26 -0
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import type { PermissionResponse } from 'expo-modules-core';
|
|
2
|
+
import type {
|
|
3
|
+
AlarmMethod,
|
|
4
|
+
AttendeeRole,
|
|
5
|
+
AttendeeStatus,
|
|
6
|
+
AttendeeType,
|
|
7
|
+
CalendarAccessLevel,
|
|
8
|
+
CalendarDialogResultActions,
|
|
9
|
+
CalendarType,
|
|
10
|
+
DayOfTheWeek,
|
|
11
|
+
EntityTypes,
|
|
12
|
+
EventAccessLevel,
|
|
13
|
+
EventStatus,
|
|
14
|
+
Frequency,
|
|
15
|
+
MonthOfTheYear,
|
|
16
|
+
SourceType,
|
|
17
|
+
Availability,
|
|
18
|
+
} from './enums';
|
|
19
|
+
|
|
20
|
+
export type { PermissionResponse };
|
|
21
|
+
|
|
22
|
+
export type IRecurringEventOptions = {
|
|
23
|
+
futureEvents?: boolean;
|
|
24
|
+
instanceStartDate?: string | Date;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export type IOrganizer = {
|
|
28
|
+
isCurrentUser: boolean;
|
|
29
|
+
name?: string;
|
|
30
|
+
role: string;
|
|
31
|
+
status: string;
|
|
32
|
+
type: string;
|
|
33
|
+
url?: string;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export type ISource = {
|
|
37
|
+
id?: string;
|
|
38
|
+
type: string | SourceType;
|
|
39
|
+
name: string;
|
|
40
|
+
isLocalAccount?: boolean;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export type ICalendar = {
|
|
44
|
+
id: string;
|
|
45
|
+
title: string;
|
|
46
|
+
sourceId?: string;
|
|
47
|
+
source: ISource;
|
|
48
|
+
type?: CalendarType;
|
|
49
|
+
color: string;
|
|
50
|
+
entityType?: EntityTypes;
|
|
51
|
+
allowsModifications: boolean;
|
|
52
|
+
allowedAvailabilities: Availability[];
|
|
53
|
+
isPrimary?: boolean;
|
|
54
|
+
name?: string | null;
|
|
55
|
+
ownerAccount?: string;
|
|
56
|
+
timeZone?: string;
|
|
57
|
+
allowedReminders?: AlarmMethod[];
|
|
58
|
+
allowedAttendeeTypes?: AttendeeType[];
|
|
59
|
+
isVisible?: boolean;
|
|
60
|
+
isSynced?: boolean;
|
|
61
|
+
accessLevel?: CalendarAccessLevel;
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
export type IEvent = {
|
|
65
|
+
id: string;
|
|
66
|
+
calendarId: string;
|
|
67
|
+
title: string;
|
|
68
|
+
location: string | null;
|
|
69
|
+
creationDate?: string | Date;
|
|
70
|
+
lastModifiedDate?: string | Date;
|
|
71
|
+
timeZone: string;
|
|
72
|
+
endTimeZone?: string;
|
|
73
|
+
url?: string;
|
|
74
|
+
notes: string;
|
|
75
|
+
alarms: IAlarm[];
|
|
76
|
+
recurrenceRule: IRecurrenceRule | null;
|
|
77
|
+
startDate: string | Date;
|
|
78
|
+
endDate: string | Date;
|
|
79
|
+
originalStartDate?: string | Date;
|
|
80
|
+
isDetached?: boolean;
|
|
81
|
+
allDay: boolean;
|
|
82
|
+
availability: Availability;
|
|
83
|
+
status: EventStatus;
|
|
84
|
+
organizer?: IOrganizer;
|
|
85
|
+
organizerEmail?: string;
|
|
86
|
+
accessLevel?: EventAccessLevel;
|
|
87
|
+
guestsCanModify?: boolean;
|
|
88
|
+
guestsCanInviteOthers?: boolean;
|
|
89
|
+
guestsCanSeeGuests?: boolean;
|
|
90
|
+
originalId?: string;
|
|
91
|
+
instanceId?: string;
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
export type IReminder = {
|
|
95
|
+
id?: string;
|
|
96
|
+
calendarId?: string;
|
|
97
|
+
title?: string;
|
|
98
|
+
location?: string;
|
|
99
|
+
creationDate?: string | Date;
|
|
100
|
+
lastModifiedDate?: string | Date;
|
|
101
|
+
timeZone?: string;
|
|
102
|
+
url?: string;
|
|
103
|
+
notes?: string;
|
|
104
|
+
alarms?: IAlarm[];
|
|
105
|
+
recurrenceRule?: IRecurrenceRule | null;
|
|
106
|
+
startDate?: string | Date;
|
|
107
|
+
dueDate?: string | Date;
|
|
108
|
+
allDay?: boolean;
|
|
109
|
+
completed?: boolean;
|
|
110
|
+
completionDate?: string | Date;
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
export type IAttendee = {
|
|
114
|
+
id?: string;
|
|
115
|
+
isCurrentUser?: boolean;
|
|
116
|
+
name: string;
|
|
117
|
+
role: AttendeeRole;
|
|
118
|
+
status: AttendeeStatus;
|
|
119
|
+
type: AttendeeType;
|
|
120
|
+
url?: string;
|
|
121
|
+
email?: string;
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
export type IAlarmLocation = {
|
|
125
|
+
title?: string;
|
|
126
|
+
proximity?: string;
|
|
127
|
+
radius?: number;
|
|
128
|
+
coords?: { latitude?: number; longitude?: number };
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
export type IAlarm = {
|
|
132
|
+
absoluteDate?: string;
|
|
133
|
+
relativeOffset?: number;
|
|
134
|
+
structuredLocation?: IAlarmLocation;
|
|
135
|
+
method?: AlarmMethod;
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
export type IDaysOfTheWeek = {
|
|
139
|
+
dayOfTheWeek: DayOfTheWeek;
|
|
140
|
+
weekNumber?: number;
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
export type IRecurrenceRule = {
|
|
144
|
+
frequency: Frequency;
|
|
145
|
+
interval?: number;
|
|
146
|
+
endDate?: string | Date;
|
|
147
|
+
occurrence?: number;
|
|
148
|
+
daysOfTheWeek?: IDaysOfTheWeek[];
|
|
149
|
+
daysOfTheMonth?: number[];
|
|
150
|
+
monthsOfTheYear?: MonthOfTheYear[];
|
|
151
|
+
weeksOfTheYear?: number[];
|
|
152
|
+
daysOfTheYear?: number[];
|
|
153
|
+
setPositions?: number[];
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
export type IOpenEventDialogResult = {
|
|
157
|
+
action: Extract<
|
|
158
|
+
CalendarDialogResultActions,
|
|
159
|
+
'done' | 'canceled' | 'deleted' | 'responded'
|
|
160
|
+
>;
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
export type IDialogEventResult = {
|
|
164
|
+
action: Extract<
|
|
165
|
+
CalendarDialogResultActions,
|
|
166
|
+
'done' | 'saved' | 'canceled' | 'deleted'
|
|
167
|
+
>;
|
|
168
|
+
id: string | null;
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
export type IPresentationOptions = {
|
|
172
|
+
startNewActivityTask?: boolean;
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
export type IOpenEventPresentationOptions = IPresentationOptions & {
|
|
176
|
+
allowsEditing?: boolean;
|
|
177
|
+
allowsCalendarPreview?: boolean;
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
export type ICalendarDialogParams = {
|
|
181
|
+
id: string;
|
|
182
|
+
instanceStartDate?: string | Date;
|
|
183
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { createPermissionHook } from '@symbiote-native/react';
|
|
2
|
+
import {
|
|
3
|
+
calendarPermissionMethods,
|
|
4
|
+
splitCalendarPermissionOptions,
|
|
5
|
+
type ICalendarPermissionMethodOptions,
|
|
6
|
+
} from '../core/calendar-permission-api';
|
|
7
|
+
import type { PermissionResponse } from 'expo-modules-core';
|
|
8
|
+
import type { IPermissionHookOptions } from '@symbiote-native/engine';
|
|
9
|
+
|
|
10
|
+
export type IUseCalendarPermissionsOptions = ICalendarPermissionMethodOptions;
|
|
11
|
+
|
|
12
|
+
export type IUseCalendarPermissionsResult = [
|
|
13
|
+
PermissionResponse | null,
|
|
14
|
+
() => Promise<PermissionResponse>,
|
|
15
|
+
() => Promise<PermissionResponse>,
|
|
16
|
+
];
|
|
17
|
+
|
|
18
|
+
const usePermission = createPermissionHook(calendarPermissionMethods);
|
|
19
|
+
|
|
20
|
+
// React twin of `expo-calendar`'s `useCalendarPermissions`
|
|
21
|
+
export function useCalendarPermissions(
|
|
22
|
+
options?: IPermissionHookOptions<IUseCalendarPermissionsOptions>,
|
|
23
|
+
): IUseCalendarPermissionsResult {
|
|
24
|
+
return usePermission(...splitCalendarPermissionOptions(options));
|
|
25
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { createPermissionHook } from '@symbiote-native/react';
|
|
2
|
+
import {
|
|
3
|
+
getRemindersPermissions,
|
|
4
|
+
requestRemindersPermissions,
|
|
5
|
+
} from '../core/calendar';
|
|
6
|
+
import type { PermissionResponse } from 'expo-modules-core';
|
|
7
|
+
import type { IPermissionHookBehavior } from '@symbiote-native/engine';
|
|
8
|
+
|
|
9
|
+
export type IUseRemindersPermissionsResult = [
|
|
10
|
+
PermissionResponse | null,
|
|
11
|
+
() => Promise<PermissionResponse>,
|
|
12
|
+
() => Promise<PermissionResponse>,
|
|
13
|
+
];
|
|
14
|
+
|
|
15
|
+
const usePermission = createPermissionHook({
|
|
16
|
+
getMethod: getRemindersPermissions,
|
|
17
|
+
requestMethod: requestRemindersPermissions,
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
// React twin of `expo-calendar`'s `useRemindersPermissions`
|
|
21
|
+
export function useRemindersPermissions(
|
|
22
|
+
options?: IPermissionHookBehavior,
|
|
23
|
+
): IUseRemindersPermissionsResult {
|
|
24
|
+
return usePermission(options);
|
|
25
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { createPermissionHook } from '@symbiote-native/solid';
|
|
2
|
+
import {
|
|
3
|
+
calendarPermissionMethods,
|
|
4
|
+
splitCalendarPermissionOptions,
|
|
5
|
+
type ICalendarPermissionMethodOptions,
|
|
6
|
+
} from '../core/calendar-permission-api';
|
|
7
|
+
import type { PermissionResponse } from 'expo-modules-core';
|
|
8
|
+
import type { IPermissionHookOptions } from '@symbiote-native/engine';
|
|
9
|
+
import type { Accessor } from 'solid-js';
|
|
10
|
+
|
|
11
|
+
export type IUseCalendarPermissionsOptions = ICalendarPermissionMethodOptions;
|
|
12
|
+
|
|
13
|
+
export type IUseCalendarPermissionsResult = [
|
|
14
|
+
Accessor<PermissionResponse | null>,
|
|
15
|
+
() => Promise<PermissionResponse>,
|
|
16
|
+
() => Promise<PermissionResponse>,
|
|
17
|
+
];
|
|
18
|
+
|
|
19
|
+
const usePermission = createPermissionHook(calendarPermissionMethods);
|
|
20
|
+
|
|
21
|
+
// Solid twin of `../react`'s `useCalendarPermissions`
|
|
22
|
+
export function useCalendarPermissions(
|
|
23
|
+
options?: IPermissionHookOptions<IUseCalendarPermissionsOptions>,
|
|
24
|
+
): IUseCalendarPermissionsResult {
|
|
25
|
+
return usePermission(...splitCalendarPermissionOptions(options));
|
|
26
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { createPermissionHook } from '@symbiote-native/solid';
|
|
2
|
+
import {
|
|
3
|
+
getRemindersPermissions,
|
|
4
|
+
requestRemindersPermissions,
|
|
5
|
+
} from '../core/calendar';
|
|
6
|
+
import type { PermissionResponse } from 'expo-modules-core';
|
|
7
|
+
import type { IPermissionHookBehavior } from '@symbiote-native/engine';
|
|
8
|
+
import type { Accessor } from 'solid-js';
|
|
9
|
+
|
|
10
|
+
export type IUseRemindersPermissionsResult = [
|
|
11
|
+
Accessor<PermissionResponse | null>,
|
|
12
|
+
() => Promise<PermissionResponse>,
|
|
13
|
+
() => Promise<PermissionResponse>,
|
|
14
|
+
];
|
|
15
|
+
|
|
16
|
+
const usePermission = createPermissionHook({
|
|
17
|
+
getMethod: getRemindersPermissions,
|
|
18
|
+
requestMethod: requestRemindersPermissions,
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
// Solid twin of `../react`'s `useRemindersPermissions`
|
|
22
|
+
export function useRemindersPermissions(
|
|
23
|
+
options?: IPermissionHookBehavior,
|
|
24
|
+
): IUseRemindersPermissionsResult {
|
|
25
|
+
return usePermission(options);
|
|
26
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// Re-exports the existing harness instead of a third copy (packages/sqlite and
|
|
2
|
+
// packages/navigation already carry one, not part of either package's public exports)
|
|
3
|
+
export {
|
|
4
|
+
createSvelteHarness,
|
|
5
|
+
loadComponent,
|
|
6
|
+
type ISvelteHarness,
|
|
7
|
+
} from '../../../sqlite/src/svelte/svelte-compile.test-helper';
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { createPermissionHook } from '@symbiote-native/svelte/runes/create-permission-hook';
|
|
2
|
+
import {
|
|
3
|
+
calendarPermissionMethods,
|
|
4
|
+
splitCalendarPermissionOptions,
|
|
5
|
+
type ICalendarPermissionMethodOptions,
|
|
6
|
+
} from '../core/calendar-permission-api';
|
|
7
|
+
import type { PermissionResponse } from 'expo-modules-core';
|
|
8
|
+
import type { IPermissionHookOptions } from '@symbiote-native/engine';
|
|
9
|
+
|
|
10
|
+
export type IUseCalendarPermissionsOptions = ICalendarPermissionMethodOptions;
|
|
11
|
+
|
|
12
|
+
export type IUseCalendarPermissionsResult = {
|
|
13
|
+
readonly status: PermissionResponse | null;
|
|
14
|
+
requestPermission: () => Promise<PermissionResponse>;
|
|
15
|
+
getPermission: () => Promise<PermissionResponse>;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const usePermission = createPermissionHook(calendarPermissionMethods);
|
|
19
|
+
|
|
20
|
+
// Svelte twin of `../react`'s `useCalendarPermissions`
|
|
21
|
+
export function useCalendarPermissions(
|
|
22
|
+
options?: IPermissionHookOptions<IUseCalendarPermissionsOptions>,
|
|
23
|
+
): IUseCalendarPermissionsResult {
|
|
24
|
+
return usePermission(...splitCalendarPermissionOptions(options));
|
|
25
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { createPermissionHook } from '@symbiote-native/svelte/runes/create-permission-hook';
|
|
2
|
+
import {
|
|
3
|
+
getRemindersPermissions,
|
|
4
|
+
requestRemindersPermissions,
|
|
5
|
+
} from '../core/calendar';
|
|
6
|
+
import type { PermissionResponse } from 'expo-modules-core';
|
|
7
|
+
import type { IPermissionHookBehavior } from '@symbiote-native/engine';
|
|
8
|
+
|
|
9
|
+
export type IUseRemindersPermissionsResult = {
|
|
10
|
+
readonly status: PermissionResponse | null;
|
|
11
|
+
requestPermission: () => Promise<PermissionResponse>;
|
|
12
|
+
getPermission: () => Promise<PermissionResponse>;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const usePermission = createPermissionHook({
|
|
16
|
+
getMethod: getRemindersPermissions,
|
|
17
|
+
requestMethod: requestRemindersPermissions,
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
// Svelte twin of `../react`'s `useRemindersPermissions`
|
|
21
|
+
export function useRemindersPermissions(
|
|
22
|
+
behavior?: IPermissionHookBehavior,
|
|
23
|
+
): IUseRemindersPermissionsResult {
|
|
24
|
+
return usePermission(behavior);
|
|
25
|
+
}
|
package/src/vue/index.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { createPermissionHook } from '@symbiote-native/vue';
|
|
2
|
+
import {
|
|
3
|
+
calendarPermissionMethods,
|
|
4
|
+
splitCalendarPermissionOptions,
|
|
5
|
+
type ICalendarPermissionMethodOptions,
|
|
6
|
+
} from '../core/calendar-permission-api';
|
|
7
|
+
import type { PermissionResponse } from 'expo-modules-core';
|
|
8
|
+
import type { IPermissionHookOptions } from '@symbiote-native/engine';
|
|
9
|
+
import type { Ref } from '@vue/runtime-core';
|
|
10
|
+
|
|
11
|
+
export type IUseCalendarPermissionsOptions = ICalendarPermissionMethodOptions;
|
|
12
|
+
|
|
13
|
+
export type IUseCalendarPermissionsResult = [
|
|
14
|
+
Ref<PermissionResponse | null>,
|
|
15
|
+
() => Promise<PermissionResponse>,
|
|
16
|
+
() => Promise<PermissionResponse>,
|
|
17
|
+
];
|
|
18
|
+
|
|
19
|
+
const usePermission = createPermissionHook(calendarPermissionMethods);
|
|
20
|
+
|
|
21
|
+
// Vue twin of `../react`'s `useCalendarPermissions`
|
|
22
|
+
export function useCalendarPermissions(
|
|
23
|
+
options?: IPermissionHookOptions<IUseCalendarPermissionsOptions>,
|
|
24
|
+
): IUseCalendarPermissionsResult {
|
|
25
|
+
return usePermission(...splitCalendarPermissionOptions(options));
|
|
26
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { createPermissionHook } from '@symbiote-native/vue';
|
|
2
|
+
import {
|
|
3
|
+
getRemindersPermissions,
|
|
4
|
+
requestRemindersPermissions,
|
|
5
|
+
} from '../core/calendar';
|
|
6
|
+
import type { PermissionResponse } from 'expo-modules-core';
|
|
7
|
+
import type { IPermissionHookBehavior } from '@symbiote-native/engine';
|
|
8
|
+
import type { Ref } from '@vue/runtime-core';
|
|
9
|
+
|
|
10
|
+
export type IUseRemindersPermissionsResult = [
|
|
11
|
+
Ref<PermissionResponse | null>,
|
|
12
|
+
() => Promise<PermissionResponse>,
|
|
13
|
+
() => Promise<PermissionResponse>,
|
|
14
|
+
];
|
|
15
|
+
|
|
16
|
+
const usePermission = createPermissionHook({
|
|
17
|
+
getMethod: getRemindersPermissions,
|
|
18
|
+
requestMethod: requestRemindersPermissions,
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
// Vue twin of `../react`'s `useRemindersPermissions`
|
|
22
|
+
export function useRemindersPermissions(
|
|
23
|
+
options?: IPermissionHookBehavior,
|
|
24
|
+
): IUseRemindersPermissionsResult {
|
|
25
|
+
return usePermission(options);
|
|
26
|
+
}
|