com.azerion.bluestack 6.0.0-beta.1 → 6.0.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Changelog
2
2
 
3
- ## [6.0.0-beta.1] - 2026-06-10
3
+ ## [6.0.0-beta.2] - 2026-06-10
4
4
 
5
5
  ### Native SDK upgrades
6
6
 
@@ -1,4 +1,4 @@
1
- <dependencies version="6.0.0-beta.1">
1
+ <dependencies version="6.0.0-beta.2">
2
2
  <androidPackages>
3
3
  <androidPackage alias="BlueStack" spec="com.azerion:bluestack-sdk-core:6.0.1">
4
4
  <repositories>
@@ -5,6 +5,6 @@ namespace Azerion.BlueStack.Common
5
5
  {
6
6
  public static class BlueStackSdkInfo
7
7
  {
8
- public const string Version = "6.0.0-beta.1";
8
+ public const string Version = "6.0.0-beta.2";
9
9
  }
10
10
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "com.azerion.bluestack",
3
- "version": "6.0.0-beta.1",
3
+ "version": "6.0.0-beta.2",
4
4
  "displayName": "BlueStack",
5
5
  "description": "BlueStack SDK has been designed to give developers options for showing Ads from different ad networks.",
6
6
  "unity": "2020.3",
package/CLAUDE.md DELETED
@@ -1,157 +0,0 @@
1
- # CLAUDE.md
2
-
3
- This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4
-
5
- ## What This Is
6
-
7
- `com.azerion.bluestack` — a Unity UPM package (v6.0.0) that wraps the native BlueStack ad SDK for iOS and Android. It exposes a cross-platform C# API for banner, interstitial, rewarded, and native ad formats.
8
- - **package project repo**: `/Users/moinhasan/Development/Azerdev/bluestack/unity/bluestack-sdk-unity`
9
- - **UPM package directory**: `/Users/moinhasan/Development/Azerdev/bluestack/unity/bluestack-sdk-unity/plugin`
10
-
11
- **Related repos worked on alongside this package:**
12
- - **Demo/test app**: `/Users/moinhasan/Development/Azerdev/bluestack/unity/bluestack-demo-unity`
13
- - **Android native bridge source**: `/Users/moinhasan/Development/Azerdev/bluestack/unity/bluestack-sdk-unity/android-bridge`
14
- - **Public Documentation**: `/Users/moinhasan/Development/Azerdev/bluestack/bluestack-app`
15
-
16
- ---
17
-
18
- ## Build Commands
19
-
20
- ### Rebuild Android Bridge AAR
21
-
22
- After changing any Kotlin source in `android-bridge/`, rebuild and deploy the AAR:
23
-
24
- ```bash
25
- cd /Users/moinhasan/Development/Azerdev/bluestack/unity/bluestack-sdk-unity/android-bridge
26
- ./gradlew mkBlueStackSdk
27
- ```
28
-
29
- Output goes to `plugin/Plugins/Android/bluestack-unity-android-bridge-{version}.aar`. The version is set in `android-bridge/build.gradle` ext block.
30
-
31
- ### iOS Bridge
32
-
33
- No build step — Swift/Objective-C files in `Plugins/iOS/` are compiled by Xcode during Unity iOS export. After exporting from Unity, run `pod install` in the generated Xcode project.
34
-
35
- ### Run SDK Tests
36
-
37
- Use **Unity Test Runner** (`Window > General > Test Runner`):
38
- - `Tests/Runtime/` — `Azerion.BlueStack.Tests` assembly
39
- - `Tests/Editor/` — `Azerion.BlueStack.Editor.Tests` assembly
40
-
41
- Moq is available at `Plugins/Moq/` for mocking interfaces in tests.
42
-
43
- ---
44
-
45
- ## Architecture
46
-
47
- ### Layer Stack
48
-
49
- ```
50
- Developer code
51
-
52
- API layer Runtime/API/ Public classes (BannerAd, InterstitialAd, …)
53
-
54
- Interfaces Runtime/Internal/ IBannerAdClient, IInterstitialAdClient, …
55
-
56
- Platform clients Runtime/Platforms/
57
- Android/ AndroidJavaProxy-based wrappers
58
- iOS/ P/Invoke wrappers
59
- Unity/ Editor stubs (simulate ads in Play mode)
60
-
61
- Native bridge
62
- Plugins/Android/*.aar Kotlin — com.azerion.bluestack.unity.*
63
- Plugins/iOS/*.swift/.m Swift/Obj-C — BSU* classes
64
- ```
65
-
66
- ### Factory Pattern — Platform Selection
67
-
68
- `BlueStackAds.GetClientsFactory()` (in `Runtime/API/BlueStackAds.cs`) selects the platform factory at runtime:
69
-
70
- ```
71
- Application.platform == Android → Platforms.Android.ClientsFactory
72
- Application.platform == iPhone → Platforms.iOS.ClientsFactory
73
- anything else (Editor) → Platforms.Unity.ClientsFactory (loaded via Activator.CreateInstance)
74
- ```
75
-
76
- The Unity editor factory uses reflection so its assembly (`Azerion.BlueStack.Editor`) doesn't need to be referenced from the runtime assembly. All platform clients implement `IClientsFactory` and create the six client interfaces: `IBlueStackClient`, `IBannerAdClient`, `IInterstitialAdClient`, `IRewardedVideoAdClient`, `INativeAdClient`, `IPreferenceClient`.
77
-
78
- ### Main Thread Dispatcher
79
-
80
- `BlueStackMainThreadDispatcher` (`Runtime/Common/`) is a `DontDestroyOnLoad` MonoBehaviour. Native SDK callbacks arrive on native threads; they must be marshalled to Unity's main thread before firing C# events.
81
-
82
- - Call `BlueStackMainThreadDispatcher.ExecuteInUpdate(action)` from any thread
83
- - Actions are drained in `Update()` under a lock
84
- - Initialised once by `BlueStackAds.Initialize()`
85
-
86
- ### Android Platform Client Pattern
87
-
88
- - Client classes extend `AndroidJavaProxy`, passing the matching Java interface name to the base constructor (e.g. `UnityBannerAdListenerClassName`)
89
- - The Java bridge calls back into C# by invoking the proxy's methods on the Unity thread
90
- - All outbound calls to Java go through `AndroidJavaObjectFactory.Instance.RunOnUiThread(() => _unityBannerAd.Call("methodName", args))` — Android SDK requires UI thread
91
- - Java class names are centralised in `BlueStackNativeClassNames.cs`
92
-
93
- ### iOS Platform Client Pattern
94
-
95
- - All native function declarations live in `Runtime/Platforms/iOS/Externs.cs` as `[DllImport("__Internal")]`
96
- - Function naming: `BSU<AdFormat><Action>` (e.g. `BSULoadBannerAd`, `BSUShowRewardedAd`, `BSUDestroyInterstitialAd`)
97
- - Callbacks from native → C# use typed `delegate` definitions + `[AOT.MonoPInvokeCallback(typeof(DelegateType))]` on `static` methods
98
- - `GCHandle.Alloc(this)` pins the client instance; `GCHandle.ToIntPtr()` is passed to native as the "client ref" opaque pointer, recovered in callbacks via `GCHandle.FromIntPtr().Target`
99
- - Native objects are kept alive in `BSUObjectCache` (Swift) until `BSURelease(ptr)` is called
100
-
101
- ### iOS Native Bridge (Plugins/iOS/)
102
-
103
- - `BSUInterface.m` — all `extern "C"` entry points; the only file that crosses the C↔Swift boundary
104
- - `BSU<Format>.swift` — Swift classes implementing BlueStack iOS SDK delegates (e.g. `BSUBanner: NSObject, BannerViewDelegate`)
105
- - `BSU<Format>.h` — Objective-C headers exposing Swift classes to C
106
- - `BSUTypes.h` / `BSUTypes.swift` — opaque pointer `typedef`s (`BSUTypeBannerClientRef`, etc.) shared across all files
107
- - `BSUObjectCache.swift` — thread-safe singleton (serial dispatch queue); keys objects by memory address string; objects are released by `BSURelease()`
108
- - `MaskView.swift` — `MTKView` subclass for banner clipping/masking
109
- - `UnityFramework.modulemap` — module map so Unity's Xcode build can import the bridge headers
110
-
111
- Banner positioning strategy in `BSUBanner.swift`:
112
- - Preset positions (top/bottom): `NSLayoutConstraint` Auto Layout anchored to safe area
113
- - Custom positions: frame-based with `CATransaction.disableActions` to avoid implicit animations
114
-
115
- ---
116
-
117
- ## Key Files
118
-
119
- | File | Purpose |
120
- |---|---|
121
- | `Runtime/API/BlueStackAds.cs` | SDK entry point; factory selection |
122
- | `Runtime/Internal/IClientsFactory.cs` | Interface every platform factory must implement |
123
- | `Runtime/Platforms/Android/BlueStackNativeClassNames.cs` | All Java class name constants |
124
- | `Runtime/Platforms/Android/AndroidJavaObjectFactory.cs` | UI thread runner + Java object creation |
125
- | `Runtime/Platforms/iOS/Externs.cs` | Every `[DllImport]` declaration |
126
- | `Runtime/Common/BlueStackMainThreadDispatcher.cs` | Thread-safe callback queue |
127
- | `Plugins/iOS/BSUInterface.m` | C entry points for all P/Invoke calls |
128
- | `Plugins/iOS/BSUTypes.h` | Shared opaque pointer typedefs |
129
- | `Plugins/iOS/BSUObjectCache.swift` | Native object lifetime management |
130
- | `Editor/BlueStackSettingsEditor.cs` | `Azerion > BlueStack > Settings` menu |
131
- | `package.json` | UPM manifest (version bump here) |
132
- | `CHANGELOG.md` | Version history |
133
-
134
- ---
135
-
136
- ## Adding a New Ad Format
137
-
138
- Follow the existing pattern — each format has the same set of files:
139
-
140
- 1. `Runtime/API/<Format>.cs` — public API class, holds `IFormatClient` reference
141
- 2. `Runtime/Internal/IFormatClient.cs` — interface with Load/Show/Destroy + events
142
- 3. `Runtime/Platforms/Android/<Format>Client.cs` — extends `AndroidJavaProxy`, calls `_unityAd.Call(...)` on UI thread
143
- 4. `Runtime/Platforms/iOS/<Format>Client.cs` — `IntPtr` holder + delegate types + `[MonoPInvokeCallback]` statics
144
- 5. `Runtime/Platforms/Unity/<Format>Client.cs` — Editor stub
145
- 6. Add `Create<Format>Client()` to all three `ClientsFactory.cs` files and to `IClientsFactory`
146
- 7. `Plugins/iOS/BSU<Format>.swift` + `BSU<Format>.h` — Swift delegate implementation
147
- 8. Add `extern "C"` functions to `BSUInterface.m` and declare in `Externs.cs`
148
- 9. Android: add `Unity<Format>Ad.kt` + listener interface to `android-bridge`, rebuild AAR
149
-
150
- ---
151
-
152
- ## Editor Tooling
153
-
154
- - **Settings window**: `Azerion > BlueStack > Settings` — configures AdMob App IDs and mediation networks; writes `Assets/Resources/BlueStackSettings.asset` into the consuming project
155
- - **Dependency management**: `Editor/BlueStackDependenciesSource.xml` declares native dependencies; EDM4U (`com.google.external-dependency-manager`) resolves them into Android Gradle and iOS Podfile
156
- - **Post-build hooks**: `Editor/Android/AndroidBuildPostProcess.cs` and `Editor/iOS/BlueStackBuildPostProcess.cs` run after Unity builds to patch Xcode project / Gradle config
157
- - **Asset post-processor**: `BlueStackAssetPostProcessor.cs` syncs dependency metadata when SDK version changes
@@ -1,179 +0,0 @@
1
- // using Azerion.BlueStack.API;
2
- // using UnityEngine;
3
- // using Azerion.BlueStack.API.Banner;
4
- //
5
- // namespace Azerion.BlueStack.Example
6
- // {
7
- // /// <summary>
8
- // /// Example script demonstrating anchor-based banner ad positioning.
9
- // /// Attach this to any GameObject in your scene and assign an anchor GameObject.
10
- // /// </summary>
11
- // public class AnchoredBannerExample : MonoBehaviour
12
- // {
13
- // [Header("Banner Configuration")]
14
- // [SerializeField] private string placementId = "your-placement-id";
15
- // [SerializeField] private AdSize adSize = AdSize.Banner;
16
- //
17
- // [Header("Anchor Settings")]
18
- // [Tooltip("GameObject to anchor the banner to (automatically creates if null)")]
19
- // [SerializeField] private GameObject anchor;
20
- //
21
- // [Tooltip("Camera for position tracking (null = Camera.main)")]
22
- // [SerializeField] private Camera trackingCamera;
23
- //
24
- // [Header("Auto-Create Anchor")]
25
- // [SerializeField] private bool autoCreateAnchor = true;
26
- // [SerializeField] private Vector3 anchorWorldPosition = new Vector3(0, 0, 5);
27
- //
28
- // private BannerAd bannerAd;
29
- //
30
- // void Start()
31
- // {
32
- // // Create anchor if needed
33
- // if (anchor == null && autoCreateAnchor)
34
- // {
35
- // CreateAnchor();
36
- // }
37
- //
38
- // if (anchor == null)
39
- // {
40
- // Debug.LogError("AnchoredBannerExample: No anchor GameObject assigned or created!");
41
- // return;
42
- // }
43
- //
44
- // // Create banner with anchor
45
- // CreateBannerWithAnchor();
46
- // }
47
- //
48
- // private void CreateAnchor()
49
- // {
50
- // anchor = new GameObject("BannerAnchor");
51
- // anchor.transform.position = anchorWorldPosition;
52
- //
53
- // // Optional: Add a visual indicator in editor
54
- // #if UNITY_EDITOR
55
- // var meshFilter = anchor.AddComponent<MeshFilter>();
56
- // var meshRenderer = anchor.AddComponent<MeshRenderer>();
57
- //
58
- // // Create a simple sphere mesh
59
- // meshFilter.sharedMesh = Resources.GetBuiltinResource<Mesh>("Sphere.fbx");
60
- //
61
- // // Make it small and semi-transparent
62
- // anchor.transform.localScale = Vector3.one * 0.2f;
63
- //
64
- // var material = new Material(Shader.Find("Standard"));
65
- // material.color = new Color(0, 1, 0, 0.5f);
66
- // meshRenderer.sharedMaterial = material;
67
- // #endif
68
- //
69
- // Debug.Log($"Created banner anchor at {anchorWorldPosition}");
70
- // }
71
- //
72
- // private void CreateBannerWithAnchor()
73
- // {
74
- // try
75
- // {
76
- // // Create banner ad with anchor GameObject
77
- // bannerAd = new BannerAd(placementId, anchor, trackingCamera);
78
- //
79
- // // Subscribe to events
80
- // bannerAd.OnAdLoaded += OnBannerLoaded;
81
- // bannerAd.OnAdFailedToLoad += OnBannerFailed;
82
- // bannerAd.OnAdDisplayed += OnAdDisplayed;
83
- // bannerAd.OnAdHidden += OnAdHidden;
84
- //
85
- // // Load the banner
86
- // bannerAd.Load(adSize);
87
- //
88
- // Debug.Log($"Banner created and loading with anchor: {anchor.name}");
89
- // }
90
- // catch (System.Exception e)
91
- // {
92
- // Debug.LogError($"Failed to create banner: {e.Message}");
93
- // }
94
- // }
95
- //
96
- // private void OnBannerLoaded(object sender, System.EventArgs args)
97
- // {
98
- // Debug.Log("Banner loaded successfully");
99
- // bannerAd.Show();
100
- // }
101
- //
102
- // private void OnBannerFailed(object sender, BlueStackError error)
103
- // {
104
- // Debug.LogError($"Banner failed to load: {error.Message}");
105
- // }
106
- //
107
- // private void OnAdDisplayed(object sender, System.EventArgs args)
108
- // {
109
- // Debug.Log("Banner displayed");
110
- // }
111
- //
112
- // private void OnAdHidden(object sender, System.EventArgs args)
113
- // {
114
- // Debug.Log("Banner hidden");
115
- // }
116
- //
117
- // /// <summary>
118
- // /// Example: Move the anchor to a new position
119
- // /// </summary>
120
- // public void MoveAnchorTo(Vector3 newPosition)
121
- // {
122
- // if (anchor != null)
123
- // {
124
- // anchor.transform.position = newPosition;
125
- // // AdPlacementHandler will automatically update the banner position
126
- // Debug.Log($"Moved anchor to {newPosition}");
127
- // }
128
- // }
129
- //
130
- // /// <summary>
131
- // /// Example: Access the placement handler for advanced control
132
- // /// </summary>
133
- // public void ForceUpdateBannerPosition()
134
- // {
135
- // if (bannerAd?.PlacementHandler != null)
136
- // {
137
- // bannerAd.PlacementHandler.ForceUpdate();
138
- // Debug.Log("Forced banner position update");
139
- // }
140
- // }
141
- //
142
- // /// <summary>
143
- // /// Example: Check if banner is visible
144
- // /// </summary>
145
- // public bool IsBannerVisible()
146
- // {
147
- // return bannerAd?.PlacementHandler?.IsVisible ?? false;
148
- // }
149
- //
150
- // private void OnDestroy()
151
- // {
152
- // // Clean up the banner ad
153
- // if (bannerAd != null)
154
- // {
155
- // bannerAd.Destroy();
156
- // bannerAd = null;
157
- // }
158
- //
159
- // // Clean up auto-created anchor
160
- // if (autoCreateAnchor && anchor != null)
161
- // {
162
- // Destroy(anchor);
163
- // }
164
- // }
165
- //
166
- // #if UNITY_EDITOR
167
- // private void OnDrawGizmos()
168
- // {
169
- // // Draw a line from this object to the anchor in editor
170
- // if (anchor != null)
171
- // {
172
- // Gizmos.color = Color.cyan;
173
- // Gizmos.DrawLine(transform.position, anchor.transform.position);
174
- // Gizmos.DrawWireSphere(anchor.transform.position, 0.3f);
175
- // }
176
- // }
177
- // #endif
178
- // }
179
- // }
@@ -1,2 +0,0 @@
1
- fileFormatVersion: 2
2
- guid: 6f6bb4665bcd74fbca72ce0f533b7aee
@@ -1,75 +0,0 @@
1
- using Azerion.BlueStack.API;
2
- // using Azerion.BlueStack.Utilities;
3
- using UnityEngine;
4
-
5
- namespace Azerion.BlueStack.Example
6
- {
7
- [RequireComponent(typeof(RectTransform))]
8
- public class BannerAnchor : MonoBehaviour
9
- {
10
- [Header("Anchor Configuration")]
11
- [SerializeField] private AdSize adSize = AdSize.Banner;
12
-
13
- [Header("Auto Resize")]
14
- [SerializeField] private bool resizeOnStart = true;
15
-
16
- private RectTransform rectTransform;
17
-
18
- public AdSize AdSize
19
- {
20
- get => adSize;
21
- set
22
- {
23
- adSize = value;
24
- if (Application.isPlaying)
25
- {
26
- ApplyAdSize();
27
- }
28
- }
29
- }
30
-
31
- private void Awake()
32
- {
33
- rectTransform = GetComponent<RectTransform>();
34
- }
35
-
36
- private void Start()
37
- {
38
- if (resizeOnStart && adSize != null)
39
- {
40
- ApplyAdSize();
41
- }
42
- }
43
-
44
- /// <summary>
45
- /// Sets the AdSize and immediately applies it to the RectTransform.
46
- /// This method can be used when adding the component via AddComponent.
47
- /// </summary>
48
- /// <param name="newAdSize">The AdSize to apply</param>
49
- public void SetAdSize(AdSize newAdSize)
50
- {
51
- adSize = newAdSize;
52
- ApplyAdSize();
53
- }
54
-
55
- /// <summary>
56
- /// Applies the current AdSize to the RectTransform.
57
- /// Converts dp dimensions to Unity pixels.
58
- /// </summary>
59
- public void ApplyAdSize()
60
- {
61
- if (adSize == null)
62
- {
63
- Debug.LogWarning("BannerAnchor: AdSize is null, cannot resize RectTransform");
64
- return;
65
- }
66
-
67
- if (rectTransform == null)
68
- {
69
- rectTransform = GetComponent<RectTransform>();
70
- }
71
-
72
- // CoordinateConverter.ResizeRectTransformFromDpWxH(adSize, rectTransform);
73
- }
74
- }
75
- }
@@ -1,2 +0,0 @@
1
- fileFormatVersion: 2
2
- guid: bc8fcf3b2416348d198f12342f98237c