Skip to content

Commit

Permalink
1.6.20
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergey Korney committed Sep 12, 2024
1 parent ce360b3 commit ae99262
Show file tree
Hide file tree
Showing 39 changed files with 1,123 additions and 98 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# Changelog

## [1.6.20] - 2024-09-11

### Added

- Module `Subscription` support.

### Changed

- Update native iOS to [`1.6.40`](https://github.com/affise/sdk-ios/blob/1.6.40/CHANGELOG.md).
- Update native Android to [`1.6.44`](https://github.com/affise/sdk-android/blob/v1.6.44/CHANGELOG.md).

## [1.6.19] - 2024-08-19

### Added
Expand Down Expand Up @@ -112,6 +123,7 @@
- Api `Affise.android.getReferrer` to `Affise.getReferrer`
- Api `Affise.android.getReferrerValue` to `Affise.getReferrerValue`

[1.6.20]: https://github.com/affise/sdk-react/compare/1.6.19...1.6.20
[1.6.19]: https://github.com/affise/sdk-react/compare/1.6.18...1.6.19
[1.6.18]: https://github.com/affise/sdk-react/compare/1.6.17...1.6.18
[1.6.17]: https://github.com/affise/sdk-react/compare/1.6.16...1.6.17
Expand Down
120 changes: 103 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@
- [iOS](#ios)
- [Module Advertising](#module-advertising)
- [Module Link](#module-link)
- [Module Status](#module-status)
- [Module Subscription](#module-subscription)
- [AffiseProductType](#affiseproducttype)
- [Initialize](#initialize)
- [Before application is published](#before-application-is-published)
- [Domain](#domain)
- [Requirements](#requirements)
- [Android](#android-1)
Expand Down Expand Up @@ -117,19 +121,20 @@ Affise.module.getModulesInstalled().then((modules) => {

Add modules to Android project

| Module | Version | Start |
|---------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------|
| `ADVERTISING` | [![module-advertising](https://img.shields.io/maven-central/v/com.affise/module-advertising?label=latest)](https://mvnrepository.com/artifact/com.affise/module-advertising) | `Auto` |
| `ANDROIDID` | [![module-androidid](https://img.shields.io/maven-central/v/com.affise/module-androidid?label=latest)](https://mvnrepository.com/artifact/com.affise/module-androidid) | `Auto` |
| `LINK` | [![module-link](https://img.shields.io/maven-central/v/com.affise/module-link?label=latest)](https://mvnrepository.com/artifact/com.affise/module-link) | `Auto` |
| `NETWORK` | [![module-network](https://img.shields.io/maven-central/v/com.affise/module-network?label=latest)](https://mvnrepository.com/artifact/com.affise/module-network) | `Auto` |
| `PHONE` | [![module-phone](https://img.shields.io/maven-central/v/com.affise/module-phone?label=latest)](https://mvnrepository.com/artifact/com.affise/module-phone) | `Auto` |
| `STATUS` | [![module-status](https://img.shields.io/maven-central/v/com.affise/module-status?label=latest)](https://mvnrepository.com/artifact/com.affise/module-status) | `Auto` |
| Module | Version | Start |
|----------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------|
| `ADVERTISING` | [![module-advertising](https://img.shields.io/maven-central/v/com.affise/module-advertising?label=latest)](https://mvnrepository.com/artifact/com.affise/module-advertising) | `Auto` |
| `ANDROIDID` | [![module-androidid](https://img.shields.io/maven-central/v/com.affise/module-androidid?label=latest)](https://mvnrepository.com/artifact/com.affise/module-androidid) | `Auto` |
| `LINK` | [![module-link](https://img.shields.io/maven-central/v/com.affise/module-link?label=latest)](https://mvnrepository.com/artifact/com.affise/module-link) | `Auto` |
| `NETWORK` | [![module-network](https://img.shields.io/maven-central/v/com.affise/module-network?label=latest)](https://mvnrepository.com/artifact/com.affise/module-network) | `Auto` |
| `PHONE` | [![module-phone](https://img.shields.io/maven-central/v/com.affise/module-phone?label=latest)](https://mvnrepository.com/artifact/com.affise/module-phone) | `Auto` |
| `STATUS` | [![module-status](https://img.shields.io/maven-central/v/com.affise/module-status?label=latest)](https://mvnrepository.com/artifact/com.affise/module-status) | `Auto` |
| `SUBSCRIPTION` | [![module-status](https://img.shields.io/maven-central/v/com.affise/module-subscription?label=latest)](https://mvnrepository.com/artifact/com.affise/module-subscription) | `Auto` |

Example [`example/android/app/build.gradle`](example/android/app/build.gradle)

```gradle
final affise_version = '1.6.42'
final affise_version = '1.6.44'
dependencies {
// Affise modules
Expand All @@ -139,18 +144,20 @@ dependencies {
implementation "com.affise:module-network:$affise_version"
implementation "com.affise:module-phone:$affise_version"
implementation "com.affise:module-status:$affise_version"
implementation 'com.affise:module-subscription:1.6.44'
}
```

#### iOS

Add modules to iOS project

| Module | Version | Start |
|---------------|:------------------------------------------------------------------------------------:|----------|
| `ADVERTISING` | [`1.6.39`](https://github.com/CocoaPods/Specs/tree/master/Specs/0/3/d/AffiseModule/) | `Manual` |
| `LINK` | [`1.6.39`](https://github.com/CocoaPods/Specs/tree/master/Specs/0/3/d/AffiseModule/) | `Auto` |
| `STATUS` | [`1.6.39`](https://github.com/CocoaPods/Specs/tree/master/Specs/0/3/d/AffiseModule/) | `Auto` |
| Module | Version | Start |
|----------------|:------------------------------------------------------------------------------------:|----------|
| `ADVERTISING` | [`1.6.40`](https://github.com/CocoaPods/Specs/tree/master/Specs/0/3/d/AffiseModule/) | `Manual` |
| `LINK` | [`1.6.40`](https://github.com/CocoaPods/Specs/tree/master/Specs/0/3/d/AffiseModule/) | `Auto` |
| `STATUS` | [`1.6.40`](https://github.com/CocoaPods/Specs/tree/master/Specs/0/3/d/AffiseModule/) | `Auto` |
| `SUBSCRIPTION` | [`1.6.40`](https://github.com/CocoaPods/Specs/tree/master/Specs/0/3/d/AffiseModule/) | `Auto` |

Example [example/ios/Podfile](example/ios/Podfile)

Expand All @@ -159,9 +166,10 @@ target 'YourAppProject' do
# ...

# Affise Modules
pod 'AffiseModule/Advertising', `1.6.39`
pod 'AffiseModule/Link', `1.6.39`
pod 'AffiseModule/Status', `1.6.39`
pod 'AffiseModule/Advertising', `1.6.40`
pod 'AffiseModule/Link', `1.6.40`
pod 'AffiseModule/Status', `1.6.40`
pod 'AffiseModule/Subscription', `1.6.40`
end
```

Expand Down Expand Up @@ -207,6 +215,62 @@ Affise.module.linkResolve("SITE_WITH_REDIRECTION", (redirectUrl) => {
});
```

#### Module Status

> **Warning**
>
> 🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥
>
> If `getStatus` return an error or working more than 2 minutes
>
> Please see section [validation credentials](#validate-credentials)
>
> 🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥
```typescript
Affise.module.getStatus(AffiseModules.STATUS, (response) => {
// handle status response
});
```

#### Module Subscription

Get products by ids:

```typescript
const ids = ["exampple.product.id_1", "exampple.product.id_2"];

Affise.module.fetchProducts(ids, (result) => {
if (result.isSuccess) {
const value = result.asSuccess;
const products: AffiseProduct[] = value.products;
const invalidIds: string[] = value.invalidIds;
} else {
const error: string = result.asFailure;
}
});
```

Purchase product:

```typescript
// Specify product type for correct affise event
Affise.module.purchase(product, AffiseProductType.CONSUMABLE, (result) => {
if (result.isSuccess) {
const purchasedInfo: AffisePurchasedInfo = result.asSuccess;
} else {
const error: string = result.asFailure;
}
});
```

##### AffiseProductType

- `CONSUMABLE`
- `NON_CONSUMABLE`
- `RENEWABLE_SUBSCRIPTION`
- `NON_RENEWABLE_SUBSCRIPTION`

### Initialize

After dependency is added, and project is sync with `npm install` and initialize.
Expand Down Expand Up @@ -244,6 +308,18 @@ Check if library is initialized
Affise.isInitialized();
```

#### Before application is published

> **Warning**
>
> 🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥
>
> Please make sure your credentials are valid
>
> Visit section [validation credentials](#validate-credentials)
>
> 🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥
#### Domain

Set SDK server domain:
Expand Down Expand Up @@ -1180,6 +1256,16 @@ In examples above `ReferrerKey.CLICK_ID` is used, but many others is available:

## Get module state

> **Warning**
>
> 🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥
>
> If `getStatus` return an error or working more than 2 minutes
>
> Please see section [validation credentials](#validate-credentials)
>
> 🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥
```typescript
Affise.module.getStatus(AffiseModules.STATUS, (response) => {
// handle status response
Expand Down
2 changes: 1 addition & 1 deletion affise-attribution-native.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Pod::Spec.new do |s|
s.source_files = "ios/**/*.{h,m,mm,swift}"

s.dependency "React-Core"
s.dependency 'AffiseInternal', '1.6.39'
s.dependency 'AffiseInternal', '1.6.40'

# Don't install the dependencies when we run `pod install` in the old architecture.
if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then
Expand Down
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ buildscript {
// Buildscript is evaluated before everything else so we can't use getExtOrDefault
def kotlin_version = rootProject.ext.has("kotlinVersion") ? rootProject.ext.get("kotlinVersion") : project.properties["AffiseAttributionNative_kotlinVersion"]
ext {
affise_version = '1.6.42'
affise_version = '1.6.44'
agp_version = '7.2.2'
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class AffiseAttributionNativeModule(
init {
(reactContext.applicationContext as? Application)?.let { app ->
apiWrapper = AffiseApiWrapper(app)
updateActivity()
apiWrapper?.react()
apiWrapper?.setCallback { name, map ->
val data = Arguments.createMap().apply {
Expand All @@ -43,8 +44,17 @@ class AffiseAttributionNativeModule(
return NAME
}

private fun updateActivity() {
apiWrapper?.let {
if (it.activity == null) {
it.activity = currentActivity
}
}
}

@ReactMethod
fun invokeMethod(apiName: String, data: ReadableMap, result: Promise) {
updateActivity()
apiWrapper?.call(AffiseApiMethod.from(apiName), data.toHashMap(), ResultWrapper(result))
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package com.affise.attribution.react

import com.affise.attribution.internal.callback.AffiseResult
import com.affise.attribution.internal.callback.InternalResult
import com.facebook.react.bridge.Arguments
import com.facebook.react.bridge.Promise

class ResultWrapper(private val promise: Promise) : AffiseResult {
class ResultWrapper(private val promise: Promise) : InternalResult {
override fun success(data: Any?) {
promise.resolve(data?.asNativeData())
}
Expand Down
3 changes: 2 additions & 1 deletion example/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ android {
}
}

final affise_version = '1.6.42'
final affise_version = '1.6.44'

dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
Expand All @@ -260,6 +260,7 @@ dependencies {
implementation "com.affise:module-network:$affise_version"
implementation "com.affise:module-phone:$affise_version"
implementation "com.affise:module-status:$affise_version"
implementation "com.affise:module-subscription:$affise_version"

//noinspection GradleDynamicVersion
implementation "com.facebook.react:react-native:+" // From node_modules
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
13B07FBC1A68108700A75B9A /* AppDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB01A68108700A75B9A /* AppDelegate.mm */; };
13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; };
13B07FC11A68108700A75B9A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; };
2BD048D22C905E06004AF20C /* DemoStore.storekit in Resources */ = {isa = PBXBuildFile; fileRef = 2BD048D12C905E06004AF20C /* DemoStore.storekit */; };
7699B88040F8A987B510C191 /* libPods-AffiseAttributionLibExample-AffiseAttributionLibExampleTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 19F6CBCC0A4E27FBF8BF4A61 /* libPods-AffiseAttributionLibExample-AffiseAttributionLibExampleTests.a */; };
81AB9BB82411601600AC10FF /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */; };
/* End PBXBuildFile section */
Expand All @@ -37,6 +38,7 @@
13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = AffiseAttributionLibExample/Info.plist; sourceTree = "<group>"; };
13B07FB71A68108700A75B9A /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = AffiseAttributionLibExample/main.m; sourceTree = "<group>"; };
19F6CBCC0A4E27FBF8BF4A61 /* libPods-AffiseAttributionLibExample-AffiseAttributionLibExampleTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-AffiseAttributionLibExample-AffiseAttributionLibExampleTests.a"; sourceTree = BUILT_PRODUCTS_DIR; };
2BD048D12C905E06004AF20C /* DemoStore.storekit */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = DemoStore.storekit; path = AffiseAttributionLibExample/DemoStore.storekit; sourceTree = "<group>"; };
3B4392A12AC88292D35C810B /* Pods-AffiseAttributionLibExample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-AffiseAttributionLibExample.debug.xcconfig"; path = "Target Support Files/Pods-AffiseAttributionLibExample/Pods-AffiseAttributionLibExample.debug.xcconfig"; sourceTree = "<group>"; };
5709B34CF0A7D63546082F79 /* Pods-AffiseAttributionLibExample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-AffiseAttributionLibExample.release.xcconfig"; path = "Target Support Files/Pods-AffiseAttributionLibExample/Pods-AffiseAttributionLibExample.release.xcconfig"; sourceTree = "<group>"; };
5B7EB9410499542E8C5724F5 /* Pods-AffiseAttributionLibExample-AffiseAttributionLibExampleTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-AffiseAttributionLibExample-AffiseAttributionLibExampleTests.debug.xcconfig"; path = "Target Support Files/Pods-AffiseAttributionLibExample-AffiseAttributionLibExampleTests/Pods-AffiseAttributionLibExample-AffiseAttributionLibExampleTests.debug.xcconfig"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -86,6 +88,7 @@
13B07FAE1A68108700A75B9A /* AffiseAttributionLibExample */ = {
isa = PBXGroup;
children = (
2BD048D12C905E06004AF20C /* DemoStore.storekit */,
13B07FAF1A68108700A75B9A /* AppDelegate.h */,
13B07FB01A68108700A75B9A /* AppDelegate.mm */,
13B07FB51A68108700A75B9A /* Images.xcassets */,
Expand Down Expand Up @@ -242,6 +245,7 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
2BD048D22C905E06004AF20C /* DemoStore.storekit in Resources */,
81AB9BB82411601600AC10FF /* LaunchScreen.storyboard in Resources */,
13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */,
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@
isEnabled = "YES">
</EnvironmentVariable>
</EnvironmentVariables>
<StoreKitConfigurationFileReference
identifier = "../AffiseAttributionLibExample/DemoStore.storekit">
</StoreKitConfigurationFileReference>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
Expand Down
Loading

0 comments on commit ae99262

Please sign in to comment.