Skip to content
Merged
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
8 changes: 7 additions & 1 deletion .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,14 @@ jobs:
echo "should_publish=true" >> $GITHUB_OUTPUT
fi

# Publishing is gated behind the ENABLE_PUBLISH repo variable so the
# Deploy workflow still runs and succeeds (which is what sync.yaml's
# workflow_run trigger needs) while we test repo sync + branding.
# To start publishing for real: set repo variable ENABLE_PUBLISH=true.
- name: Publish to pub.dev
if: steps.version_check.outputs.should_publish == 'true'
if: >-
vars.ENABLE_PUBLISH == 'true' &&
steps.version_check.outputs.should_publish == 'true'
run: |
# Создаём файл с credentials (берём из секретов)
echo "${{ secrets.PUB_DEV_CREDENTIALS }}" > ~/.pub-cache/credentials.json
Expand Down
40 changes: 40 additions & 0 deletions .github/workflows/sync.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Repository synchronization

on:
workflow_run:
workflows:
- Deploy
types:
- completed
workflow_dispatch:

jobs:
prepare:
if: |
(github.event_name == 'workflow_dispatch' ||
github.event.workflow_run.conclusion == 'success') &&
!contains(github.repository_owner, 'personaclick')
runs-on: ubuntu-latest
outputs:
replacements: ${{ steps.getReplacementsStep.outputs.replacements }}
steps:
- uses: rees46/workflow/.github/actions/sync/read-replacements@master
id: getReplacementsStep
with:
appId: ${{ vars.PUBLIVERSIONER_ID }}
appSecret: ${{ secrets.PUBLIVERSIONER_SECRET }}
replacementsRepo: rees46/workflow
repositoryOwner: rees46
replacementsPath: github/repo-sync-replacements/flutter-sdk.yml

repoSync:
needs: prepare
uses: rees46/workflow/.github/workflows/reusable-repo-sync.yml@master
secrets:
appSecret: ${{ secrets.PERSONACLICK_COURIER_SECRET }}
with:
appId: ${{ vars.PERSONACLICK_COURIER_ID }}
replacements: ${{ needs.prepare.outputs.replacements }}
repositoryOwner: personaclick
targetRepository: personaclick/flutter-sdk
reviewerUsername: ${{ vars.REVIEWER_USERNAME }}
33 changes: 33 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Miscellaneous
*.class
*.log
*.pyc
*.swp
.DS_Store
.atom/
.build/
.buildlog/
.history
.svn/
.swiftpm/
migrate_working_dir/

# IntelliJ related
*.iml
*.ipr
*.iws
.idea/

# The .vscode folder contains launch configuration and tasks you configure in
# VS Code which you may wish to be included in version control, so this line
# is commented out by default.
#.vscode/

# Flutter/Dart/Pub related
# Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock.
/pubspec.lock
**/doc/api/
.dart_tool/
.flutter-plugins-dependencies
/build/
/coverage/
33 changes: 33 additions & 0 deletions .metadata
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# This file tracks properties of this Flutter project.
# Used by Flutter tool to assess capabilities and perform upgrades etc.
#
# This file should be version controlled and should not be manually edited.

version:
revision: "ff37bef603469fb030f2b72995ab929ccfc227f0"
channel: "stable"

project_type: plugin

# Tracks metadata for the flutter migrate command
migration:
platforms:
- platform: root
create_revision: ff37bef603469fb030f2b72995ab929ccfc227f0
base_revision: ff37bef603469fb030f2b72995ab929ccfc227f0
- platform: android
create_revision: ff37bef603469fb030f2b72995ab929ccfc227f0
base_revision: ff37bef603469fb030f2b72995ab929ccfc227f0
- platform: ios
create_revision: ff37bef603469fb030f2b72995ab929ccfc227f0
base_revision: ff37bef603469fb030f2b72995ab929ccfc227f0

# User provided section

# List of Local paths (relative to this file) that should be
# ignored by the migrate tool.
#
# Files that are not part of the templates will be ignored by default.
unmanaged_files:
- 'lib/main.dart'
- 'ios/Runner.xcodeproj/project.pbxproj'
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## 0.0.1

* TODO: Describe initial release.
1 change: 1 addition & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
TODO: Add your license here.
60 changes: 60 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# rees46_flutter_sdk

Flutter plugin wrapper around REES46 native SDKs (Android/iOS).

## Getting Started

### Install

Add dependency in your app:

```yaml
dependencies:
personalization_flutter_sdk: ^0.0.1
```

### Initialize

```dart
import 'package:personaclick_flutter_sdk/personaclick_flutter_sdk.dart';

final sdk = Rees46FlutterSdk();

await sdk.initialize(
const Rees46InitConfig(
shopId: 'YOUR_SHOP_ID',
apiDomain: 'api.rees46.ru',
// stream defaults to 'ios' on iOS and 'android' on Android if omitted.
stream: 'ios',
enableLogs: false,
autoSendPushToken: true,
sendAdvertisingId: false,
enableAutoPopupPresentation: true,
needReInitialization: false,
),
);
```

### API structure (core + wrappers)

- **Core (private-ish)**: `PersonalizationSdk` and `SdkInitConfig` live in `lib/src/`.
- **REES46 wrapper**: `Rees46FlutterSdk` + `Rees46InitConfig` in `lib/rees46_flutter_sdk.dart`.
- **PersonaClick wrapper**: `PersonaclickFlutterSdk` + `PersonaclickInitConfig` in `lib/personaclick_flutter_sdk.dart` (primary entrypoint in PersonaClick repo).

### Run demo app

```bash
cd example
fvm flutter run
```

### Notes

- **Android**: uses Maven dependency `com.rees46:rees46-sdk:2.28.0` and calls `SDK.initialize(...)`. Some iOS-only init flags are accepted by Dart API but ignored on Android.
- **iOS**: uses CocoaPods dependency `REES46 (3.23.0)` and calls `createPersonalizationSDK(...)`.
- **Pushes**:
- **Android**: when `autoSendPushToken=true`, the native SDK fetches the FCM token via `FirebaseMessaging.getInstance().token` during initialization and sends it.
- **iOS**: when `autoSendPushToken=true`, the native SDK requests notification permission and registers for remote notifications. The Flutter plugin also forwards `didRegisterForRemoteNotificationsWithDeviceToken` and `didReceiveRemoteNotification` AppDelegate callbacks to the native SDK.

For Flutter plugin development basics, see Flutter docs: [develop plugins](https://flutter.dev/to/develop-plugins).

4 changes: 4 additions & 0 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
include: package:flutter_lints/flutter.yaml

# Additional information about this file can be found at
# https://dart.dev/guides/language/analysis-options
9 changes: 9 additions & 0 deletions android/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
*.iml
.gradle
/local.properties
/.idea/workspace.xml
/.idea/libraries
.DS_Store
/build
/captures
.cxx
95 changes: 95 additions & 0 deletions android/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
group = "com.rees46.rees46_flutter_sdk"
version = "1.0-SNAPSHOT"

buildscript {
val kotlinVersion = "2.2.20"
repositories {
google()
mavenCentral()
maven(url = "https://jitpack.io")
}

dependencies {
classpath("com.android.tools.build:gradle:8.11.1")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion")
}
}

allprojects {
repositories {
google()
mavenCentral()
maven(url = "https://jitpack.io")
}
}

plugins {
id("com.android.library")
id("kotlin-android")
}

android {
namespace = "com.rees46.rees46_flutter_sdk"

compileSdk = 36

flavorDimensions += "brand"

productFlavors {
create("rees46") {
dimension = "brand"
}
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}

kotlinOptions {
jvmTarget = JavaVersion.VERSION_17.toString()
}

sourceSets {
getByName("main") {
java.srcDirs("src/main/kotlin")
}
getByName("test") {
java.srcDirs("src/test/kotlin")
}
}

defaultConfig {
minSdk = 24
}

testOptions {
unitTests {
isIncludeAndroidResources = true
all {
it.useJUnitPlatform()

it.outputs.upToDateWhen { false }

it.testLogging {
events("passed", "skipped", "failed", "standardOut", "standardError")
showStandardStreams = true
}
}
}
}
}

dependencies {
// REES46 Android SDK (Maven Central).
//
// Note: the 2.x line in Maven Central uses versions like 2.6.0 (not 2.28.0).
val rees46AndroidSdkVersion = "2.6.0"
add(
"rees46Implementation",
"com.rees46:rees46-sdk:$rees46AndroidSdkVersion",
)

testImplementation("org.jetbrains.kotlin:kotlin-test")
testImplementation("org.mockito:mockito-core:5.0.0")
}
1 change: 1 addition & 0 deletions android/settings.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
rootProject.name = 'rees46_flutter_sdk'
1 change: 1 addition & 0 deletions android/settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
rootProject.name = 'rees46_flutter_sdk'
3 changes: 3 additions & 0 deletions android/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.rees46.rees46_flutter_sdk">
</manifest>
Loading
Loading