-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #52 from m0skit0/refactoringFAM
Refactoring for issue #40
- Loading branch information
Showing
6 changed files
with
46 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
hms-sdk-unity/HuaweiMobileServices/Utils/GenericBridgeWrapper.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
using System; | ||
|
||
namespace HuaweiMobileServices.Utils | ||
{ | ||
using HuaweiMobileServices.Base; | ||
using UnityEngine; | ||
|
||
internal static class GenericBridgeWrapper | ||
{ | ||
private static readonly AndroidJavaClass sJavaClass = new AndroidJavaClass("org.m0skit0.android.hms.unity.GenericBridge"); | ||
|
||
public static void CallGenericBridge(this JavaObjectWrapper javaObjectWrapper, String methodName, Action onSuccess, Action<HMSException> onFailure) | ||
{ | ||
|
||
javaObjectWrapper.CallAsWrapper<TaskAndroidJavaObject>(methodName) | ||
.AddOnSuccessListener((intent) => | ||
{ | ||
var callback = new GenericBridgeCallbackWrapper() | ||
.AddOnFailureListener(onFailure) | ||
.AddOnSuccessListener((nothing) => | ||
{ | ||
onSuccess.Invoke(); | ||
}); | ||
sJavaClass.CallStatic("receiveShow", intent, callback); | ||
|
||
}).AddOnFailureListener((exception) => onFailure.Invoke(exception)); | ||
} | ||
} | ||
} |