Skip to content

Commit e338a92

Browse files
committed
Upgrade to 2.0.0-pre.12
1 parent 8f8f8b1 commit e338a92

9 files changed

+65
-16
lines changed
Binary file not shown.

Android/com/phantomsxr/armodplugin/ARMODEventListener.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ public interface ARMODEventListener {
1313
void onRecognitionComplete();
1414
void onTryAcquireInformation(String opTag,AndroidCallback androidCallback);
1515
void onPackageSizeMoreThanPresetSize(String currentSize,String presetSize);
16+
void onMessageReceived(String data)
1617
void onARMODExit();
1718
void onARMODLaunch();
1819
}

Android/com/phantomsxr/armodplugin/BaseARMODActivity.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ public abstract class BaseARMODActivity extends UnityPlayerActivity {
2424
private final String Dispose = "Dispose";
2525
private final String DoQuit = "doQuit";
2626
private final String CleanCache = "CleanCache";
27+
private final String SendMessageToXRMODEngine="SendMessageToXRMODEngine";
2728
private final String SetUIInterfaceOrientation = "SetUIInterfaceOrientation";
2829
private ARMODCallbackAPI armodCallbackAPI;
2930

@@ -116,6 +117,13 @@ public void cleanCache(){
116117
Utils.getInstance().callSDKMethod(CleanCache,"");
117118
}
118119

120+
/**
121+
* Clear AR cache
122+
*/
123+
public void sendMessageToXRMODEngine(String data){
124+
Utils.getInstance().callSDKMethod(SendMessageToXRMODEngine,data);
125+
}
126+
119127

120128
/**
121129
* Start image recognition, the recognition is successful at the beginning of the recognition, please refer to'onRecognized' and'startRecognized'

Android/libs.zip

-434 KB
Binary file not shown.

iOS/ARMODCommunicationLayer.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,12 @@
6868
*/
6969
- (void) fetchProject:(NSString*) projecetUid;
7070

71+
/*!
72+
@Discussion Query AR projects by using the unique Id of the project
73+
@param projectName Project unique name
74+
*/
75+
- (void)fetchProjectByName:(NSString*) projectName;
76+
7177
/*!
7278
@Discussion Query AR projects through pictures
7379
*/
@@ -103,4 +109,10 @@
103109
@Discussion Continue to download the AR experience
104110
*/
105111
- (void)continueToDownloadARExperience;
112+
113+
/*!
114+
@Discussion Send data to XR-Experience
115+
@param data Will send data
116+
*/
117+
- (void)sendMessageToXRMODEngine:(NSString *)data;
106118
@end

iOS/ARMODCommunicationLayer.mm

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -132,12 +132,12 @@ - (void)unloadARMODWindow{
132132
if([self armodIsInitialized]){
133133
[self callSDKMethod:dispose addData:""];
134134

135-
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.125 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
136-
// [UnityFrameworkLoad() unloadApplication];
137-
[[self ufw] unregisterFrameworkListener:self];
138-
[self setUfw:nil];
139-
[originWindow makeKeyAndVisible];
140-
});
135+
// dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.125 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
136+
//// [UnityFrameworkLoad() unloadApplication];
137+
// [[self ufw] unregisterFrameworkListener:self];
138+
// [self setUfw:nil];
139+
// [originWindow makeKeyAndVisible];
140+
// });
141141
}
142142
}
143143

@@ -198,6 +198,17 @@ - (void)fetchProject:(NSString*) projecetUid{
198198
});
199199
}
200200

201+
/*!
202+
@Discussion Query the XR Experience from local
203+
*/
204+
- (void)fetchProjectByName:(NSString*) projectName{
205+
//Since the initialization decision is performed asynchronously, the query item needs to be delayed
206+
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.125 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
207+
const char *converted_projectName = [projectName UTF8String];
208+
[self callSDKMethod:"LaunchAROffline" addData:converted_projectName];
209+
});
210+
}
211+
201212
/*!
202213
@Discussion Query the AR Experience project by image
203214
*/
@@ -263,6 +274,16 @@ - (void)continueToDownloadARExperience{
263274
[self callSDKMethod:continueToDownloadARExperience addData:""];
264275
}
265276
}
277+
278+
/*!
279+
@Discussion Send a message to XRMOD Engine.
280+
*/
281+
- (void)sendMessageToXRMODEngine:(NSString *)data{
282+
if([self armodIsInitialized]){
283+
const char *stringToUnity = [data UTF8String];
284+
[self callSDKMethod:onMessageReceived addData:stringToUnity];
285+
}
286+
}
266287
// MARK: - Application Hook
267288

268289
-(void)applicationWillResignActive:(UIApplication *)application{

iOS/ForFlutter/ARMODCallbackAPI.swift

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
//
88

99
import Foundation
10-
//import flutter_armod_widget
10+
import flutter_armod_widget
1111

1212
@objc public class ARMODCallbackAPI: UIResponder,NativeCallsProtocol {
1313
public func tryAcquireInformation(_ opTag: String!, callBackFuncP callback: TryAcquireInformationCallBackFuncP!) {
@@ -99,25 +99,31 @@ import Foundation
9999
globalChannel?.invokeMethod("events#onPackageSizeMoreThanPresetSize", arguments: playload)
100100
}
101101

102-
private func test(opTag:String){
103-
let playload: Dictionary<String, Any> = [
104-
"opTag": opTag
102+
public func onMessageReceived(_ data: String!) {
103+
let playload: Dictionary<String, String> = [
104+
"data": data
105105
]
106-
107-
globalChannel?.invokeMethod("events#onTryAcquireInformation", arguments: playload, result: {result in
108-
self.resultStr = result as? String ?? ""
109-
self.gotResult = true
110-
})
106+
globalChannel?.invokeMethod("events#onMessageReceived", arguments: playload)
111107
}
112108

109+
// private func test(opTag:String){
110+
// let playload: Dictionary<String, Any> = [
111+
// "opTag": opTag
112+
// ]
113+
//
114+
// globalChannel?.invokeMethod("events#onTryAcquireInformation", arguments: playload, result: {result in
115+
// self.resultStr = result as? String ?? ""
116+
// self.gotResult = true
117+
// })
118+
// }
119+
113120

114121
func tryAcquireInfomationAsync(
115122
_ completion: @escaping (String?, Error?) -> Void
116123
)
117124
{
118125
DispatchQueue.global().async {
119126
do {
120-
self.test(opTag: "123")
121127
while !self.gotResult{
122128
print(self.gotResult)
123129
}

iOS/Framework.zip

-279 KB
Binary file not shown.

iOS/version.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Version:2.0-pre.12

0 commit comments

Comments
 (0)