Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 1 addition & 5 deletions .github/workflows/android-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,13 @@ jobs:
flutter-version: ${{ env.FLUTTER_VERSION }}
channel: ${{ env.FLUTTER_CHANNEL }}

# This step enables KVM (Kernel-based Virtual Machine).
# KVM is a virtualization module in the Linux kernel that allows the
# kernel to function as a hypervisor. This is necessary for running
# virtual machines on the host system.
- name: Enable KVM
run: |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm

- name: run android tests
- name: Run integration test on Android emulator
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 29
Expand Down
74 changes: 8 additions & 66 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,87 +8,29 @@ on:
- '*'
jobs:
build:
runs-on: macos-latest

strategy:
matrix:
include:
- flutter-version: '3.27.3'
build: cocoapods
- flutter-version: '3.44.0'
build: android
- flutter-version: '3.44.0'
build: spm
runs-on: ubuntu-latest

env:
FLUTTER_CHANNEL: stable
FLUTTER_VERSION: 3.27.3

steps:
- name: Checkout code
uses: actions/checkout@v6

- name: Fetch submodules
run: git submodule update --init --recursive

- name: Set up JDK 17
if: matrix.build != 'spm'
uses: actions/setup-java@v5
with:
java-version: 17
distribution: 'zulu'

- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: ${{ matrix.flutter-version }}
flutter-version: ${{ env.FLUTTER_VERSION }}
channel: ${{ env.FLUTTER_CHANNEL }}

- name: Copy Confidence sources for CocoaPods
if: matrix.build == 'cocoapods'
working-directory: ios/Classes
run: cp -r confidence-sdk/Sources/Confidence .

- name: Remove the submodule
if: matrix.build == 'cocoapods'
working-directory: ios/Classes
run: rm -rf confidence-sdk

- name: Remove git submodule
if: matrix.build == 'cocoapods'
working-directory: ios/Classes
run: git rm confidence-sdk
- run: echo API_KEY=${{ secrets.TEST_API_KEY }} > example/.env

- name: Install dependencies
if: matrix.build != 'spm'
working-directory: example
run: flutter pub get

- run: echo API_KEY=${{ secrets.TEST_API_KEY }} > example/.env
if: matrix.build != 'spm'

- name: Build Android
if: matrix.build != 'spm'
working-directory: example
run: flutter build apk --release

- name: Build iOS (CocoaPods)
if: matrix.build == 'cocoapods'
working-directory: example
run: flutter build ios --release --no-codesign

- name: Copy Confidence sources for SPM
if: matrix.build == 'spm'
run: cp -r ios/Classes/confidence-sdk/Sources/Confidence ios/confidence_flutter_sdk/Sources/confidence_flutter_sdk/

- name: Prepare plugin without git context
if: matrix.build == 'spm'
run: |
mkdir -p /tmp/confidence_flutter_sdk
rsync -a --exclude='.git' --exclude='ios/Classes/confidence-sdk' . /tmp/confidence_flutter_sdk/
- name: Analyze
run: flutter analyze

- run: echo API_KEY=dummy > /tmp/confidence_flutter_sdk/example/.env
if: matrix.build == 'spm'
- name: Build iOS (SPM)
if: matrix.build == 'spm'
working-directory: /tmp/confidence_flutter_sdk/example
run: flutter build ios --no-codesign
- name: Run tests
run: flutter test
15 changes: 0 additions & 15 deletions .github/workflows/ios-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,6 @@ jobs:
- name: Checkout code
uses: actions/checkout@v6

- name: fetch submodules
run: git submodule update --init --recursive

- name: Copy iOS
working-directory: ios/Classes
run: cp -r confidence-sdk/Sources/Confidence .

- name: Remove the submodule
working-directory: ios/Classes
run: rm -rf confidence-sdk

- name: Remove git submodule
working-directory: ios/Classes
run: git rm confidence-sdk

- name: Select iOS simulator
id: simulator
run: |
Expand Down
3 changes: 0 additions & 3 deletions .gitmodules

This file was deleted.

18 changes: 5 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Flutter implementation of the [Confidence](https://confidence.spotify.com/) SDK.

This SDK uses the [Android](https://github.com/spotify/confidence-sdk-android) and [iOS](https://github.com/spotify/confidence-sdk-swift) respectively under the hood.
This package provides a pure Dart Confidence SDK for Flutter apps, plus a legacy `ConfidenceFlutterSdk` wrapper for existing integrations.

## Usage
Add the confidence sdk to your flutter app using the following command:
Expand All @@ -28,7 +28,7 @@ To use a self-hosted local resolver SDK or sidecar resolver for flag resolve and
await confidence.setup("API_KEY", LoggingLevel.WARN, "http://localhost:8090");
```

The native SDKs append `/v1/flags:resolve` and `/v1/flags:apply` to this URL. Event tracking continues to use the Confidence events endpoint.
The pure Dart resolve and apply clients append `/v1/flags:resolve` and `/v1/flags:apply` to this URL. Event tracking continues to use the Confidence events endpoint.

Context could be passed to the sdk as follows:
```dart
Expand Down Expand Up @@ -57,19 +57,11 @@ we can send custom events to the confidence sdk like following:
confidence.track("[EVENT-NAME]", <String, dynamic>{});
```

### Running the example iOS app in xcode
to run the iOS example app in xcode, first fetch the submodules:

```bash
git submodule update --init --recursive
```

then you can drag and drop the `ios/Classes/confidence_sdk/Sources/Confidence` folder into your xcode project next to the `ConfidenceFlutterSDkPlugin.swift` file.

then we can run flutter on iOS given your iOS simulator is running using:
### Running the example iOS app in Xcode
Run the app on iOS with a simulator already running:

```bash
flutter run
```

or simply run the app from XCode.
or open the example app in Xcode and run it from there.
9 changes: 0 additions & 9 deletions android/.gitignore

This file was deleted.

71 changes: 0 additions & 71 deletions android/build.gradle

This file was deleted.

17 changes: 0 additions & 17 deletions android/proguard-rules.pro

This file was deleted.

1 change: 0 additions & 1 deletion android/settings.gradle

This file was deleted.

3 changes: 0 additions & 3 deletions android/src/main/AndroidManifest.xml

This file was deleted.

Loading