123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209 |
- using System;
- using Pico.Platform.Models;
- using UnityEngine;
- using SystemInfo = Pico.Platform.Models.SystemInfo;
- namespace Pico.Platform
- {
-
- public static class ApplicationService
- {
-
-
-
-
-
-
-
- public static Task<string> LaunchApp(string packageName, ApplicationOptions options = null)
- {
- if (!CoreService.Initialized)
- {
- Debug.LogError(CoreService.NotInitializedError);
- return null;
- }
- return new Task<string>(CLIB.ppf_Application_LaunchOtherApp(packageName, (IntPtr) options));
- }
-
-
-
-
-
-
-
- public static Task<string> LaunchAppByAppId(string appId, ApplicationOptions options = null)
- {
- if (!CoreService.Initialized)
- {
- Debug.LogError(CoreService.NotInitializedError);
- return null;
- }
- return new Task<string>(CLIB.ppf_Application_LaunchOtherAppByAppID(appId, (IntPtr) options));
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
- public static Task<string> LaunchStore()
- {
- if (!CoreService.Initialized)
- {
- Debug.LogError(CoreService.NotInitializedError);
- return null;
- }
- return new Task<string>(CLIB.ppf_Application_LaunchStore());
- }
-
-
-
-
-
-
-
-
-
- public static Task<ApplicationVersion> GetVersion()
- {
- if (!CoreService.Initialized)
- {
- Debug.LogError(CoreService.NotInitializedError);
- return null;
- }
- return new Task<ApplicationVersion>(CLIB.ppf_Application_GetVersion());
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- public static LaunchDetails GetLaunchDetails()
- {
- if (!CoreService.Initialized)
- {
- Debug.LogError(CoreService.NotInitializedError);
- return null;
- }
- return new LaunchDetails(CLIB.ppf_ApplicationLifecycle_GetLaunchDetails());
- }
-
-
-
-
-
-
- public static SystemInfo GetSystemInfo()
- {
- if (!CoreService.Initialized)
- {
- Debug.LogError(CoreService.NotInitializedError);
- return null;
- }
- return new SystemInfo(CLIB.ppf_Application_GetSystemInfo());
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
- public static void LogDeeplinkResult(string trackId, LaunchResult result)
- {
- CLIB.ppf_ApplicationLifecycle_LogDeeplinkResult(trackId, result);
- }
-
-
-
-
-
- public static void SetLaunchIntentChangedCallback(Message<string>.Handler callback)
- {
- Looper.RegisterNotifyHandler(MessageType.Notification_ApplicationLifecycle_LaunchIntentChanged, callback);
- }
- }
- public class ApplicationOptions
- {
- public ApplicationOptions()
- {
- Handle = CLIB.ppf_ApplicationOptions_Create();
- }
- public void SetDeeplinkMessage(string value)
- {
- CLIB.ppf_ApplicationOptions_SetDeeplinkMessage(Handle, value);
- }
-
- public static explicit operator IntPtr(ApplicationOptions options)
- {
- return options?.Handle ?? IntPtr.Zero;
- }
- ~ApplicationOptions()
- {
- CLIB.ppf_ApplicationOptions_Destroy(Handle);
- }
- readonly IntPtr Handle;
- }
- }
|