Skip to content

Commit

Permalink
Chore: Merge main to next-release/main (#7383)
Browse files Browse the repository at this point in the history
* fix(main): update overflow background color in dark mode (#7316)

* fix(main): update background color in darkmode

* fix darkmode when system default is used

* StoragePath Documentation for Gen1 (#7279)

* storage: update swift storage with storage path

* chore: update swift storage docs with storage path

* chore: update storage getting started content

* chore: add callout warning to file access level

* chore: update gen2 callout

* chore: convert fragments to inline filter

* update storage path example

* Android Gen2 Storage

* remove upload from getting started

* Add Using Storagepath

* add content to storage path page

* Expand storagepath

* improve doc

* update callout message

* modify file access level callout

* add accidental remove

* gramatical issues

* Update src/pages/[platform]/build-a-backend/storage/download/index.mdx

Co-authored-by: Jordan Nelson <nejrd@amazon.com>

* Update src/pages/[platform]/build-a-backend/storage/upload/index.mdx

Co-authored-by: Jordan Nelson <nejrd@amazon.com>

* Update src/pages/[platform]/build-a-backend/storage/storagepath/index.mdx

Co-authored-by: Jordan Nelson <nejrd@amazon.com>

* Update src/pages/[platform]/build-a-backend/storage/list/index.mdx

Co-authored-by: Jordan Nelson <nejrd@amazon.com>

* Update src/pages/[platform]/build-a-backend/storage/remove/index.mdx

Co-authored-by: Jordan Nelson <nejrd@amazon.com>

* Bump Android version

---------

Co-authored-by: Tuan Pham <phantum@amazon.com>
Co-authored-by: Jordan Nelson <nejrd@amazon.com>

* Update npx amplify generate config -> outputs - Gen2 doc (#7344)

npx amplify generate config is throwing 
>>Unknown command: config

Generates post deployment artifacts

Commands:
  amplify generate outputs               Generates amplify outputs
  amplify generate forms                 Generates UI forms
  amplify generate graphql-client-code   Generates graphql API code
  amplify generate schema-from-database  Generates typescript data schema from a
                                          SQL database

* chore: add kotlin update to docs and formatting changes for flutter (#7023)

* chore: add kotlin update to docs and formatting changes for new flutter build.gradle creation

* chore: remove steps for apps created with flutter 3.16 and earlier

* JS Gen2 Storage Docs (#7323)

* [Gen2 Storage JS] DownloadData doc updates (#7049)
* [JS] Update migration docs to use path (#7143)
* [JS] Storage API - path update (#7145)
* [Gen2 Storage JS] Update version and path strings (#7307)
* fix missed $ in string

---------

Co-authored-by: Jim Blanchard <jim.l.blanchard@gmail.com>

* update sandbox secret management (#7108)

* update sandbox secret management

* Update src/pages/gen2/deploy-and-host/sandbox-environments/features/index.mdx

* Update src/pages/gen2/deploy-and-host/sandbox-environments/features/index.mdx

* Update src/pages/gen2/deploy-and-host/sandbox-environments/features/index.mdx

* Update src/pages/gen2/deploy-and-host/sandbox-environments/features/index.mdx

* Update src/pages/gen2/deploy-and-host/sandbox-environments/features/index.mdx

---------

Co-authored-by: josef <josef.aidt@gmail.com>

* add angular specific code snippet (#7353)

* add angular specific code snippet

* update dist directory path

* chore(gen2): replace authMode 'iam' with 'identityPool' (#7370)

* fix: Typos in JS Auth migration & getting started guides (#7371)

* [Gen2][Backend] Update casing of MFA mode.

* move build-a-backend/storage/path and storagepath to gen1

* Update src/fragments/lib/storage/native_common/configureaccess/common.mdx

Co-authored-by: Tim Nguyen <54393192+timngyn@users.noreply.github.com>

* Update src/fragments/lib/storage/native_common/configureaccess/common.mdx

Co-authored-by: Tim Nguyen <54393192+timngyn@users.noreply.github.com>

* fixing merge errors

* fixing merge errors for v5-v6 migration guide

---------

Co-authored-by: Heather Buchel <hbuchel@gmail.com>
Co-authored-by: Tyler Roach <tjroach@amazon.com>
Co-authored-by: Tuan Pham <phantum@amazon.com>
Co-authored-by: Jordan Nelson <nejrd@amazon.com>
Co-authored-by: Susmitha <sushpatg@amazon.com>
Co-authored-by: Kha Truong <64438356+khatruong2009@users.noreply.github.com>
Co-authored-by: ashika112 <155593080+ashika112@users.noreply.github.com>
Co-authored-by: Jim Blanchard <jim.l.blanchard@gmail.com>
Co-authored-by: Edward Foyle <foyleef@amazon.com>
Co-authored-by: josef <josef.aidt@gmail.com>
Co-authored-by: Harshita Daddala <harshita.d11@gmail.com>
Co-authored-by: Ivan Artemiev <29709626+iartemiev@users.noreply.github.com>
Co-authored-by: Jacob Logan <lognjc@amazon.com>
Co-authored-by: Tim Nguyen <54393192+timngyn@users.noreply.github.com>
  • Loading branch information
15 people committed May 1, 2024
1 parent 777daa2 commit 7ac494c
Show file tree
Hide file tree
Showing 42 changed files with 2,224 additions and 608 deletions.
2 changes: 2 additions & 0 deletions cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -1229,6 +1229,8 @@
"storagedemo",
"storagemanager",
"storageOptions",
"storagepath",
"StoragePath",
"StorageType",
"streamName",
"struct",
Expand Down
6 changes: 6 additions & 0 deletions src/directory/directory.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -1181,6 +1181,12 @@ export const directory = {
{
path: 'src/pages/gen1/[platform]/build-a-backend/storage/set-up-storage/index.mdx'
},
{
path: 'src/pages/gen1/[platform]/build-a-backend/storage/path/index.mdx'
},
{
path: 'src/pages/gen1/[platform]/build-a-backend/storage/storagepath/index.mdx'
},
{
path: 'src/pages/gen1/[platform]/build-a-backend/storage/upload/index.mdx'
},
Expand Down
26 changes: 17 additions & 9 deletions src/fragments/lib/project-setup/flutter/platform-setup/android.mdx
Original file line number Diff line number Diff line change
@@ -1,19 +1,27 @@
Amplify requires a minimum of API level 24 (Android 7.0), Gradle 7 and Kotlin > 1.7 when targeting Android.
Amplify requires a minimum of API level 24 (Android 7.0), Gradle 7 and Kotlin > 1.9 when targeting Android.

From your project root, navigate to the `android/` directory and open `build.gradle` in the text editor of your choice. Update the Gradle plugin version to 7.4.2 or higher:
_If your Flutter app was generated with Flutter 3.16 or lower, please follow the migration guide [here](https://docs.flutter.dev/release/breaking-changes/flutter-gradle-plugin-apply)._

From your project root, navigate to the `android/` directory and open `settings.gradle` in the text editor of your choice. Update the Gradle plugin version to 7.4.2 or higher:

```diff
dependencies {
- classpath 'com.android.tools.build:gradle:7.2.0'
+ classpath 'com.android.tools.build:gradle:7.4.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
plugins {
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
- id "com.android.application" version "7.3.0" apply false
+ id "com.android.application" version "7.4.2" apply false
id "org.jetbrains.kotlin.android" version "1.9.10" apply false
}
```

If your Kotlin Gradle plugin version is below 1.7, update `android/build.gradle`:
Go to the `android/` directory and open `settings.gradle`. Update the Kotlin plugin version to 1.9.10 or higher:

```
ext.kotlin_version = '1.7.10'
```diff
plugins {
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
id "com.android.application" version "7.3.0" apply false
- id "org.jetbrains.kotlin.android" version "1.7.10" apply false
+ id "org.jetbrains.kotlin.android" version "1.9.10" apply false
}
```

Then, open `android/gradle/wrapper/gradle-wrapper.properties`. Update the Gradle `distributionUrl` to a version between 7.3 and 7.6.1 (see the [Flutter docs](https://docs.flutter.dev/release/breaking-changes/android-java-gradle-migration-guide) for more info).
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## Customization
## Customization (Deprecated)

### Customize Object Key Path

Expand Down
184 changes: 183 additions & 1 deletion src/fragments/lib/storage/android/download.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,69 @@

{/* TODO Rewrite monitor progress of download for iOS/Flutter/Android? */}

If you uploaded the data using the key `ExampleKey`, you can retrieve the data using `Amplify.Storage.downloadFile`.
#### With StoragePath

<BlockSwitcher>
<Block name="Java">

```java
Amplify.Storage.downloadFile(
StoragePath.fromString("public/example"),
new File(getApplicationContext().getFilesDir() + "/download.txt"),
result -> Log.i("MyAmplifyApp", "Successfully downloaded: " + result.getFile().getName()),
error -> Log.e("MyAmplifyApp", "Download Failure", error)
);
```

</Block>
<Block name="Kotlin - Callbacks">

```kotlin
val file = File("${applicationContext.filesDir}/download.txt")
Amplify.Storage.downloadFile(StoragePath.fromString("public/example"), file,
{ Log.i("MyAmplifyApp", "Successfully downloaded: ${it.file.name}") },
{ Log.e("MyAmplifyApp", "Download Failure", it) }
)
```

</Block>
<Block name="Kotlin - Coroutines">

```kotlin
try {
val file = File("${applicationContext.filesDir}/download.txt")
val download = Amplify.Storage.downloadFile(StoragePath.fromString("public/example"), file)
try {
val fileName = download.result().file.name
Log.i("MyAmplifyApp", "Successfully downloaded: $fileName")
} catch (error: StorageException) {
Log.e("MyAmplifyApp", "Download Failure", error)
}
}
```

</Block>
<Block name="RxJava">

```java
RxProgressAwareSingleOperation<StorageDownloadFileResult> download =
RxAmplify.Storage.downloadFile(
StoragePath.fromString("public/example"),
new File(getApplicationContext().getFilesDir() + "/download.txt"
);

download
.observeResult()
.subscribe(
result -> Log.i("MyAmplifyApp", "Successfully downloaded: " + result.getFile().getName()),
error -> Log.e("MyAmplifyApp", "Download Failure", error)
);
```

</Block>
</BlockSwitcher>

#### With Key (Deprecated)

<BlockSwitcher>
<Block name="Java">
Expand Down Expand Up @@ -68,6 +130,75 @@ download

To track progress of the download, use the `downloadFile` API that includes a progress listener callback.

#### With StoragePath

<BlockSwitcher>
<Block name="Java">

```java
Amplify.Storage.downloadFile(
StoragePath.fromString("public/example"),
new File(getApplicationContext().getFilesDir() + "/download.txt"),
StorageDownloadFileOptions.defaultInstance(),
progress -> Log.i("MyAmplifyApp", "Fraction completed: " + progress.getFractionCompleted()),
result -> Log.i("MyAmplifyApp", "Successfully downloaded: " + result.getFile().getName()),
error -> Log.e("MyAmplifyApp", "Download Failure", error)
);
```

</Block>
<Block name="Kotlin - Callbacks">

```kotlin
val file = File("${applicationContext.filesDir}/download.txt")
val options = StorageDownloadFileOptions.defaultInstance()
Amplify.Storage.downloadFile(StoragePath.fromString("public/example"), file, options,
{ Log.i("MyAmplifyApp", "Fraction completed: ${it.fractionCompleted}") },
{ Log.i("MyAmplifyApp", "Successfully downloaded: ${it.file.name}") },
{ Log.e("MyAmplifyApp", "Download Failure", it) }
)
```

</Block>
<Block name="Kotlin - Coroutines">

```kotlin
val file = File("${applicationContext.filesDir}/download.txt")
val options = StorageDownloadFileOptions.defaultInstance()
val download = Amplify.Storage.downloadFile(StoragePath.fromString("public/example"), file, options)
val progressJob = activityScope.async {
download.progress().collect { progress ->
Log.i("MyAmplifyApp", "Fraction completed: ${progress.fractionCompleted}")
}
}
try {
val fileName = download.result().file.name
Log.i("MyAmplifyApp", "Successfully downloaded: $fileName")
} catch (error: StorageException) {
Log.e("MyAmplifyApp", "Download Failure", error)
}
progressJob.cancel()
```

</Block>
<Block name="RxJava">

```java
RxProgressAwareSingleOperation<StorageDownloadFileResult> download =
RxAmplify.Storage.downloadFile(StoragePath.fromString("public/example"), localFile);

download
.observeProgress()
.subscribe(
progress -> Log.i("MyAmplifyApp", progress.getFractionCompleted())
);
```

</Block>
</BlockSwitcher>

#### With Key (Deprecated)

<BlockSwitcher>
<Block name="Java">

Expand Down Expand Up @@ -137,6 +268,57 @@ download

You can also retrieve a URL for the object in storage:

#### With StoragePath

<BlockSwitcher>
<Block name="Java">

```java
Amplify.Storage.getUrl(
StoragePath.fromString("public/example"),
result -> Log.i("MyAmplifyApp", "Successfully generated: " + result.getUrl()),
error -> Log.e("MyAmplifyApp", "URL generation failure", error)
);
```

</Block>
<Block name="Kotlin - Callbacks">

```kotlin
Amplify.Storage.getUrl(
StoragePath.fromString("public/example"),
{ Log.i("MyAmplifyApp", "Successfully generated: ${it.url}") },
{ Log.e("MyAmplifyApp", "URL generation failure", it) }
)
```

</Block>
<Block name="Kotlin - Coroutines">

```kotlin
try {
val url = Amplify.Storage.getUrl(StoragePath.fromString("public/example")).url
Log.i("MyAmplifyApp", "Successfully generated: $url")
} catch (error: StorageException) {
Log.e("MyAmplifyApp", "URL generation failure", error)
}
```

</Block>
<Block name="RxJava">

```java
RxAmplify.Storage.getUrl(StoragePath.fromString("public/example")).subscribe(
result -> Log.i("MyAmplifyApp", "Successfully generated: " + result.getUrl()),
error -> Log.e("MyAmplifyApp", "URL generation failure", error)
);
```

</Block>
</BlockSwitcher>

#### With Key (Deprecated)

<BlockSwitcher>
<Block name="Java">

Expand Down
117 changes: 0 additions & 117 deletions src/fragments/lib/storage/android/getting-started/40_upload.mdx

This file was deleted.

Loading

0 comments on commit 7ac494c

Please sign in to comment.