diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 317e401..ae27c15 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -20,7 +20,7 @@ env: jobs: build-library: - if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release/') || github.ref != 'refs/heads/doc/*' + if: github.event_name == 'pull_request' && github.event.action == 'opened' && startsWith(github.event.pull_request.head.ref, 'samples/') runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -73,6 +73,7 @@ jobs: name: code-coverage-report-${{ github.job }} path: "**/build/reports/**/*" check-sample-android-app: + if: github.event_name == 'pull_request' && github.event.action == 'opened' && startsWith(github.event.pull_request.head.ref, 'samples/') needs: build-library runs-on: ubuntu-latest steps: @@ -84,6 +85,7 @@ jobs: target: androidapp githubToken: ${{ secrets.GITHUB_TOKEN }} check-sample-desktop-app: + if: github.event_name == 'pull_request' && github.event.action == 'opened' && startsWith(github.event.pull_request.head.ref, 'samples/') needs: build-library runs-on: ubuntu-latest steps: @@ -95,6 +97,7 @@ jobs: target: desktopApp githubToken: ${{ secrets.GITHUB_TOKEN }} check-sample-wear-app: + if: github.event_name == 'pull_request' && github.event.action == 'opened' && startsWith(github.event.pull_request.head.ref, 'samples/') needs: build-library runs-on: ubuntu-latest steps: @@ -106,6 +109,7 @@ jobs: target: wearapp githubToken: ${{ secrets.GITHUB_TOKEN }} check-sample-web-app: + if: github.event_name == 'pull_request' && github.event.action == 'opened' && startsWith(github.event.pull_request.head.ref, 'samples/') needs: build-library runs-on: ubuntu-latest steps: diff --git a/.github/workflows/code-coverage.yml b/.github/workflows/code-coverage.yml index 5297a59..e44d983 100644 --- a/.github/workflows/code-coverage.yml +++ b/.github/workflows/code-coverage.yml @@ -21,6 +21,7 @@ permissions: jobs: build: + if: github.event_name == 'pull_request' && github.event.action == 'opened' && startsWith(github.event.pull_request.head.ref, 'samples/') name: Build and analyze runs-on: self-hosted steps: diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index a196625..ea13783 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -18,6 +18,7 @@ env: jobs: build-documentation: + if: github.event_name == 'pull_request' && github.event.action == 'opened' && startsWith(github.event.pull_request.head.ref, 'samples/') runs-on: ubuntu-latest steps: - name: Checkout repository @@ -47,6 +48,7 @@ jobs: retention-days: 7 test-documentation: + if: github.event_name == 'pull_request' && github.event.action == 'opened' && startsWith(github.event.pull_request.head.ref, 'samples/') needs: build-documentation runs-on: ubuntu-latest @@ -63,6 +65,7 @@ jobs: instance: ${{ env.INSTANCE }} deploy-documentation: + if: github.event_name == 'pull_request' && github.event.action == 'opened' && startsWith(github.event.pull_request.head.ref, 'samples/') environment: name: github-pages url: ${{ steps.deployment.outputs.page_url }} diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 9975c4b..8e4ff95 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -27,6 +27,7 @@ env: jobs: pre-build: + if: github.event_name == 'pull_request' && github.event.action == 'opened' && startsWith(github.event.pull_request.head.ref, 'samples/') name: Publish library at mavenCentral runs-on: self-hosted steps: @@ -53,6 +54,7 @@ jobs: - name: Publish library run: ./gradlew publish --no-parallel release: + if: github.event_name == 'pull_request' && github.event.action == 'opened' && startsWith(github.event.pull_request.head.ref, 'samples/') name: Create release v${{ github.event.inputs.version }} needs: pre-build runs-on: self-hosted diff --git a/README.md b/README.md index 87cdf0d..3da6d1b 100644 --- a/README.md +++ b/README.md @@ -44,11 +44,13 @@ Before [creating an issue](https://github.com/estivensh4/aws-kmp/issues/new), pl Branching Model --------------- -Development is done with feature branches like `feature/xxx`. Any bug fixes for a particular release should be directed to a release branch such as `release/1.2.x` and from release will be pushed to main. If you want to update the documentation create a branch like docs/xxx. +Development is done with feature branches like `feature/xxx`. Any bug fixes for a particular release should be directed to a release branch like `release/1.2.x` and from the release will be pushed to the main branch. If you want to update the documentation create a branch like `docs/xxx`. -Project members push directly to branches in the main repository. External contributors work on the corresponding branch in their own clone and issue a pull request. +If you want to update only the sample project do it from a branch like `samples/xxx`. -You can, of course, suggest any changes via a pull request, but we suggest that you first create an issue. Creating an issue helps to avoid wasting time. +Project members submit directly to the main repository branches. External contributors work on the corresponding branch in their own clone and issue a pull request. + +You can, of course, suggest any changes through a pull request, but we suggest that you first create an issue. Creating an issue helps to avoid wasting time ## License diff --git a/samples/androidapp/src/main/java/com/estivensh4/androidapp/MainActivity.kt b/samples/androidapp/src/main/java/com/estivensh4/androidapp/MainActivity.kt index 4ea014c..cb8220e 100644 --- a/samples/androidapp/src/main/java/com/estivensh4/androidapp/MainActivity.kt +++ b/samples/androidapp/src/main/java/com/estivensh4/androidapp/MainActivity.kt @@ -21,7 +21,7 @@ import androidx.compose.runtime.remember import androidx.compose.runtime.setValue import androidx.compose.ui.platform.LocalContext import com.estivensh4.androidapp.ui.theme.AwskmpTheme -import com.estivensh4.aws_s3.ImageFile +import com.estivensh4.s3.ImageFile import com.estivensh4.shared.SampleViewModel import kotlinx.datetime.Clock import kotlinx.datetime.DateTimeUnit diff --git a/samples/desktopApp/src/main/kotlin/Main.kt b/samples/desktopApp/src/main/kotlin/Main.kt index 5edcdbb..e71db60 100644 --- a/samples/desktopApp/src/main/kotlin/Main.kt +++ b/samples/desktopApp/src/main/kotlin/Main.kt @@ -1,7 +1,6 @@ import androidx.compose.desktop.ui.tooling.preview.Preview import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column -import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.lazy.items @@ -21,7 +20,7 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.window.AwtWindow import androidx.compose.ui.window.Window import androidx.compose.ui.window.application -import com.estivensh4.aws_s3.ImageFile +import com.estivensh4.s3.ImageFile import com.estivensh4.shared.SampleViewModel import kotlinx.coroutines.launch import java.awt.FileDialog diff --git a/samples/gradle/libs.versions.toml b/samples/gradle/libs.versions.toml index 5a223e4..307d7a8 100644 --- a/samples/gradle/libs.versions.toml +++ b/samples/gradle/libs.versions.toml @@ -1,6 +1,6 @@ [versions] agp = "8.1.4" -awsS3 = "0.5.4" +awsS3 = "0.5.6" kotlin = "1.9.20" compose = "1.5.4" compose-compiler = "1.5.4" diff --git a/samples/iosApp/iosApp.xcodeproj/project.pbxproj b/samples/iosApp/iosApp.xcodeproj/project.pbxproj index 2e2cc41..e618d18 100644 --- a/samples/iosApp/iosApp.xcodeproj/project.pbxproj +++ b/samples/iosApp/iosApp.xcodeproj/project.pbxproj @@ -9,7 +9,6 @@ /* Begin PBXBuildFile section */ 058557BB273AAA24004C7B11 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 058557BA273AAA24004C7B11 /* Assets.xcassets */; }; 058557D9273AAEEB004C7B11 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 058557D8273AAEEB004C7B11 /* Preview Assets.xcassets */; }; - 14B556C42B02FCD900F83F55 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 14B556C32B02FCD900F83F55 /* AppDelegate.swift */; }; 14D2717A2B069C5E008E0210 /* KMMViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 14D271792B069C5E008E0210 /* KMMViewModel.swift */; }; 14D2717D2B069CFA008E0210 /* KMMViewModelCore in Frameworks */ = {isa = PBXBuildFile; productRef = 14D2717C2B069CFA008E0210 /* KMMViewModelCore */; }; 14D2717F2B069CFA008E0210 /* KMMViewModelSwiftUI in Frameworks */ = {isa = PBXBuildFile; productRef = 14D2717E2B069CFA008E0210 /* KMMViewModelSwiftUI */; }; @@ -21,7 +20,6 @@ /* Begin PBXFileReference section */ 058557BA273AAA24004C7B11 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 058557D8273AAEEB004C7B11 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = ""; }; - 14B556C32B02FCD900F83F55 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 14D271792B069C5E008E0210 /* KMMViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMMViewModel.swift; sourceTree = ""; }; 2152FB032600AC8F00CF470E /* iOSApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = iOSApp.swift; sourceTree = ""; }; 6BCC0A48C5FCF9A097A71478 /* Pods-iosApp.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-iosApp.debug.xcconfig"; path = "Target Support Files/Pods-iosApp/Pods-iosApp.debug.xcconfig"; sourceTree = ""; }; @@ -80,7 +78,6 @@ 7555FF8C242A565B00829871 /* Info.plist */, 2152FB032600AC8F00CF470E /* iOSApp.swift */, 058557D7273AAEEB004C7B11 /* Preview Content */, - 14B556C32B02FCD900F83F55 /* AppDelegate.swift */, 14D271792B069C5E008E0210 /* KMMViewModel.swift */, ); path = iosApp; @@ -224,7 +221,6 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 14B556C42B02FCD900F83F55 /* AppDelegate.swift in Sources */, 2152FB042600AC8F00CF470E /* iOSApp.swift in Sources */, 14D2717A2B069C5E008E0210 /* KMMViewModel.swift in Sources */, 7555FF83242A565900829871 /* ContentView.swift in Sources */, diff --git a/samples/iosApp/iosApp/AppDelegate.swift b/samples/iosApp/iosApp/AppDelegate.swift deleted file mode 100644 index a059d59..0000000 --- a/samples/iosApp/iosApp/AppDelegate.swift +++ /dev/null @@ -1,33 +0,0 @@ -// -// AppDelegate.swift -// iosApp -// -// Created by Estiven on 13/11/23. -// Copyright © 2023 orgName. All rights reserved. -// - -import Foundation -import UIKit -import AWSS3 -import shared - - -class AppDelegate: UIResponder, UIApplicationDelegate { - - var window: UIWindow? - - func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { - - initializeS3() - return true - - } -} - -func initializeS3(){ - - let credentialsProvider = AWSStaticCredentialsProvider(accessKey: BuildPublicConfig().accessKey, secretKey: BuildPublicConfig().secretKey) - let configuration = AWSServiceConfiguration.init(region: .USEast1, credentialsProvider: credentialsProvider) - - AWSServiceManager.default().defaultServiceConfiguration = configuration -} diff --git a/samples/iosApp/iosApp/ContentView.swift b/samples/iosApp/iosApp/ContentView.swift index d4f3a75..348bd09 100644 --- a/samples/iosApp/iosApp/ContentView.swift +++ b/samples/iosApp/iosApp/ContentView.swift @@ -70,7 +70,7 @@ struct ContentView: View { if let selectedImageData, let uiImage = UIImage(data: selectedImageData) { - sampleViewModel.putObject(bucketName: bucketName, key: key, imageFile: uiImage) + sampleViewModel.putObject(bucketName: bucketName, key: key, imageFile: .init(uiImage: uiImage)) } diff --git a/samples/iosApp/iosApp/Info.plist b/samples/iosApp/iosApp/Info.plist index 9a269f5..f6caa0b 100644 --- a/samples/iosApp/iosApp/Info.plist +++ b/samples/iosApp/iosApp/Info.plist @@ -44,5 +44,20 @@ UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight + NSAppTransportSecurity + + NSAllowsArbitraryLoads + + NSExceptionDomains + + http://s3.us-east-1.amazonaws.com/ + + NSIncludesSubdomains + + NSThirdPartyExceptionRequiresForwardSecrecy + + + + diff --git a/samples/iosApp/iosApp/iOSApp.swift b/samples/iosApp/iosApp/iOSApp.swift index ee6901c..f46ca9f 100644 --- a/samples/iosApp/iosApp/iOSApp.swift +++ b/samples/iosApp/iosApp/iOSApp.swift @@ -4,8 +4,6 @@ import SwiftUI @main struct iOSApp: App { - @UIApplicationDelegateAdaptor(AppDelegate.self) var delegate - var body: some Scene { WindowGroup { ContentView() diff --git a/samples/shared/src/commonMain/kotlin/com/estivensh4/shared/SampleViewModel.kt b/samples/shared/src/commonMain/kotlin/com/estivensh4/shared/SampleViewModel.kt index b7fe274..68b86cc 100644 --- a/samples/shared/src/commonMain/kotlin/com/estivensh4/shared/SampleViewModel.kt +++ b/samples/shared/src/commonMain/kotlin/com/estivensh4/shared/SampleViewModel.kt @@ -1,8 +1,8 @@ package com.estivensh4.shared -import com.estivensh4.aws_s3.AWSS3 -import com.estivensh4.aws_s3.Bucket -import com.estivensh4.aws_s3.ImageFile +import com.estivensh4.s3.AWSS3 +import com.estivensh4.s3.Bucket +import com.estivensh4.s3.ImageFile import com.rickclephas.kmm.viewmodel.KMMViewModel import com.rickclephas.kmm.viewmodel.MutableStateFlow import com.rickclephas.kmp.nativecoroutines.NativeCoroutinesState @@ -28,7 +28,7 @@ open class SampleViewModel : KMMViewModel() { @NativeCoroutinesState val generatePresignedUrl get() = _generatePresignedUrl.asStateFlow() - private val client = AWSS3.Builder() + private val client = AWSS3.builder() .accessKey(BuildPublicConfig.accessKey) .secretKey(BuildPublicConfig.secretKey) .setEndpoint("s3.amazonaws.com") diff --git a/samples/wearapp/src/main/java/com/estivensh4/wearapp/presentation/MainActivity.kt b/samples/wearapp/src/main/java/com/estivensh4/wearapp/presentation/MainActivity.kt index 8424a90..2a93718 100644 --- a/samples/wearapp/src/main/java/com/estivensh4/wearapp/presentation/MainActivity.kt +++ b/samples/wearapp/src/main/java/com/estivensh4/wearapp/presentation/MainActivity.kt @@ -29,7 +29,7 @@ import androidx.wear.compose.material.ScalingLazyColumn import androidx.wear.compose.material.Text import androidx.wear.compose.material.TimeText import androidx.wear.compose.material.rememberScalingLazyListState -import com.estivensh4.aws_s3.ImageFile +import com.estivensh4.s3.ImageFile import com.estivensh4.shared.SampleViewModel import com.estivensh4.wearapp.presentation.theme.ExampleTheme import kotlinx.datetime.Clock