Skip to content
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

[Feat] Expand iOS Presentation Methods #543

Merged
merged 21 commits into from
Aug 8, 2023
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
4 changes: 2 additions & 2 deletions .github/workflows/build_test_ios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
run: cd example && yalc add react-native-plaid-link-sdk && cd ../

- name: Delete package.lock
run: cd example && rm package-lock.json
run: cd example && rm package-lock.json && cd ../

- name: Install Node modules
run: cd example && npm install && cd ../
Expand All @@ -42,7 +42,7 @@ jobs:
${{ runner.os }}-pods-

- name: Install pod dependencies
run: cd example/ios && bundle install && bundle exec pod install && cd ..
run: cd example/ios && bundle install && bundle exec pod install && cd ../

- name: Install the Apple certificate and provisioning profile
env:
Expand Down
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,8 @@ buck-out/
*.keystore

# React Native ts
dist/
dist/

.vscode
example/.yalc
example/yalc.lock
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,23 @@ AutoLinking should handle all of the Android setup.

```javascript
import { Text } from 'react-native';
import { PlaidLink, LinkSuccess, LinkExit } from 'react-native-plaid-link-sdk';
import { PlaidLink, LinkSuccess, LinkExit, LinkLogLevel, LinkIOSPresentationStyle } from 'react-native-plaid-link-sdk';

const MyPlaidComponent = () => {
return (
<PlaidLink
tokenConfig={{
token: "#GENERATED_LINK_TOKEN#",
// OPTIONAL - log level.
logLevel: LinkLogLevel.ERROR,
// OPTIONAL - Hides native activity indicator if true.
noLoadingState: false,
}}
onSuccess={(success: LinkSuccess) => { console.log(success) }}
onExit={(exit: LinkExit) => { console.log(exit) }}
// OPTIONAL - MODAL or FULL_SCREEEN presentation on iOS. Defaults to MODAL.
// UI is always presented in full screen on Android.
iOSPresentationStyle={LinkIOSPresentationStyle.MODAL}
>
<Text>Add Account</Text>
</PlaidLink>
Expand Down
7 changes: 6 additions & 1 deletion example/PlaidEventContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React from 'react';
import {TextInput, Text, TouchableOpacity, useColorScheme} from 'react-native';
import {Colors} from 'react-native/Libraries/NewAppScreen';
import {styles} from './Styles';

import {
LinkExit,
LinkEvent,
Expand All @@ -11,6 +12,7 @@ import {
dismissLink,
PlaidLinkProps,
usePlaidEmitter,
LinkIOSPresentationStyle,
} from 'react-native-plaid-link-sdk';

// Create PlaidLinkProps from the provided token string.
Expand All @@ -19,7 +21,8 @@ function makeLinkTokenProps(token: string): PlaidLinkProps {
tokenConfig: {
token: token,
logLevel: LinkLogLevel.ERROR,
noLoadingState: false, // Hides native activity indicator if true.
// Hides native activity indicator if true.
noLoadingState: false,
},
onSuccess: (success: LinkSuccess) => {
// User was able to successfully link their account.
Expand All @@ -31,6 +34,8 @@ function makeLinkTokenProps(token: string): PlaidLinkProps {
console.log('Exit: ', linkExit);
dismissLink();
},
// MODAL or FULL_SCREEEN presentation on iOS. Defaults to MODAL.
iOSPresentationStyle: LinkIOSPresentationStyle.MODAL,
};
}

Expand Down
Binary file modified example/ios/main.jsbundle
Binary file not shown.
5 changes: 3 additions & 2 deletions example/ios/plaidRNDemoUITests/PlaidRNDemoUITests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,23 @@ final class PlaidRNDemoUITests: XCTestCase {
var webview: XCUIElement { app.webViews.firstMatch }

/// Default amount of time to wait for elements before throwing an error.
let defaultTimeout: TimeInterval = 15.0
let defaultTimeout: TimeInterval = 25.0

private(set) var clientID: String = ""
private(set) var apiSecret: String = ""

func enterToken(token: String) throws {
let tokenTextField = app.otherElements["link-sandbox-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"]
let openElements = app.otherElements.matching(identifier: "OPEN LINK")
let _ = tokenTextField.waitForExistence(timeout: defaultTimeout * 2)
let _ = tokenTextField.waitForExistence(timeout: defaultTimeout)

guard tokenTextField.exists else {
throw UITestError.elementDoesNotExist(message: "Token TextField does not exist.")
}

UIPasteboard.general.string = token
tokenTextField.doubleTap()
sleep(2)
tokenTextField.doubleTap()

// Typing in the link token caused issues where it would type "lnk-token-xxxx" which resulted
Expand Down
Loading