Skip to content

Commit

Permalink
Merge branch 'main' into test/dev
Browse files Browse the repository at this point in the history
  • Loading branch information
nattb8 committed Sep 27, 2024
2 parents 1e3574c + b64f817 commit 24e27d0
Show file tree
Hide file tree
Showing 27 changed files with 188 additions and 155 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ jobs:
projectPath: './sample'
githubToken: ${{ secrets.GITHUB_TOKEN }}
testMode: 'EditMode'
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v4
if: always()
with:
name: Test results
path: ${{ steps.passportTest.outputs.artifactsPath }}

- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v4
if: always()
with:
name: Coverage results
Expand Down
57 changes: 47 additions & 10 deletions .github/workflows/update-version.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,21 @@
---
name: "Update version in package.json"
name: "Update SDK version"

on:
workflow_dispatch:
inputs:
version:
description: 'Version to update to (e.g. 1.20.0)'
upgrade_type:
type: choice
description: Upgrade Type
options:
- patch
- minor
# - major
required: true
default: patch

env:
UPGRADE_TYPE: ${{ github.event.inputs.upgrade_type || 'patch' }}

jobs:
update:
Expand Down Expand Up @@ -37,26 +46,54 @@ jobs:
- name: Install jq
run: sudo apt-get install -y jq

- name: Replace version string
- name: Update Version in package.json
id: replace_version
run: |
FILE=./src/Packages/Passport/package.json
VERSION=${{ github.event.inputs.version }}
jq --arg version "$VERSION" '.version = $version' $FILE > tmp.$$.json && mv tmp.$$.json $FILE
CURRENT_VERSION=$(jq -r '.version' $FILE)
IFS='.' read -r MAJOR MINOR PATCH <<< "$CURRENT_VERSION"
# Increment version based on UPGRADE_TYPE
case "$UPGRADE_TYPE" in
major)
MAJOR=$((MAJOR + 1))
MINOR=0
PATCH=0
;;
minor)
MINOR=$((MINOR + 1))
PATCH=0
;;
patch)
PATCH=$((PATCH + 1))
;;
*)
echo "Invalid upgrade type: $UPGRADE_TYPE"
exit 1
;;
esac
NEW_VERSION="$MAJOR.$MINOR.$PATCH"
jq --arg version "$NEW_VERSION" '.version = $version' $FILE > tmp.$$.json && mv tmp.$$.json $FILE
echo "Updated version in package.json from $CURRENT_VERSION to $NEW_VERSION"
echo "version=$NEW_VERSION" >> "$GITHUB_OUTPUT"
- name: Replace engine sdk version string
- name: Update SDK Version in SdkVersionInfoHelpers.cs
id: replace_engine_sdk_version
run: |
FILE=./src/Packages/Passport/Runtime/Scripts/Private/Helpers/SdkVersionInfoHelpers.cs
VERSION=${{ github.event.inputs.version }}
sed -i -E "s/[0-9]+\.[0-9]+\.[0-9]+/$VERSION/g" $FILE
NEW_VERSION="${{ steps.replace_version.outputs.version }}"
sed -i -E "s/[0-9]+\.[0-9]+\.[0-9]+/$NEW_VERSION/g" $FILE
echo "Updated SDK version in SdkVersionInfoHelpers.cs to $NEW_VERSION"
- uses: gr2m/create-or-update-pull-request-action@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
title: "chore: update version"
body: "Update version in package.json"
branch: "chore/update-version-${{ github.event.inputs.version }}"
branch: "chore/update-version-${{ steps.replace_version.outputs.version }}"
commit-message: "chore: update version"
labels: release
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
81B8C535151078DB000C56DC /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 81B8C534151078DB000C56DC /* WebKit.framework */; };
81B8C53815108B89000C56DC /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 81B8C53715108B89000C56DC /* Carbon.framework */; };
81E2C20C14C5684A004CE5C2 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 81E2C20B14C5684A004CE5C2 /* Cocoa.framework */; };
81F4B4D914C6888B001B4465 /* WebView.mm in Sources */ = {isa = PBXBuildFile; fileRef = 81F4B4D814C6888B001B4465 /* WebView.mm */; };
81F4B4D914C6888B001B4465 /* ImmutableWebView.mm in Sources */ = {isa = PBXBuildFile; fileRef = 81F4B4D814C6888B001B4465 /* ImmutableWebView.mm */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
Expand All @@ -23,11 +23,11 @@
8102525614C569D80022296D /* Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Prefix.pch; path = Resources/Prefix.pch; sourceTree = SOURCE_ROOT; };
81B8C534151078DB000C56DC /* WebKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WebKit.framework; path = System/Library/Frameworks/WebKit.framework; sourceTree = SDKROOT; };
81B8C53715108B89000C56DC /* Carbon.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Carbon.framework; path = System/Library/Frameworks/Carbon.framework; sourceTree = SDKROOT; };
81E2C20814C5684A004CE5C2 /* WebView.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = WebView.bundle; sourceTree = BUILT_PRODUCTS_DIR; };
81E2C20814C5684A004CE5C2 /* ImmutableWebView.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ImmutableWebView.bundle; sourceTree = BUILT_PRODUCTS_DIR; };
81E2C20B14C5684A004CE5C2 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; };
81E2C20E14C5684A004CE5C2 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; };
81E2C21014C5684A004CE5C2 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
81F4B4D814C6888B001B4465 /* WebView.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WebView.mm; path = Sources/WebView.mm; sourceTree = "<group>"; };
81F4B4D814C6888B001B4465 /* ImmutableWebView.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = ImmutableWebView.mm; path = Sources/ImmutableWebView.mm; sourceTree = "<group>"; };
81F81AEC14D76D2400845D4C /* OpenGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGL.framework; path = System/Library/Frameworks/OpenGL.framework; sourceTree = SDKROOT; };
/* End PBXFileReference section */

Expand All @@ -49,7 +49,7 @@
8102525914C573EB0022296D /* Sources */ = {
isa = PBXGroup;
children = (
81F4B4D814C6888B001B4465 /* WebView.mm */,
81F4B4D814C6888B001B4465 /* ImmutableWebView.mm */,
);
name = Sources;
sourceTree = "<group>";
Expand All @@ -67,7 +67,7 @@
81E2C20914C5684A004CE5C2 /* Products */ = {
isa = PBXGroup;
children = (
81E2C20814C5684A004CE5C2 /* WebView.bundle */,
81E2C20814C5684A004CE5C2 /* ImmutableWebView.bundle */,
);
name = Products;
sourceTree = "<group>";
Expand Down Expand Up @@ -101,9 +101,9 @@
/* End PBXGroup section */

/* Begin PBXNativeTarget section */
81E2C20714C5684A004CE5C2 /* WebView */ = {
81E2C20714C5684A004CE5C2 /* ImmutableWebView */ = {
isa = PBXNativeTarget;
buildConfigurationList = 81E2C21A14C5684A004CE5C2 /* Build configuration list for PBXNativeTarget "WebView" */;
buildConfigurationList = 81E2C21A14C5684A004CE5C2 /* Build configuration list for PBXNativeTarget "ImmutableWebView" */;
buildPhases = (
81E2C20414C5684A004CE5C2 /* Sources */,
81E2C20514C5684A004CE5C2 /* Frameworks */,
Expand All @@ -113,9 +113,9 @@
);
dependencies = (
);
name = WebView;
name = ImmutableWebView;
productName = WebView;
productReference = 81E2C20814C5684A004CE5C2 /* WebView.bundle */;
productReference = 81E2C20814C5684A004CE5C2 /* ImmutableWebView.bundle */;
productType = "com.apple.product-type.bundle";
};
/* End PBXNativeTarget section */
Expand All @@ -127,7 +127,7 @@
BuildIndependentTargetsInParallel = YES;
LastUpgradeCheck = 1200;
};
buildConfigurationList = 81E2C20214C5684A004CE5C2 /* Build configuration list for PBXProject "WebView" */;
buildConfigurationList = 81E2C20214C5684A004CE5C2 /* Build configuration list for PBXProject "ImmutableWebView" */;
compatibilityVersion = "Xcode 8.0";
developmentRegion = en;
hasScannedForEncodings = 0;
Expand All @@ -140,7 +140,7 @@
projectDirPath = "";
projectRoot = "";
targets = (
81E2C20714C5684A004CE5C2 /* WebView */,
81E2C20714C5684A004CE5C2 /* ImmutableWebView */,
);
};
/* End PBXProject section */
Expand All @@ -161,7 +161,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
81F4B4D914C6888B001B4465 /* WebView.mm in Sources */,
81F4B4D914C6888B001B4465 /* ImmutableWebView.mm in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -280,7 +280,8 @@
LD_RUNPATH_SEARCH_PATHS = "";
LIBRARY_SEARCH_PATHS = "$(inherited)";
MACOSX_DEPLOYMENT_TARGET = 12.4;
PRODUCT_BUNDLE_IDENTIFIER = "net.gree.unitywebview.${PRODUCT_NAME:rfc1034identifier}";
PRODUCT_BUNDLE_IDENTIFIER = "Immutable.Browser.--PRODUCT-NAME-rfc1034identifier-";
"PRODUCT_BUNDLE_IDENTIFIER[sdk=macosx*]" = Immutable.Browser.WebView;
PRODUCT_NAME = "$(TARGET_NAME)";
USE_HEADERMAP = YES;
WRAPPER_EXTENSION = bundle;
Expand All @@ -301,7 +302,8 @@
LD_RUNPATH_SEARCH_PATHS = "";
LIBRARY_SEARCH_PATHS = "$(inherited)";
MACOSX_DEPLOYMENT_TARGET = 12.4;
PRODUCT_BUNDLE_IDENTIFIER = "net.gree.unitywebview.${PRODUCT_NAME:rfc1034identifier}";
PRODUCT_BUNDLE_IDENTIFIER = "Immutable.Browser.--PRODUCT-NAME-rfc1034identifier-";
"PRODUCT_BUNDLE_IDENTIFIER[sdk=macosx*]" = Immutable.Browser.WebView;
PRODUCT_NAME = "$(TARGET_NAME)";
USE_HEADERMAP = YES;
WRAPPER_EXTENSION = bundle;
Expand All @@ -311,7 +313,7 @@
/* End XCBuildConfiguration section */

/* Begin XCConfigurationList section */
81E2C20214C5684A004CE5C2 /* Build configuration list for PBXProject "WebView" */ = {
81E2C20214C5684A004CE5C2 /* Build configuration list for PBXProject "ImmutableWebView" */ = {
isa = XCConfigurationList;
buildConfigurations = (
81E2C21814C5684A004CE5C2 /* Debug */,
Expand All @@ -320,7 +322,7 @@
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
81E2C21A14C5684A004CE5C2 /* Build configuration list for PBXNativeTarget "WebView" */ = {
81E2C21A14C5684A004CE5C2 /* Build configuration list for PBXNativeTarget "ImmutableWebView" */ = {
isa = XCConfigurationList;
buildConfigurations = (
81E2C21B14C5684A004CE5C2 /* Debug */,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -374,26 +374,26 @@ - (nonnull ASPresentationAnchor)presentationAnchorForWebAuthenticationSession:(n
@end

extern "C" {
void *_CWebViewPlugin_Init(const char *ua);
void _CWebViewPlugin_Destroy(void *instance);
void _CWebViewPlugin_LoadURL(void *instance, const char *url);
void _CWebViewPlugin_EvaluateJS(void *instance, const char *url);
void _CWebViewPlugin_SetDelegate(DelegateCallbackFunction callback);
void _CWebViewPlugin_LaunchAuthURL(void *instance, const char *url, const char *redirectUri);
void *_CImmutableWebViewPlugin_Init(const char *ua);
void _CImmutableWebViewPlugin_Destroy(void *instance);
void _CImmutableWebViewPlugin_LoadURL(void *instance, const char *url);
void _CImmutableWebViewPlugin_EvaluateJS(void *instance, const char *url);
void _CImmutableWebViewPlugin_SetDelegate(DelegateCallbackFunction callback);
void _CImmutableWebViewPlugin_LaunchAuthURL(void *instance, const char *url, const char *redirectUri);
}

void _CWebViewPlugin_SetDelegate(DelegateCallbackFunction callback) {
void _CImmutableWebViewPlugin_SetDelegate(DelegateCallbackFunction callback) {
delegateCallback = callback;
}

void *_CWebViewPlugin_Init(const char *ua)
void *_CImmutableWebViewPlugin_Init(const char *ua)
{
CWebViewPlugin *webViewPlugin = [[CWebViewPlugin alloc] initWithUa:ua];
[_instances addObject:webViewPlugin];
return (__bridge_retained void *)webViewPlugin;
}

void _CWebViewPlugin_Destroy(void *instance)
void _CImmutableWebViewPlugin_Destroy(void *instance)
{
if (instance == NULL)
return;
Expand All @@ -403,23 +403,23 @@ void _CWebViewPlugin_Destroy(void *instance)
webViewPlugin = nil;
}

void _CWebViewPlugin_LoadURL(void *instance, const char *url)
void _CImmutableWebViewPlugin_LoadURL(void *instance, const char *url)
{
if (instance == NULL)
return;
CWebViewPlugin *webViewPlugin = (__bridge CWebViewPlugin *)instance;
[webViewPlugin loadURL:url];
}

void _CWebViewPlugin_EvaluateJS(void *instance, const char *js)
void _CImmutableWebViewPlugin_EvaluateJS(void *instance, const char *js)
{
if (instance == NULL)
return;
CWebViewPlugin *webViewPlugin = (__bridge CWebViewPlugin *)instance;
[webViewPlugin evaluateJS:js];
}

void _CWebViewPlugin_LaunchAuthURL(void *instance, const char *url, const char *redirectUri)
void _CImmutableWebViewPlugin_LaunchAuthURL(void *instance, const char *url, const char *redirectUri)
{
if (instance == NULL)
return;
Expand Down
4 changes: 2 additions & 2 deletions Plugins/Mac/install.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/bin/bash
DSTDIR="../../src/Packages/Passport/Runtime/ThirdParty/Gree/Assets/Plugins/"
rm -rf DerivedData
xcodebuild -target WebView -configuration Release -arch x86_64 -arch arm64 build CONFIGURATION_BUILD_DIR='DerivedData' | xcbeautify
xcodebuild -target ImmutableWebView -configuration Release -arch x86_64 -arch arm64 build CONFIGURATION_BUILD_DIR='DerivedData' | xcbeautify
mkdir -p $DSTDIR

cp -r DerivedData/WebView.bundle $DSTDIR
cp -r DerivedData/ImmutableWebView.bundle $DSTDIR
rm -rf DerivedData
cp *.bundle.meta $DSTDIR
6 changes: 3 additions & 3 deletions sample/Assets/Scripts/SelectAuthMethodScript.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ void Start()
// If PKCE is not supported, initialise Passport to use Device Code Auth
if (!SampleAppManager.SupportsPKCE)
{
InitialisePassport();
InitialisePassport(logoutRedirectUri: "https://www.immutable.com");
}
}

Expand All @@ -44,7 +44,7 @@ private bool IsPKCESupported()
public void UseDeviceCodeAuth()
{
SampleAppManager.UsePKCE = false;
InitialisePassport();
InitialisePassport(logoutRedirectUri: "https://www.immutable.com");
}

/// <summary>
Expand All @@ -61,7 +61,7 @@ public void UsePKCE()
/// </summary>
/// <param name="redirectUri">(Android, iOS and macOS only) The URL to which auth will redirect the browser after
/// authorisation has been granted by the user</param>
/// <param name="logoutRedirectUri">(Android, iOS and macOS only) The URL to which auth will redirect the browser
/// <param name="logoutRedirectUri">The URL to which auth will redirect the browser
/// after log out is complete</param>
private async void InitialisePassport(string redirectUri = null, string logoutRedirectUri = null)
{
Expand Down
48 changes: 24 additions & 24 deletions src/Packages/Passport/Runtime/Resources/index.html

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ public class SdkVersionInfoHelpers
{
public static string GetSdkVersionInfo()
{
return "1.25.2";
return "1.26.0";
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"VoltstroStudios.UnityWebBrowser",
"UniTask",
"Immutable.Browser.Core",
"unity-webview",
"Immutable.Browser.Gree",
"Immutable.Passport.Core.Logging"
],
"includePlatforms": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ internal class InitRequest
{
public string clientId;
public string environment;
public string logoutRedirectUri;
public VersionInfo engineVersion;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public async UniTask Init(string clientId, string environment, string redirectUr
};

string initRequest;
if (redirectUri != null && logoutRedirectUri != null)
if (redirectUri != null)
{
InitRequestWithRedirectUri requestWithRedirectUri = new InitRequestWithRedirectUri()
{
Expand All @@ -89,6 +89,7 @@ public async UniTask Init(string clientId, string environment, string redirectUr
{
clientId = clientId,
environment = environment,
logoutRedirectUri = logoutRedirectUri,
engineVersion = versionInfo
};
initRequest = JsonUtility.ToJson(request);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"VoltstroStudios.UnityWebBrowser",
"UniTask",
"Immutable.Browser.Core",
"unity-webview",
"Immutable.Browser.Gree",
"Immutable.Passport.Runtime.Private",
"Immutable.Passport.Core.Logging"
],
Expand Down
Loading

0 comments on commit 24e27d0

Please sign in to comment.