Skip to content

Commit 2eba41d

Browse files
authored
feat: add examples for react-native 0.71 and 0.77 (#75)
* bump version up yarn * 0.71 * demo-kit * 0.77 * update contributing * update setup script * update tsconfig
1 parent 69cb4fe commit 2eba41d

File tree

172 files changed

+23456
-16829
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

172 files changed

+23456
-16829
lines changed

.eslintrc.js

+12
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,17 @@ module.exports = {
3333
files: ['**/?(*.)+(spec|test).ts?(x)'],
3434
extends: [require.resolve('@vercel/style-guide/eslint/jest')],
3535
},
36+
{
37+
files: ['examples/**/*.js?(x)', 'examples/**/*.ts?(x)'],
38+
rules: {
39+
'no-console': 'off',
40+
'import/no-default-export': 'off',
41+
'import/no-extraneous-dependencies': 'off',
42+
'unicorn/filename-case': 'off',
43+
'@typescript-eslint/no-shadow': 'off',
44+
'@typescript-eslint/no-misused-promises': 'off',
45+
'@typescript-eslint/no-confusing-void-expression': 'off',
46+
},
47+
},
3648
],
3749
};

.github/actions/setup/action.yml

+3-5
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ runs:
55
using: composite
66
steps:
77
- name: Setup Node.js
8-
uses: actions/setup-node@v3
8+
uses: actions/setup-node@v4
99
with:
1010
node-version-file: .nvmrc
1111

@@ -15,7 +15,7 @@ runs:
1515

1616
- name: Cache dependencies
1717
id: yarn-cache
18-
uses: actions/cache@v3
18+
uses: actions/cache@v4
1919
with:
2020
path: |
2121
**/node_modules
@@ -25,7 +25,5 @@ runs:
2525
2626
- name: Install dependencies
2727
if: steps.yarn-cache.outputs.cache-hit != 'true'
28-
run: |
29-
yarn install --cwd example --frozen-lockfile
30-
yarn install --frozen-lockfile
28+
run: yarn install --immutable
3129
shell: bash

.gitignore

+7-8
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,15 @@ project.xcworkspace
4040
local.properties
4141
android.iml
4242
android/gradle*
43+
*.keystore
44+
!debug.keystore
4345

4446
# Cocoapods
4547
#
46-
example/ios/Pods
48+
examples/*/ios/Pods
4749

4850
# Ruby
49-
example/vendor/
51+
examples/*/vendor/
5052

5153
# node.js
5254
#
@@ -55,12 +57,6 @@ npm-debug.log
5557
yarn-debug.log
5658
yarn-error.log
5759

58-
# BUCK
59-
buck-out/
60-
\.buckd/
61-
android/app/libs
62-
android/keystores/debug.keystore
63-
6460
# Expo
6561
.expo/
6662

@@ -69,3 +65,6 @@ android/keystores/debug.keystore
6965

7066
# generated by bob
7167
lib/
68+
69+
# Temporary files created by Metro to check the health of the file watcher
70+
.metro-health-check*

.nvmrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
18.17.1
1+
22.12.0

.yarn/install-state.gz

1.88 MB
Binary file not shown.

.yarnrc

-3
This file was deleted.

.yarnrc.yml

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
nodeLinker: node-modules
2+
nmHoistingLimits: workspaces

CONTRIBUTING.md

+19-8
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ We want this community to be friendly and respectful to each other. Please follo
99
To get started with the project, run `yarn` in the root directory to install the required dependencies for each package:
1010

1111
```sh
12-
yarn
12+
yarn && yarn workspaces foreach --all run bootstrap
1313
```
1414

1515
> While it's possible to use [`npm`](https://github.com/npm/cli), the tooling is built around [`yarn`](https://classic.yarnpkg.com/), so you'll have an easier time if you use `yarn` for development.
@@ -19,19 +19,31 @@ While developing, you can run the [example app](/example/) to test your changes.
1919
To start the packager:
2020

2121
```sh
22-
yarn example start
22+
# React Native 0.71
23+
yarn workspace example071 run start
24+
25+
# React Native 0.77
26+
yarn workspace example077 run start
2327
```
2428

2529
To run the example app on Android:
2630

2731
```sh
28-
yarn example android
32+
# React Native 0.71
33+
yarn workspace example071 run android
34+
35+
# React Native 0.77
36+
yarn workspace example077 run android
2937
```
3038

3139
To run the example app on iOS:
3240

3341
```sh
34-
yarn example ios
42+
# React Native 0.71
43+
yarn workspace example071 run ios
44+
45+
# React Native 0.77
46+
yarn workspace example077 run ios
3547
```
3648

3749
Make sure your code passes TypeScript and ESLint. Run the following to verify:
@@ -65,7 +77,6 @@ To edit the Objective-C or Swift files, open `example/ios/ZendeskMessagingExampl
6577

6678
To edit the Java or Kotlin files, open `example/android` in Android studio and find the source files at `react-native-zendesk-messaging` under `Android`.
6779

68-
6980
### Commit message convention
7081

7182
We follow the [conventional commits specification](https://www.conventionalcommits.org/en) for our commit messages:
@@ -106,9 +117,9 @@ The `package.json` file contains various scripts for common tasks:
106117
- `yarn lint`: lint files with ESLint.
107118
- `yarn lint:swift`: lint files with SwiftLint.
108119
- `yarn test`: run unit tests with Jest.
109-
- `yarn example start`: start the Metro server for the example app.
110-
- `yarn example android`: run the example app on Android.
111-
- `yarn example ios`: run the example app on iOS.
120+
- `yarn workspace <example-name> start`: start the Metro server for the example app.
121+
- `yarn workspace <example-name> android`: run the example app on Android.
122+
- `yarn workspace <example-name> ios`: run the example app on iOS.
112123

113124
### Sending a pull request
114125

android/src/main/java/dev/geundung/zendesk/messaging/ZendeskMessagingModule.kt

+9-3
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,10 @@ class ZendeskMessagingModule(private val reactContext: ReactApplicationContext)
144144
return
145145
}
146146

147-
module.setConversationFields(fields.toHashMap())
147+
fields.toHashMap()
148+
.filterValues { it != null }
149+
.mapValues { it.value!! }
150+
.let { module.setConversationFields(it) }
148151
}
149152

150153
@ReactMethod
@@ -197,7 +200,11 @@ class ZendeskMessagingModule(private val reactContext: ReactApplicationContext)
197200
@ReactMethod
198201
fun handleNotification(remoteMessage: ReadableMap, promise: Promise) {
199202
try {
200-
val messageData = remoteMessage.toHashMap().toMap() as Map<String, String>
203+
val messageData: Map<String, String> = remoteMessage.toHashMap()
204+
.filterValues { it is String }
205+
.mapValues { it.value as String }
206+
.toMap()
207+
201208
module.handleNotification(
202209
context = reactContext,
203210
messageData = messageData,
@@ -217,7 +224,6 @@ class ZendeskMessagingModule(private val reactContext: ReactApplicationContext)
217224
// noop
218225
}
219226

220-
221227
companion object {
222228
const val NAME = "ZendeskMessaging"
223229
}

example/.node-version

-1
This file was deleted.

example/.ruby-version

-1
This file was deleted.

example/Gemfile

-6
This file was deleted.

example/android/app/_BUCK

-55
This file was deleted.

0 commit comments

Comments
 (0)