Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
DmitriiFeshchenko committed Jan 29, 2024
0 parents commit c6a5b65
Show file tree
Hide file tree
Showing 132 changed files with 17,502 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Auto detect text files and perform LF normalization
* text=auto
50 changes: 50 additions & 0 deletions .github/ISSUE_TEMPLATE/bug-report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: bug
assignees: DmitriiFeshchenko

---

## Step 0: Is this a new bug?

Make sure to check our
[troubleshooting](https://docs.appodeal.com/faq-and-troubleshooting/troubleshooting/unity-common-issues/65k-reference-limit)
and [issues](https://github.com/appodeal/cmp-unity-plugin/issues) pages before submitting your bug report.

*Please delete this section when posting a bug report.*

## Step 1: Environment

**[REQUIRED]**
- Computer OS: [e.g. Windows, macOS]
- Unity Editor Version: [e.g. 2021.3.1f1]
- Appodeal Unity Plugin Version: [e.g. 3.0.1]
- Bug Repro Rate: [e.g. 100%, 25%]

**[OPTIONAL]** *(if applicable)*
- Xcode Version: [e.g. 13.3.1]
- CocoaPods Version: [e.g. 1.11.3]
- Device Model: [e.g. Pixel 6 Pro, iPhone 13]
- Device OS Version: [e.g. Android 13, iOS 15.4.1]

## Step 2: Describe the bug
A clear and concise description of what the bug is, including device logs, Unity Editor logs, and
stack traces if available.

## Step 3: How to reproduce
Describe here step by step how to reproduce this bug.
[e.g. 1. Request Consent status. 2. Call `ConsentForm.Show();` method. 3. See error.]

## Step 4: Expected behavior
A clear and concise description of what you expected to happen.

## Step 5: Screenshots
If applicable, add screenshots to help explain your problem.

## Step 6: Additional context
Add any other context about the problem here.

*If you have a downloadable sample project that reproduces the bug you're reporting, you will likely receive
a faster response on your issue.*
5 changes: 5 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
blank_issues_enabled: false
contact_links:
- name: Appodeal CMP Unity Plugin Documentation
url: https://docs.appodeal.com/unity/data-protection/gdpr-and-ccpa
about: The place to get started with Appodeal CMP Unity Plugin.
45 changes: 45 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
[Ll]ibrary/
[Tt]emp/
[Oo]bj/
[Bb]uild/
[Bb]uilds/
Assets/AssetStoreTools*

# Visual Studio cache directory
.vs/

# Autogenerated VS/MD/Consulo solution and project files
ExportedObj/
.consulo/
*.csproj
*.unityproj
*.sln
*.suo
*.tmp
*.user
*.userprefs
*.pidb
*.booproj
*.svd
*.pdb
*.opendb
*.VC.db

# Unity3D generated meta files
*.pidb.meta
*.pdb.meta
*.mdb.meta

# Unity3D Generated File On Crash Reports
sysinfo.txt

# Builds
*.apk
*.aab
*.app

# Crashlytics generated file
crashlytics-build.properties

#System files
*.DS_Store
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Appodeal CMP Unity Plugin

## Changelog

### v2.0.0 (January 31, 2024)

+ Prepared package for UPM distribution
+ Implemented necessary plugin tools
+ Implemented plugin API
+ Implemented Android bridge
+ Implemented iOS bridge
+ Created usage sample
7 changes: 7 additions & 0 deletions CHANGELOG.md.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions Documentation~/Index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Appodeal CMP Unity Plugin Documentation

There is no offline doc at the moment. The actual documentation can always be obtained on the
[Appodeal website](https://docs.appodeal.com/unity/data-protection/gdpr-and-ccpa).
8 changes: 8 additions & 0 deletions Editor.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions Editor/AppodealStack.Cmp.Editor.asmdef
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"name": "AppodealStack.Cmp.Editor",
"rootNamespace": "AppodealStack.Cmp.Editor",
"references": [],
"includePlatforms": [
"Editor"
],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": false,
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}
7 changes: 7 additions & 0 deletions Editor/AppodealStack.Cmp.Editor.asmdef.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions Editor/PluginRemover.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions Editor/PluginRemover/ItemToRemove.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// ReSharper Disable CheckNamespace
namespace AppodealStack.Cmp.Editor.PluginRemover
{
[System.Serializable]
internal class ItemToRemove
{
public string name;
public string path;
public string filter;
public string description;
public bool checkIfEmpty;
public bool isConfirmationRequired;
public bool performOnlyIfTotalRemove;
}
}
11 changes: 11 additions & 0 deletions Editor/PluginRemover/ItemToRemove.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

165 changes: 165 additions & 0 deletions Editor/PluginRemover/RemoveHelper.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
// ReSharper Disable CheckNamespace

using System.IO;
using System.Xml;
using System.Linq;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using UnityEngine;
using UnityEditor;
using UnityEditor.PackageManager;
using AppodealStack.Cmp.Editor.Utilities;

namespace AppodealStack.Cmp.Editor.PluginRemover
{
internal static class RemoveHelper
{
private static bool IsFolderEmpty(string path)
{
if (!Directory.Exists(path)) return false;
var filesPaths = Directory.GetFiles(path, "*", SearchOption.TopDirectoryOnly);
var s = new List<string>(filesPaths);
for (var i = 0; i < s.Count; i++)
{
if (s[i].Contains(".DS_Store"))
{
s.RemoveAt(i);
}
}

return s.Count == 0;
}

private static IEnumerable<ItemToRemove> ReadXML()
{
var itemToRemoveList = new List<ItemToRemove>();
var xDoc = new XmlDocument();
xDoc.Load(EditorConstants.PackageRemoveListFilePath);
var xRoot = xDoc.DocumentElement;

if (xRoot == null) return itemToRemoveList.ToArray();
foreach (XmlNode xNode in xRoot)
{
var itemToRemove = new ItemToRemove();
foreach (XmlNode childNode in xNode.ChildNodes)
{
if (childNode.Name.Equals("name"))
{
itemToRemove.name = childNode.InnerText;
}

if (childNode.Name.Equals("is_confirmation_required"))
{
if (childNode.InnerText.Equals("true"))
{
itemToRemove.isConfirmationRequired = true;
}
else if (childNode.InnerText.Equals("true"))
{
itemToRemove.isConfirmationRequired = false;
}
}

if (childNode.Name.Equals("path"))
{
itemToRemove.path = childNode.InnerText;
}

if (childNode.Name.Equals("description"))
{
itemToRemove.description = childNode.InnerText;
}

if (childNode.Name.Equals("check_if_empty"))
{
if (childNode.InnerText.Equals("true"))
{
itemToRemove.checkIfEmpty = true;
}
else if (childNode.InnerText.Equals("false"))
{
itemToRemove.checkIfEmpty = false;
}
}

if (childNode.Name.Equals("perform_only_if_total_remove"))
{
if (childNode.InnerText.Equals("true"))
{
itemToRemove.performOnlyIfTotalRemove = true;
}
else if (childNode.InnerText.Equals("false"))
{
itemToRemove.performOnlyIfTotalRemove = false;
}
}

if (childNode.Name.Equals("filter"))
{
itemToRemove.filter = childNode.InnerText;
}
}

itemToRemoveList.Add(itemToRemove);
}

return itemToRemoveList.ToArray();
}

public static void RemovePlugin(bool isCleanBeforeUpdate = false)
{
if (!EditorUtility.DisplayDialog("Remove Appodeal CMP Plugin",
"Are you sure you want to remove the Appodeal CMP plugin from your project?",
"Yes",
"Cancel")) return;

var items = ReadXML();
foreach (var t in items)
{
if (t.performOnlyIfTotalRemove && isCleanBeforeUpdate) continue;
var confirmed = !t.isConfirmationRequired || isCleanBeforeUpdate;
var fullItemPath = Path.Combine(Application.dataPath, t.path);

if (!confirmed)
{
if (EditorUtility.DisplayDialog("Removing " + t.name, t.description, "Yes", "No"))
{
confirmed = true;
}
}

if (!confirmed) continue;
var isChecked = !t.checkIfEmpty;
if (!isChecked) isChecked = IsFolderEmpty(fullItemPath);
if (!isChecked) continue;

if (string.IsNullOrEmpty(t.filter))
{
FileUtil.DeleteFileOrDirectory(fullItemPath);
FileUtil.DeleteFileOrDirectory(fullItemPath + ".meta");
continue;
}

var isDirectoryExists = Directory.Exists(fullItemPath);
if (!isDirectoryExists) continue;
var filesList =
new List<string>(Directory.GetFiles(fullItemPath, "*", SearchOption.TopDirectoryOnly));
filesList.AddRange(Directory.GetDirectories(fullItemPath, "*", SearchOption.TopDirectoryOnly));
foreach (var t1 in from t1 in filesList
let fileName = Path.GetFileName(t1)
where Regex.IsMatch(fileName, t.filter, RegexOptions.IgnoreCase)
select t1)
{
FileUtil.DeleteFileOrDirectory(t1);
FileUtil.DeleteFileOrDirectory(t1 + ".meta");
}

if (!IsFolderEmpty(fullItemPath)) continue;
FileUtil.DeleteFileOrDirectory(fullItemPath);
FileUtil.DeleteFileOrDirectory(fullItemPath + ".meta");
}

Client.Remove(EditorConstants.PackageName);
}
}
}
11 changes: 11 additions & 0 deletions Editor/PluginRemover/RemoveHelper.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit c6a5b65

Please sign in to comment.