Skip to content

Commit

Permalink
🛜 Improve Sync
Browse files Browse the repository at this point in the history
- Onedrive (#26)
  • Loading branch information
Daniele-rolli committed Jan 13, 2025
1 parent fedace7 commit ec65138
Show file tree
Hide file tree
Showing 7 changed files with 290 additions and 277 deletions.
21 changes: 13 additions & 8 deletions ios/App/App.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 70;
objectVersion = 77;
objects = {

/* Begin PBXBuildFile section */
Expand Down Expand Up @@ -64,7 +64,7 @@
/* End PBXFileReference section */

/* Begin PBXFileSystemSynchronizedBuildFileExceptionSet section */
AB2445C62D061EBC0047BA3E /* PBXFileSystemSynchronizedBuildFileExceptionSet */ = {
AB2445C62D061EBC0047BA3E /* Exceptions for "share" folder in "share" target */ = {
isa = PBXFileSystemSynchronizedBuildFileExceptionSet;
membershipExceptions = (
Info.plist,
Expand All @@ -74,7 +74,14 @@
/* End PBXFileSystemSynchronizedBuildFileExceptionSet section */

/* Begin PBXFileSystemSynchronizedRootGroup section */
AB2445BC2D061EBC0047BA3E /* share */ = {isa = PBXFileSystemSynchronizedRootGroup; exceptions = (AB2445C62D061EBC0047BA3E /* PBXFileSystemSynchronizedBuildFileExceptionSet */, ); explicitFileTypes = {}; explicitFolders = (); path = share; sourceTree = "<group>"; };
AB2445BC2D061EBC0047BA3E /* share */ = {
isa = PBXFileSystemSynchronizedRootGroup;
exceptions = (
AB2445C62D061EBC0047BA3E /* Exceptions for "share" folder in "share" target */,
);
path = share;
sourceTree = "<group>";
};
/* End PBXFileSystemSynchronizedRootGroup section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -191,8 +198,6 @@
AB2445BC2D061EBC0047BA3E /* share */,
);
name = share;
packageProductDependencies = (
);
productName = share;
productReference = AB2445BB2D061EBC0047BA3E /* share.appex */;
productType = "com.apple.product-type.app-extension";
Expand All @@ -217,14 +222,14 @@
};
};
buildConfigurationList = 504EC2FF1FED79650016851F /* Build configuration list for PBXProject "App" */;
compatibilityVersion = "Xcode 8.0";
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = 504EC2FB1FED79650016851F;
preferredProjectObjectVersion = 77;
productRefGroup = 504EC3051FED79650016851F /* Products */;
projectDirPath = "";
projectRoot = "";
Expand Down Expand Up @@ -282,10 +287,10 @@
buildActionMask = 2147483647;
files = (
);
inputPaths = (
inputFileListPaths = (
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
outputFileListPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
Expand Down
4 changes: 2 additions & 2 deletions ios/App/App/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -167,12 +167,12 @@
<key>iCloud.beaver.notes.pocket</key>
<dict>
<key>NSUbiquitousContainerIsDocumentScopePublic</key>
<true/>
<true />
<key>NSUbiquitousContainerName</key>
<string>Beaver Pocket</string>
<key>NSUbiquitousContainerSupportedFolderLevels</key>
<string>ANY</string>
</dict>
</dict>
</dict>
<key>UIFileSharingEnabled</key>
<true />
Expand Down
4 changes: 2 additions & 2 deletions src/components/Editor/EditorComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import useNoteEditor from "../../store/useNoteActions";
import { useNotesState } from "../../store/Activenote";
import Icons from "../../lib/remixicon-react";
import Mousetrap from "mousetrap";
import getMimeType from "../../utils/mimetype";
import mime from "mime";
import { saveImageToFileSystem } from "../../utils/fileHandler";
import { saveFileToFileSystem } from "../../utils/fileHandler";
import { useSyncDav } from "../../utils/Webdav/webDavUtil";
Expand Down Expand Up @@ -483,7 +483,7 @@ function EditorComponent({ note, notesState, setNotesState }: Props) {
if (item.kind === "file") {
const file = item.getAsFile();
if (file) {
const fileType = getMimeType(file.name);
const fileType = mime.getType(file.name);
if (fileType) {
await handleFileByType(file);
} else {
Expand Down
12 changes: 9 additions & 3 deletions src/settings/screens/dropbox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,10 @@ const DropboxSync: React.FC<DropboxProps> = ({ setNotesState }) => {

// Determine file type and create a blob
const fileType = mime.getType(item.name);
const blob = base64ToBlob(String(fileData.data), String(fileType));
const blob = base64ToBlob(
String(fileData.data),
String(fileType)
);
const uploadedFile = new File([blob], item.name, {
type: "application/octet-stream",
});
Expand Down Expand Up @@ -622,7 +625,10 @@ const DropboxSync: React.FC<DropboxProps> = ({ setNotesState }) => {
const fileType = mime.getType(file.name); // Get file MIME type

// Convert base64 string to Blob
const blob = base64ToBlob(String(fileData.data), String(fileType));
const blob = base64ToBlob(
String(fileData.data),
String(fileType)
);

// Create a File from the Blob
const uploadedFile = new File([blob], file.name, {
Expand Down Expand Up @@ -850,7 +856,7 @@ const DropboxSync: React.FC<DropboxProps> = ({ setNotesState }) => {
console.error("Error logging out:", error);
}
};

const [autoSync, setAutoSync] = useState<boolean>(() => {
const storedSync = localStorage.getItem("sync");
return storedSync === "dropbox";
Expand Down
Loading

0 comments on commit ec65138

Please sign in to comment.