Skip to content

Commit

Permalink
Merge branch 'release/v2.0.0' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
HarrisonHough committed Oct 5, 2023
2 parents e58ef36 + 2d4300c commit 253c84e
Show file tree
Hide file tree
Showing 27 changed files with 97 additions and 519 deletions.
57 changes: 57 additions & 0 deletions .github/workflows/pr-test-runner.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Run Tests

on:
pull_request:
types: [ opened, reopened ]
workflow_dispatch:

jobs:
runAllTests:
name: ${{ matrix.unityVersion }} ${{ matrix.testMode }} tests
runs-on: ubuntu-latest
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
testMode:
- playmode
- editmode
unityVersion:
- 2020.3.0f1
steps:
- name: Checkout Unity-SDK Repository
uses: actions/checkout@v3
with:
repository: "readyplayerme/Unity-SDK"
submodules: true
fetch-depth: 0
ref: develop
token: ${{ secrets.DEV_SDK_TOKEN }}

- name: Checkout submodule branch
run: |
cd Assets/Ready\ Player\ Me/WebView
git fetch -a
git checkout ${{ github.event.pull_request.head.ref }}
git pull origin ${{ github.event.pull_request.head.ref }}
- name: Cache Project
uses: actions/cache@v3
with:
path: Library
key: Library-${{ hashFiles('Assets/**', 'Packages/**', 'ProjectSettings/**') }}
restore-keys: |
Library-
- name: Run Tests
uses: game-ci/unity-test-runner@v2
env:
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
UNITY_SERIAL: ${{ secrets.UNITY_SERIAL }}
with:
unityVersion: ${{ matrix.unityVersion }}
testMode: ${{ matrix.testMode }}
projectPath: ${{ matrix.projectPath }}
checkName: ${{ matrix.unityVersion }} ${{ matrix.testMode }} tests result
githubToken: ${{ secrets.GITHUB_TOKEN }}
coverageOptions: "generateAdditionalMetrics;generateHtmlReport;generateBadgeReport;assemblyFilters:+my.assembly.*"
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).

## [2.0.0] - 2023.20.04

### Updated
- moved core iframe and url logic to Core package @harrisonhough in [#21](https://github.com/readyplayerme/rpm-unity-sdk-webview/pull/21)

## [1.2.1] - 2023.08.14

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion Editor/WebViewBuildPostprocessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
using UnityEditor.iOS.Xcode;
#endif

namespace ReadyPlayerMe.WebView.Editor
namespace ReadyPlayerMe.WebView
{
/// <summary>
/// Receives a callback after the Android Gradle project is generated,
Expand Down
4 changes: 2 additions & 2 deletions Editor/WebViewEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
using UnityEditor;
using UnityEngine;

namespace ReadyPlayerMe.WebView.Editor
namespace ReadyPlayerMe.WebView
{
public class WebViewEditor : UnityEditor.Editor
public class WebViewEditor : Editor
{
private const string WEB_VIEW_CANVAS_FILE_NAME = "WebView Canvas";

Expand Down
23 changes: 19 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,6 @@ _NOTE: The WebView example scene will not load an avatar into the unity scene, i
**_Alternatively, you can build the APK and deploy it on your own.
For release builds, see the Unity and Android documentation._**

## Troubleshooting
- If you don't have a subdomain, this warning will pop up, and you can click Continue with 'demo' subdomain.
- If your package name does not comply with the required format, you will get this warning and can't continue until you fix it.

## Deploy on iOS
1. In Build Settings, set the Platform to iOS.
2. Select Debug and check Development build.
Expand All @@ -84,3 +80,22 @@ For release builds, see the Unity and Android documentation._**
6. Close Project Settings.
7. Click Build.
8. In the file explorer, find your Builds folder and in it the `Unity-iPhone.xcodeproj`.


## WebView 2.0 update

As of WebView 2.0 a number of changes have been made to isolate the WebView module from the rest of the Ready Player Me Unity SDK.

This means that the classes and logic required to work with an iFrame (AKA a WebView), that is running Web Avatar Creator have now been moved to the Ready Player Me Core module.
This change enables developers to utilize API's for working with any iFrame, without requiring the installation of our WebView package.

As such the following classes are now located in the Ready Player Me Core module:
- WebViewMessageHelper
- UrlConfig
- WebMessage
- MessagePanel
- WebMessageHelper
- WebViewEvents

If you have any scripts in your Unity project that reference these classes you will need to update the namespace to use ReadyPlayerMe.Core instead of ReadyPlayerMe.WebView, be sure to update the import statements in these scripts.
EG: `using ReadyPlayerMe.WebView;` should be changed to `using ReadyPlayerMe.Core;`
96 changes: 0 additions & 96 deletions Runtime/Data/Enums.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
using System;
using System.Reflection;

namespace ReadyPlayerMe.WebView
{
/// <summary>
Expand All @@ -22,97 +19,4 @@ public enum WebkitContentMode
Mobile = 1,
Desktop = 2
}

/// <summary>
/// Defines all the options for the language translation of the Ready Player Me website.
/// </summary>
public enum Language
{
[StringValue("")] Default,
[StringValue("ch")] Chinese,
[StringValue("de")] German,
[StringValue("en-IE")] EnglishIreland,
[StringValue("en")] English,
[StringValue("es-MX")] SpanishMexico,
[StringValue("es")] Spanish,
[StringValue("fr")] French,
[StringValue("it")] Italian,
[StringValue("jp")] Japanese,
[StringValue("kr")] Korean,
[StringValue("pt-BR")] PortugueseBrazil,
[StringValue("pt")] Portuguese,
[StringValue("tr")] Turkish
}

/// <summary>
/// Defines the options for the avatar body type.
/// </summary>
public enum BodyType
{
Selectable,
[StringValue("fullbody")] FullBody,
[StringValue("halfbody")] HalfBody
}

/// <summary>
/// Defines the options used for the avatars gender.
/// </summary>
public enum Gender
{
None,
[StringValue("male")] Male,
[StringValue("female")] Female
}

/// <summary>
/// Defines the options used for the WebView and Message panel UI.
/// </summary>
public enum MessageType
{
[StringValue("Loading...")]
Loading,
[StringValue("Network is not reachable.")]
NetworkError,
[StringValue("WebView is only supported on Android and iOS.\nBuild and run on a mobile device.")]
NotSupported
}

// Attribute for storing a string value in the enum field
public class StringValueAttribute : Attribute
{

public StringValueAttribute(string value)
{
Value = value;
}

public string Value { get; }
}

// Extension methods and helpers for enums
public static class EnumHelpers
{
// Helps extracting the string value stored in the StringValue attribute of the enum field
public static string GetValue<T>(this T enumerationValue) where T : struct
{
Type type = enumerationValue.GetType();
if (!type.IsEnum)
{
throw new ArgumentException("EnumerationValue must be of Enum type", nameof(enumerationValue));
}

MemberInfo[] memberInfo = type.GetMember(enumerationValue.ToString());
if (memberInfo.Length > 0)
{
var attrs = memberInfo[0].GetCustomAttributes(typeof(StringValueAttribute), false);

if (attrs.Length > 0)
{
return ((StringValueAttribute) attrs[0]).Value;
}
}

return enumerationValue.ToString();
}
}
}
2 changes: 1 addition & 1 deletion Runtime/Data/Enums.cs.meta

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

14 changes: 0 additions & 14 deletions Runtime/Data/ScreenPadding.cs

This file was deleted.

11 changes: 0 additions & 11 deletions Runtime/Data/ScreenPadding.cs.meta

This file was deleted.

68 changes: 0 additions & 68 deletions Runtime/Data/UrlConfig.cs

This file was deleted.

11 changes: 0 additions & 11 deletions Runtime/Data/UrlConfig.cs.meta

This file was deleted.

12 changes: 0 additions & 12 deletions Runtime/Data/WebMessage.cs

This file was deleted.

11 changes: 0 additions & 11 deletions Runtime/Data/WebMessage.cs.meta

This file was deleted.

Loading

0 comments on commit 253c84e

Please sign in to comment.