Skip to content

Update touch ID enroll method #695

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 25, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,23 @@ public class IOSMobileCommandHelper extends MobileCommand {
/**
* This method forms a {@link java.util.Map} of parameters for the toggling touchId
* enrollment in simulator.
*
* The method is deprecated. Please use {@link #toggleTouchIdEnrollmentCommand(boolean)} instead.
*/
@Deprecated
public static Map.Entry<String, Map<String, ?>> toggleTouchIdEnrollmentCommand() {
return new AbstractMap.SimpleEntry<>(
TOUCH_ID_ENROLLMENT, ImmutableMap.<String, Object>of());
}

/**
* This method forms a {@link java.util.Map} of parameters for the toggling touchId
* enrollment in simulator.
*
* @param enabled Whether to enable or disable Touch ID Enrollment for Simulator.
*
*/
public static Map.Entry<String, Map<String, ?>> toggleTouchIdEnrollmentCommand(boolean enabled) {
return new AbstractMap.SimpleEntry<>(
TOUCH_ID_ENROLLMENT, prepareArguments("enabled", enabled));
}
}
17 changes: 16 additions & 1 deletion src/main/java/io/appium/java_client/ios/PerformsTouchID.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,24 @@ default void performTouchID(boolean match) {

/**
* Enrolls touchId in iOS Simulators.
*
* This method is deprecated. Please use {@link #toggleTouchIDEnrollment(boolean)} instead
*/
@Deprecated
default void toggleTouchIDEnrollment() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mykola-mokhnach We haven't released a version after this implementation. Can we remove this or Do you still wanted it to be marked deprecated?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

marking it as deprecated is safer. We can remove as soon as beta is released (what we, actually, always do)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm ok

CommandExecutionHelper.execute(this, toggleTouchIdEnrollmentCommand());
}

/**
* Enrolls touchId in iOS Simulators. This call will only work if Appium process or its
* parent application (e.g. Terminal.app or Appium.app) has
* access to Mac OS accessibility in System Preferences &gt;
* Security &amp; Privacy &gt; Privacy &gt; Accessibility list.
*
* @param enabled Whether to enable or disable Touch ID Enrollment. The actual state of the feature
* will only be changed if the current value is different from the previous one.
* Multiple calls of the method with the same argument value have no effect.
*/
default void toggleTouchIDEnrollment(boolean enabled) {
CommandExecutionHelper.execute(this, toggleTouchIdEnrollmentCommand(enabled));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public class XCUIAutomationTest extends AppXCUITTest {

@Test public void testTouchId() {
try {
driver.toggleTouchIDEnrollment();
driver.toggleTouchIDEnrollment(true);
driver.performTouchID(true);
driver.performTouchID(false);
assertEquals(true, true);
Expand Down