Skip to content

feat!: dismiss from reschedule confirmations #73

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 43 commits into from
Apr 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
af20c58
feat: dismiss from reschedule confirmations!
williscool Apr 10, 2025
01075cc
feat: ids array over the bridge!
williscool Apr 10, 2025
7bf3d1c
feat: json over the bridge!
williscool Apr 10, 2025
fae32ac
feat: stub for in the app
williscool Apr 10, 2025
8744657
feat: events all the way to the app side!
williscool Apr 10, 2025
cb297b7
feat: maybe dismiss from react native!
williscool Apr 10, 2025
2c9a95e
feat: updated dissmiss message
williscool Apr 10, 2025
faf1883
feat: safe dismiss in bulk
williscool Apr 10, 2025
d316092
test: tests!
williscool Apr 10, 2025
309a301
chore: interface
williscool Apr 10, 2025
5ce5b0a
test: event dissmiss tests run
williscool Apr 10, 2025
4367d8e
test: ignore orig tests for now
williscool Apr 10, 2025
0acf2d8
feat: version that maybe works and passes tests
williscool Apr 10, 2025
69d8a93
feat: toasts, example logs, hide button behind danger zone
williscool Apr 11, 2025
50738fe
fix: dont show dev page
williscool Apr 11, 2025
5c7e7c5
ci: comment pr # and commit sha
williscool Apr 11, 2025
049c4ac
feat: clean up button styles
williscool Apr 11, 2025
6a62157
fix: only limit debug view to 3 events not the whole feature :D
williscool Apr 11, 2025
2f4bec8
refactor: type imports
williscool Apr 12, 2025
c697509
docs: future purgeDismissed
williscool Apr 14, 2025
a1e83d8
fix: safe dismiss states
williscool Apr 14, 2025
684a398
fix: logging
williscool Apr 14, 2025
648fbe7
fix: log and toasts
williscool Apr 14, 2025
b5d7cba
fix: s/RESCHEDULE_CONFIRMATIONS/RESCHEDULE_CONFIRMATIONS_RECEIVED/g
williscool Apr 24, 2025
4a05a32
fix: dont overwrite our setValueAsync reference function
williscool Apr 24, 2025
cfd47b7
ci: latest mcfly db
williscool Apr 24, 2025
e8c1a18
ci: extract setup_dev_container_android_toolchain
williscool Apr 24, 2025
e0f7c93
fix: codespace setup
williscool Apr 25, 2025
32ca35b
docs: no bools in powersync
williscool Apr 24, 2025
f445b09
docs: canBeRestored
williscool Apr 24, 2025
b363fc0
fix: some more codespace fixes
williscool Apr 25, 2025
31651d0
ci: more codespace stuff
williscool Apr 25, 2025
96e94a7
ci: more better setup_github_codespace
williscool Apr 25, 2025
9cca6fc
ci: more better codespace
williscool Apr 25, 2025
8cdcef1
fix: metro bundler type warning
williscool Apr 25, 2025
669c8e3
fix: vscode settings didnt want
williscool Apr 25, 2025
65c3ff6
feat: safeDismissEventsFromRescheduleConfirmations
williscool Apr 25, 2025
381683d
test: safeDismissEventsFromRescheduleConfirmations
williscool Apr 25, 2025
4d26b95
test: more safeDismissEventsFromRescheduleConfirmations
williscool Apr 25, 2025
4605eeb
test: all but 3 pass
williscool Apr 25, 2025
4fd8bab
test: testSafeDismissEventsFromRescheduleConfirmations almost there
williscool Apr 25, 2025
7cec40f
test: db mocking shortcomings still there
williscool Apr 25, 2025
7345bf0
docs: on showing time of reschedule to
williscool Apr 25, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified .devcontainer/mcfly_history.db
Binary file not shown.
2 changes: 1 addition & 1 deletion .github/workflows/actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ jobs:
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `Build artifacts for this PR are available:
body: `Build artifacts for PR #${context.issue.number} (commit ${context.sha}) are available:

- [Debug APKs (arm64-v8a, x86_64)](${workflowUrl}#artifacts)
- [Release APKs (arm64-v8a, x86_64)](${workflowUrl}#artifacts)
Expand Down
60 changes: 44 additions & 16 deletions App/SetupSync.tsx
Original file line number Diff line number Diff line change
@@ -1,23 +1,26 @@
import React, { useContext, useEffect, useState } from 'react';
import { StyleSheet, Text, View, Button, TouchableOpacity, ScrollView, Linking } from 'react-native';
import { hello, MyModuleView, setValueAsync, addChangeListener } from '../modules/my-module';
import { hello, MyModuleView, setValueAsync, sendRescheduleConfirmations, addChangeListener } from '../modules/my-module';
import { open } from '@op-engineering/op-sqlite';
import { useQuery } from '@powersync/react';
import { PowerSyncContext } from "@powersync/react";
import { installCrsqliteOnTable } from '@lib/cr-sqlite/install';
import { psInsertDbTable, psClearTable } from '@lib/orm';
import { useNavigation } from '@react-navigation/native';
import { NativeStackNavigationProp } from '@react-navigation/native-stack';
import { RootStackParamList } from './index';
import { useSettings } from '@lib/hooks/SettingsContext';
import { GITHUB_README_URL } from '@lib/constants';

// Split out type imports for better readability
import type { RawRescheduleConfirmation } from '../modules/my-module';
import type { NativeStackNavigationProp } from '@react-navigation/native-stack';
import type { RootStackParamList } from './index';

type NavigationProp = NativeStackNavigationProp<RootStackParamList>;

export const SetupSync = () => {
const navigation = useNavigation<NavigationProp>();
const { settings } = useSettings();
const debugDisplayKeys = ['id', 'ttl', 'loc'];
const debugDisplayKeys = ['id', 'ttl', 'istart' ,'loc'];
const [showDangerZone, setShowDangerZone] = useState(false);
const [showDebugOutput, setShowDebugOutput] = useState(false);
const [isConnected, setIsConnected] = useState<boolean | null>(null);
Expand All @@ -34,6 +37,8 @@ export const SetupSync = () => {
const debugDisplayQuery = `select ${debugDisplayKeys.join(', ')} from eventsV9 limit ${numEventsToDisplay}`;

const { data: psEvents } = useQuery<string>(debugDisplayQuery);
const { data: rawConfirmations } = useQuery<RawRescheduleConfirmation>(`select event_id, calendar_id, original_instance_start_time, title, new_instance_start_time, is_in_future, created_at, updated_at from reschedule_confirmations`);

const [sqliteEvents, setSqliteEvents] = useState<any[]>([]);
const [tempTableEvents, setTempTableEvents] = useState<any[]>([]);
const [dbStatus, setDbStatus] = useState<string>('');
Expand Down Expand Up @@ -163,12 +168,12 @@ export const SetupSync = () => {

{showDebugOutput && (
<View style={styles.debugSection}>
<Text style={styles.hello}> Sample Local SQLite Events eventsV9: {JSON.stringify(sqliteEvents)}</Text>

<Text style={styles.hello}> Sample PowerSync Remote Events: {JSON.stringify(psEvents)}</Text>
<Text style={styles.hello} selectable> Sample Local SQLite Events eventsV9: {JSON.stringify(sqliteEvents)}</Text>
<Text style={styles.hello} selectable> Sample PowerSync Remote Events: {JSON.stringify(psEvents)}</Text>

<Text style={styles.hello} selectable> Sample PowerSync Remote Events reschedule_confirmations: {JSON.stringify(rawConfirmations?.slice(0, numEventsToDisplay))}</Text>
{settings.syncEnabled && settings.syncType === 'bidirectional' && (
<Text style={styles.hello}>Events V9 Temp Table: {JSON.stringify(tempTableEvents)}</Text>
<Text style={styles.hello} selectable>Events V9 Temp Table: {JSON.stringify(tempTableEvents)}</Text>
)}
</View>
)}
Expand Down Expand Up @@ -202,6 +207,24 @@ export const SetupSync = () => {

{showDangerZone && isConnected !== false && (
<>
<View style={styles.warningContainer}>
<Text style={styles.warningText}>
⚠️ WARNING: This will dismiss potentially many events from your local device!{'\n'}
You can restore them from the bin.
</Text>
</View>

<TouchableOpacity
style={[styles.syncButton, styles.yellowButton]}
onPress={async () => {
if (rawConfirmations) {
await sendRescheduleConfirmations(rawConfirmations);
}
}}
>
<Text style={styles.yellowButtonText}>Send Reschedule Confirmations</Text>
</TouchableOpacity>

<View style={styles.warningContainer}>
<Text style={styles.warningText}>
⚠️ WARNING: This will only delete events from the remote PowerSync database.{'\n'}
Expand All @@ -224,17 +247,13 @@ export const SetupSync = () => {
</>
)}

{/* TODO: this native module can be used to communicate with the kolin code */}

{/* this native module can be used to communicate with the kolin code */}
{/* I want to use it to get things like the mute status of a notification */}
{/* or whatever other useful things. so dont delete it so I remember to use it later */}

{/* <MyModuleView name="MyModuleView" />
<Button
title="Click me!"
onPress={async () => {
await setValueAsync('blarf');
}}
></Button> */}

{/* <MyModuleView name="MyModuleView" /> */}

</ScrollView>
);
Expand Down Expand Up @@ -311,6 +330,15 @@ const styles = StyleSheet.create({
deleteButton: {
backgroundColor: '#FF3B30',
},
yellowButton: {
backgroundColor: '#FFD700',
},
yellowButtonText: {
color: '#000000',
fontSize: 16,
textAlign: 'center',
fontWeight: '600',
},
warningContainer: {
backgroundColor: '#fff',
padding: 10,
Expand Down
5 changes: 3 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlinx-serialization'
apply plugin: "com.facebook.react"
apply plugin: 'jacoco'

Expand Down Expand Up @@ -254,8 +255,8 @@ dependencies {
strictly '3.45.0'
}
}

// Unit test dependencies
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.3")
// Unit test dependencies
testImplementation 'junit:junit:4.13.2'

// Test dependencies - use test-compatible versions
Expand Down
Loading
Loading