Skip to content

Commit

Permalink
Fix example app and upgrade packages (#100)
Browse files Browse the repository at this point in the history
* fixed android example

* upgrade ios app to react-native 0.75.3

* updated project.pbxproj

* fixed ios

* @mxenabled/widget-post-message-definitions

* fixed the test

* bumped up the sdk version

---------

Co-authored-by: Clement Mwimo <[email protected]>
  • Loading branch information
mwclemy and Clement Mwimo authored Oct 7, 2024
1 parent 558e7bb commit 48c2b01
Show file tree
Hide file tree
Showing 58 changed files with 18,965 additions and 35,656 deletions.
13 changes: 4 additions & 9 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
module.exports = function(api) {
api.cache(true);
return {
presets: [
"module:metro-react-native-babel-preset",
"@babel/preset-typescript",
]
};
};
// eslint-disable-next-line no-undef
module.exports = {
presets: ["module:@react-native/babel-preset"],
}
58 changes: 58 additions & 0 deletions docs/widget_callback_props.md
Original file line number Diff line number Diff line change
Expand Up @@ -436,3 +436,61 @@ import { ConnectWidget } from "@mxenabled/react-native-widget-sdk"
</details>
---
### Back to search (`mx/connect/backToSearch`)
- Widget callback prop name: `onBackToSearch`
- Payload fields:
- `user_guid` (`string`)
- `session_guid` (`string`)
- `context` (optional) (`string`)
<details>
<summary>Click here to view a sample usage of <code>onBackToSearch</code>.</summary>
```jsx
import { ConnectWidget } from "@mxenabled/react-native-widget-sdk"

<ConnectWidget
url="https://widgets.moneydesktop.com/md/connect/..."

onBackToSearch={(payload) => {
console.log(`User guid: ${payload.user_guid}`)
console.log(`Session guid: ${payload.session_guid}`)
console.log(`Context: ${payload.context}`)
}
/>
```
</details>
---
### Invalid data (`mx/connect/invalidData`)
- Widget callback prop name: `onInvalidData`
- Payload fields:
- `user_guid` (`string`)
- `session_guid` (`string`)
- `member_guid` (`string`)
- `code` (`number`)
<details>
<summary>Click here to view a sample usage of <code>onInvalidData</code>.</summary>
```jsx
import { ConnectWidget } from "@mxenabled/react-native-widget-sdk"

<ConnectWidget
url="https://widgets.moneydesktop.com/md/connect/..."

onInvalidData={(payload) => {
console.log(`User guid: ${payload.user_guid}`)
console.log(`Session guid: ${payload.session_guid}`)
console.log(`Member guid: ${payload.member_guid}`)
console.log(`Code: ${payload.code}`)
}
/>
```
</details>
6 changes: 0 additions & 6 deletions example/.buckconfig

This file was deleted.

8 changes: 6 additions & 2 deletions example/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
module.exports = {
root: true,
extends: '@react-native-community',
};
extends: "@react-native",
rules: {
semi: 0,
singleQuote: false,
},
}
12 changes: 6 additions & 6 deletions example/App.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useState, FC, PropsWithChildren } from "react"
import { SafeAreaView, Text, View, StyleSheet, StyleProp, ViewStyle } from "react-native"
import React, { FC, PropsWithChildren } from "react"
import { SafeAreaView, Text, View, StyleSheet, StyleProp, ViewStyle, Platform } from "react-native"
import { NativeRouter, Routes, Route, Link } from "react-router-native"

import {
Expand All @@ -11,7 +11,8 @@ import {
TransactionsWidget,
} from "@mxenabled/react-native-widget-sdk"

const proxy = "http://localhost:8089/user/widget_urls"
const baseUrl = Platform.OS === "android" ? "http://10.0.2.2:8089" : "http://localhost:8089"
const proxy = `${baseUrl}/user/widget_urls`
const styles = StyleSheet.create({
page: {
backgroundColor: "#ffffff",
Expand Down Expand Up @@ -72,7 +73,6 @@ const Home = () => (

const Page: FC<PropsWithChildren<{ style?: StyleProp<ViewStyle>; goBack?: boolean }>> = ({
children,
style,
goBack = true,
}) => (
<SafeAreaView style={styles.page}>
Expand Down Expand Up @@ -108,10 +108,10 @@ const Connect = () => {
onInvalidMessageError={(url, _error) => {
console.log(`Got an unknown message: ${url}`)
}}
onLoad={(payload) => {
onLoad={(_payload) => {
console.log("Widget is loading")
}}
onLoaded={(payload) => {
onLoaded={(_payload) => {
console.log("Widget has loaded")
}}
onStepChange={(payload) => {
Expand Down
6 changes: 4 additions & 2 deletions example/Gemfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
source 'https://rubygems.org'

# You may use http://rbenv.org/ or https://rvm.io/ to install and use this version
ruby '2.7.5'
ruby ">= 2.6.10"

gem 'cocoapods', '~> 1.11', '>= 1.11.2'
# Exclude problematic versions of cocoapods and activesupport that causes build failures.
gem 'cocoapods', '>= 1.13', '!= 1.15.0', '!= 1.15.1'
gem 'activesupport', '>= 6.1.7.5', '!= 7.1.0'
70 changes: 43 additions & 27 deletions example/Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,41 +1,49 @@
GEM
remote: https://rubygems.org/
specs:
CFPropertyList (3.0.5)
CFPropertyList (3.0.7)
base64
nkf
rexml
activesupport (6.1.7)
activesupport (7.1.4)
base64
bigdecimal
concurrent-ruby (~> 1.0, >= 1.0.2)
connection_pool (>= 2.2.5)
drb
i18n (>= 1.6, < 2)
minitest (>= 5.1)
mutex_m
tzinfo (~> 2.0)
zeitwerk (~> 2.3)
addressable (2.8.1)
public_suffix (>= 2.0.2, < 6.0)
addressable (2.8.7)
public_suffix (>= 2.0.2, < 7.0)
algoliasearch (1.27.5)
httpclient (~> 2.8, >= 2.8.3)
json (>= 1.5.1)
atomos (0.1.3)
base64 (0.2.0)
bigdecimal (3.1.8)
claide (1.1.0)
cocoapods (1.11.3)
cocoapods (1.15.2)
addressable (~> 2.8)
claide (>= 1.0.2, < 2.0)
cocoapods-core (= 1.11.3)
cocoapods-core (= 1.15.2)
cocoapods-deintegrate (>= 1.0.3, < 2.0)
cocoapods-downloader (>= 1.4.0, < 2.0)
cocoapods-downloader (>= 2.1, < 3.0)
cocoapods-plugins (>= 1.0.0, < 2.0)
cocoapods-search (>= 1.0.0, < 2.0)
cocoapods-trunk (>= 1.4.0, < 2.0)
cocoapods-trunk (>= 1.6.0, < 2.0)
cocoapods-try (>= 1.1.0, < 2.0)
colored2 (~> 3.1)
escape (~> 0.0.4)
fourflusher (>= 2.3.0, < 3.0)
gh_inspector (~> 1.0)
molinillo (~> 0.8.0)
nap (~> 1.0)
ruby-macho (>= 1.0, < 3.0)
xcodeproj (>= 1.21.0, < 2.0)
cocoapods-core (1.11.3)
activesupport (>= 5.0, < 7)
ruby-macho (>= 2.3.0, < 3.0)
xcodeproj (>= 1.23.0, < 2.0)
cocoapods-core (1.15.2)
activesupport (>= 5.0, < 8)
addressable (~> 2.8)
algoliasearch (~> 1.0)
concurrent-ruby (~> 1.1)
Expand All @@ -45,7 +53,7 @@ GEM
public_suffix (~> 4.0)
typhoeus (~> 1.0)
cocoapods-deintegrate (1.0.5)
cocoapods-downloader (1.6.3)
cocoapods-downloader (2.1)
cocoapods-plugins (1.0.0)
nap
cocoapods-search (1.0.1)
Expand All @@ -54,44 +62,52 @@ GEM
netrc (~> 0.11)
cocoapods-try (1.2.0)
colored2 (3.1.2)
concurrent-ruby (1.1.10)
concurrent-ruby (1.3.4)
connection_pool (2.4.1)
drb (2.2.1)
escape (0.0.4)
ethon (0.15.0)
ethon (0.16.0)
ffi (>= 1.15.0)
ffi (1.15.5)
ffi (1.17.0)
ffi (1.17.0-arm64-darwin)
ffi (1.17.0-x86_64-darwin)
fourflusher (2.3.1)
fuzzy_match (2.0.4)
gh_inspector (1.1.3)
httpclient (2.8.3)
i18n (1.12.0)
i18n (1.14.6)
concurrent-ruby (~> 1.0)
json (2.6.2)
minitest (5.16.3)
json (2.7.2)
minitest (5.25.1)
molinillo (0.8.0)
mutex_m (0.2.0)
nanaimo (0.3.0)
nap (1.1.0)
netrc (0.11.0)
nkf (0.2.0)
public_suffix (4.0.7)
rexml (3.2.5)
rexml (3.3.7)
ruby-macho (2.5.1)
typhoeus (1.4.0)
typhoeus (1.4.1)
ethon (>= 0.9.0)
tzinfo (2.0.5)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
xcodeproj (1.22.0)
xcodeproj (1.25.0)
CFPropertyList (>= 2.3.3, < 4.0)
atomos (~> 0.1.3)
claide (>= 1.0.2, < 2.0)
colored2 (~> 3.1)
nanaimo (~> 0.3.0)
rexml (~> 3.2.4)
zeitwerk (2.6.1)
rexml (>= 3.3.2, < 4.0)

PLATFORMS
arm64-darwin-23
ruby
x86_64-darwin-21

DEPENDENCIES
cocoapods (~> 1.11, >= 1.11.2)
activesupport (>= 6.1.7.5, != 7.1.0)
cocoapods (>= 1.13, != 1.15.1, != 1.15.0)

RUBY VERSION
ruby 2.7.5p203
Expand Down
14 changes: 7 additions & 7 deletions example/__tests__/App-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
* @format
*/

import 'react-native';
import React from 'react';
import App from '../App';
import "react-native"
import React from "react"
import App from "../App"

// Note: test renderer must be required after react-native.
import renderer from 'react-test-renderer';
import renderer from "react-test-renderer"

it('renders correctly', () => {
renderer.create(<App />);
});
it("renders correctly", () => {
renderer.create(<App />)
})
1 change: 0 additions & 1 deletion example/_node-version

This file was deleted.

1 change: 0 additions & 1 deletion example/_ruby-version

This file was deleted.

55 changes: 0 additions & 55 deletions example/android/app/_BUCK

This file was deleted.

Loading

0 comments on commit 48c2b01

Please sign in to comment.