Skip to content
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

CloudStorage v2 🎉 #32

Merged
merged 36 commits into from
Sep 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
ed809f9
chore: remove deprecated stuff
mfkrause Apr 25, 2024
6efc252
refactor: introduce cloud storage providers for more modularity
mfkrause Apr 25, 2024
435a46f
feat: allow creating provider-specific instances
mfkrause Apr 25, 2024
dbbb5c3
fix: throw if requesting an unsupported provider instance
mfkrause Apr 25, 2024
8fb9a3c
chore: upgraded to react-native 0.72.17
mfkrause Sep 26, 2024
de3b95c
chore: upgraded to react-native 0.73
mfkrause Sep 26, 2024
afb56a2
docs: typo
mfkrause Sep 26, 2024
dd66170
chore: upgraded to react-native 0.74
mfkrause Sep 26, 2024
843566c
chore(example): enable new arch
mfkrause Sep 26, 2024
73b3304
chore: merge master into v2
mfkrause Sep 26, 2024
1c74772
refactor: cleaned up and restructured Swift project
mfkrause Sep 27, 2024
6b3f34f
fix: update `useIsCloudAvailable` hook on provider change
mfkrause Sep 27, 2024
525dbbd
refactor: fixed & improved CloudStorage static & instance API
mfkrause Sep 27, 2024
b8e8549
fix: make `nativeInstance` private
mfkrause Sep 27, 2024
6e055b7
docs: added missing `getDefaultProvider` to docs
mfkrause Sep 27, 2024
98e5a38
docs: typo
mfkrause Sep 27, 2024
3b867b9
docs: minor documentation improvements
mfkrause Sep 27, 2024
5d36e03
docs: clarified some stuff
mfkrause Sep 27, 2024
76f1d9c
docs: fixed wrong docs for `getProviderOptions`
mfkrause Sep 27, 2024
f3ae9a6
fix: fixed `useIsCloudAvailable` hook on multi-provider environments
mfkrause Sep 27, 2024
9a0ab05
ci: optionally override versioning
mfkrause Sep 27, 2024
e777619
docs: fixed typo in README
mfkrause Sep 27, 2024
d8115b6
chore: updated LICENSE
mfkrause Sep 27, 2024
9d447bd
refactor: formatted swift files
mfkrause Sep 27, 2024
d90110b
ci: fixed swiftlint during ci
mfkrause Sep 27, 2024
d2163b8
ci: try to fix swiftlint ci
mfkrause Sep 27, 2024
5b56dc5
ci: allow specifying specific version for release
mfkrause Sep 27, 2024
f84705c
ci: fixed swiftformat
mfkrause Sep 27, 2024
cbfc74b
ci: check swiftformat didnt make any changes
mfkrause Sep 27, 2024
8914419
ci: typo
mfkrause Sep 27, 2024
ff23f5f
ci: try to fix swiftformat
mfkrause Sep 27, 2024
a849db8
ci: add mint binaries to PATH
mfkrause Sep 27, 2024
f8da08a
docs: fixed quick start
mfkrause Sep 27, 2024
3a4aa31
ci: cache mint packages
mfkrause Sep 27, 2024
639825c
ci: fixed mint caching order
mfkrause Sep 27, 2024
535f134
ci: better mint cache key
mfkrause Sep 27, 2024
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
49 changes: 47 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
name: Release
on: workflow_dispatch
on:
workflow_dispatch:
inputs:
release_type:
description: 'Release type (patch, minor, major, or a semver version)'
required: false
type: string

jobs:
lint:
Expand All @@ -11,9 +17,31 @@ jobs:
- name: Setup
uses: ./.github/actions/setup

- name: Setup Mint package manager
uses: irgaly/setup-mint@v1

- name: Cache Mint packages
uses: actions/cache@v3
with:
path: ~/.mint
key: ${{ runner.os }}-mint-${{ hashFiles('**/Mintfile') }}
restore-keys: |
${{ runner.os }}-mint-

- name: Install SwiftFormat
run: |
mint install nicklockwood/SwiftFormat
echo "$HOME/.mint/bin" >> $GITHUB_PATH

- name: Lint files
run: yarn lint

- name: Run SwiftFormat
run: swiftformat --verbose ios

- name: Verify formatted code is unchanged
run: git diff --exit-code HEAD

- name: Typecheck files
run: yarn typecheck

Expand Down Expand Up @@ -52,7 +80,24 @@ jobs:
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Validate release type
if: ${{ inputs.release_type != '' }}
run: |
if [[ "${{ inputs.release_type }}" =~ ^(patch|minor|major)$ ]]; then
echo "Valid release type: ${{ inputs.release_type }}"
elif [[ "${{ inputs.release_type }}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "Valid semver version: ${{ inputs.release_type }}"
else
echo "Invalid input. Must be 'patch', 'minor', 'major', or a valid semver version (e.g., 1.2.3)."
exit 1
fi

- name: Release
run: yarn release
run: |
if [ -n "${{ inputs.release_type }}" ]; then
yarn release --release-as ${{ inputs.release_type }}
else
yarn release
fi
env:
GITHUB_TOKEN: ${{ secrets.CICD_PAT }}
22 changes: 22 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,31 @@ jobs:
- name: Setup
uses: ./.github/actions/setup

- name: Setup Mint package manager
uses: irgaly/setup-mint@v1

- name: Cache Mint packages
uses: actions/cache@v3
with:
path: ~/.mint
key: ${{ runner.os }}-mint-${{ hashFiles('**/Mintfile') }}
restore-keys: |
${{ runner.os }}-mint-

- name: Install SwiftFormat
run: |
mint install nicklockwood/SwiftFormat
echo "$HOME/.mint/bin" >> $GITHUB_PATH

- name: Lint files
run: yarn lint

- name: Run SwiftFormat
run: swiftformat --verbose ios

- name: Verify formatted code is unchanged
run: git diff --exit-code HEAD

- name: Typecheck files
run: yarn typecheck

Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ DerivedData
*.ipa
*.xcuserstate
project.xcworkspace
**/.xcode.env.local

# Android/IJ
#
Expand All @@ -44,7 +45,7 @@ android.iml

# Cocoapods
#
example/ios/Pods
**/Pods

# Ruby
example/vendor/
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2023 Kuatsu Digital Agency
Copyright (c) 2023-2024 Kuatsu Digital Agency
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
Expand Down
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

![npm bundle size](https://img.shields.io/bundlephobia/min/react-native-cloud-storage?style=flat-square) ![GitHub](https://img.shields.io/github/license/kuatsu/react-native-cloud-storage?style=flat-square) ![GitHub last commit](https://img.shields.io/github/last-commit/kuatsu/react-native-cloud-storage?style=flat-square)

This library provides a unified and streamlined API for accessing cloud storage services on iOS, Android and Web. It supports iCloud on iOS and Google Drive on all other platforms.
This library provides a unified and streamlined API for accessing cloud storage services on iOS, Android and Web. It supports iCloud (on iOS only) and Google Drive (all platforms).

- 💾 Read and write files to the cloud
- 🧪 Fully compatible with Expo
- 📱 iOS, Android & Web support
- 🏎️ Lightning fast iCloud performance using native iOS APIs
- 🌐 Google Drive REST API implementation for other platforms
- 🌐 Google Drive REST API implementation for all platforms
- 🧬 Easy to use React Hooks API, or use the imperative `fs`-style API
- 👌 Zero dependencies, small bundle size

Expand Down Expand Up @@ -36,14 +36,15 @@ Afterwards, [add the provided config plugin](https://react-native-cloud-storage.
```jsx
import React from 'react';
import { Platform, View, Text, Button } from 'react-native';
import { CloudStorage, useIsCloudAvailable } from 'react-native-cloud-storage';
import { CloudStorage, CloudStorageProvider, useIsCloudAvailable } from 'react-native-cloud-storage';

const App = () => {
const cloudAvailable = useIsCloudAvailable();

React.useEffect(() => {
if (Platform.OS !== 'ios') {
CloudStorage.setGoogleDriveAccessToken('some-access-token'); // get via @react-native-google-signin/google-signin or similar
if (CloudStorage.getDefaultProvider() === CloudStorageProvider.GoogleDrive) {
// get access token via @react-native-google-signin/google-signin or similar
CloudStorage.setProviderOptions({ accessToken: 'some-access-token' });
}
}, []);

Expand Down
2 changes: 1 addition & 1 deletion babel.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module.exports = {
presets: ['module:metro-react-native-babel-preset'],
presets: ['module:@react-native/babel-preset'],
};
Loading
Loading