public override void Test() { var client = AN_Games.GetAchievementsClient(); client.Load(false, (result) => { if (result.IsSucceeded) { foreach (var achievement in result.Achievements) { if (achievement.Type == AN_Achievement.AchievementType.INCREMENTAL) { if (achievement.TotalSteps > achievement.CurrentSteps) { m_achievement = achievement; } } } if (m_achievement != null) { TestIncrement(); } else { SetResult(SA_TestResult.WithError("Wasn't able to find suitable Achievement to Incremental")); } } else { SetAPIResult(result); } }); }
private void CheckIfCompleted(string achievementId) { ISN_GKAchievement.LoadAchievements((result) => { if (result.IsSucceeded) { if (result.Achievements.Count == 1) { var achievement = result.Achievements[0]; if (achievement.Completed) { SetResult(SA_TestResult.OK); } else { SetResult(SA_TestResult.WithError("Achievement has to be completed, but it's not")); } } else { SetResult(SA_TestResult.WithError("App should 1 reeported achivement, found " + result.Achievements.Count + " instead")); } } else { SetAPIResult(result); } }); }
public override void Test() { AN_NotificationManager.CancelAll(); AN_NotificationManager.Cancel(1); AN_NotificationManager.Unschedule(1); AN_NotificationManager.OnNotificationReceived.AddListener((request) => { bool requestValid = ValidateRequest(request); if (requestValid) { variant++; TestNotificationWithVariantId(variant); } else { string msg = "Received request does not match sent request received: " + JsonUtility.ToJson(request) + " sent: " + JsonUtility.ToJson(m_sendedRequest); SetResult(SA_TestResult.WithError(msg)); } }); TestNotificationWithVariantId(variant); }
public override void Test() { ISN_NSUbiquitousKeyValueStore.Synchronize(); //Probably need to add more data types to test later. //but we only save string on iOS part so this should be enouph string testString = "testString"; ISN_NSUbiquitousKeyValueStore.SetString("test_key_string", testString); ISN_NSKeyValueObject kvObject = ISN_NSUbiquitousKeyValueStore.KeyValueStoreObjectForKey("test_key_string"); if (!kvObject.StringValue.Equals(testString)) { SetResult(SA_TestResult.WithError("String value is wrong")); return; } ISN_NSUbiquitousKeyValueStore.Reset(); SetResult(SA_TestResult.OK); }
public override void Test() { var client = AN_Games.GetSnapshotsClient(); client.Load((result) => { if (result.IsSucceeded) { if (result.Snapshots.Count == 0) { SetResult(SA_TestResult.WithError("There are no spanpshot's. Can't test delete action")); return; } AN_SnapshotMetadata meta = result.Snapshots[0]; client.Delete(meta, (deleteResult) => { if (deleteResult.IsSucceeded) { AN_Logger.Log("deleteResult.SnapshotId: " + deleteResult.SnapshotId); } SetAPIResult(deleteResult); }); } else { SetAPIResult(result); } }); }
public override void Test() { SignInClient.RevokeAccess(() => { //Now we need to make sure we can't Sing in siletly SilentSignIn((result) => { if (result.IsSucceeded) { SetResult(SA_TestResult.WithError("User was able to do Silent SignIn after RevokeAccess")); } else { //InteractiveSignIn should work InteractiveSignIn((InteractiveSignInResult) => { SetAPIResult(InteractiveSignInResult); if (InteractiveSignInResult.IsSucceeded) { var gamesClient = AN_Games.GetGamesClient(); gamesClient.SetViewForPopups(AN_MainActivity.Instance); //optionally gamesClient.SetGravityForPopups(AN_Gravity.TOP | AN_Gravity.CENTER_HORIZONTAL); } }); } }); }); }
private void VerifySnapshotsSave(string name) { var client = AN_Games.GetSnapshotsClient(); client.Open(name, m_createIfNotFound, m_conflictPolicy, (result) => { if (result.IsSucceeded) { AN_Snapshot snapshot = result.Data.GetSnapshot(); byte[] data = snapshot.ReadFully(); var meta = snapshot.GetMetadata(); if (meta.ProgressValue != m_progress) { SetResult(SA_TestResult.WithError("ProgressValue verification failed")); return; } if (meta.PlayedTime != m_playedTime) { SetResult(SA_TestResult.WithError("PlayedTime verification failed")); return; } string snapshotData = string.Empty; snapshotData = snapshotData.FromBytes(data); if (!snapshotData.Equals(m_snpashotData)) { SetResult(SA_TestResult.WithError("Snapshot Data verification failed")); return; } } SetAPIResult(result); }); }
public override void Test() { var client = AN_Games.GetAchievementsClient(); client.Load(false, (result) => { if (result.IsSucceeded) { foreach (var achievement in result.Achievements) { if (achievement.Type == AN_Achievement.AchievementType.STANDARD && achievement.State == AN_Achievement.AchievementState.HIDDEN) { m_achievement = achievement; break; } } if (m_achievement != null) { TestOperation(); } else { SetResult(SA_TestResult.WithError("Wasn't able to find suitable Achievement to Reveal")); } } else { SetAPIResult(result); } }); }
public override void Test() { //Package Info string packageName = UnityEngine.Application.identifier; var pm = AN_MainActivity.Instance.GetPackageManager(); AN_PackageInfo packageInfo = pm.GetPackageInfo(packageName, 0); AN_Logger.Log("packageInfo.VersionName: " + packageInfo.VersionName); AN_Logger.Log("packageInfo.PackageName: " + packageInfo.PackageName); AN_Logger.Log("packageInfo.SharedUserId: " + packageInfo.SharedUserId); //Query Intent Activities TEST //Simple intent to get list of the apps that can support the send action AN_Intent testIntent = new AN_Intent(); testIntent.SetAction(AN_Intent.ACTION_SEND); testIntent.SetType("text/plain"); List <AN_ResolveInfo> resolveInfoList = pm.QueryIntentActivities(testIntent, 0); foreach (var resolveInfo in resolveInfoList) { AN_Logger.Log("resolveInfo.ActivityInfo.Name: " + resolveInfo.ActivityInfo.Name); AN_Logger.Log("resolveInfo.ActivityInfo.PackageName: " + resolveInfo.ActivityInfo.PackageName); } ///Open External App AN_Intent startAppIntent = pm.GetLaunchIntentForPackage("com.facebook.katana"); if (startAppIntent == null) { SetResult(SA_TestResult.WithError("App with Id: com.facebook.katana not found on device")); return; } startAppIntent.AddCategory(AN_Intent.CATEGORY_LAUNCHER); /* * AN_ProxyActivity proxy = new AN_ProxyActivity(); * bool started = proxy.StartActivityForResult(startAppIntent, (result) => { * SetResult(TestResult.OK); * proxy.Finish(); * }); * * if(!started) { * SetResult(TestResult.GetError("Failed to create activity")); * }*/ SetResult(SA_TestResult.OK); }
public override void Test() { ISN_GKLeaderboard.LoadLeaderboards((result) => { if (result.IsSucceeded && result.Leaderboards.Count > 0) { OnLeaderboardReady(result.Leaderboards[0]); } else { SetResult(SA_TestResult.WithError("Wasn't able to find leaderboards")); } }); }
public override void Test() { ISN_CNContactStore.FetchPhoneContacts((result) => { if (result.IsSucceeded) { if (result.Contacts.Count == 0) { SetResult(SA_TestResult.WithError("No Contacts inside the Sucsses result")); return; } PrintContacts(result.Contacts); } SetAPIResult(result); }); }
public override void Test() { if (!AN_InstagramSharing.IsAppInstalled) { SetResult(SA_TestResult.WithError("No App installed")); return; } SA_ScreenUtil.TakeScreenshot(256, (screenshot) => { var composer = new AN_InstagramSharing(); composer.AddImage(screenshot); // composer.AddImage(screenshot); composer.Share(() => { Debug.Log("Sharing flow is finished, User has retured to the app"); SetResult(SA_TestResult.OK); }); }); }
public override void Test() { var picker = new ISN_UIImagePickerController(); picker.SourceType = ISN_UIImagePickerControllerSourceType.Album; picker.MediaTypes = new List <string>() { ISN_UIMediaType.IMAGE }; picker.MaxImageSize = 512; picker.ImageCompressionFormat = ISN_UIImageCompressionFormat.JPEG; picker.ImageCompressionRate = 0.8f; picker.Present((result) => { if (result.IsSucceeded) { if (!result.MediaType.Equals(ISN_UIMediaType.IMAGE)) { SetResult(SA_TestResult.WithError("Wrong media type in callback")); return; } if (result.Image == null) { SetResult(SA_TestResult.WithError("No image")); return; } if (string.IsNullOrEmpty(result.ImageURL)) { SetResult(SA_TestResult.WithError("No image")); return; } TestVideo(); } else { SetAPIResult(result); } }); }
private void CheckIfResetCompleted() { ISN_GKAchievement.LoadAchievements((result) => { if (result.IsSucceeded) { if (result.Achievements.Count == 0) { SetResult(SA_TestResult.OK); } else { SetResult(SA_TestResult.WithError("Reporteed achivemnts list has to be eempty, but it's not")); } } else { SetAPIResult(result); } }); }
public override void Test() { var leaderboards = AN_Games.GetLeaderboardsClient(); leaderboards.LoadLeaderboardMetadata(false, (result) => { if (result.IsSucceeded) { if (result.Leaderboards.Count == 0) { SetResult(SA_TestResult.WithError("Request returned with Succeeded, but Leaderboards list is empty")); return; } AN_Logger.Log("Load Leaderboards Metadata Succeeded, count: " + result.Leaderboards.Count); PrintLeaderboardsInfo(result.Leaderboards); } SetAPIResult(result); }); }
public override void Test() { var client = AN_Games.GetLeaderboardsClient(); client.LoadLeaderboardMetadata(false, (result) => { if (result.IsSucceeded) { if (result.Leaderboards.Count == 0) { SetResult(SA_TestResult.WithError("Result is Succeeded, but Leaderboards list is empty")); return; } TestLeaderboard(result.Leaderboards[0], client); } else { SetAPIResult(result); } }); }
public override void Test() { ISN_GKLeaderboard.LoadLeaderboards((result) => { if (result.IsSucceeded) { if (result.Leaderboards.Count == 0) { SetResult(SA_TestResult.WithError("No leaderboards inside the Sucsses result")); return; } foreach (var leaderboards in result.Leaderboards) { ISN_Logger.Log(leaderboards.Identifier); ISN_Logger.Log(leaderboards.GroupIdentifier); ISN_Logger.Log(leaderboards.Title); } } SetAPIResult(result); }); }
public override void Test() { ISN_UIApplication.RegisterForRemoteNotifications(); ISN_UIApplication.ApplicationDelegate.DidRegisterForRemoteNotifications.AddListener((result) => { if (result.IsSucceeded) { var token = result.DeviceTokenUTF8; if (string.IsNullOrEmpty(token)) { SetResult(SA_TestResult.WithError("Token is empty")); return; } ISN_Logger.Log("ANS token string:" + token); } else { ISN_Logger.Log("Error: " + result.Error.Message); } SetAPIResult(result); }); }
public override void Test() { int responce = AN_GoogleApiAvailability.IsGooglePlayServicesAvailable(); if (responce == AN_ConnectionResult.SUCCESS) { SetResult(SA_TestResult.OK); } else { AN_Logger.Log("Google Api not avaliable on current device, trying to resolve"); AN_GoogleApiAvailability.MakeGooglePlayServicesAvailable((result) => { if (result.IsSucceeded) { SetResult(SA_TestResult.OK); } else { SetResult(SA_TestResult.WithError("Google Api not avaliable on current device")); } }); } }
private void ValidateRequest(ISN_UNNotificationRequest presentdeRequest) { bool valid = true; if (!presentdeRequest.Content.Body.Equals(m_request.Content.Body)) { valid = false; } if (!presentdeRequest.Content.Title.Equals(m_request.Content.Title)) { valid = false; } if (!presentdeRequest.Content.Subtitle.Equals(m_request.Content.Subtitle)) { valid = false; } var userInfoJson1 = presentdeRequest.Content.GetUserInfo <ISN_UNNotificationContent>(); if (!userInfoJson1.Title.Equals("Info Test")) { valid = false; } if (valid) { SetResult(SA_TestResult.OK); } else { SetResult(SA_TestResult.WithError("Request Validation failede")); } }
public override void Test() { if (AN_Build.VERSION.SDK_INT >= AN_Build.VERSION_CODES.O) { string channelId = "my_channel_id"; string name = "My Channel Name"; string description = "My Channel Description"; var importance = AN_NotificationManager.Importance.DEFAULT; AN_NotificationChannel channel = new AN_NotificationChannel(channelId, name, importance); channel.Description = description; // Register the channel with the system; you can't change the importance // or other notification behaviors after this AN_NotificationManager.CreateNotificationChannel(channel); //Now let's Read notification channel settings and make sure we have our chnnael registred List <AN_NotificationChannel> channels; channels = AN_NotificationManager.GetNotificationChannels(); bool found = false; foreach (var stsChannel in channels) { PrintChannelInfo(stsChannel); if (stsChannel.Id.Equals(channelId)) { found = true; break; } } if (!found) { SetResult(SA_TestResult.WithError("The Notification Channel wasn't registred in the system")); return; } channel = AN_NotificationManager.GetNotificationChannel(channelId); if (channel == null) { SetResult(SA_TestResult.WithError("The Notification Channel wasn't registred in the system")); return; } else { PrintChannelInfo(channel); } AN_NotificationManager.DeleteNotificationChannel(channelId); channels = AN_NotificationManager.GetNotificationChannels(); found = false; foreach (var stsCahnnel in channels) { PrintChannelInfo(stsCahnnel); if (stsCahnnel.Id.Equals(channelId)) { found = true; break; } } if (found) { SetResult(SA_TestResult.WithError("The Notification Channel wasn't deleted from the system")); return; } SetResult(SA_TestResult.OK); } else { SetResult(SA_TestResult.WithError("Notification Channels can only be tested on android 8.0 oreo (api 26) or higher")); } }