Skip to content

Commit

Permalink
1.6.17
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergey Korney committed Mar 14, 2024
1 parent 02b5a2a commit a84f39f
Show file tree
Hide file tree
Showing 13 changed files with 74 additions and 26 deletions.
12 changes: 6 additions & 6 deletions Editor/Resources/AffiseModules.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,36 +3,36 @@
"name": "Advertising",
"android": {
"module": "com.affise:module-advertising",
"version": "1.6.23"
"version": "1.6.26"
},
"ios": {
"module": "AffiseModule/Advertising",
"version": "1.6.25"
"version": "1.6.27"
}
},
{
"name": "Status",
"android": {
"module": "com.affise:module-status",
"version": "1.6.23"
"version": "1.6.26"
},
"ios": {
"module": "AffiseModule/Status",
"version": "1.6.25"
"version": "1.6.27"
}
},
{
"name": "Network",
"android": {
"module": "com.affise:module-network",
"version": "1.6.23"
"version": "1.6.26"
}
},
{
"name": "Phone",
"android": {
"module": "com.affise:module-phone",
"version": "1.6.23"
"version": "1.6.26"
}
}
]
2 changes: 1 addition & 1 deletion Editor/Resources/iOS/AffisePodfile.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
platform :ios, '11.0'

target 'UnityFramework' do
pod 'AffiseInternal', '1.6.25'
pod 'AffiseInternal', '1.6.27'

end

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

| Artifact | Version |
|---------------|-----------------------|
| `attribution` | [`1.6.16`](/releases) |
| `attribution` | [`1.6.17`](/releases) |

- [Affise Unity package](#affise-unity-package)
- [Description](#description)
Expand Down Expand Up @@ -49,6 +49,7 @@
- [Get random user Id](#get-random-user-id)
- [Get random device Id](#get-random-device-id)
- [Get providers](#get-providers)
- [Is first run](#is-first-run)
- [Get referrer](#get-referrer)
- [Get referrer value](#get-referrer-value)
- [Referrer keys](#referrer-keys)
Expand Down Expand Up @@ -82,7 +83,7 @@ Add package from git url `https://github.com/affise/sdk-unity.git`

### Integrate unitypackage file

Download latest Affise SDK [`attribution-1.6.16.unitypackage`](https://github.com/affise/sdk-unity/releases/download/1.6.16/attribution-1.6.16.unitypackage)
Download latest Affise SDK [`attribution-1.6.17.unitypackage`](https://github.com/affise/sdk-unity/releases/download/1.6.17/attribution-1.6.17.unitypackage)
from [releases page](https://github.com/affise/sdk-unity/releases) and drop this file to unity editor

### Initialize
Expand Down Expand Up @@ -216,10 +217,10 @@ Dependencies located in Android project gradle file `build.gradle`
dependencies {
// ...
// Affise modules
implementation 'com.affise:module-advertising:1.6.23'
implementation 'com.affise:module-network:1.6.23'
implementation 'com.affise:module-phone:1.6.23'
implementation 'com.affise:module-status:1.6.23'
implementation 'com.affise:module-advertising:1.6.26'
implementation 'com.affise:module-network:1.6.26'
implementation 'com.affise:module-phone:1.6.26'
implementation 'com.affise:module-status:1.6.26'
}
```

Expand All @@ -233,20 +234,20 @@ All affise modules is updated automatically on build
| Module | Version | Start |
|---------------|:------------------------------------------------------------------------------------:|----------|
| `Advertising` | [`1.6.25`](https://github.com/CocoaPods/Specs/tree/master/Specs/0/3/d/AffiseModule/) | `Manual` |
| `Status` | [`1.6.25`](https://github.com/CocoaPods/Specs/tree/master/Specs/0/3/d/AffiseModule/) | `Auto` |
| `Advertising` | [`1.6.27`](https://github.com/CocoaPods/Specs/tree/master/Specs/0/3/d/AffiseModule/) | `Manual` |
| `Status` | [`1.6.27`](https://github.com/CocoaPods/Specs/tree/master/Specs/0/3/d/AffiseModule/) | `Auto` |

Dependencies located in XCode project folder `Podfile`

```rb
platform :ios, '11.0'

target 'UnityFramework' do
pod 'AffiseInternal', '1.6.25'
pod 'AffiseInternal', '1.6.27'

# Affise Modules
pod 'AffiseModule/Advertising', `1.6.25`
pod 'AffiseModule/Status', `1.6.25`
pod 'AffiseModule/Advertising', `1.6.27`
pod 'AffiseModule/Status', `1.6.27`
end

target 'Unity-iPhone' do
Expand Down Expand Up @@ -301,10 +302,10 @@ Podfile:
platform :ios, '11.0'

target 'UnityFramework' do
pod 'AffiseInternal', '1.6.25'
pod 'AffiseInternal', '1.6.27'

# Affise Modules
# pod 'AffiseModule/Status', `1.6.25`
# pod 'AffiseModule/Status', `1.6.27`
end

target 'Unity-iPhone' do
Expand Down Expand Up @@ -864,6 +865,12 @@ if (providers.ContainsKey(key)) {
}
```

## Is first run

```c#
Affise.IsFirstRun();
```

## Get referrer

> **Warning**
Expand Down
9 changes: 9 additions & 0 deletions Runtime/Affise.cs
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,15 @@ public static List<AffiseModules> GetModulesInstalled()
#endif
}

public static bool IsFirstRun()
{
#if (UNITY_ANDROID || UNITY_IOS) && !UNITY_EDITOR
return _native?.IsFirstRun() ?? true;
#else
return _api?.FirstAppOpenUseCase.IsFirstRun() ?? true;
#endif
}

/**
* Get referrer
*/
Expand Down
2 changes: 2 additions & 0 deletions Runtime/Native/AffiseApiMethod.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ internal enum AffiseApiMethod
GET_PROVIDERS,
MODULE_START,
GET_MODULES_INSTALLED,
IS_FIRST_RUN,

// callbacks
GET_REFERRER_CALLBACK,
Expand Down Expand Up @@ -82,6 +83,7 @@ internal static class AffiseApiMethodExt
AffiseApiMethod.GET_PROVIDERS => "get_providers",
AffiseApiMethod.MODULE_START => "module_start",
AffiseApiMethod.GET_MODULES_INSTALLED => "get_modules_installed",
AffiseApiMethod.IS_FIRST_RUN => "is_first_run",
// callbacks
AffiseApiMethod.GET_REFERRER_CALLBACK => "get_referrer_callback",
AffiseApiMethod.GET_REFERRER_VALUE_CALLBACK => "get_referrer_value_callback",
Expand Down
5 changes: 5 additions & 0 deletions Runtime/Native/AffiseNative.cs
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,11 @@ public List<AffiseModules> GetModules()
return result;
}

public bool IsFirstRun()
{
return Native<bool>(AffiseApiMethod.IS_FIRST_RUN);
}

public string? GetRandomUserId()
{
return Native<string>(AffiseApiMethod.GET_RANDOM_USER_ID);
Expand Down
12 changes: 11 additions & 1 deletion Runtime/Native/Android/NativeAndroid.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ internal class NativeAndroid : AndroidJavaProxy, INative
private const string JavaUnityPlayer = "com.unity3d.player.UnityPlayer";
private const string JavaApiCall = "apiCall";
private const string JavaApiCallVoid = "apiCallVoid";
private const string JavaApiCallBool = "apiCallBool";

private readonly AndroidJavaObject? _plugin;

Expand Down Expand Up @@ -63,7 +64,16 @@ public void NativeHandleDeeplink(string url)
if (_plugin is null) return default;
try
{
return _plugin.Call<T>(JavaApiCall, apiName, json);
object? value = Type.GetTypeCode(typeof(T)) switch
{
TypeCode.Boolean => _plugin.Call<int>(JavaApiCallBool, apiName, json) != 0,
_ => _plugin.Call<T>(JavaApiCall, apiName, json)
};

if (value is T result)
{
return result;
}
}
catch (AndroidJavaException e)
{
Expand Down
2 changes: 2 additions & 0 deletions Runtime/Native/IAffiseNative.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ internal interface IAffiseNative

Dictionary<ProviderType, object?> GetProviders();

bool IsFirstRun();

void RegisterAppForAdNetworkAttribution(ErrorCallback completionHandler);

void UpdatePostbackConversionValue(int fineValue, CoarseValue coarseValue, ErrorCallback completionHandler);
Expand Down
2 changes: 1 addition & 1 deletion Runtime/Parameters/Providers/AffSDKVersionProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ internal class AffSDKVersionProvider : StringPropertyProvider
{
public override float Order => 47.0f;
public override ProviderType? Key => ProviderType.AFFISE_SDK_VERSION;
public override string Provide() => "1.6.16";
public override string Provide() => "1.6.17";
}
}
2 changes: 1 addition & 1 deletion Runtime/Plugins/unity.androidlib/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ android {
dependencies {
implementation "com.android.installreferrer:installreferrer:2.2"
// Affise SDK
implementation "com.affise:internal:1.6.23"
implementation "com.affise:internal:1.6.26"
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,12 @@ public <T> T apiCall(String apiName, String json) throws Exception {
throw new Exception(String.format("AffiseApi [%s] error: [%s]", apiName, e.getLocalizedMessage()));
}
}


public int apiCallBool(String apiName, String json) throws Exception {
Boolean value = apiCall(apiName, json);
return value ? 1 : 0;
}

private <T> T asNativeData(ApiResult result) {
Object data = result.getResult();

Expand Down
10 changes: 9 additions & 1 deletion Runtime/Usecase/FirstAppOpenUseCase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ namespace AffiseAttributionLib.Usecase
internal class FirstAppOpenUseCase
{
private readonly ICurrentActiveActivityCountProvider _activityCountProvider;
private bool _firstRun = false;

public FirstAppOpenUseCase(ICurrentActiveActivityCountProvider activityCountProvider)
{
Expand All @@ -31,6 +32,8 @@ public void OnAppCreated()
}

CheckSaveUUIDs();

_firstRun = PrefUtils.GetBoolean(FIRST_OPENED, true);

//init session observer
_activityCountProvider.Init();
Expand Down Expand Up @@ -72,7 +75,12 @@ public bool IsFirstOpen()
PrefUtils.SaveBoolean(FIRST_OPENED, false);
return true;
}


public bool IsFirstRun()
{
return _firstRun;
}

/**
* Get first open date
* @return first open date
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "com.affise.attribution",
"version": "1.6.16",
"version": "1.6.17",
"displayName": "Affise Attribution",
"description": "A platform for data-loving marketers that want to grow their revenue by up to 250%",
"unity": "2020.3",
Expand Down

0 comments on commit a84f39f

Please sign in to comment.