diff --git a/.eslintrc.js b/.eslintrc.js index 45cf2c1e..8e39d62a 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,5 +1,5 @@ module.exports = { root: true, - extends: ['universe/native', 'universe/web'], - ignorePatterns: ['build'], + extends: ["universe/native", "universe/web"], + ignorePatterns: ["build"], }; diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml index bd75af08..7a1979c3 100644 --- a/.github/workflows/npm-publish.yml +++ b/.github/workflows/npm-publish.yml @@ -8,41 +8,43 @@ on: workflow_dispatch: inputs: description: - description: 'Description' + description: "Description" required: false type: string release_type: - description: 'Release Type' + description: "Release Type" required: true - default: 'patch' + default: "patch" type: choice options: - - 'patch' - - 'minor' - - 'major' + - "patch" + - "minor" + - "major" jobs: test: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - + - uses: oven-sh/setup-bun@v2 with: bun-version: latest - run: bun install - + - run: bun lint - + - run: bun typecheck + - run: bun run test + publish-to-npm: needs: test runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - + - uses: actions/setup-node@v4 - uses: oven-sh/setup-bun@v2 @@ -90,4 +92,4 @@ jobs: with: name: ${{ env.versionTag }} ${{ github.event.inputs.description }} tag_name: ${{ env.versionTag }} - generate_release_notes: true \ No newline at end of file + generate_release_notes: true diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index b84743fd..359cabb3 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -9,7 +9,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - + - uses: oven-sh/setup-bun@v2 with: bun-version: latest @@ -21,6 +21,6 @@ jobs: cd packages/react-native-device-activity bun run build bun run prepublishOnly - + - name: Publish preview - run: bunx pkg-pr-new@latest publish './packages/*' \ No newline at end of file + run: bunx pkg-pr-new@latest publish './packages/*' diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 15d9e40b..3a4c6e12 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -37,6 +37,21 @@ jobs: - run: bun typecheck + test-js: + name: JS Tests + runs-on: ubuntu-latest + timeout-minutes: 10 + steps: + - uses: actions/checkout@v4 + + - uses: oven-sh/setup-bun@v2 + with: + bun-version: latest + + - run: bun install + + - run: bun run test + typecheck-example: name: Typecheck (example project) runs-on: ubuntu-latest @@ -98,11 +113,11 @@ jobs: - run: bun install - - run: bunx expo prebuild + - run: bun run prebuild working-directory: apps/example swift-lint: - name: SwiftLint (example project) + name: SwiftLint (iOS harness) runs-on: macos-latest timeout-minutes: 10 steps: @@ -114,20 +129,20 @@ jobs: - uses: actions/cache@v4 with: - path: example/ios/Pods - key: ${{ runner.os }}-pods-${{ hashFiles('example/ios/Podfile.lock') }} + path: packages/react-native-device-activity/ios/TestHarness/Pods + key: ${{ runner.os }}-pods-${{ hashFiles('packages/react-native-device-activity/ios/TestHarness/Podfile.lock') }} restore-keys: | ${{ runner.os }}-pods- - run: bun install - run: pod install - working-directory: apps/example/ios + working-directory: packages/react-native-device-activity/ios/TestHarness - - run: apps/example/ios/Pods/SwiftLint/swiftlint lint + - run: packages/react-native-device-activity/ios/TestHarness/Pods/SwiftLint/swiftlint lint --strict --config .swiftlint.yml swift-test: - name: Swift Test (example project) + name: Swift Test (iOS harness) runs-on: macos-latest timeout-minutes: 25 steps: @@ -143,14 +158,10 @@ jobs: - run: bun install - - name: Start bundler - run: bun start & - working-directory: apps/example - - uses: actions/cache@v4 with: - path: example/ios/Pods - key: ${{ runner.os }}-pods-${{ hashFiles('example/ios/Podfile.lock') }} + path: packages/react-native-device-activity/ios/TestHarness/Pods + key: ${{ runner.os }}-pods-${{ hashFiles('packages/react-native-device-activity/ios/TestHarness/Podfile.lock') }} restore-keys: | ${{ runner.os }}-pods- @@ -172,9 +183,7 @@ jobs: run: swift --version - run: pod install - working-directory: apps/example/ios - - - run: cp .swiftlint.yml apps/example/ios + working-directory: packages/react-native-device-activity/ios/TestHarness - - run: xcodebuild test -workspace reactnativedeviceactivityexample.xcworkspace -scheme Tests -allowProvisioningUpdates -destination "platform=iOS Simulator,OS=latest,name=iPhone 17" - working-directory: apps/example/ios + - run: xcodebuild test -workspace reactnativedeviceactivityexample.xcworkspace -scheme Tests -destination "platform=iOS Simulator,OS=latest,name=iPhone 17" + working-directory: packages/react-native-device-activity/ios/TestHarness diff --git a/.gitignore b/.gitignore index 895b5cc7..e12653ea 100644 --- a/.gitignore +++ b/.gitignore @@ -36,12 +36,17 @@ project.xcworkspace local.properties android.iml +# Example native output (CNG) +apps/example/ios/ +apps/example/android/ +apps/example/targets/ + # Cocoapods # -example/ios/Pods +apps/example/ios/Pods # Ruby -example/vendor/ +apps/example/vendor/ # node.js # diff --git a/.husky/pre-commit b/.husky/pre-commit index fa4d0074..51b6dccb 100644 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,2 +1,3 @@ -swift format -i -p -r ./packages/react-native-device-activity/ios ./packages/react-native-device-activity/targets ./apps/example/ios -apps/example/ios/Pods/SwiftLint/swiftlint lint --fix \ No newline at end of file +swift format -i -p -r ./packages/react-native-device-activity/ios/Tests ./packages/react-native-device-activity/targets ./packages/react-native-device-activity/ios/TestHarness/reactnativedeviceactivityexample +swift format -i -p ./packages/react-native-device-activity/ios/Shared.swift ./packages/react-native-device-activity/ios/ReactNativeDeviceActivityModule.swift ./packages/react-native-device-activity/ios/ReactNativeDeviceActivityView.swift ./packages/react-native-device-activity/ios/ReactNativeDeviceActivityViewPersisted.swift ./packages/react-native-device-activity/ios/ScreenTimeActivityPicker.swift +packages/react-native-device-activity/ios/TestHarness/Pods/SwiftLint/swiftlint lint --fix --config .swiftlint.yml diff --git a/.husky/pre-push b/.husky/pre-push index fe2292f5..f7757de6 100644 --- a/.husky/pre-push +++ b/.husky/pre-push @@ -1 +1 @@ -npm run pre-push \ No newline at end of file +bun run pre-push diff --git a/.npmignore b/.npmignore index 88749731..f16cb065 100644 --- a/.npmignore +++ b/.npmignore @@ -8,7 +8,7 @@ __tests__ /android/src/androidTest/ /android/src/test/ /android/build/ -/example/ +/apps/example/ # Test files *.test.ts @@ -18,4 +18,4 @@ __tests__ __tests__/ # seems like something is causing example to get installed recursively (bun bug?) -example \ No newline at end of file +apps/example diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 00000000..2a5e2f0a --- /dev/null +++ b/.prettierignore @@ -0,0 +1,15 @@ +node_modules/ +bun.lock + +# Expo / native generated artifacts +apps/example/.expo/ +apps/example/dist/ +apps/example/ios/Pods/ +apps/example/ios/build/ + +# Package build output +packages/react-native-device-activity/build/ + +# iOS test harness generated artifacts +packages/react-native-device-activity/ios/TestHarness/Pods/ +packages/react-native-device-activity/ios/TestHarness/build/ diff --git a/.prettierrc.json b/.prettierrc.json new file mode 100644 index 00000000..3fccd987 --- /dev/null +++ b/.prettierrc.json @@ -0,0 +1,6 @@ +{ + "$schema": "https://json.schemastore.org/prettierrc", + "singleQuote": false, + "semi": true, + "trailingComma": "all" +} diff --git a/.swiftlint.yml b/.swiftlint.yml index 13a0a142..3fa56772 100644 --- a/.swiftlint.yml +++ b/.swiftlint.yml @@ -12,6 +12,15 @@ disabled_rules: - inclusive_language included: -- packages/react-native-device-activity/ios -- apps/example/ios -- packages/react-native-device-activity/targets \ No newline at end of file + - packages/react-native-device-activity/ios/ReactNativeDeviceActivityModule.swift + - packages/react-native-device-activity/ios/ReactNativeDeviceActivityView.swift + - packages/react-native-device-activity/ios/ReactNativeDeviceActivityViewPersisted.swift + - packages/react-native-device-activity/ios/ScreenTimeActivityPicker.swift + - packages/react-native-device-activity/ios/Tests + - packages/react-native-device-activity/ios/Shared.swift + - packages/react-native-device-activity/ios/TestHarness/reactnativedeviceactivityexample + - packages/react-native-device-activity/targets + +excluded: + - packages/react-native-device-activity/ios/TestHarness/Pods + - packages/react-native-device-activity/ios/TestHarness/build diff --git a/.vscode/extensions.json b/.vscode/extensions.json index e6d68f07..a072e50d 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -1,6 +1,3 @@ { - "recommendations": [ - "vknabel.vscode-swiftlint", - "swiftlang.swift-vscode" - ], -} \ No newline at end of file + "recommendations": ["vknabel.vscode-swiftlint", "swiftlang.swift-vscode"] +} diff --git a/.vscode/launch.json b/.vscode/launch.json index 5f17df8c..69cb3d94 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -10,4 +10,4 @@ "android": {} } ] -} \ No newline at end of file +} diff --git a/.vscode/settings.json b/.vscode/settings.json index 85ea4c62..204d1ffc 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,7 +1,5 @@ { - "cSpell.words": [ - "Triggerable" - ], - "swiftlint.path": "apps/example/ios/Pods/SwiftLint/swiftlint", + "cSpell.words": ["Triggerable"], + "swiftlint.path": "packages/react-native-device-activity/ios/TestHarness/Pods/SwiftLint/swiftlint", "swift.SDK": "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS18.2.sdk" -} \ No newline at end of file +} diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 79bc8098..bd32a6f0 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,13 +1,81 @@ -# Example project setup +# Repository development setup -The example project is linked specifically to simplify development. This means it's not looking exactly like the published package, but for most intents and purposes it should result in the same outcome. +## Example app config (env-driven) -- The config plugin has a `copyToTargetFolder` option that is set to false. This is to prevent the target folder from being copied to the example project and potentially overwriting the original files. -- The swift files in the targets folder are linked to the root project instead of duplicated. If adding new swift files, try to link them instead of duplicating to keep things clean. -- The entitlements and info.plist files however duplicated - to not mess with the example project/signing etc. -- There is a Shared.swift file that can be accessed by all targets. This is linked to each target in the example project, but in the published package it's copied and duplicated to each target. I prefer this to making more changes in @bacons/xcode package which only supports swift files on the root level of each target directory. -- In addition the example project contains an XCode test target as well as SwiftLint. +The example app uses `apps/example/app.config.ts` so local developer values do not need to be committed. -## Prebuild +Create local env values from the template: -To try out prebuild functionality (i.e. the config plugin) run `bun run prebuild` in the example project (it uses the `INTERNALLY_TEST_EXAMPLE_PROJECT` and `COPY_TO_TARGET_FOLDER` env variables to behave like a published package). This should be used to verify changes are expected, but the result should not in it's full state be commited to the example project, since it will break the DX of the example project as explained above. +```bash +cp apps/example/.env.example apps/example/.env +``` + +Supported variables: + +- `RNDA_APPLE_TEAM_ID` +- `RNDA_APP_GROUP` +- `RNDA_IOS_BUNDLE_ID` +- `RNDA_ANDROID_PACKAGE` + +If these variables are missing, `app.config.ts` falls back to stable defaults for this repository. + +## Example app follows CNG + +The example app no longer tracks `apps/example/ios` and `apps/example/android`. +The example target folder `apps/example/targets` is also generated during prebuild and should not be committed. + +Regenerate native folders when needed: + +```bash +cd apps/example +bun run prebuild +# or +bun run ios +bun run android +``` + +## Swift test ownership + +Swift test sources are package-owned and live in: + +- `packages/react-native-device-activity/ios/Tests` + +The iOS test runner lives in: + +- `packages/react-native-device-activity/ios/TestHarness` + +## SwiftLint setup + +The repository runs SwiftLint from the iOS test harness CocoaPods installation: + +- `packages/react-native-device-activity/ios/TestHarness/Pods/SwiftLint/swiftlint` + +Run this once after cloning (and again if Pod dependencies are cleaned): + +```bash +cd packages/react-native-device-activity/ios/TestHarness +pod install +``` + +Then run repository checks from the root: + +```bash +bun run pre-push +``` + +## Formatting setup + +The formatting scripts intentionally call `node ./node_modules/prettier/bin/prettier.cjs` to avoid PATH/bin shadowing from transitive tooling (see [expo/expo#42994](https://github.com/expo/expo/issues/42994)). + +## Plugin testing + +In addition to app/prebuild validation, config plugin regression tests are defined under: + +- `packages/react-native-device-activity/plugin/__tests__` + +Run them with: + +```bash +cd packages/react-native-device-activity +bun run test:plugin +``` diff --git a/README.md b/README.md index b67d4c35..eab8f05d 100644 --- a/README.md +++ b/README.md @@ -196,7 +196,6 @@ Here's another example that focuses on tracking app usage with time thresholds: import * as ReactNativeDeviceActivity from "react-native-device-activity"; ReactNativeDeviceActivity.revokeAuthorization(); - ``` ### Select Apps to track @@ -433,9 +432,9 @@ ReactNativeDeviceActivity.updateShield( This example shows how to implement a complete app blocking system on a given interval. The main principle is that you're configuring these apps to be blocked with FamilyControl API and then schedule when the shield should be shown with ActivityMonitor API. You're customizing the shield UI and actions with ShieldConfiguration and ShieldAction APIs. ```typescript -import { useEffect, useState } from 'react'; -import { Alert, View, Button } from 'react-native'; -import * as ReactNativeDeviceActivity from 'react-native-device-activity'; +import { useEffect, useState } from "react"; +import { Alert, View, Button } from "react-native"; +import * as ReactNativeDeviceActivity from "react-native-device-activity"; // Constants for identifying your selections, shields and scheduled activities const SELECTION_ID = "evening_block_selection"; @@ -459,7 +458,9 @@ const AppBlocker = () => { // Step 3: Handle selection changes from the native selection UI const handleSelectionChange = (event) => { // The selection is a serialized string containing the user's app selections - setCurrentFamilyActivitySelection(event.nativeEvent.familyActivitySelection); + setCurrentFamilyActivitySelection( + event.nativeEvent.familyActivitySelection, + ); }; // Step 4: Save the selection for use by the extension @@ -472,7 +473,7 @@ const AppBlocker = () => { // Store the selection with a consistent ID so the extension can access it ReactNativeDeviceActivity.setFamilyActivitySelectionId({ id: SELECTION_ID, - familyActivitySelection: currentFamilyActivitySelection + familyActivitySelection: currentFamilyActivitySelection, }); // Now configure the blocking schedule @@ -486,14 +487,14 @@ const AppBlocker = () => { title: "App Blocked", subtitle: "This app is currently unavailable", primaryButtonLabel: "OK", - iconSystemName: "moon.stars.fill" // SF Symbols icon name + iconSystemName: "moon.stars.fill", // SF Symbols icon name }; // Define what happens when users interact with the shield const shieldActions = { primary: { - behavior: "close" // Just close the shield when OK is tapped - } + behavior: "close", // Just close the shield when OK is tapped + }, }; // Apply the shield configuration @@ -503,21 +504,25 @@ const AppBlocker = () => { ReactNativeDeviceActivity.configureActions({ activityName: ACTIVITY_NAME, callbackName: "intervalDidStart", // Called when the scheduled time begins - actions: [{ - type: "blockSelection", - familyActivitySelectionId: SELECTION_ID, // The stored selection ID - shieldId: SHIELD_CONFIG_ID // The shield to show when blocked - }] + actions: [ + { + type: "blockSelection", + familyActivitySelectionId: SELECTION_ID, // The stored selection ID + shieldId: SHIELD_CONFIG_ID, // The shield to show when blocked + }, + ], }); // Configure what happens when the scheduled interval ends ReactNativeDeviceActivity.configureActions({ activityName: ACTIVITY_NAME, callbackName: "intervalDidEnd", // Called when the scheduled time ends - actions: [{ - type: "unblockSelection", - familyActivitySelectionId: SELECTION_ID // Unblock the same selection - }] + actions: [ + { + type: "unblockSelection", + familyActivitySelectionId: SELECTION_ID, // Unblock the same selection + }, + ], }); // Start the monitoring schedule @@ -531,7 +536,7 @@ const AppBlocker = () => { const schedule = { intervalStart: { hour: 19, minute: 0 }, // 7:00 PM intervalEnd: { hour: 23, minute: 59 }, // 11:59 PM - repeats: true // Repeat this schedule daily + repeats: true, // Repeat this schedule daily // Optional: warningTime: { minutes: 5 } // Warn user 5 minutes before blocking starts }; @@ -543,7 +548,9 @@ const AppBlocker = () => { second: (new Date().getSeconds() + 10) % 60, // +10 seconds from now }, intervalEnd: { - hour: new Date().getHours() + Math.floor((new Date().getMinutes() + 5) / 60), + hour: + new Date().getHours() + + Math.floor((new Date().getMinutes() + 5) / 60), minute: (new Date().getMinutes() + 5) % 60, // +5 minutes from start }, repeats: false, // One-time test @@ -554,7 +561,7 @@ const AppBlocker = () => { await ReactNativeDeviceActivity.startMonitoring( ACTIVITY_NAME, schedule, // Use testSchedule for testing - [] + [], ); Alert.alert("Success", "Blocking schedule has been set up!"); @@ -572,7 +579,7 @@ const AppBlocker = () => { familyActivitySelection={currentFamilyActivitySelection} style={{ width: "100%", - flex: 1 + flex: 1, }} /> @@ -594,7 +601,7 @@ const AppBlocker = () => { 4. **Action Configuration**: Defines what happens when the scheduled interval starts/ends. 5. **Scheduling**: Sets up when blocking should occur (e.g., evenings from 7 PM to midnight). -For a complete implementation, see the [example app](https://github.com/Kingstinct/react-native-device-activity/tree/main/example). +For a complete implementation, see the [example app](https://github.com/Kingstinct/react-native-device-activity/tree/main/apps/example). ## API Reference (the list is not exhaustive yet please refer to the TypeScript types for the full list) @@ -629,13 +636,29 @@ For a complete implementation, see the [example app](https://github.com/Kingstin ## Contributing -Contributions are very welcome! Please refer to guidelines described in the [contributing guide](https://github.com/expo/expo#contributing). +Contributions are very welcome! Please refer to guidelines described in [`CONTRIBUTING.md`](./CONTRIBUTING.md). + +### Repository development setup + +This repository uses an env-driven Expo example config in `apps/example/app.config.ts` to avoid committing local developer values such as team ID and app group. + +Use `apps/example/.env.example` as a template for local values: + +- `RNDA_APPLE_TEAM_ID` +- `RNDA_APP_GROUP` +- `RNDA_IOS_BUNDLE_ID` +- `RNDA_ANDROID_PACKAGE` + +The example app follows CNG workflow (`expo prebuild --clean` / `expo run:*`) and native folders are generated as needed. + +Swift test sources are package-owned in `packages/react-native-device-activity/ios/Tests` and run through the iOS harness in `packages/react-native-device-activity/ios/TestHarness`. + +For repository-specific details, see [`CONTRIBUTING.md`](./CONTRIBUTING.md). ## Weird behaviors ⚠️ - Authorization changes outside app not captured When we've asked whether the user has authorized us to use screen time, and the state is changed outside the app, the native API doesn't update until the app restarts, i.e. this flow: - 1. Ask for current permission 2. Change permission outside the app 3. Ask for current permission again will return same as (1) diff --git a/apps/example/.env.example b/apps/example/.env.example new file mode 100644 index 00000000..0a40ddfa --- /dev/null +++ b/apps/example/.env.example @@ -0,0 +1,4 @@ +RNDA_APPLE_TEAM_ID=YOUR_APPLE_TEAM_ID # Found in https://developer.apple.com/account#MembershipDetailsCard +RNDA_APP_GROUP=group.your-app-group +RNDA_IOS_BUNDLE_ID=com.yourcompany.yourapp +RNDA_ANDROID_PACKAGE=com.yourcompany.yourapp diff --git a/apps/example/android/.gitignore b/apps/example/android/.gitignore deleted file mode 100644 index 8a6be077..00000000 --- a/apps/example/android/.gitignore +++ /dev/null @@ -1,16 +0,0 @@ -# OSX -# -.DS_Store - -# Android/IntelliJ -# -build/ -.idea -.gradle -local.properties -*.iml -*.hprof -.cxx/ - -# Bundle artifacts -*.jsbundle diff --git a/apps/example/android/app/build.gradle b/apps/example/android/app/build.gradle deleted file mode 100644 index 8d7d60f1..00000000 --- a/apps/example/android/app/build.gradle +++ /dev/null @@ -1,201 +0,0 @@ -apply plugin: "com.android.application" -apply plugin: "org.jetbrains.kotlin.android" -apply plugin: "com.facebook.react" - -def projectRoot = rootDir.getAbsoluteFile().getParentFile().getAbsolutePath() - -static def versionToNumber(major, minor, patch) { - return patch * 100 + minor * 10000 + major * 1000000 -} - -def getRNVersion() { - def version = providers.exec { - workingDir(projectDir) - commandLine("node", "-e", "console.log(require('react-native/package.json').version);") - }.standardOutput.asText.get().trim() - - def coreVersion = version.split("-")[0] - def (major, minor, patch) = coreVersion.tokenize('.').collect { it.toInteger() } - - return versionToNumber( - major, - minor, - patch - ) -} -def rnVersion = getRNVersion() - -/** - * This is the configuration block to customize your React Native Android app. - * By default you don't need to apply any configuration, just uncomment the lines you need. - */ -react { - entryFile = file(["node", "-e", "require('expo/scripts/resolveAppEntry')", projectRoot, "android", "absolute"].execute(null, rootDir).text.trim()) - reactNativeDir = new File(["node", "--print", "require.resolve('react-native/package.json')"].execute(null, rootDir).text.trim()).getParentFile().getAbsoluteFile() - hermesCommand = new File(["node", "--print", "require.resolve('react-native/package.json')"].execute(null, rootDir).text.trim()).getParentFile().getAbsolutePath() + "/sdks/hermesc/%OS-BIN%/hermesc" - codegenDir = new File(["node", "--print", "require.resolve('@react-native/codegen/package.json', { paths: [require.resolve('react-native/package.json')] })"].execute(null, rootDir).text.trim()).getParentFile().getAbsoluteFile() - - // Use Expo CLI to bundle the app, this ensures the Metro config - // works correctly with Expo projects. - cliFile = new File(["node", "--print", "require.resolve('@expo/cli', { paths: [require.resolve('expo/package.json')] })"].execute(null, rootDir).text.trim()) - bundleCommand = "export:embed" - - /* Folders */ - // The root of your project, i.e. where "package.json" lives. Default is '..' - // root = file("../") - // The folder where the react-native NPM package is. Default is ../node_modules/react-native - // reactNativeDir = file("../node_modules/react-native") - // The folder where the react-native Codegen package is. Default is ../node_modules/@react-native/codegen - // codegenDir = file("../node_modules/@react-native/codegen") - - /* Variants */ - // The list of variants to that are debuggable. For those we're going to - // skip the bundling of the JS bundle and the assets. By default is just 'debug'. - // If you add flavors like lite, prod, etc. you'll have to list your debuggableVariants. - // debuggableVariants = ["liteDebug", "prodDebug"] - - /* Bundling */ - // A list containing the node command and its flags. Default is just 'node'. - // nodeExecutableAndArgs = ["node"] - - // - // The path to the CLI configuration file. Default is empty. - // bundleConfig = file(../rn-cli.config.js) - // - // The name of the generated asset file containing your JS bundle - // bundleAssetName = "MyApplication.android.bundle" - // - // The entry file for bundle generation. Default is 'index.android.js' or 'index.js' - // entryFile = file("../js/MyApplication.android.js") - // - // A list of extra flags to pass to the 'bundle' commands. - // See https://github.com/react-native-community/cli/blob/main/docs/commands.md#bundle - // extraPackagerArgs = [] - - /* Hermes Commands */ - // The hermes compiler command to run. By default it is 'hermesc' - // hermesCommand = "$rootDir/my-custom-hermesc/bin/hermesc" - // - // The list of flags to pass to the Hermes compiler. By default is "-O", "-output-source-map" - // hermesFlags = ["-O", "-output-source-map"] - - if (rnVersion >= versionToNumber(0, 75, 0)) { - /* Autolinking */ - autolinkLibrariesWithApp() - } -} - -/** - * Set this to true to Run Proguard on Release builds to minify the Java bytecode. - */ -def enableProguardInReleaseBuilds = (findProperty('android.enableProguardInReleaseBuilds') ?: false).toBoolean() - -/** - * The preferred build flavor of JavaScriptCore (JSC) - * - * For example, to use the international variant, you can use: - * `def jscFlavor = 'org.webkit:android-jsc-intl:+'` - * - * The international variant includes ICU i18n library and necessary data - * allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that - * give correct results when using with locales other than en-US. Note that - * this variant is about 6MiB larger per architecture than default. - */ -def jscFlavor = 'org.webkit:android-jsc:+' - -android { - ndkVersion rootProject.ext.ndkVersion - - buildToolsVersion rootProject.ext.buildToolsVersion - compileSdk rootProject.ext.compileSdkVersion - - namespace 'expo.modules.deviceactivity.example' - defaultConfig { - applicationId 'expo.modules.deviceactivity.example' - minSdkVersion rootProject.ext.minSdkVersion - targetSdkVersion rootProject.ext.targetSdkVersion - versionCode 1 - versionName "1.0.0" - } - signingConfigs { - debug { - storeFile file('debug.keystore') - storePassword 'android' - keyAlias 'androiddebugkey' - keyPassword 'android' - } - } - buildTypes { - debug { - signingConfig signingConfigs.debug - } - release { - // Caution! In production, you need to generate your own keystore file. - // see https://reactnative.dev/docs/signed-apk-android. - signingConfig signingConfigs.debug - shrinkResources (findProperty('android.enableShrinkResourcesInReleaseBuilds')?.toBoolean() ?: false) - minifyEnabled enableProguardInReleaseBuilds - proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" - crunchPngs (findProperty('android.enablePngCrunchInReleaseBuilds')?.toBoolean() ?: true) - } - } - packagingOptions { - jniLibs { - useLegacyPackaging (findProperty('expo.useLegacyPackaging')?.toBoolean() ?: false) - } - } -} - -// Apply static values from `gradle.properties` to the `android.packagingOptions` -// Accepts values in comma delimited lists, example: -// android.packagingOptions.pickFirsts=/LICENSE,**/picasa.ini -["pickFirsts", "excludes", "merges", "doNotStrip"].each { prop -> - // Split option: 'foo,bar' -> ['foo', 'bar'] - def options = (findProperty("android.packagingOptions.$prop") ?: "").split(","); - // Trim all elements in place. - for (i in 0.. 0) { - println "android.packagingOptions.$prop += $options ($options.length)" - // Ex: android.packagingOptions.pickFirsts += '**/SCCS/**' - options.each { - android.packagingOptions[prop] += it - } - } -} - -dependencies { - // The version of react-native is set by the React Native Gradle Plugin - implementation("com.facebook.react:react-android") - - def isGifEnabled = (findProperty('expo.gif.enabled') ?: "") == "true"; - def isWebpEnabled = (findProperty('expo.webp.enabled') ?: "") == "true"; - def isWebpAnimatedEnabled = (findProperty('expo.webp.animated') ?: "") == "true"; - - if (isGifEnabled) { - // For animated gif support - implementation("com.facebook.fresco:animated-gif:${reactAndroidLibs.versions.fresco.get()}") - } - - if (isWebpEnabled) { - // For webp support - implementation("com.facebook.fresco:webpsupport:${reactAndroidLibs.versions.fresco.get()}") - if (isWebpAnimatedEnabled) { - // Animated webp support - implementation("com.facebook.fresco:animated-webp:${reactAndroidLibs.versions.fresco.get()}") - } - } - - if (hermesEnabled.toBoolean()) { - implementation("com.facebook.react:hermes-android") - } else { - implementation jscFlavor - } -} - -if (rnVersion < versionToNumber(0, 75, 0)) { - apply from: new File(["node", "--print", "require.resolve('@react-native-community/cli-platform-android/package.json', { paths: [require.resolve('react-native/package.json')] })"].execute(null, rootDir).text.trim(), "../native_modules.gradle"); - applyNativeModulesAppBuildGradle(project) -} diff --git a/apps/example/android/app/debug.keystore b/apps/example/android/app/debug.keystore deleted file mode 100644 index 364e105e..00000000 Binary files a/apps/example/android/app/debug.keystore and /dev/null differ diff --git a/apps/example/android/app/proguard-rules.pro b/apps/example/android/app/proguard-rules.pro deleted file mode 100644 index 551eb41d..00000000 --- a/apps/example/android/app/proguard-rules.pro +++ /dev/null @@ -1,14 +0,0 @@ -# Add project specific ProGuard rules here. -# By default, the flags in this file are appended to flags specified -# in /usr/local/Cellar/android-sdk/24.3.3/tools/proguard/proguard-android.txt -# You can edit the include path and order by changing the proguardFiles -# directive in build.gradle. -# -# For more details, see -# http://developer.android.com/guide/developing/tools/proguard.html - -# react-native-reanimated --keep class com.swmansion.reanimated.** { *; } --keep class com.facebook.react.turbomodule.** { *; } - -# Add any project specific keep options here: diff --git a/apps/example/android/app/src/debug/AndroidManifest.xml b/apps/example/android/app/src/debug/AndroidManifest.xml deleted file mode 100644 index 3ec2507b..00000000 --- a/apps/example/android/app/src/debug/AndroidManifest.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - diff --git a/apps/example/android/app/src/main/AndroidManifest.xml b/apps/example/android/app/src/main/AndroidManifest.xml deleted file mode 100644 index 7887c00c..00000000 --- a/apps/example/android/app/src/main/AndroidManifest.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/apps/example/android/app/src/main/java/expo/modules/deviceactivity/example/MainActivity.kt b/apps/example/android/app/src/main/java/expo/modules/deviceactivity/example/MainActivity.kt deleted file mode 100644 index 48624eef..00000000 --- a/apps/example/android/app/src/main/java/expo/modules/deviceactivity/example/MainActivity.kt +++ /dev/null @@ -1,61 +0,0 @@ -package expo.modules.deviceactivity.example - -import android.os.Build -import android.os.Bundle - -import com.facebook.react.ReactActivity -import com.facebook.react.ReactActivityDelegate -import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.fabricEnabled -import com.facebook.react.defaults.DefaultReactActivityDelegate - -import expo.modules.ReactActivityDelegateWrapper - -class MainActivity : ReactActivity() { - override fun onCreate(savedInstanceState: Bundle?) { - // Set the theme to AppTheme BEFORE onCreate to support - // coloring the background, status bar, and navigation bar. - // This is required for expo-splash-screen. - setTheme(R.style.AppTheme); - super.onCreate(null) - } - - /** - * Returns the name of the main component registered from JavaScript. This is used to schedule - * rendering of the component. - */ - override fun getMainComponentName(): String = "main" - - /** - * Returns the instance of the [ReactActivityDelegate]. We use [DefaultReactActivityDelegate] - * which allows you to enable New Architecture with a single boolean flags [fabricEnabled] - */ - override fun createReactActivityDelegate(): ReactActivityDelegate { - return ReactActivityDelegateWrapper( - this, - BuildConfig.IS_NEW_ARCHITECTURE_ENABLED, - object : DefaultReactActivityDelegate( - this, - mainComponentName, - fabricEnabled - ){}) - } - - /** - * Align the back button behavior with Android S - * where moving root activities to background instead of finishing activities. - * @see onBackPressed - */ - override fun invokeDefaultOnBackPressed() { - if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.R) { - if (!moveTaskToBack(false)) { - // For non-root activities, use the default implementation to finish them. - super.invokeDefaultOnBackPressed() - } - return - } - - // Use the default back button implementation on Android S - // because it's doing more than [Activity.moveTaskToBack] in fact. - super.invokeDefaultOnBackPressed() - } -} diff --git a/apps/example/android/app/src/main/java/expo/modules/deviceactivity/example/MainApplication.kt b/apps/example/android/app/src/main/java/expo/modules/deviceactivity/example/MainApplication.kt deleted file mode 100644 index a7599c4d..00000000 --- a/apps/example/android/app/src/main/java/expo/modules/deviceactivity/example/MainApplication.kt +++ /dev/null @@ -1,55 +0,0 @@ -package expo.modules.deviceactivity.example - -import android.app.Application -import android.content.res.Configuration - -import com.facebook.react.PackageList -import com.facebook.react.ReactApplication -import com.facebook.react.ReactNativeHost -import com.facebook.react.ReactPackage -import com.facebook.react.ReactHost -import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.load -import com.facebook.react.defaults.DefaultReactNativeHost -import com.facebook.soloader.SoLoader - -import expo.modules.ApplicationLifecycleDispatcher -import expo.modules.ReactNativeHostWrapper - -class MainApplication : Application(), ReactApplication { - - override val reactNativeHost: ReactNativeHost = ReactNativeHostWrapper( - this, - object : DefaultReactNativeHost(this) { - override fun getPackages(): List { - // Packages that cannot be autolinked yet can be added manually here, for example: - // packages.add(new MyReactNativePackage()); - return PackageList(this).packages - } - - override fun getJSMainModuleName(): String = ".expo/.virtual-metro-entry" - - override fun getUseDeveloperSupport(): Boolean = BuildConfig.DEBUG - - override val isNewArchEnabled: Boolean = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED - override val isHermesEnabled: Boolean = BuildConfig.IS_HERMES_ENABLED - } - ) - - override val reactHost: ReactHost - get() = ReactNativeHostWrapper.createReactHost(applicationContext, reactNativeHost) - - override fun onCreate() { - super.onCreate() - SoLoader.init(this, false) - if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) { - // If you opted-in for the New Architecture, we load the native entry point for this app. - load() - } - ApplicationLifecycleDispatcher.onApplicationCreate(this) - } - - override fun onConfigurationChanged(newConfig: Configuration) { - super.onConfigurationChanged(newConfig) - ApplicationLifecycleDispatcher.onConfigurationChanged(this, newConfig) - } -} diff --git a/apps/example/android/app/src/main/res/drawable-hdpi/splashscreen_image.png b/apps/example/android/app/src/main/res/drawable-hdpi/splashscreen_image.png deleted file mode 100644 index c52c2c68..00000000 Binary files a/apps/example/android/app/src/main/res/drawable-hdpi/splashscreen_image.png and /dev/null differ diff --git a/apps/example/android/app/src/main/res/drawable-mdpi/splashscreen_image.png b/apps/example/android/app/src/main/res/drawable-mdpi/splashscreen_image.png deleted file mode 100644 index c52c2c68..00000000 Binary files a/apps/example/android/app/src/main/res/drawable-mdpi/splashscreen_image.png and /dev/null differ diff --git a/apps/example/android/app/src/main/res/drawable-xhdpi/splashscreen_image.png b/apps/example/android/app/src/main/res/drawable-xhdpi/splashscreen_image.png deleted file mode 100644 index c52c2c68..00000000 Binary files a/apps/example/android/app/src/main/res/drawable-xhdpi/splashscreen_image.png and /dev/null differ diff --git a/apps/example/android/app/src/main/res/drawable-xxhdpi/splashscreen_image.png b/apps/example/android/app/src/main/res/drawable-xxhdpi/splashscreen_image.png deleted file mode 100644 index c52c2c68..00000000 Binary files a/apps/example/android/app/src/main/res/drawable-xxhdpi/splashscreen_image.png and /dev/null differ diff --git a/apps/example/android/app/src/main/res/drawable-xxxhdpi/splashscreen_image.png b/apps/example/android/app/src/main/res/drawable-xxxhdpi/splashscreen_image.png deleted file mode 100644 index c52c2c68..00000000 Binary files a/apps/example/android/app/src/main/res/drawable-xxxhdpi/splashscreen_image.png and /dev/null differ diff --git a/apps/example/android/app/src/main/res/drawable/kingstinct.png b/apps/example/android/app/src/main/res/drawable/kingstinct.png deleted file mode 100644 index cebd97f5..00000000 Binary files a/apps/example/android/app/src/main/res/drawable/kingstinct.png and /dev/null differ diff --git a/apps/example/android/app/src/main/res/drawable/rn_edit_text_material.xml b/apps/example/android/app/src/main/res/drawable/rn_edit_text_material.xml deleted file mode 100644 index 5c25e728..00000000 --- a/apps/example/android/app/src/main/res/drawable/rn_edit_text_material.xml +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - - - - - diff --git a/apps/example/android/app/src/main/res/drawable/splashscreen.xml b/apps/example/android/app/src/main/res/drawable/splashscreen.xml deleted file mode 100644 index c8568e16..00000000 --- a/apps/example/android/app/src/main/res/drawable/splashscreen.xml +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/apps/example/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/apps/example/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml deleted file mode 100644 index 3941bea9..00000000 --- a/apps/example/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/apps/example/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/apps/example/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml deleted file mode 100644 index 3941bea9..00000000 --- a/apps/example/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/apps/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/apps/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png deleted file mode 100644 index 0a61c1b2..00000000 Binary files a/apps/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png and /dev/null differ diff --git a/apps/example/android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png b/apps/example/android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png deleted file mode 100644 index ac03dbf6..00000000 Binary files a/apps/example/android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png and /dev/null differ diff --git a/apps/example/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png b/apps/example/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png deleted file mode 100644 index 26deb972..00000000 Binary files a/apps/example/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png and /dev/null differ diff --git a/apps/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/apps/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png deleted file mode 100644 index fd1a2c71..00000000 Binary files a/apps/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png and /dev/null differ diff --git a/apps/example/android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png b/apps/example/android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png deleted file mode 100644 index e1173a94..00000000 Binary files a/apps/example/android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png and /dev/null differ diff --git a/apps/example/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png b/apps/example/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png deleted file mode 100644 index 4d3ac7a4..00000000 Binary files a/apps/example/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png and /dev/null differ diff --git a/apps/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/apps/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png deleted file mode 100644 index d57caa30..00000000 Binary files a/apps/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png and /dev/null differ diff --git a/apps/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png b/apps/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png deleted file mode 100644 index ff086fdc..00000000 Binary files a/apps/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png and /dev/null differ diff --git a/apps/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/apps/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png deleted file mode 100644 index 95ac5824..00000000 Binary files a/apps/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png and /dev/null differ diff --git a/apps/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/apps/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png deleted file mode 100644 index 0a07e73a..00000000 Binary files a/apps/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png and /dev/null differ diff --git a/apps/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png b/apps/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png deleted file mode 100644 index f7f1d069..00000000 Binary files a/apps/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png and /dev/null differ diff --git a/apps/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/apps/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png deleted file mode 100644 index 6508f742..00000000 Binary files a/apps/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png and /dev/null differ diff --git a/apps/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/apps/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png deleted file mode 100644 index 499e372b..00000000 Binary files a/apps/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png and /dev/null differ diff --git a/apps/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png b/apps/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png deleted file mode 100644 index 49a464ee..00000000 Binary files a/apps/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png and /dev/null differ diff --git a/apps/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/apps/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png deleted file mode 100644 index d54716bf..00000000 Binary files a/apps/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png and /dev/null differ diff --git a/apps/example/android/app/src/main/res/values-night/colors.xml b/apps/example/android/app/src/main/res/values-night/colors.xml deleted file mode 100644 index 3c05de5b..00000000 --- a/apps/example/android/app/src/main/res/values-night/colors.xml +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/apps/example/android/app/src/main/res/values/colors.xml b/apps/example/android/app/src/main/res/values/colors.xml deleted file mode 100644 index f387b901..00000000 --- a/apps/example/android/app/src/main/res/values/colors.xml +++ /dev/null @@ -1,6 +0,0 @@ - - #ffffff - #ffffff - #023c69 - #ffffff - \ No newline at end of file diff --git a/apps/example/android/app/src/main/res/values/strings.xml b/apps/example/android/app/src/main/res/values/strings.xml deleted file mode 100644 index cdba88ec..00000000 --- a/apps/example/android/app/src/main/res/values/strings.xml +++ /dev/null @@ -1,5 +0,0 @@ - - react-native-device-activity-example - contain - false - \ No newline at end of file diff --git a/apps/example/android/app/src/main/res/values/styles.xml b/apps/example/android/app/src/main/res/values/styles.xml deleted file mode 100644 index ab7cb49e..00000000 --- a/apps/example/android/app/src/main/res/values/styles.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - \ No newline at end of file diff --git a/apps/example/android/build.gradle b/apps/example/android/build.gradle deleted file mode 100644 index 932bf7b3..00000000 --- a/apps/example/android/build.gradle +++ /dev/null @@ -1,41 +0,0 @@ -// Top-level build file where you can add configuration options common to all sub-projects/modules. - -buildscript { - ext { - buildToolsVersion = findProperty('android.buildToolsVersion') ?: '34.0.0' - minSdkVersion = Integer.parseInt(findProperty('android.minSdkVersion') ?: '23') - compileSdkVersion = Integer.parseInt(findProperty('android.compileSdkVersion') ?: '34') - targetSdkVersion = Integer.parseInt(findProperty('android.targetSdkVersion') ?: '34') - kotlinVersion = findProperty('android.kotlinVersion') ?: '1.9.23' - - ndkVersion = "26.1.10909125" - } - repositories { - google() - mavenCentral() - } - dependencies { - classpath('com.android.tools.build:gradle') - classpath('com.facebook.react:react-native-gradle-plugin') - classpath('org.jetbrains.kotlin:kotlin-gradle-plugin') - } -} - -apply plugin: "com.facebook.react.rootproject" - -allprojects { - repositories { - maven { - // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm - url(new File(['node', '--print', "require.resolve('react-native/package.json')"].execute(null, rootDir).text.trim(), '../android')) - } - maven { - // Android JSC is installed from npm - url(new File(['node', '--print', "require.resolve('jsc-android/package.json', { paths: [require.resolve('react-native/package.json')] })"].execute(null, rootDir).text.trim(), '../dist')) - } - - google() - mavenCentral() - maven { url 'https://www.jitpack.io' } - } -} diff --git a/apps/example/android/gradle.properties b/apps/example/android/gradle.properties deleted file mode 100644 index e56f44c8..00000000 --- a/apps/example/android/gradle.properties +++ /dev/null @@ -1,61 +0,0 @@ -# Project-wide Gradle settings. - -# IDE (e.g. Android Studio) users: -# Gradle settings configured through the IDE *will override* -# any settings specified in this file. - -# For more details on how to configure your build environment visit -# http://www.gradle.org/docs/current/userguide/build_environment.html - -# Specifies the JVM arguments used for the daemon process. -# The setting is particularly useful for tweaking memory settings. -# Default value: -Xmx512m -XX:MaxMetaspaceSize=256m -org.gradle.jvmargs=-Xmx2048m -XX:MaxMetaspaceSize=512m - -# When configured, Gradle will run in incubating parallel mode. -# This option should only be used with decoupled projects. More details, visit -# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects -# org.gradle.parallel=true - -# AndroidX package structure to make it clearer which packages are bundled with the -# Android operating system, and which are packaged with your app's APK -# https://developer.android.com/topic/libraries/support-library/androidx-rn -android.useAndroidX=true - -# Automatically convert third-party libraries to use AndroidX -android.enableJetifier=true - -# Enable AAPT2 PNG crunching -android.enablePngCrunchInReleaseBuilds=true - -# Use this property to specify which architecture you want to build. -# You can also override it from the CLI using -# ./gradlew -PreactNativeArchitectures=x86_64 -reactNativeArchitectures=armeabi-v7a,arm64-v8a,x86,x86_64 - -# Use this property to enable support to the new architecture. -# This will allow you to use TurboModules and the Fabric render in -# your application. You should enable this flag either if you want -# to write custom TurboModules/Fabric components OR use libraries that -# are providing them. -newArchEnabled=false - -# Use this property to enable or disable the Hermes JS engine. -# If set to false, you will be using JSC instead. -hermesEnabled=true - -# Enable GIF support in React Native images (~200 B increase) -expo.gif.enabled=true -# Enable webp support in React Native images (~85 KB increase) -expo.webp.enabled=true -# Enable animated webp support (~3.4 MB increase) -# Disabled by default because iOS doesn't support animated webp -expo.webp.animated=false - -# Enable network inspector -EX_DEV_CLIENT_NETWORK_INSPECTOR=true - -# Use legacy packaging to compress native libraries in the resulting APK. -expo.useLegacyPackaging=false - -android.extraMavenRepos=[] \ No newline at end of file diff --git a/apps/example/android/gradle/wrapper/gradle-wrapper.jar b/apps/example/android/gradle/wrapper/gradle-wrapper.jar deleted file mode 100644 index e6441136..00000000 Binary files a/apps/example/android/gradle/wrapper/gradle-wrapper.jar and /dev/null differ diff --git a/apps/example/android/gradle/wrapper/gradle-wrapper.properties b/apps/example/android/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index 6f7a6eb3..00000000 --- a/apps/example/android/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,7 +0,0 @@ -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-all.zip -networkTimeout=10000 -validateDistributionUrl=true -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists diff --git a/apps/example/android/gradlew b/apps/example/android/gradlew deleted file mode 100755 index 1aa94a42..00000000 --- a/apps/example/android/gradlew +++ /dev/null @@ -1,249 +0,0 @@ -#!/bin/sh - -# -# Copyright © 2015-2021 the original authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -############################################################################## -# -# Gradle start up script for POSIX generated by Gradle. -# -# Important for running: -# -# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is -# noncompliant, but you have some other compliant shell such as ksh or -# bash, then to run this script, type that shell name before the whole -# command line, like: -# -# ksh Gradle -# -# Busybox and similar reduced shells will NOT work, because this script -# requires all of these POSIX shell features: -# * functions; -# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», -# «${var#prefix}», «${var%suffix}», and «$( cmd )»; -# * compound commands having a testable exit status, especially «case»; -# * various built-in commands including «command», «set», and «ulimit». -# -# Important for patching: -# -# (2) This script targets any POSIX shell, so it avoids extensions provided -# by Bash, Ksh, etc; in particular arrays are avoided. -# -# The "traditional" practice of packing multiple parameters into a -# space-separated string is a well documented source of bugs and security -# problems, so this is (mostly) avoided, by progressively accumulating -# options in "$@", and eventually passing that to Java. -# -# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, -# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; -# see the in-line comments for details. -# -# There are tweaks for specific operating systems such as AIX, CygWin, -# Darwin, MinGW, and NonStop. -# -# (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt -# within the Gradle project. -# -# You can find Gradle at https://github.com/gradle/gradle/. -# -############################################################################## - -# Attempt to set APP_HOME - -# Resolve links: $0 may be a link -app_path=$0 - -# Need this for daisy-chained symlinks. -while - APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path - [ -h "$app_path" ] -do - ls=$( ls -ld "$app_path" ) - link=${ls#*' -> '} - case $link in #( - /*) app_path=$link ;; #( - *) app_path=$APP_HOME$link ;; - esac -done - -# This is normally unused -# shellcheck disable=SC2034 -APP_BASE_NAME=${0##*/} -# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) -APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD=maximum - -warn () { - echo "$*" -} >&2 - -die () { - echo - echo "$*" - echo - exit 1 -} >&2 - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -nonstop=false -case "$( uname )" in #( - CYGWIN* ) cygwin=true ;; #( - Darwin* ) darwin=true ;; #( - MSYS* | MINGW* ) msys=true ;; #( - NONSTOP* ) nonstop=true ;; -esac - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - - -# Determine the Java command to use to start the JVM. -if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD=$JAVA_HOME/jre/sh/java - else - JAVACMD=$JAVA_HOME/bin/java - fi - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD=java - if ! command -v java >/dev/null 2>&1 - then - die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -fi - -# Increase the maximum file descriptors if we can. -if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then - case $MAX_FD in #( - max*) - # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC2039,SC3045 - MAX_FD=$( ulimit -H -n ) || - warn "Could not query maximum file descriptor limit" - esac - case $MAX_FD in #( - '' | soft) :;; #( - *) - # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC2039,SC3045 - ulimit -n "$MAX_FD" || - warn "Could not set maximum file descriptor limit to $MAX_FD" - esac -fi - -# Collect all arguments for the java command, stacking in reverse order: -# * args from the command line -# * the main class name -# * -classpath -# * -D...appname settings -# * --module-path (only if needed) -# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. - -# For Cygwin or MSYS, switch paths to Windows format before running java -if "$cygwin" || "$msys" ; then - APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) - CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) - - JAVACMD=$( cygpath --unix "$JAVACMD" ) - - # Now convert the arguments - kludge to limit ourselves to /bin/sh - for arg do - if - case $arg in #( - -*) false ;; # don't mess with options #( - /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath - [ -e "$t" ] ;; #( - *) false ;; - esac - then - arg=$( cygpath --path --ignore --mixed "$arg" ) - fi - # Roll the args list around exactly as many times as the number of - # args, so each arg winds up back in the position where it started, but - # possibly modified. - # - # NB: a `for` loop captures its iteration list before it begins, so - # changing the positional parameters here affects neither the number of - # iterations, nor the values presented in `arg`. - shift # remove old arg - set -- "$@" "$arg" # push replacement arg - done -fi - - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' - -# Collect all arguments for the java command: -# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, -# and any embedded shellness will be escaped. -# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be -# treated as '${Hostname}' itself on the command line. - -set -- \ - "-Dorg.gradle.appname=$APP_BASE_NAME" \ - -classpath "$CLASSPATH" \ - org.gradle.wrapper.GradleWrapperMain \ - "$@" - -# Stop when "xargs" is not available. -if ! command -v xargs >/dev/null 2>&1 -then - die "xargs is not available" -fi - -# Use "xargs" to parse quoted args. -# -# With -n1 it outputs one arg per line, with the quotes and backslashes removed. -# -# In Bash we could simply go: -# -# readarray ARGS < <( xargs -n1 <<<"$var" ) && -# set -- "${ARGS[@]}" "$@" -# -# but POSIX shell has neither arrays nor command substitution, so instead we -# post-process each arg (as a line of input to sed) to backslash-escape any -# character that might be a shell metacharacter, then use eval to reverse -# that process (while maintaining the separation between arguments), and wrap -# the whole thing up as a single "set" statement. -# -# This will of course break if any of these variables contains a newline or -# an unmatched quote. -# - -eval "set -- $( - printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | - xargs -n1 | - sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | - tr '\n' ' ' - )" '"$@"' - -exec "$JAVACMD" "$@" diff --git a/apps/example/android/gradlew.bat b/apps/example/android/gradlew.bat deleted file mode 100644 index 7101f8e4..00000000 --- a/apps/example/android/gradlew.bat +++ /dev/null @@ -1,92 +0,0 @@ -@rem -@rem Copyright 2015 the original author or authors. -@rem -@rem Licensed under the Apache License, Version 2.0 (the "License"); -@rem you may not use this file except in compliance with the License. -@rem You may obtain a copy of the License at -@rem -@rem https://www.apache.org/licenses/LICENSE-2.0 -@rem -@rem Unless required by applicable law or agreed to in writing, software -@rem distributed under the License is distributed on an "AS IS" BASIS, -@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@rem See the License for the specific language governing permissions and -@rem limitations under the License. -@rem - -@if "%DEBUG%"=="" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%"=="" set DIRNAME=. -@rem This is normally unused -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Resolve any "." and ".." in APP_HOME to make it shorter. -for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if %ERRORLEVEL% equ 0 goto execute - -echo. 1>&2 -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 -echo. 1>&2 -echo Please set the JAVA_HOME variable in your environment to match the 1>&2 -echo location of your Java installation. 1>&2 - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto execute - -echo. 1>&2 -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 -echo. 1>&2 -echo Please set the JAVA_HOME variable in your environment to match the 1>&2 -echo location of your Java installation. 1>&2 - -goto fail - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* - -:end -@rem End local scope for the variables with windows NT shell -if %ERRORLEVEL% equ 0 goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -set EXIT_CODE=%ERRORLEVEL% -if %EXIT_CODE% equ 0 set EXIT_CODE=1 -if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% -exit /b %EXIT_CODE% - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega diff --git a/apps/example/android/react-settings-plugin/build.gradle.kts b/apps/example/android/react-settings-plugin/build.gradle.kts deleted file mode 100644 index b4f6668e..00000000 --- a/apps/example/android/react-settings-plugin/build.gradle.kts +++ /dev/null @@ -1,19 +0,0 @@ -import org.jetbrains.kotlin.gradle.tasks.KotlinCompile - -plugins { - kotlin("jvm") version "1.9.24" - id("java-gradle-plugin") -} - -repositories { - mavenCentral() -} - -gradlePlugin { - plugins { - create("reactSettingsPlugin") { - id = "com.facebook.react.settings" - implementationClass = "expo.plugins.ReactSettingsPlugin" - } - } -} diff --git a/apps/example/android/react-settings-plugin/src/main/kotlin/expo/plugins/ReactSettingsPlugin.kt b/apps/example/android/react-settings-plugin/src/main/kotlin/expo/plugins/ReactSettingsPlugin.kt deleted file mode 100644 index c54f6c7a..00000000 --- a/apps/example/android/react-settings-plugin/src/main/kotlin/expo/plugins/ReactSettingsPlugin.kt +++ /dev/null @@ -1,10 +0,0 @@ -package expo.plugins - -import org.gradle.api.Plugin -import org.gradle.api.initialization.Settings - -class ReactSettingsPlugin : Plugin { - override fun apply(settings: Settings) { - // Do nothing, just register the plugin. - } -} diff --git a/apps/example/android/settings.gradle b/apps/example/android/settings.gradle deleted file mode 100644 index 219427a1..00000000 --- a/apps/example/android/settings.gradle +++ /dev/null @@ -1,66 +0,0 @@ -pluginManagement { - def version = providers.exec { - commandLine("node", "-e", "console.log(require('react-native/package.json').version);") - }.standardOutput.asText.get().trim() - def (_, reactNativeMinor, reactNativePatch) = version.split("-")[0].tokenize('.').collect { it.toInteger() } - - includeBuild(new File(["node", "--print", "require.resolve('@react-native/gradle-plugin/package.json')"].execute(null, rootDir).text.trim()).getParentFile().toString()) - if(reactNativeMinor == 74 && reactNativePatch <= 3){ - includeBuild("react-settings-plugin") - } -} - -plugins { id("com.facebook.react.settings") } - -def getRNMinorVersion() { - def version = providers.exec { - commandLine("node", "-e", "console.log(require('react-native/package.json').version);") - }.standardOutput.asText.get().trim() - - def coreVersion = version.split("-")[0] - def (major, minor, patch) = coreVersion.tokenize('.').collect { it.toInteger() } - - return minor -} - -if (getRNMinorVersion() >= 75) { - extensions.configure(com.facebook.react.ReactSettingsExtension) { ex -> - if (System.getenv('EXPO_UNSTABLE_CORE_AUTOLINKING') == '1') { - println('\u001B[32mUsing expo-modules-autolinking as core autolinking source\u001B[0m') - def command = [ - 'node', - '--no-warnings', - '--eval', - 'require(require.resolve(\'expo-modules-autolinking\', { paths: [require.resolve(\'expo/package.json\')] }))(process.argv.slice(1))', - 'react-native-config', - '--json', - '--platform', - 'android' - ].toList() - ex.autolinkLibrariesFromCommand(command) - } else { - ex.autolinkLibrariesFromCommand() - } - } -} - -rootProject.name = 'react-native-device-activity-example' - -dependencyResolutionManagement { - versionCatalogs { - reactAndroidLibs { - from(files(new File(["node", "--print", "require.resolve('react-native/package.json')"].execute(null, rootDir).text.trim(), "../gradle/libs.versions.toml"))) - } - } -} - -apply from: new File(["node", "--print", "require.resolve('expo/package.json')"].execute(null, rootDir).text.trim(), "../scripts/autolinking.gradle"); -useExpoModules() - -if (getRNMinorVersion() < 75) { - apply from: new File(["node", "--print", "require.resolve('@react-native-community/cli-platform-android/package.json', { paths: [require.resolve('react-native/package.json')] })"].execute(null, rootDir).text.trim(), "../native_modules.gradle"); - applyNativeModulesSettingsGradle(settings) -} - -include ':app' -includeBuild(new File(["node", "--print", "require.resolve('@react-native/gradle-plugin/package.json', { paths: [require.resolve('react-native/package.json')] })"].execute(null, rootDir).text.trim()).getParentFile()) diff --git a/apps/example/app.config.ts b/apps/example/app.config.ts new file mode 100644 index 00000000..8603b78c --- /dev/null +++ b/apps/example/app.config.ts @@ -0,0 +1,99 @@ +import type { ExpoConfig } from "expo/config"; + +const APPLE_TEAM_ID = process.env.RNDA_APPLE_TEAM_ID ?? "34SE8X7Q58"; +const APP_GROUP = process.env.RNDA_APP_GROUP ?? "group.ActivityMonitor"; +const IOS_BUNDLE_ID = + process.env.RNDA_IOS_BUNDLE_ID ?? "expo.modules.deviceactivity.example"; +const ANDROID_PACKAGE = + process.env.RNDA_ANDROID_PACKAGE ?? "expo.modules.deviceactivity.example"; + +const appExtensions = [ + { + targetName: "ActivityMonitorExtension", + bundleIdentifier: `${IOS_BUNDLE_ID}.ActivityMonitorExtension`, + entitlements: { + "com.apple.developer.family-controls": true, + "com.apple.security.application-groups": [APP_GROUP], + }, + }, + { + targetName: "ShieldConfiguration", + bundleIdentifier: `${IOS_BUNDLE_ID}.ShieldConfiguration`, + entitlements: { + "com.apple.developer.family-controls": true, + "com.apple.security.application-groups": [APP_GROUP], + }, + }, + { + targetName: "ShieldAction", + bundleIdentifier: `${IOS_BUNDLE_ID}.ShieldAction`, + entitlements: { + "com.apple.developer.family-controls": true, + "com.apple.security.application-groups": [APP_GROUP], + }, + }, +] as const; + +const config: ExpoConfig = { + name: "react-native-device-activity-example", + slug: "react-native-device-activity-example", + version: "1.0.0", + scheme: "device-activity", + orientation: "portrait", + icon: "./assets/icon.png", + platforms: ["ios"], + userInterfaceStyle: "light", + splash: { + image: "./assets/splash.png", + resizeMode: "contain", + backgroundColor: "#ffffff", + }, + ios: { + appleTeamId: APPLE_TEAM_ID, + supportsTablet: true, + bundleIdentifier: IOS_BUNDLE_ID, + }, + assetBundlePatterns: ["assets/*"], + android: { + package: ANDROID_PACKAGE, + }, + web: { + favicon: "./assets/favicon.png", + }, + plugins: [ + [ + "expo-build-properties", + { + ios: { + deploymentTarget: "15.1", + }, + }, + ], + [ + "expo-asset", + { + assets: ["./assets/kingstinct.png"], + }, + ], + [ + "react-native-device-activity", + { + appGroup: APP_GROUP, + copyToTargetFolder: false, + }, + ], + ], + extra: { + eas: { + build: { + experimental: { + ios: { + appExtensions, + }, + }, + }, + }, + }, +}; + +export default config; diff --git a/apps/example/app.json b/apps/example/app.json deleted file mode 100644 index a5cb611e..00000000 --- a/apps/example/app.json +++ /dev/null @@ -1,91 +0,0 @@ -{ - "expo": { - "name": "react-native-device-activity-example", - "slug": "react-native-device-activity-example", - "version": "1.0.0", - "scheme": "device-activity", - "orientation": "portrait", - "icon": "./assets/icon.png", - "platforms": ["ios"], - "userInterfaceStyle": "light", - "splash": { - "image": "./assets/splash.png", - "resizeMode": "contain", - "backgroundColor": "#ffffff" - }, - "ios": { - "appleTeamId": "34SE8X7Q58", - "supportsTablet": true, - "bundleIdentifier": "expo.modules.deviceactivity.example" - }, - "assetBundlePatterns": [ - "assets/*" - ], - "android": { - "package": "expo.modules.deviceactivity.example", - }, - "web": { - "favicon": "./assets/favicon.png" - }, - "plugins": [ - [ - "expo-build-properties", - { - "ios": { - "deploymentTarget": "15.1" - } - } - ], - - [ - "expo-asset", - { - "assets": ["./assets/kingstinct.png"] - } - ], - [ - "../../packages/react-native-device-activity/app.plugin.js", - { - "appGroup": "group.ActivityMonitor", - "copyToTargetFolder": false - } - ] - ], - "extra": { - "eas": { - "build": { - "experimental": { - "ios": { - "appExtensions": [ - { - "targetName": "ActivityMonitorExtension", - "bundleIdentifier": "expo.modules.deviceactivity.example.ActivityMonitorExtension", - "entitlements": { - "com.apple.developer.family-controls": true, - "com.apple.security.application-groups": ["group.ActivityMonitor"] - } - }, - { - "targetName": "ShieldConfiguration", - "bundleIdentifier": "expo.modules.deviceactivity.example.ShieldConfiguration", - "entitlements": { - "com.apple.developer.family-controls": true, - "com.apple.security.application-groups": ["group.ActivityMonitor"] - } - }, - { - "targetName": "ShieldAction", - "bundleIdentifier": "expo.modules.deviceactivity.example.ShieldAction", - "entitlements": { - "com.apple.developer.family-controls": true, - "com.apple.security.application-groups": ["group.ActivityMonitor"] - } - } - ] - } - } - } - } - } - } -} \ No newline at end of file diff --git a/apps/example/babel.config.js b/apps/example/babel.config.js index 9d89e131..73ebf58e 100644 --- a/apps/example/babel.config.js +++ b/apps/example/babel.config.js @@ -1,6 +1,6 @@ module.exports = function (api) { api.cache(true); return { - presets: ['babel-preset-expo'], + presets: ["babel-preset-expo"], }; }; diff --git a/apps/example/components/CreateActivity.tsx b/apps/example/components/CreateActivity.tsx index 8488c3b6..0b26277b 100644 --- a/apps/example/components/CreateActivity.tsx +++ b/apps/example/components/CreateActivity.tsx @@ -236,7 +236,7 @@ export const CreateActivity = ({ onDismiss }: { onDismiss: () => void }) => { mode="contained" disabled={!familyActivitySelectionResult || !activityName} onPress={() => { - void startMonitoring( + startMonitoring( familyActivitySelectionResult?.familyActivitySelection ?? "", activityName, ); diff --git a/apps/example/ios/reactnativedeviceactivityexample/Images.xcassets/Contents.json b/apps/example/ios/reactnativedeviceactivityexample/Images.xcassets/Contents.json deleted file mode 100644 index ed285c2e..00000000 --- a/apps/example/ios/reactnativedeviceactivityexample/Images.xcassets/Contents.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "info" : { - "version" : 1, - "author" : "expo" - } -} diff --git a/apps/example/package.json b/apps/example/package.json index 61a61160..8365938b 100644 --- a/apps/example/package.json +++ b/apps/example/package.json @@ -4,12 +4,12 @@ "main": "index.js", "scripts": { "start": "INTERNALLY_TEST_EXAMPLE_PROJECT=true expo start", - "android": "INTERNALLY_TEST_EXAMPLE_PROJECT=true expo run:android", - "ios": "INTERNALLY_TEST_EXAMPLE_PROJECT=true expo run:ios", + "android": "COPY_TO_TARGET_FOLDER=true INTERNALLY_TEST_EXAMPLE_PROJECT=true expo run:android", + "ios": "COPY_TO_TARGET_FOLDER=true INTERNALLY_TEST_EXAMPLE_PROJECT=true expo run:ios", "web": "INTERNALLY_TEST_EXAMPLE_PROJECT=true expo start --web", "bundle": "INTERNALLY_TEST_EXAMPLE_PROJECT=true expo export", "typecheck": "tsc --noEmit", - "prebuild": "rm -rf targets && COPY_TO_TARGET_FOLDER=true INTERNALLY_TEST_EXAMPLE_PROJECT=true npx expo prebuild --platform=ios --clean" + "prebuild": "rm -rf targets && COPY_TO_TARGET_FOLDER=true INTERNALLY_TEST_EXAMPLE_PROJECT=true bunx expo prebuild --platform=ios --clean" }, "dependencies": { "expo": "52", diff --git a/apps/example/screens/AllTheThings.tsx b/apps/example/screens/AllTheThings.tsx index ab6fd20d..0b034a3a 100644 --- a/apps/example/screens/AllTheThings.tsx +++ b/apps/example/screens/AllTheThings.tsx @@ -24,8 +24,6 @@ import { ActivityPickerPersisted } from "../components/ActivityPicker"; // const initialMinutes = 1; // const postponeMinutes = 60; -const trackEveryXMinutes = 1; - const selectionId = "some-id-3"; export function requestPermissionsAsync() { @@ -328,7 +326,7 @@ export function AllTheThings() { { type: "stopMonitoring", activityNames: ["sneekpeak"], - } + }, ], }); ReactNativeDeviceActivity.updateShield( @@ -358,7 +356,7 @@ export function AllTheThings() { }, ); console.log("done!"); - console.log(ReactNativeDeviceActivity.getEvents()) + console.log(ReactNativeDeviceActivity.getEvents()); }} /> diff --git a/apps/example/screens/WhiteList.tsx b/apps/example/screens/WhiteList.tsx index 49ece77d..20d70086 100644 --- a/apps/example/screens/WhiteList.tsx +++ b/apps/example/screens/WhiteList.tsx @@ -1,4 +1,4 @@ -import React, { useCallback, useEffect, useMemo, useState } from "react"; +import React, { useCallback, useEffect, useState } from "react"; import { NativeSyntheticEvent, ScrollView, @@ -12,7 +12,6 @@ import { activitySelectionMetadata, disableBlockAllMode, enableBlockAllMode, - clearWhitelistAndUpdateBlock, addSelectionToWhitelistAndUpdateBlock, ActivitySelectionMetadata, resetBlocks, diff --git a/apps/example/targets/ActivityMonitorExtension/Info.plist b/apps/example/targets/ActivityMonitorExtension/Info.plist deleted file mode 100644 index 411d0e6c..00000000 --- a/apps/example/targets/ActivityMonitorExtension/Info.plist +++ /dev/null @@ -1,16 +0,0 @@ - - - - - REACT_NATIVE_DEVICE_ACTIVITY_APP_GROUP - $(REACT_NATIVE_DEVICE_ACTIVITY_APP_GROUP) - NSExtension - - NSExtensionPointIdentifier - com.apple.deviceactivity.monitor-extension - NSExtensionPrincipalClass - $(PRODUCT_MODULE_NAME).DeviceActivityMonitorExtension - - - - \ No newline at end of file diff --git a/apps/example/targets/ActivityMonitorExtension/expo-target.config.js b/apps/example/targets/ActivityMonitorExtension/expo-target.config.js deleted file mode 100644 index 875e1cc7..00000000 --- a/apps/example/targets/ActivityMonitorExtension/expo-target.config.js +++ /dev/null @@ -1,5 +0,0 @@ -const { - createConfig, -} = require("react-native-device-activity/config-plugin/createExpoTargetConfig"); - -module.exports = createConfig("device-activity-monitor"); diff --git a/apps/example/targets/ShieldAction/Info.plist b/apps/example/targets/ShieldAction/Info.plist deleted file mode 100644 index ad639962..00000000 --- a/apps/example/targets/ShieldAction/Info.plist +++ /dev/null @@ -1,15 +0,0 @@ - - - - - REACT_NATIVE_DEVICE_ACTIVITY_APP_GROUP - $(REACT_NATIVE_DEVICE_ACTIVITY_APP_GROUP) - NSExtension - - NSExtensionPointIdentifier - com.apple.ManagedSettings.shield-action-service - NSExtensionPrincipalClass - $(PRODUCT_MODULE_NAME).ShieldActionExtension - - - diff --git a/apps/example/targets/ShieldAction/expo-target.config.js b/apps/example/targets/ShieldAction/expo-target.config.js deleted file mode 100644 index da3a98b3..00000000 --- a/apps/example/targets/ShieldAction/expo-target.config.js +++ /dev/null @@ -1,5 +0,0 @@ -const { - createConfig, -} = require("react-native-device-activity/config-plugin/createExpoTargetConfig"); - -module.exports = createConfig("shield-action"); diff --git a/apps/example/targets/ShieldConfiguration/Info.plist b/apps/example/targets/ShieldConfiguration/Info.plist deleted file mode 100644 index 84601bbf..00000000 --- a/apps/example/targets/ShieldConfiguration/Info.plist +++ /dev/null @@ -1,15 +0,0 @@ - - - - - REACT_NATIVE_DEVICE_ACTIVITY_APP_GROUP - $(REACT_NATIVE_DEVICE_ACTIVITY_APP_GROUP) - NSExtension - - NSExtensionPointIdentifier - com.apple.ManagedSettingsUI.shield-configuration-service - NSExtensionPrincipalClass - $(PRODUCT_MODULE_NAME).ShieldConfigurationExtension - - - diff --git a/apps/example/targets/ShieldConfiguration/expo-target.config.js b/apps/example/targets/ShieldConfiguration/expo-target.config.js deleted file mode 100644 index ccd0685f..00000000 --- a/apps/example/targets/ShieldConfiguration/expo-target.config.js +++ /dev/null @@ -1,5 +0,0 @@ -const { - createConfig, -} = require("react-native-device-activity/config-plugin/createExpoTargetConfig"); - -module.exports = createConfig("shield-configuration"); diff --git a/apps/example/tsconfig.json b/apps/example/tsconfig.json index f8849b7d..1c678535 100644 --- a/apps/example/tsconfig.json +++ b/apps/example/tsconfig.json @@ -4,8 +4,12 @@ "strict": true, "allowJs": true, "paths": { - "react-native-device-activity": ["../../packages/react-native-device-activity/src/index"], - "react-native-device-activity/*": ["../../packages/react-native-device-activity/*"] + "react-native-device-activity": [ + "../../packages/react-native-device-activity/src/index" + ], + "react-native-device-activity/*": [ + "../../packages/react-native-device-activity/*" + ] } } } diff --git a/bun.lock b/bun.lock index 09bd807d..e27513eb 100644 --- a/bun.lock +++ b/bun.lock @@ -1,12 +1,13 @@ { "lockfileVersion": 1, + "configVersion": 0, "workspaces": { "": { "name": "react-native-device-activity", "devDependencies": { - "eslint": "8", + "eslint": "^8.57.1", "husky": "^9.1.7", - "prettier": "^3.3.3", + "prettier": "^3.8.1", }, }, "apps/example": { @@ -33,7 +34,7 @@ }, "packages/react-native-device-activity": { "name": "react-native-device-activity", - "version": "0.4.20", + "version": "0.5.3", "dependencies": { "@bacons/xcode": "^1.0.0-alpha.24", "@expo/plist": "^0.1.3", @@ -855,7 +856,7 @@ "command-exists": ["command-exists@1.2.9", "", {}, "sha512-LTQ/SGc+s0Xc0Fu5WaKnR0YiygZkm9eKFvyS+fRsU7/ZWFF8ykFM6Pc9aCVf1+xasOOZpO3BAVgVrKvsqKHV7w=="], - "commander": ["commander@12.1.0", "", {}, "sha512-Vw8qHK3bZM9y/P10u3Vib8o/DdkvA2OtPtZvD871QKjy74Wj1WSKFILMPRPSdUSx5RFK1arlJzEtA4PkFgnbuA=="], + "commander": ["commander@2.20.3", "", {}, "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ=="], "commondir": ["commondir@1.0.1", "", {}, "sha512-W9pAhw0ja1Edb5GVdIF1mjZw/ASI0AlShXM83UUGe2DVr5TdAPEA1OA8m/g8zWp9x6On7gqufY+FatDbC3MDQg=="], @@ -1743,7 +1744,7 @@ "prelude-ls": ["prelude-ls@1.2.1", "", {}, "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g=="], - "prettier": ["prettier@3.4.2", "", { "bin": { "prettier": "bin/prettier.cjs" } }, "sha512-e9MewbtFo+Fevyuxn/4rrcDAaq0IYxPGLvObpQjiZBMAzB9IGmzlnG9RZy3FFas+eBMu2vA0CszMeduow5dIuQ=="], + "prettier": ["prettier@3.8.1", "", { "bin": { "prettier": "bin/prettier.cjs" } }, "sha512-UOnG6LftzbdaHZcKoPFtOcCKztrQ57WkHDeRD9t/PTQtmT0NHSeWWepj6pS0z/N7+08BHFDQVUrfmfMRcZwbMg=="], "prettier-linter-helpers": ["prettier-linter-helpers@1.0.0", "", { "dependencies": { "fast-diff": "^1.1.2" } }, "sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w=="], @@ -2425,8 +2426,6 @@ "expo-module-scripts/babel-preset-expo": ["babel-preset-expo@11.0.15", "", { "dependencies": { "@babel/plugin-proposal-decorators": "^7.12.9", "@babel/plugin-transform-export-namespace-from": "^7.22.11", "@babel/plugin-transform-object-rest-spread": "^7.12.13", "@babel/plugin-transform-parameters": "^7.22.15", "@babel/preset-react": "^7.22.15", "@babel/preset-typescript": "^7.23.0", "@react-native/babel-preset": "0.74.87", "babel-plugin-react-compiler": "0.0.0-experimental-592953e-20240517", "babel-plugin-react-native-web": "~0.19.10", "react-refresh": "^0.14.2" } }, "sha512-rgiMTYwqIPULaO7iZdqyL7aAff9QLOX6OWUtLZBlOrOTreGY1yHah/5+l8MvI6NVc/8Zj5LY4Y5uMSnJIuzTLw=="], - "expo-module-scripts/commander": ["commander@2.20.3", "", {}, "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ=="], - "expo-module-scripts/typescript": ["typescript@5.7.3", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-84MVSjMEHP+FQRPy3pX9sTVV/INIex71s9TL2Gm5FG/WG1SqXeKyZ0k7/blY/4FdOzI12CBy1vGc4og/eus0fw=="], "expo-modules-autolinking/commander": ["commander@7.2.0", "", {}, "sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw=="], @@ -2547,6 +2546,8 @@ "react-devtools-core/ws": ["ws@7.5.10", "", { "peerDependencies": { "bufferutil": "^4.0.1", "utf-8-validate": "^5.0.2" }, "optionalPeers": ["bufferutil", "utf-8-validate"] }, "sha512-+dbF1tHwZpXcbOJdVOkzLDxZP1ailvSxM6ZweXTegylPny803bFhA+vqBYw4s31NSAk4S2Qz+AKXK9a4wkdjcQ=="], + "react-native/commander": ["commander@12.1.0", "", {}, "sha512-Vw8qHK3bZM9y/P10u3Vib8o/DdkvA2OtPtZvD871QKjy74Wj1WSKFILMPRPSdUSx5RFK1arlJzEtA4PkFgnbuA=="], + "react-native-vector-icons/yargs": ["yargs@16.2.0", "", { "dependencies": { "cliui": "^7.0.2", "escalade": "^3.1.1", "get-caller-file": "^2.0.5", "require-directory": "^2.1.1", "string-width": "^4.2.0", "y18n": "^5.0.5", "yargs-parser": "^20.2.2" } }, "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw=="], "react-test-renderer/scheduler": ["scheduler@0.23.2", "", { "dependencies": { "loose-envify": "^1.1.0" } }, "sha512-UOShsPwz7NrMUqhR6t0hWjFduvOzbtv7toDH1/hIrfRNIDBnnBWd0CwJTGvTpngVlmwGCdP9/Zl/tVrDqcuYzQ=="], @@ -2599,8 +2600,6 @@ "terminal-link/ansi-escapes": ["ansi-escapes@4.3.2", "", { "dependencies": { "type-fest": "^0.21.3" } }, "sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ=="], - "terser/commander": ["commander@2.20.3", "", {}, "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ=="], - "tinyglobby/picomatch": ["picomatch@4.0.2", "", {}, "sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg=="], "tough-cookie/universalify": ["universalify@0.2.0", "", {}, "sha512-CJ1QgKmNg3CwvAv/kOFmtnEN05f0D/cn9QntgNOQlQF9dgvVTHj3t+8JPdjqawCHk7V/KA+fbUqzZ9XWhcqPUg=="], diff --git a/package.json b/package.json index 43f70bed..20c0a5a6 100644 --- a/package.json +++ b/package.json @@ -4,8 +4,13 @@ "private": true, "description": "Provides access to Apples DeviceActivity API", "scripts": { + "format": "node ./node_modules/prettier/bin/prettier.cjs --write .", + "format:check": "node ./node_modules/prettier/bin/prettier.cjs --check .", + "format:version": "node ./node_modules/prettier/bin/prettier.cjs --version && node -e \"console.log(require('./node_modules/prettier/package.json').version)\"", "lint": "eslint .", - "pre-push": "bun run typecheck && bun run lint && apps/example/ios/Pods/SwiftLint/swiftlint lint --strict", + "test": "cd packages/react-native-device-activity && bun run test", + "swiftlint": "[ -x packages/react-native-device-activity/ios/TestHarness/Pods/SwiftLint/swiftlint ] || { echo 'SwiftLint pod binary missing. Run: cd packages/react-native-device-activity/ios/TestHarness && pod install'; exit 1; }; packages/react-native-device-activity/ios/TestHarness/Pods/SwiftLint/swiftlint lint --strict --config .swiftlint.yml", + "pre-push": "bun run typecheck && bun run lint && bun run test && bun run swiftlint", "typecheck": "cd packages/react-native-device-activity && bun run typecheck && cd ../../apps/example && bun run typecheck", "prepare": "husky", "nail-workspace-dependency-versions": "bun run scripts/nail-workspace-dependency-versions.ts" @@ -31,8 +36,8 @@ "license": "MIT", "homepage": "https://github.com/kingstinct/react-native-device-activity#readme", "devDependencies": { - "eslint": "8", + "eslint": "^8.57.1", "husky": "^9.1.7", - "prettier": "^3.3.3" + "prettier": "^3.8.1" } } diff --git a/packages/react-native-device-activity/.npmignore b/packages/react-native-device-activity/.npmignore new file mode 100644 index 00000000..ea74b7dd --- /dev/null +++ b/packages/react-native-device-activity/.npmignore @@ -0,0 +1,14 @@ +# Package-local dev/test files +ios/TestHarness/ +ios/Tests/ +plugin/__tests__/ +src/*.test.ts +build/*.test.* +jest.runtime.config.js +plugin/jest.config.js + +# Generated target metadata (not currently shipped in npm package) +targets/ActivityMonitorExtension/generated.entitlements +targets/ShieldAction/generated.entitlements +targets/ShieldConfiguration/generated.entitlements +targets/ShieldConfiguration/PrivacyInfo.xcprivacy diff --git a/packages/react-native-device-activity/expo-module.config.json b/packages/react-native-device-activity/expo-module.config.json index aadad61f..ca8942bb 100644 --- a/packages/react-native-device-activity/expo-module.config.json +++ b/packages/react-native-device-activity/expo-module.config.json @@ -1,6 +1,9 @@ { "platforms": ["ios"], "ios": { - "modules": ["ReactNativeDeviceActivityModule", "ReactNativeDeviceActivityViewPersistedModule"] + "modules": [ + "ReactNativeDeviceActivityModule", + "ReactNativeDeviceActivityViewPersistedModule" + ] } } diff --git a/packages/react-native-device-activity/ios/ReactNativeDeviceActivity.podspec b/packages/react-native-device-activity/ios/ReactNativeDeviceActivity.podspec index ca80f3cd..79b01576 100644 --- a/packages/react-native-device-activity/ios/ReactNativeDeviceActivity.podspec +++ b/packages/react-native-device-activity/ios/ReactNativeDeviceActivity.podspec @@ -24,4 +24,8 @@ Pod::Spec.new do |s| } s.source_files = "**/*.{h,m,swift}" + s.exclude_files = [ + "Tests/**/*", + "TestHarness/**/*" + ] end diff --git a/apps/example/ios/.gitignore b/packages/react-native-device-activity/ios/TestHarness/.gitignore similarity index 100% rename from apps/example/ios/.gitignore rename to packages/react-native-device-activity/ios/TestHarness/.gitignore diff --git a/apps/example/ios/.xcode.env b/packages/react-native-device-activity/ios/TestHarness/.xcode.env similarity index 100% rename from apps/example/ios/.xcode.env rename to packages/react-native-device-activity/ios/TestHarness/.xcode.env diff --git a/apps/example/ios/Podfile b/packages/react-native-device-activity/ios/TestHarness/Podfile similarity index 78% rename from apps/example/ios/Podfile rename to packages/react-native-device-activity/ios/TestHarness/Podfile index 1717e5e9..7c02b598 100644 --- a/apps/example/ios/Podfile +++ b/packages/react-native-device-activity/ios/TestHarness/Podfile @@ -7,11 +7,16 @@ podfile_properties = JSON.parse(File.read(File.join(__dir__, 'Podfile.properties ENV['RCT_NEW_ARCH_ENABLED'] = podfile_properties['newArchEnabled'] == 'true' ? '1' : '0' ENV['EX_DEV_CLIENT_NETWORK_INSPECTOR'] = podfile_properties['EX_DEV_CLIENT_NETWORK_INSPECTOR'] -use_autolinking_method_symbol = ('use' + '_native' + '_modules!').to_sym -origin_autolinking_method = self.method(use_autolinking_method_symbol) -self.define_singleton_method(use_autolinking_method_symbol) do |*args| - if ENV['EXPO_UNSTABLE_CORE_AUTOLINKING'] == '1' - Pod::UI.puts('Using expo-modules-autolinking as core autolinking source'.green) +platform :ios, podfile_properties['ios.deploymentTarget'] || '15.1' +install! 'cocoapods', + :deterministic_uuids => false + +prepare_react_native_project! + +target 'reactnativedeviceactivityexample' do + if ENV['EXPO_USE_COMMUNITY_AUTOLINKING'] == '1' + config_command = ['node', '-e', "process.argv=['', '', 'config'];require('@react-native-community/cli').run()"]; + else config_command = [ 'node', '--no-warnings', @@ -22,37 +27,34 @@ self.define_singleton_method(use_autolinking_method_symbol) do |*args| '--platform', 'ios' ] - origin_autolinking_method.call(config_command) - else - origin_autolinking_method.call() end -end - -platform :ios, podfile_properties['ios.deploymentTarget'] || '15.1' -install! 'cocoapods', - :deterministic_uuids => false -prepare_react_native_project! - -target 'reactnativedeviceactivityexample' do - use_expo_modules! - config = use_native_modules! + app_root = File.expand_path('../../../../apps/example', __dir__) + react_native_path = '../../../../node_modules/react-native' + autolinking = nil + Dir.chdir(app_root) do + use_expo_modules! + autolinking = list_native_modules!(config_command) + end + autolinking[:ios_project_root_path] = __dir__ + autolinking[:react_native_path] = react_native_path + config = link_native_modules!(autolinking) use_frameworks! :linkage => podfile_properties['ios.useFrameworks'].to_sym if podfile_properties['ios.useFrameworks'] use_frameworks! :linkage => ENV['USE_FRAMEWORKS'].to_sym if ENV['USE_FRAMEWORKS'] use_react_native!( - :path => config[:reactNativePath], + :path => react_native_path, :hermes_enabled => podfile_properties['expo.jsEngine'] == nil || podfile_properties['expo.jsEngine'] == 'hermes', # An absolute path to your application root. - :app_path => "#{Pod::Config.instance.installation_root}/..", + :app_path => "#{Pod::Config.instance.installation_root}/../../../../apps/example", :privacy_file_aggregation_enabled => podfile_properties['apple.privacyManifestAggregationEnabled'] != 'false', ) post_install do |installer| react_native_post_install( installer, - config[:reactNativePath], + react_native_path, :mac_catalyst_enabled => false, :ccache_enabled => podfile_properties['apple.ccacheEnabled'] == 'true', ) @@ -82,7 +84,7 @@ end # apple-targets-extension-loader -- Dynamic loading of target configurations -Dir.glob(File.join(__dir__, '..', 'targets', '**', 'pods.rb')).each do |target_file| +Dir.glob(File.join(__dir__, '..', '..', 'targets', '**', 'pods.rb')).each do |target_file| target_name = File.basename(File.dirname(target_file)) target target_name do # Create a new binding with access to necessary methods and variables diff --git a/apps/example/ios/Podfile.lock b/packages/react-native-device-activity/ios/TestHarness/Podfile.lock similarity index 77% rename from apps/example/ios/Podfile.lock rename to packages/react-native-device-activity/ios/TestHarness/Podfile.lock index 40c1cafc..79923f2f 100644 --- a/apps/example/ios/Podfile.lock +++ b/packages/react-native-device-activity/ios/TestHarness/Podfile.lock @@ -1601,7 +1601,7 @@ PODS: - React-logger - React-perflogger - React-utils (= 0.76.9) - - ReactNativeDeviceActivity (0.4.30): + - ReactNativeDeviceActivity (0.5.3): - ExpoModulesCore - RNVectorIcons (10.2.0): - DoubleConversion @@ -1629,86 +1629,86 @@ PODS: - Yoga (0.0.0) DEPENDENCIES: - - boost (from `../../../node_modules/react-native/third-party-podspecs/boost.podspec`) - - DoubleConversion (from `../../../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec`) - - EXApplication (from `../../../node_modules/expo-application/ios`) - - EXConstants (from `../../../node_modules/expo-constants/ios`) - - EXNotifications (from `../../../node_modules/expo-notifications/ios`) - - Expo (from `../../../node_modules/expo`) - - ExpoAsset (from `../../../node_modules/expo-asset/ios`) - - ExpoFileSystem (from `../../../node_modules/expo-file-system/ios`) - - ExpoFont (from `../../../node_modules/expo-font/ios`) - - ExpoKeepAwake (from `../../../node_modules/expo-keep-awake/ios`) - - ExpoModulesCore (from `../../../node_modules/expo-modules-core`) - - "ExtensionStorage (from `../../../node_modules/@kingstinct/expo-apple-targets/ios`)" - - fast_float (from `../../../node_modules/react-native/third-party-podspecs/fast_float.podspec`) - - FBLazyVector (from `../../../node_modules/react-native/Libraries/FBLazyVector`) - - fmt (from `../../../node_modules/react-native/third-party-podspecs/fmt.podspec`) - - glog (from `../../../node_modules/react-native/third-party-podspecs/glog.podspec`) - - hermes-engine (from `../../../node_modules/react-native/sdks/hermes-engine/hermes-engine.podspec`) - - RCT-Folly (from `../../../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec`) - - RCT-Folly/Fabric (from `../../../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec`) - - RCTDeprecation (from `../../../node_modules/react-native/ReactApple/Libraries/RCTFoundation/RCTDeprecation`) - - RCTRequired (from `../../../node_modules/react-native/Libraries/Required`) - - RCTTypeSafety (from `../../../node_modules/react-native/Libraries/TypeSafety`) - - React (from `../../../node_modules/react-native/`) - - React-callinvoker (from `../../../node_modules/react-native/ReactCommon/callinvoker`) - - React-Core (from `../../../node_modules/react-native/`) - - React-Core/RCTWebSocket (from `../../../node_modules/react-native/`) - - React-CoreModules (from `../../../node_modules/react-native/React/CoreModules`) - - React-cxxreact (from `../../../node_modules/react-native/ReactCommon/cxxreact`) - - React-debug (from `../../../node_modules/react-native/ReactCommon/react/debug`) - - React-defaultsnativemodule (from `../../../node_modules/react-native/ReactCommon/react/nativemodule/defaults`) - - React-domnativemodule (from `../../../node_modules/react-native/ReactCommon/react/nativemodule/dom`) - - React-Fabric (from `../../../node_modules/react-native/ReactCommon`) - - React-FabricComponents (from `../../../node_modules/react-native/ReactCommon`) - - React-FabricImage (from `../../../node_modules/react-native/ReactCommon`) - - React-featureflags (from `../../../node_modules/react-native/ReactCommon/react/featureflags`) - - React-featureflagsnativemodule (from `../../../node_modules/react-native/ReactCommon/react/nativemodule/featureflags`) - - React-graphics (from `../../../node_modules/react-native/ReactCommon/react/renderer/graphics`) - - React-hermes (from `../../../node_modules/react-native/ReactCommon/hermes`) - - React-idlecallbacksnativemodule (from `../../../node_modules/react-native/ReactCommon/react/nativemodule/idlecallbacks`) - - React-ImageManager (from `../../../node_modules/react-native/ReactCommon/react/renderer/imagemanager/platform/ios`) - - React-jserrorhandler (from `../../../node_modules/react-native/ReactCommon/jserrorhandler`) - - React-jsi (from `../../../node_modules/react-native/ReactCommon/jsi`) - - React-jsiexecutor (from `../../../node_modules/react-native/ReactCommon/jsiexecutor`) - - React-jsinspector (from `../../../node_modules/react-native/ReactCommon/jsinspector-modern`) - - React-jsitracing (from `../../../node_modules/react-native/ReactCommon/hermes/executor/`) - - React-logger (from `../../../node_modules/react-native/ReactCommon/logger`) - - React-Mapbuffer (from `../../../node_modules/react-native/ReactCommon`) - - React-microtasksnativemodule (from `../../../node_modules/react-native/ReactCommon/react/nativemodule/microtasks`) - - react-native-safe-area-context (from `../../../node_modules/react-native-safe-area-context`) - - React-nativeconfig (from `../../../node_modules/react-native/ReactCommon`) - - React-NativeModulesApple (from `../../../node_modules/react-native/ReactCommon/react/nativemodule/core/platform/ios`) - - React-perflogger (from `../../../node_modules/react-native/ReactCommon/reactperflogger`) - - React-performancetimeline (from `../../../node_modules/react-native/ReactCommon/react/performance/timeline`) - - React-RCTActionSheet (from `../../../node_modules/react-native/Libraries/ActionSheetIOS`) - - React-RCTAnimation (from `../../../node_modules/react-native/Libraries/NativeAnimation`) - - React-RCTAppDelegate (from `../../../node_modules/react-native/Libraries/AppDelegate`) - - React-RCTBlob (from `../../../node_modules/react-native/Libraries/Blob`) - - React-RCTFabric (from `../../../node_modules/react-native/React`) - - React-RCTImage (from `../../../node_modules/react-native/Libraries/Image`) - - React-RCTLinking (from `../../../node_modules/react-native/Libraries/LinkingIOS`) - - React-RCTNetwork (from `../../../node_modules/react-native/Libraries/Network`) - - React-RCTSettings (from `../../../node_modules/react-native/Libraries/Settings`) - - React-RCTText (from `../../../node_modules/react-native/Libraries/Text`) - - React-RCTVibration (from `../../../node_modules/react-native/Libraries/Vibration`) - - React-rendererconsistency (from `../../../node_modules/react-native/ReactCommon/react/renderer/consistency`) - - React-rendererdebug (from `../../../node_modules/react-native/ReactCommon/react/renderer/debug`) - - React-rncore (from `../../../node_modules/react-native/ReactCommon`) - - React-RuntimeApple (from `../../../node_modules/react-native/ReactCommon/react/runtime/platform/ios`) - - React-RuntimeCore (from `../../../node_modules/react-native/ReactCommon/react/runtime`) - - React-runtimeexecutor (from `../../../node_modules/react-native/ReactCommon/runtimeexecutor`) - - React-RuntimeHermes (from `../../../node_modules/react-native/ReactCommon/react/runtime`) - - React-runtimescheduler (from `../../../node_modules/react-native/ReactCommon/react/renderer/runtimescheduler`) - - React-timing (from `../../../node_modules/react-native/ReactCommon/react/timing`) - - React-utils (from `../../../node_modules/react-native/ReactCommon/react/utils`) + - boost (from `../../../../node_modules/react-native/third-party-podspecs/boost.podspec`) + - DoubleConversion (from `../../../../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec`) + - EXApplication (from `../../../../node_modules/expo-application/ios`) + - EXConstants (from `../../../../node_modules/expo-constants/ios`) + - EXNotifications (from `../../../../node_modules/expo-notifications/ios`) + - Expo (from `../../../../node_modules/expo`) + - ExpoAsset (from `../../../../node_modules/expo-asset/ios`) + - ExpoFileSystem (from `../../../../node_modules/expo-file-system/ios`) + - ExpoFont (from `../../../../node_modules/expo-font/ios`) + - ExpoKeepAwake (from `../../../../node_modules/expo-keep-awake/ios`) + - ExpoModulesCore (from `../../../../node_modules/expo-modules-core`) + - "ExtensionStorage (from `../../../../node_modules/@kingstinct/expo-apple-targets/ios`)" + - fast_float (from `../../../../node_modules/react-native/third-party-podspecs/fast_float.podspec`) + - FBLazyVector (from `../../../../node_modules/react-native/Libraries/FBLazyVector`) + - fmt (from `../../../../node_modules/react-native/third-party-podspecs/fmt.podspec`) + - glog (from `../../../../node_modules/react-native/third-party-podspecs/glog.podspec`) + - hermes-engine (from `../../../../node_modules/react-native/sdks/hermes-engine/hermes-engine.podspec`) + - RCT-Folly (from `../../../../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec`) + - RCT-Folly/Fabric (from `../../../../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec`) + - RCTDeprecation (from `../../../../node_modules/react-native/ReactApple/Libraries/RCTFoundation/RCTDeprecation`) + - RCTRequired (from `../../../../node_modules/react-native/Libraries/Required`) + - RCTTypeSafety (from `../../../../node_modules/react-native/Libraries/TypeSafety`) + - React (from `../../../../node_modules/react-native/`) + - React-callinvoker (from `../../../../node_modules/react-native/ReactCommon/callinvoker`) + - React-Core (from `../../../../node_modules/react-native/`) + - React-Core/RCTWebSocket (from `../../../../node_modules/react-native/`) + - React-CoreModules (from `../../../../node_modules/react-native/React/CoreModules`) + - React-cxxreact (from `../../../../node_modules/react-native/ReactCommon/cxxreact`) + - React-debug (from `../../../../node_modules/react-native/ReactCommon/react/debug`) + - React-defaultsnativemodule (from `../../../../node_modules/react-native/ReactCommon/react/nativemodule/defaults`) + - React-domnativemodule (from `../../../../node_modules/react-native/ReactCommon/react/nativemodule/dom`) + - React-Fabric (from `../../../../node_modules/react-native/ReactCommon`) + - React-FabricComponents (from `../../../../node_modules/react-native/ReactCommon`) + - React-FabricImage (from `../../../../node_modules/react-native/ReactCommon`) + - React-featureflags (from `../../../../node_modules/react-native/ReactCommon/react/featureflags`) + - React-featureflagsnativemodule (from `../../../../node_modules/react-native/ReactCommon/react/nativemodule/featureflags`) + - React-graphics (from `../../../../node_modules/react-native/ReactCommon/react/renderer/graphics`) + - React-hermes (from `../../../../node_modules/react-native/ReactCommon/hermes`) + - React-idlecallbacksnativemodule (from `../../../../node_modules/react-native/ReactCommon/react/nativemodule/idlecallbacks`) + - React-ImageManager (from `../../../../node_modules/react-native/ReactCommon/react/renderer/imagemanager/platform/ios`) + - React-jserrorhandler (from `../../../../node_modules/react-native/ReactCommon/jserrorhandler`) + - React-jsi (from `../../../../node_modules/react-native/ReactCommon/jsi`) + - React-jsiexecutor (from `../../../../node_modules/react-native/ReactCommon/jsiexecutor`) + - React-jsinspector (from `../../../../node_modules/react-native/ReactCommon/jsinspector-modern`) + - React-jsitracing (from `../../../../node_modules/react-native/ReactCommon/hermes/executor/`) + - React-logger (from `../../../../node_modules/react-native/ReactCommon/logger`) + - React-Mapbuffer (from `../../../../node_modules/react-native/ReactCommon`) + - React-microtasksnativemodule (from `../../../../node_modules/react-native/ReactCommon/react/nativemodule/microtasks`) + - react-native-safe-area-context (from `../../../../node_modules/react-native-safe-area-context`) + - React-nativeconfig (from `../../../../node_modules/react-native/ReactCommon`) + - React-NativeModulesApple (from `../../../../node_modules/react-native/ReactCommon/react/nativemodule/core/platform/ios`) + - React-perflogger (from `../../../../node_modules/react-native/ReactCommon/reactperflogger`) + - React-performancetimeline (from `../../../../node_modules/react-native/ReactCommon/react/performance/timeline`) + - React-RCTActionSheet (from `../../../../node_modules/react-native/Libraries/ActionSheetIOS`) + - React-RCTAnimation (from `../../../../node_modules/react-native/Libraries/NativeAnimation`) + - React-RCTAppDelegate (from `../../../../node_modules/react-native/Libraries/AppDelegate`) + - React-RCTBlob (from `../../../../node_modules/react-native/Libraries/Blob`) + - React-RCTFabric (from `../../../../node_modules/react-native/React`) + - React-RCTImage (from `../../../../node_modules/react-native/Libraries/Image`) + - React-RCTLinking (from `../../../../node_modules/react-native/Libraries/LinkingIOS`) + - React-RCTNetwork (from `../../../../node_modules/react-native/Libraries/Network`) + - React-RCTSettings (from `../../../../node_modules/react-native/Libraries/Settings`) + - React-RCTText (from `../../../../node_modules/react-native/Libraries/Text`) + - React-RCTVibration (from `../../../../node_modules/react-native/Libraries/Vibration`) + - React-rendererconsistency (from `../../../../node_modules/react-native/ReactCommon/react/renderer/consistency`) + - React-rendererdebug (from `../../../../node_modules/react-native/ReactCommon/react/renderer/debug`) + - React-rncore (from `../../../../node_modules/react-native/ReactCommon`) + - React-RuntimeApple (from `../../../../node_modules/react-native/ReactCommon/react/runtime/platform/ios`) + - React-RuntimeCore (from `../../../../node_modules/react-native/ReactCommon/react/runtime`) + - React-runtimeexecutor (from `../../../../node_modules/react-native/ReactCommon/runtimeexecutor`) + - React-RuntimeHermes (from `../../../../node_modules/react-native/ReactCommon/react/runtime`) + - React-runtimescheduler (from `../../../../node_modules/react-native/ReactCommon/react/renderer/runtimescheduler`) + - React-timing (from `../../../../node_modules/react-native/ReactCommon/react/timing`) + - React-utils (from `../../../../node_modules/react-native/ReactCommon/react/utils`) - ReactCodegen (from `build/generated/ios`) - - ReactCommon/turbomodule/core (from `../../../node_modules/react-native/ReactCommon`) - - ReactNativeDeviceActivity (from `../../../packages/react-native-device-activity/ios`) - - RNVectorIcons (from `../../../node_modules/react-native-vector-icons`) + - ReactCommon/turbomodule/core (from `../../../../node_modules/react-native/ReactCommon`) + - ReactNativeDeviceActivity (from `..`) + - RNVectorIcons (from `../../../../node_modules/react-native-vector-icons`) - SwiftLint - - Yoga (from `../../../node_modules/react-native/ReactCommon/yoga`) + - Yoga (from `../../../../node_modules/react-native/ReactCommon/yoga`) SPEC REPOS: trunk: @@ -1717,160 +1717,160 @@ SPEC REPOS: EXTERNAL SOURCES: boost: - :podspec: "../../../node_modules/react-native/third-party-podspecs/boost.podspec" + :podspec: "../../../../node_modules/react-native/third-party-podspecs/boost.podspec" DoubleConversion: - :podspec: "../../../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec" + :podspec: "../../../../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec" EXApplication: - :path: "../../../node_modules/expo-application/ios" + :path: "../../../../node_modules/expo-application/ios" EXConstants: - :path: "../../../node_modules/expo-constants/ios" + :path: "../../../../node_modules/expo-constants/ios" EXNotifications: - :path: "../../../node_modules/expo-notifications/ios" + :path: "../../../../node_modules/expo-notifications/ios" Expo: - :path: "../../../node_modules/expo" + :path: "../../../../node_modules/expo" ExpoAsset: - :path: "../../../node_modules/expo-asset/ios" + :path: "../../../../node_modules/expo-asset/ios" ExpoFileSystem: - :path: "../../../node_modules/expo-file-system/ios" + :path: "../../../../node_modules/expo-file-system/ios" ExpoFont: - :path: "../../../node_modules/expo-font/ios" + :path: "../../../../node_modules/expo-font/ios" ExpoKeepAwake: - :path: "../../../node_modules/expo-keep-awake/ios" + :path: "../../../../node_modules/expo-keep-awake/ios" ExpoModulesCore: - :path: "../../../node_modules/expo-modules-core" + :path: "../../../../node_modules/expo-modules-core" ExtensionStorage: - :path: "../../../node_modules/@kingstinct/expo-apple-targets/ios" + :path: "../../../../node_modules/@kingstinct/expo-apple-targets/ios" fast_float: - :podspec: "../../../node_modules/react-native/third-party-podspecs/fast_float.podspec" + :podspec: "../../../../node_modules/react-native/third-party-podspecs/fast_float.podspec" FBLazyVector: - :path: "../../../node_modules/react-native/Libraries/FBLazyVector" + :path: "../../../../node_modules/react-native/Libraries/FBLazyVector" fmt: - :podspec: "../../../node_modules/react-native/third-party-podspecs/fmt.podspec" + :podspec: "../../../../node_modules/react-native/third-party-podspecs/fmt.podspec" glog: - :podspec: "../../../node_modules/react-native/third-party-podspecs/glog.podspec" + :podspec: "../../../../node_modules/react-native/third-party-podspecs/glog.podspec" hermes-engine: - :podspec: "../../../node_modules/react-native/sdks/hermes-engine/hermes-engine.podspec" + :podspec: "../../../../node_modules/react-native/sdks/hermes-engine/hermes-engine.podspec" :tag: hermes-2024-11-12-RNv0.76.2-5b4aa20c719830dcf5684832b89a6edb95ac3d64 RCT-Folly: - :podspec: "../../../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec" + :podspec: "../../../../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec" RCTDeprecation: - :path: "../../../node_modules/react-native/ReactApple/Libraries/RCTFoundation/RCTDeprecation" + :path: "../../../../node_modules/react-native/ReactApple/Libraries/RCTFoundation/RCTDeprecation" RCTRequired: - :path: "../../../node_modules/react-native/Libraries/Required" + :path: "../../../../node_modules/react-native/Libraries/Required" RCTTypeSafety: - :path: "../../../node_modules/react-native/Libraries/TypeSafety" + :path: "../../../../node_modules/react-native/Libraries/TypeSafety" React: - :path: "../../../node_modules/react-native/" + :path: "../../../../node_modules/react-native/" React-callinvoker: - :path: "../../../node_modules/react-native/ReactCommon/callinvoker" + :path: "../../../../node_modules/react-native/ReactCommon/callinvoker" React-Core: - :path: "../../../node_modules/react-native/" + :path: "../../../../node_modules/react-native/" React-CoreModules: - :path: "../../../node_modules/react-native/React/CoreModules" + :path: "../../../../node_modules/react-native/React/CoreModules" React-cxxreact: - :path: "../../../node_modules/react-native/ReactCommon/cxxreact" + :path: "../../../../node_modules/react-native/ReactCommon/cxxreact" React-debug: - :path: "../../../node_modules/react-native/ReactCommon/react/debug" + :path: "../../../../node_modules/react-native/ReactCommon/react/debug" React-defaultsnativemodule: - :path: "../../../node_modules/react-native/ReactCommon/react/nativemodule/defaults" + :path: "../../../../node_modules/react-native/ReactCommon/react/nativemodule/defaults" React-domnativemodule: - :path: "../../../node_modules/react-native/ReactCommon/react/nativemodule/dom" + :path: "../../../../node_modules/react-native/ReactCommon/react/nativemodule/dom" React-Fabric: - :path: "../../../node_modules/react-native/ReactCommon" + :path: "../../../../node_modules/react-native/ReactCommon" React-FabricComponents: - :path: "../../../node_modules/react-native/ReactCommon" + :path: "../../../../node_modules/react-native/ReactCommon" React-FabricImage: - :path: "../../../node_modules/react-native/ReactCommon" + :path: "../../../../node_modules/react-native/ReactCommon" React-featureflags: - :path: "../../../node_modules/react-native/ReactCommon/react/featureflags" + :path: "../../../../node_modules/react-native/ReactCommon/react/featureflags" React-featureflagsnativemodule: - :path: "../../../node_modules/react-native/ReactCommon/react/nativemodule/featureflags" + :path: "../../../../node_modules/react-native/ReactCommon/react/nativemodule/featureflags" React-graphics: - :path: "../../../node_modules/react-native/ReactCommon/react/renderer/graphics" + :path: "../../../../node_modules/react-native/ReactCommon/react/renderer/graphics" React-hermes: - :path: "../../../node_modules/react-native/ReactCommon/hermes" + :path: "../../../../node_modules/react-native/ReactCommon/hermes" React-idlecallbacksnativemodule: - :path: "../../../node_modules/react-native/ReactCommon/react/nativemodule/idlecallbacks" + :path: "../../../../node_modules/react-native/ReactCommon/react/nativemodule/idlecallbacks" React-ImageManager: - :path: "../../../node_modules/react-native/ReactCommon/react/renderer/imagemanager/platform/ios" + :path: "../../../../node_modules/react-native/ReactCommon/react/renderer/imagemanager/platform/ios" React-jserrorhandler: - :path: "../../../node_modules/react-native/ReactCommon/jserrorhandler" + :path: "../../../../node_modules/react-native/ReactCommon/jserrorhandler" React-jsi: - :path: "../../../node_modules/react-native/ReactCommon/jsi" + :path: "../../../../node_modules/react-native/ReactCommon/jsi" React-jsiexecutor: - :path: "../../../node_modules/react-native/ReactCommon/jsiexecutor" + :path: "../../../../node_modules/react-native/ReactCommon/jsiexecutor" React-jsinspector: - :path: "../../../node_modules/react-native/ReactCommon/jsinspector-modern" + :path: "../../../../node_modules/react-native/ReactCommon/jsinspector-modern" React-jsitracing: - :path: "../../../node_modules/react-native/ReactCommon/hermes/executor/" + :path: "../../../../node_modules/react-native/ReactCommon/hermes/executor/" React-logger: - :path: "../../../node_modules/react-native/ReactCommon/logger" + :path: "../../../../node_modules/react-native/ReactCommon/logger" React-Mapbuffer: - :path: "../../../node_modules/react-native/ReactCommon" + :path: "../../../../node_modules/react-native/ReactCommon" React-microtasksnativemodule: - :path: "../../../node_modules/react-native/ReactCommon/react/nativemodule/microtasks" + :path: "../../../../node_modules/react-native/ReactCommon/react/nativemodule/microtasks" react-native-safe-area-context: - :path: "../../../node_modules/react-native-safe-area-context" + :path: "../../../../node_modules/react-native-safe-area-context" React-nativeconfig: - :path: "../../../node_modules/react-native/ReactCommon" + :path: "../../../../node_modules/react-native/ReactCommon" React-NativeModulesApple: - :path: "../../../node_modules/react-native/ReactCommon/react/nativemodule/core/platform/ios" + :path: "../../../../node_modules/react-native/ReactCommon/react/nativemodule/core/platform/ios" React-perflogger: - :path: "../../../node_modules/react-native/ReactCommon/reactperflogger" + :path: "../../../../node_modules/react-native/ReactCommon/reactperflogger" React-performancetimeline: - :path: "../../../node_modules/react-native/ReactCommon/react/performance/timeline" + :path: "../../../../node_modules/react-native/ReactCommon/react/performance/timeline" React-RCTActionSheet: - :path: "../../../node_modules/react-native/Libraries/ActionSheetIOS" + :path: "../../../../node_modules/react-native/Libraries/ActionSheetIOS" React-RCTAnimation: - :path: "../../../node_modules/react-native/Libraries/NativeAnimation" + :path: "../../../../node_modules/react-native/Libraries/NativeAnimation" React-RCTAppDelegate: - :path: "../../../node_modules/react-native/Libraries/AppDelegate" + :path: "../../../../node_modules/react-native/Libraries/AppDelegate" React-RCTBlob: - :path: "../../../node_modules/react-native/Libraries/Blob" + :path: "../../../../node_modules/react-native/Libraries/Blob" React-RCTFabric: - :path: "../../../node_modules/react-native/React" + :path: "../../../../node_modules/react-native/React" React-RCTImage: - :path: "../../../node_modules/react-native/Libraries/Image" + :path: "../../../../node_modules/react-native/Libraries/Image" React-RCTLinking: - :path: "../../../node_modules/react-native/Libraries/LinkingIOS" + :path: "../../../../node_modules/react-native/Libraries/LinkingIOS" React-RCTNetwork: - :path: "../../../node_modules/react-native/Libraries/Network" + :path: "../../../../node_modules/react-native/Libraries/Network" React-RCTSettings: - :path: "../../../node_modules/react-native/Libraries/Settings" + :path: "../../../../node_modules/react-native/Libraries/Settings" React-RCTText: - :path: "../../../node_modules/react-native/Libraries/Text" + :path: "../../../../node_modules/react-native/Libraries/Text" React-RCTVibration: - :path: "../../../node_modules/react-native/Libraries/Vibration" + :path: "../../../../node_modules/react-native/Libraries/Vibration" React-rendererconsistency: - :path: "../../../node_modules/react-native/ReactCommon/react/renderer/consistency" + :path: "../../../../node_modules/react-native/ReactCommon/react/renderer/consistency" React-rendererdebug: - :path: "../../../node_modules/react-native/ReactCommon/react/renderer/debug" + :path: "../../../../node_modules/react-native/ReactCommon/react/renderer/debug" React-rncore: - :path: "../../../node_modules/react-native/ReactCommon" + :path: "../../../../node_modules/react-native/ReactCommon" React-RuntimeApple: - :path: "../../../node_modules/react-native/ReactCommon/react/runtime/platform/ios" + :path: "../../../../node_modules/react-native/ReactCommon/react/runtime/platform/ios" React-RuntimeCore: - :path: "../../../node_modules/react-native/ReactCommon/react/runtime" + :path: "../../../../node_modules/react-native/ReactCommon/react/runtime" React-runtimeexecutor: - :path: "../../../node_modules/react-native/ReactCommon/runtimeexecutor" + :path: "../../../../node_modules/react-native/ReactCommon/runtimeexecutor" React-RuntimeHermes: - :path: "../../../node_modules/react-native/ReactCommon/react/runtime" + :path: "../../../../node_modules/react-native/ReactCommon/react/runtime" React-runtimescheduler: - :path: "../../../node_modules/react-native/ReactCommon/react/renderer/runtimescheduler" + :path: "../../../../node_modules/react-native/ReactCommon/react/renderer/runtimescheduler" React-timing: - :path: "../../../node_modules/react-native/ReactCommon/react/timing" + :path: "../../../../node_modules/react-native/ReactCommon/react/timing" React-utils: - :path: "../../../node_modules/react-native/ReactCommon/react/utils" + :path: "../../../../node_modules/react-native/ReactCommon/react/utils" ReactCodegen: :path: build/generated/ios ReactCommon: - :path: "../../../node_modules/react-native/ReactCommon" + :path: "../../../../node_modules/react-native/ReactCommon" ReactNativeDeviceActivity: - :path: "../../../packages/react-native-device-activity/ios" + :path: ".." RNVectorIcons: - :path: "../../../node_modules/react-native-vector-icons" + :path: "../../../../node_modules/react-native-vector-icons" Yoga: - :path: "../../../node_modules/react-native/ReactCommon/yoga" + :path: "../../../../node_modules/react-native/ReactCommon/yoga" SPEC CHECKSUMS: boost: 1dca942403ed9342f98334bf4c3621f011aa7946 @@ -1945,14 +1945,14 @@ SPEC CHECKSUMS: React-runtimescheduler: 8ec34cc885281a34696ea16c4fd86892d631f38d React-timing: 331cbf9f2668c67faddfd2e46bb7f41cbd9320b9 React-utils: ed818f19ab445000d6b5c4efa9d462449326cc9f - ReactCodegen: 2a46abb2e345dc8efaff0a724f5f8639230eb974 + ReactCodegen: 8dc03aa9aca0655304d2d8f8b591c468fd1e87cd ReactCommon: 300d8d9c5cb1a6cd79a67cf5d8f91e4d477195f9 - ReactNativeDeviceActivity: 1017837e25b5b5247b85d7a542b5176b27ee85d3 + ReactNativeDeviceActivity: 49c0579e2cbb940f4366b917d9e17491a70c5bd7 RNVectorIcons: 4330d8f8f8f4184f436e0c08ae9950431ffe466e SocketRocket: d4aabe649be1e368d1318fdf28a022d714d65748 SwiftLint: 365bcd9ffc83d0deb874e833556d82549919d6cd Yoga: feb4910aba9742cfedc059e2b2902e22ffe9954a -PODFILE CHECKSUM: 846abd8cafb42863199c6480823d97888c649e24 +PODFILE CHECKSUM: 6676eb3883eb6be7bcf93f0461d7e5bf8b57159b COCOAPODS: 1.16.2 diff --git a/apps/example/ios/Podfile.properties.json b/packages/react-native-device-activity/ios/TestHarness/Podfile.properties.json similarity index 100% rename from apps/example/ios/Podfile.properties.json rename to packages/react-native-device-activity/ios/TestHarness/Podfile.properties.json diff --git a/apps/example/Tests.xctestplan b/packages/react-native-device-activity/ios/TestHarness/Tests.xctestplan similarity index 100% rename from apps/example/Tests.xctestplan rename to packages/react-native-device-activity/ios/TestHarness/Tests.xctestplan diff --git a/apps/example/ios/reactnativedeviceactivityexample.xcodeproj/project.pbxproj b/packages/react-native-device-activity/ios/TestHarness/reactnativedeviceactivityexample.xcodeproj/project.pbxproj similarity index 94% rename from apps/example/ios/reactnativedeviceactivityexample.xcodeproj/project.pbxproj rename to packages/react-native-device-activity/ios/TestHarness/reactnativedeviceactivityexample.xcodeproj/project.pbxproj index aaa7cff8..ebe5c38d 100644 --- a/apps/example/ios/reactnativedeviceactivityexample.xcodeproj/project.pbxproj +++ b/packages/react-native-device-activity/ios/TestHarness/reactnativedeviceactivityexample.xcodeproj/project.pbxproj @@ -99,14 +99,14 @@ 6C2E3173556A471DD304B334 /* Pods-reactnativedeviceactivityexample.debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-reactnativedeviceactivityexample.debug.xcconfig"; path = "Target Support Files/Pods-reactnativedeviceactivityexample/Pods-reactnativedeviceactivityexample.debug.xcconfig"; sourceTree = ""; }; 7A4D352CD337FB3A3BF06240 /* Pods-reactnativedeviceactivityexample.release.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-reactnativedeviceactivityexample.release.xcconfig"; path = "Target Support Files/Pods-reactnativedeviceactivityexample/Pods-reactnativedeviceactivityexample.release.xcconfig"; sourceTree = ""; }; 84457EAD9B9F41CDA5B58B4E /* ActivityMonitorExtension.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; fileEncoding = 4; includeInIndex = 0; path = ActivityMonitorExtension.appex; sourceTree = BUILT_PRODUCTS_DIR; }; - 86C617632690A9F3C5D768FE /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; fileEncoding = 4; includeInIndex = 1; lastKnownFileType = text.xml; name = PrivacyInfo.xcprivacy; path = ../targets/ShieldConfiguration/PrivacyInfo.xcprivacy; sourceTree = ""; }; + 86C617632690A9F3C5D768FE /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; fileEncoding = 4; includeInIndex = 1; lastKnownFileType = text.xml; name = PrivacyInfo.xcprivacy; path = ../../targets/ShieldConfiguration/PrivacyInfo.xcprivacy; sourceTree = ""; }; 98E197012252434F88CCEEB4 /* generated.entitlements */ = {isa = PBXFileReference; explicitFileType = text.plist.entitlements; fileEncoding = 4; includeInIndex = 0; path = generated.entitlements; sourceTree = ""; }; A9A030712CFF142000D9E7E8 /* Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; fileEncoding = 4; includeInIndex = 0; path = Tests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; - A9B2DBE72CECAE610001BBAF /* Shared.swift */ = {isa = PBXFileReference; fileEncoding = 4; includeInIndex = 0; lastKnownFileType = sourcecode.swift; name = Shared.swift; path = "../../../packages/react-native-device-activity/ios/Shared.swift"; sourceTree = SOURCE_ROOT; }; - A9B2DBFF2CECB91A0001BBAF /* DeviceActivityMonitorExtension.swift */ = {isa = PBXFileReference; fileEncoding = 4; includeInIndex = 0; lastKnownFileType = sourcecode.swift; name = DeviceActivityMonitorExtension.swift; path = "../../../packages/react-native-device-activity/targets/ActivityMonitorExtension/DeviceActivityMonitorExtension.swift"; sourceTree = SOURCE_ROOT; }; - A9B2DC012CECB9430001BBAF /* ShieldConfigurationExtension.swift */ = {isa = PBXFileReference; fileEncoding = 4; includeInIndex = 0; lastKnownFileType = sourcecode.swift; name = ShieldConfigurationExtension.swift; path = "../../../packages/react-native-device-activity/targets/ShieldConfiguration/ShieldConfigurationExtension.swift"; sourceTree = SOURCE_ROOT; }; - A9B2DC032CECB9600001BBAF /* ShieldActionExtension.swift */ = {isa = PBXFileReference; fileEncoding = 4; includeInIndex = 0; lastKnownFileType = sourcecode.swift; name = ShieldActionExtension.swift; path = "../../../packages/react-native-device-activity/targets/ShieldAction/ShieldActionExtension.swift"; sourceTree = SOURCE_ROOT; }; - A9F920792D7988D400A179B2 /* Tests.xctestplan */ = {isa = PBXFileReference; lastKnownFileType = text; name = Tests.xctestplan; path = ../Tests.xctestplan; sourceTree = ""; }; + A9B2DBE72CECAE610001BBAF /* Shared.swift */ = {isa = PBXFileReference; fileEncoding = 4; includeInIndex = 0; lastKnownFileType = sourcecode.swift; name = Shared.swift; path = ../Shared.swift; sourceTree = SOURCE_ROOT; }; + A9B2DBFF2CECB91A0001BBAF /* DeviceActivityMonitorExtension.swift */ = {isa = PBXFileReference; fileEncoding = 4; includeInIndex = 0; lastKnownFileType = sourcecode.swift; name = DeviceActivityMonitorExtension.swift; path = ../../targets/ActivityMonitorExtension/DeviceActivityMonitorExtension.swift; sourceTree = SOURCE_ROOT; }; + A9B2DC012CECB9430001BBAF /* ShieldConfigurationExtension.swift */ = {isa = PBXFileReference; fileEncoding = 4; includeInIndex = 0; lastKnownFileType = sourcecode.swift; name = ShieldConfigurationExtension.swift; path = ../../targets/ShieldConfiguration/ShieldConfigurationExtension.swift; sourceTree = SOURCE_ROOT; }; + A9B2DC032CECB9600001BBAF /* ShieldActionExtension.swift */ = {isa = PBXFileReference; fileEncoding = 4; includeInIndex = 0; lastKnownFileType = sourcecode.swift; name = ShieldActionExtension.swift; path = ../../targets/ShieldAction/ShieldActionExtension.swift; sourceTree = SOURCE_ROOT; }; + A9F920792D7988D400A179B2 /* Tests.xctestplan */ = {isa = PBXFileReference; lastKnownFileType = text; name = Tests.xctestplan; path = Tests.xctestplan; sourceTree = ""; }; AA286B85B6C04FC6940260E9 /* SplashScreen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; includeInIndex = 0; lastKnownFileType = file.storyboard; name = SplashScreen.storyboard; path = reactnativedeviceactivityexample/SplashScreen.storyboard; sourceTree = ""; }; AEB321985C804DE4AB33EC69 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; includeInIndex = 0; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; BA3FB2A82413462F881AEB5A /* reactnativedeviceactivityexample-Bridging-Header.h */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 4; includeInIndex = 0; lastKnownFileType = sourcecode.c.h; name = "reactnativedeviceactivityexample-Bridging-Header.h"; path = "reactnativedeviceactivityexample/reactnativedeviceactivityexample-Bridging-Header.h"; sourceTree = ""; }; @@ -121,11 +121,11 @@ /* End PBXFileReference section */ /* Begin PBXFileSystemSynchronizedRootGroup section */ - A9A030722CFF142000D9E7E8 /* Tests */ = { + A9A030722CFF142000D9E7E8 /* ../Tests */ = { isa = PBXFileSystemSynchronizedRootGroup; exceptions = ( ); - path = Tests; + path = ../Tests; sourceTree = ""; }; /* End PBXFileSystemSynchronizedRootGroup section */ @@ -199,7 +199,7 @@ A9B2DC032CECB9600001BBAF /* ShieldActionExtension.swift */, ); name = ShieldAction; - path = ../targets/ShieldAction; + path = ../../targets/ShieldAction; sourceTree = ""; }; 2D16E6871FA4F8E400B85C8A /* Frameworks */ = { @@ -230,7 +230,7 @@ C6BB3FB112304AFCB4071189 /* expo:targets */, 13B07FAE1A68108700A75B9A /* reactnativedeviceactivityexample */, 832341AE1AAA6A7D00B99B32 /* Libraries */, - A9A030722CFF142000D9E7E8 /* Tests */, + A9A030722CFF142000D9E7E8 /* ../Tests */, 83CBBA001A601CBA00E9B192 /* Products */, 2D16E6871FA4F8E400B85C8A /* Frameworks */, D65327D7A22EEC0BE12398D9 /* Pods */, @@ -270,7 +270,7 @@ A9B2DBFF2CECB91A0001BBAF /* DeviceActivityMonitorExtension.swift */, ); name = ActivityMonitorExtension; - path = ../targets/ActivityMonitorExtension; + path = ../../targets/ActivityMonitorExtension; sourceTree = ""; }; AECFFDE3ED4343DCA9CC2989 /* Resources */ = { @@ -307,7 +307,7 @@ A9B2DC012CECB9430001BBAF /* ShieldConfigurationExtension.swift */, ); name = ShieldConfiguration; - path = ../targets/ShieldConfiguration; + path = ../../targets/ShieldConfiguration; sourceTree = ""; }; D65327D7A22EEC0BE12398D9 /* Pods */ = { @@ -404,7 +404,7 @@ A9A030762CFF142000D9E7E8 /* PBXTargetDependency */, ); fileSystemSynchronizedGroups = ( - A9A030722CFF142000D9E7E8 /* Tests */, + A9A030722CFF142000D9E7E8 /* ../Tests */, ); name = Tests; productName = Tests; @@ -542,7 +542,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "if [[ -f \"$PODS_ROOT/../.xcode.env\" ]]; then\n source \"$PODS_ROOT/../.xcode.env\"\nfi\nif [[ -f \"$PODS_ROOT/../.xcode.env.local\" ]]; then\n source \"$PODS_ROOT/../.xcode.env.local\"\nfi\n\n# The project root by default is one level up from the ios directory\nexport PROJECT_ROOT=\"$PROJECT_DIR\"/..\n\nif [[ \"$CONFIGURATION\" = *Debug* ]]; then\n export SKIP_BUNDLING=1\nfi\nif [[ -z \"$ENTRY_FILE\" ]]; then\n # Set the entry JS file using the bundler's entry resolution.\n export ENTRY_FILE=\"$(\"$NODE_BINARY\" -e \"require('expo/scripts/resolveAppEntry')\" \"$PROJECT_ROOT\" ios absolute | tail -n 1)\"\nfi\n\nif [[ -z \"$CLI_PATH\" ]]; then\n # Use Expo CLI\n export CLI_PATH=\"$(\"$NODE_BINARY\" --print \"require.resolve('@expo/cli', { paths: [require.resolve('expo/package.json')] })\")\"\nfi\nif [[ -z \"$BUNDLE_COMMAND\" ]]; then\n # Default Expo CLI command for bundling\n export BUNDLE_COMMAND=\"export:embed\"\nfi\n\n# Source .xcode.env.updates if it exists to allow\n# SKIP_BUNDLING to be unset if needed\nif [[ -f \"$PODS_ROOT/../.xcode.env.updates\" ]]; then\n source \"$PODS_ROOT/../.xcode.env.updates\"\nfi\n# Source local changes to allow overrides\n# if needed\nif [[ -f \"$PODS_ROOT/../.xcode.env.local\" ]]; then\n source \"$PODS_ROOT/../.xcode.env.local\"\nfi\n\n`\"$NODE_BINARY\" --print \"require('path').dirname(require.resolve('react-native/package.json')) + '/scripts/react-native-xcode.sh'\"`\n\n"; + shellScript = "if [[ -f \"$PODS_ROOT/../.xcode.env\" ]]; then\n source \"$PODS_ROOT/../.xcode.env\"\nfi\nif [[ -f \"$PODS_ROOT/../.xcode.env.local\" ]]; then\n source \"$PODS_ROOT/../.xcode.env.local\"\nfi\n\n# The project root by default is one level up from the ios directory\nexport PROJECT_ROOT=\"$PROJECT_DIR\"/../../../../apps/example\n\nif [[ \"$CONFIGURATION\" = *Debug* ]]; then\n export SKIP_BUNDLING=1\nfi\nif [[ -z \"$ENTRY_FILE\" ]]; then\n # Set the entry JS file using the bundler's entry resolution.\n export ENTRY_FILE=\"$(\"$NODE_BINARY\" -e \"require('expo/scripts/resolveAppEntry')\" \"$PROJECT_ROOT\" ios absolute | tail -n 1)\"\nfi\n\nif [[ -z \"$CLI_PATH\" ]]; then\n # Use Expo CLI\n export CLI_PATH=\"$(\"$NODE_BINARY\" --print \"require.resolve('@expo/cli', { paths: [require.resolve('expo/package.json')] })\")\"\nfi\nif [[ -z \"$BUNDLE_COMMAND\" ]]; then\n # Default Expo CLI command for bundling\n export BUNDLE_COMMAND=\"export:embed\"\nfi\n\n# Source .xcode.env.updates if it exists to allow\n# SKIP_BUNDLING to be unset if needed\nif [[ -f \"$PODS_ROOT/../.xcode.env.updates\" ]]; then\n source \"$PODS_ROOT/../.xcode.env.updates\"\nfi\n# Source local changes to allow overrides\n# if needed\nif [[ -f \"$PODS_ROOT/../.xcode.env.local\" ]]; then\n source \"$PODS_ROOT/../.xcode.env.local\"\nfi\n\n`\"$NODE_BINARY\" --print \"require('path').dirname(require.resolve('react-native/package.json')) + '/scripts/react-native-xcode.sh'\"`\n\n"; }; 08A4A3CD28434E44B6B9DE2E /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; @@ -833,7 +833,7 @@ "$(inherited)", " ", ); - REACT_NATIVE_PATH = "${PODS_ROOT}/../../../../node_modules/react-native"; + REACT_NATIVE_PATH = "${PODS_ROOT}/../../../../../node_modules/react-native"; SDKROOT = iphoneos; SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) DEBUG"; SWIFT_VERSION = 5.8; @@ -897,7 +897,7 @@ "$(inherited)", " ", ); - REACT_NATIVE_PATH = "${PODS_ROOT}/../../../../node_modules/react-native"; + REACT_NATIVE_PATH = "${PODS_ROOT}/../../../../../node_modules/react-native"; SDKROOT = iphoneos; SWIFT_VERSION = 5.8; USE_HERMES = true; @@ -984,7 +984,7 @@ CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; - CODE_SIGN_ENTITLEMENTS = ../targets/ShieldAction/generated.entitlements; + CODE_SIGN_ENTITLEMENTS = ../../targets/ShieldAction/generated.entitlements; CODE_SIGN_STYLE = Automatic; COPY_PHASE_STRIP = NO; CURRENT_PROJECT_VERSION = 1; @@ -992,7 +992,7 @@ DEVELOPMENT_TEAM = 34SE8X7Q58; GCC_C_LANGUAGE_STANDARD = gnu11; GENERATE_INFOPLIST_FILE = YES; - INFOPLIST_FILE = ../targets/ShieldAction/Info.plist; + INFOPLIST_FILE = ../../targets/ShieldAction/Info.plist; INFOPLIST_KEY_CFBundleDisplayName = ShieldAction; INFOPLIST_KEY_NSHumanReadableCopyright = ""; IPHONEOS_DEPLOYMENT_TARGET = 18.0; @@ -1026,7 +1026,7 @@ CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; - CODE_SIGN_ENTITLEMENTS = ../targets/ActivityMonitorExtension/generated.entitlements; + CODE_SIGN_ENTITLEMENTS = ../../targets/ActivityMonitorExtension/generated.entitlements; CODE_SIGN_STYLE = Automatic; COPY_PHASE_STRIP = NO; CURRENT_PROJECT_VERSION = 1; @@ -1034,7 +1034,7 @@ DEVELOPMENT_TEAM = 34SE8X7Q58; GCC_C_LANGUAGE_STANDARD = gnu11; GENERATE_INFOPLIST_FILE = YES; - INFOPLIST_FILE = ../targets/ActivityMonitorExtension/Info.plist; + INFOPLIST_FILE = ../../targets/ActivityMonitorExtension/Info.plist; INFOPLIST_KEY_CFBundleDisplayName = ActivityMonitorExtension; INFOPLIST_KEY_NSHumanReadableCopyright = ""; IPHONEOS_DEPLOYMENT_TARGET = 18.0; @@ -1069,7 +1069,7 @@ CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; - CODE_SIGN_ENTITLEMENTS = ../targets/ShieldConfiguration/generated.entitlements; + CODE_SIGN_ENTITLEMENTS = ../../targets/ShieldConfiguration/generated.entitlements; CODE_SIGN_STYLE = Automatic; COPY_PHASE_STRIP = NO; CURRENT_PROJECT_VERSION = 1; @@ -1077,7 +1077,7 @@ DEVELOPMENT_TEAM = 34SE8X7Q58; GCC_C_LANGUAGE_STANDARD = gnu11; GENERATE_INFOPLIST_FILE = YES; - INFOPLIST_FILE = ../targets/ShieldConfiguration/Info.plist; + INFOPLIST_FILE = ../../targets/ShieldConfiguration/Info.plist; INFOPLIST_KEY_CFBundleDisplayName = ShieldConfiguration; INFOPLIST_KEY_NSHumanReadableCopyright = ""; IPHONEOS_DEPLOYMENT_TARGET = 18.0; @@ -1110,7 +1110,7 @@ CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; - CODE_SIGN_ENTITLEMENTS = ../targets/ShieldConfiguration/generated.entitlements; + CODE_SIGN_ENTITLEMENTS = ../../targets/ShieldConfiguration/generated.entitlements; CODE_SIGN_STYLE = Automatic; COPY_PHASE_STRIP = NO; CURRENT_PROJECT_VERSION = 1; @@ -1118,7 +1118,7 @@ DEVELOPMENT_TEAM = 34SE8X7Q58; GCC_C_LANGUAGE_STANDARD = gnu11; GENERATE_INFOPLIST_FILE = YES; - INFOPLIST_FILE = ../targets/ShieldConfiguration/Info.plist; + INFOPLIST_FILE = ../../targets/ShieldConfiguration/Info.plist; INFOPLIST_KEY_CFBundleDisplayName = ShieldConfiguration; INFOPLIST_KEY_NSHumanReadableCopyright = ""; IPHONEOS_DEPLOYMENT_TARGET = 18.0; @@ -1153,7 +1153,7 @@ CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; - CODE_SIGN_ENTITLEMENTS = ../targets/ActivityMonitorExtension/generated.entitlements; + CODE_SIGN_ENTITLEMENTS = ../../targets/ActivityMonitorExtension/generated.entitlements; CODE_SIGN_STYLE = Automatic; COPY_PHASE_STRIP = NO; CURRENT_PROJECT_VERSION = 1; @@ -1161,7 +1161,7 @@ DEVELOPMENT_TEAM = 34SE8X7Q58; GCC_C_LANGUAGE_STANDARD = gnu11; GENERATE_INFOPLIST_FILE = YES; - INFOPLIST_FILE = ../targets/ActivityMonitorExtension/Info.plist; + INFOPLIST_FILE = ../../targets/ActivityMonitorExtension/Info.plist; INFOPLIST_KEY_CFBundleDisplayName = ActivityMonitorExtension; INFOPLIST_KEY_NSHumanReadableCopyright = ""; IPHONEOS_DEPLOYMENT_TARGET = 18.0; @@ -1194,7 +1194,7 @@ CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; - CODE_SIGN_ENTITLEMENTS = ../targets/ShieldAction/generated.entitlements; + CODE_SIGN_ENTITLEMENTS = ../../targets/ShieldAction/generated.entitlements; CODE_SIGN_STYLE = Automatic; COPY_PHASE_STRIP = NO; CURRENT_PROJECT_VERSION = 1; @@ -1202,7 +1202,7 @@ DEVELOPMENT_TEAM = 34SE8X7Q58; GCC_C_LANGUAGE_STANDARD = gnu11; GENERATE_INFOPLIST_FILE = YES; - INFOPLIST_FILE = ../targets/ShieldAction/Info.plist; + INFOPLIST_FILE = ../../targets/ShieldAction/Info.plist; INFOPLIST_KEY_CFBundleDisplayName = ShieldAction; INFOPLIST_KEY_NSHumanReadableCopyright = ""; IPHONEOS_DEPLOYMENT_TARGET = 18.0; diff --git a/apps/example/ios/reactnativedeviceactivityexample.xcodeproj/xcshareddata/xcschemes/Tests.xcscheme b/packages/react-native-device-activity/ios/TestHarness/reactnativedeviceactivityexample.xcodeproj/xcshareddata/xcschemes/Tests.xcscheme similarity index 97% rename from apps/example/ios/reactnativedeviceactivityexample.xcodeproj/xcshareddata/xcschemes/Tests.xcscheme rename to packages/react-native-device-activity/ios/TestHarness/reactnativedeviceactivityexample.xcodeproj/xcshareddata/xcschemes/Tests.xcscheme index 56614fcc..ddbc6e47 100644 --- a/apps/example/ios/reactnativedeviceactivityexample.xcodeproj/xcshareddata/xcschemes/Tests.xcscheme +++ b/packages/react-native-device-activity/ios/TestHarness/reactnativedeviceactivityexample.xcodeproj/xcshareddata/xcschemes/Tests.xcscheme @@ -14,7 +14,7 @@ shouldUseLaunchSchemeArgsEnv = "YES"> diff --git a/apps/example/ios/reactnativedeviceactivityexample.xcodeproj/xcshareddata/xcschemes/reactnativedeviceactivityexample.xcscheme b/packages/react-native-device-activity/ios/TestHarness/reactnativedeviceactivityexample.xcodeproj/xcshareddata/xcschemes/reactnativedeviceactivityexample.xcscheme similarity index 100% rename from apps/example/ios/reactnativedeviceactivityexample.xcodeproj/xcshareddata/xcschemes/reactnativedeviceactivityexample.xcscheme rename to packages/react-native-device-activity/ios/TestHarness/reactnativedeviceactivityexample.xcodeproj/xcshareddata/xcschemes/reactnativedeviceactivityexample.xcscheme diff --git a/apps/example/ios/reactnativedeviceactivityexample.xcworkspace/contents.xcworkspacedata b/packages/react-native-device-activity/ios/TestHarness/reactnativedeviceactivityexample.xcworkspace/contents.xcworkspacedata similarity index 100% rename from apps/example/ios/reactnativedeviceactivityexample.xcworkspace/contents.xcworkspacedata rename to packages/react-native-device-activity/ios/TestHarness/reactnativedeviceactivityexample.xcworkspace/contents.xcworkspacedata diff --git a/apps/example/ios/reactnativedeviceactivityexample/AppDelegate.h b/packages/react-native-device-activity/ios/TestHarness/reactnativedeviceactivityexample/AppDelegate.h similarity index 100% rename from apps/example/ios/reactnativedeviceactivityexample/AppDelegate.h rename to packages/react-native-device-activity/ios/TestHarness/reactnativedeviceactivityexample/AppDelegate.h diff --git a/apps/example/ios/reactnativedeviceactivityexample/AppDelegate.mm b/packages/react-native-device-activity/ios/TestHarness/reactnativedeviceactivityexample/AppDelegate.mm similarity index 100% rename from apps/example/ios/reactnativedeviceactivityexample/AppDelegate.mm rename to packages/react-native-device-activity/ios/TestHarness/reactnativedeviceactivityexample/AppDelegate.mm diff --git a/apps/example/ios/reactnativedeviceactivityexample/Images.xcassets/AppIcon.appiconset/App-Icon-1024x1024@1x.png b/packages/react-native-device-activity/ios/TestHarness/reactnativedeviceactivityexample/Images.xcassets/AppIcon.appiconset/App-Icon-1024x1024@1x.png similarity index 100% rename from apps/example/ios/reactnativedeviceactivityexample/Images.xcassets/AppIcon.appiconset/App-Icon-1024x1024@1x.png rename to packages/react-native-device-activity/ios/TestHarness/reactnativedeviceactivityexample/Images.xcassets/AppIcon.appiconset/App-Icon-1024x1024@1x.png diff --git a/apps/example/ios/reactnativedeviceactivityexample/Images.xcassets/AppIcon.appiconset/Contents.json b/packages/react-native-device-activity/ios/TestHarness/reactnativedeviceactivityexample/Images.xcassets/AppIcon.appiconset/Contents.json similarity index 99% rename from apps/example/ios/reactnativedeviceactivityexample/Images.xcassets/AppIcon.appiconset/Contents.json rename to packages/react-native-device-activity/ios/TestHarness/reactnativedeviceactivityexample/Images.xcassets/AppIcon.appiconset/Contents.json index 90d8d4c2..5f6956c1 100644 --- a/apps/example/ios/reactnativedeviceactivityexample/Images.xcassets/AppIcon.appiconset/Contents.json +++ b/packages/react-native-device-activity/ios/TestHarness/reactnativedeviceactivityexample/Images.xcassets/AppIcon.appiconset/Contents.json @@ -11,4 +11,4 @@ "version": 1, "author": "expo" } -} \ No newline at end of file +} diff --git a/packages/react-native-device-activity/ios/TestHarness/reactnativedeviceactivityexample/Images.xcassets/Contents.json b/packages/react-native-device-activity/ios/TestHarness/reactnativedeviceactivityexample/Images.xcassets/Contents.json new file mode 100644 index 00000000..b4ded435 --- /dev/null +++ b/packages/react-native-device-activity/ios/TestHarness/reactnativedeviceactivityexample/Images.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info": { + "version": 1, + "author": "expo" + } +} diff --git a/apps/example/ios/reactnativedeviceactivityexample/Images.xcassets/SplashScreenBackground.imageset/Contents.json b/packages/react-native-device-activity/ios/TestHarness/reactnativedeviceactivityexample/Images.xcassets/SplashScreen.imageset/Contents.json similarity index 99% rename from apps/example/ios/reactnativedeviceactivityexample/Images.xcassets/SplashScreenBackground.imageset/Contents.json rename to packages/react-native-device-activity/ios/TestHarness/reactnativedeviceactivityexample/Images.xcassets/SplashScreen.imageset/Contents.json index 3cf84897..7d28020e 100644 --- a/apps/example/ios/reactnativedeviceactivityexample/Images.xcassets/SplashScreenBackground.imageset/Contents.json +++ b/packages/react-native-device-activity/ios/TestHarness/reactnativedeviceactivityexample/Images.xcassets/SplashScreen.imageset/Contents.json @@ -18,4 +18,4 @@ "version": 1, "author": "expo" } -} \ No newline at end of file +} diff --git a/apps/example/ios/reactnativedeviceactivityexample/Images.xcassets/SplashScreen.imageset/image.png b/packages/react-native-device-activity/ios/TestHarness/reactnativedeviceactivityexample/Images.xcassets/SplashScreen.imageset/image.png similarity index 100% rename from apps/example/ios/reactnativedeviceactivityexample/Images.xcassets/SplashScreen.imageset/image.png rename to packages/react-native-device-activity/ios/TestHarness/reactnativedeviceactivityexample/Images.xcassets/SplashScreen.imageset/image.png diff --git a/apps/example/ios/reactnativedeviceactivityexample/Images.xcassets/SplashScreen.imageset/Contents.json b/packages/react-native-device-activity/ios/TestHarness/reactnativedeviceactivityexample/Images.xcassets/SplashScreenBackground.imageset/Contents.json similarity index 99% rename from apps/example/ios/reactnativedeviceactivityexample/Images.xcassets/SplashScreen.imageset/Contents.json rename to packages/react-native-device-activity/ios/TestHarness/reactnativedeviceactivityexample/Images.xcassets/SplashScreenBackground.imageset/Contents.json index 3cf84897..7d28020e 100644 --- a/apps/example/ios/reactnativedeviceactivityexample/Images.xcassets/SplashScreen.imageset/Contents.json +++ b/packages/react-native-device-activity/ios/TestHarness/reactnativedeviceactivityexample/Images.xcassets/SplashScreenBackground.imageset/Contents.json @@ -18,4 +18,4 @@ "version": 1, "author": "expo" } -} \ No newline at end of file +} diff --git a/apps/example/ios/reactnativedeviceactivityexample/Images.xcassets/SplashScreenBackground.imageset/image.png b/packages/react-native-device-activity/ios/TestHarness/reactnativedeviceactivityexample/Images.xcassets/SplashScreenBackground.imageset/image.png similarity index 100% rename from apps/example/ios/reactnativedeviceactivityexample/Images.xcassets/SplashScreenBackground.imageset/image.png rename to packages/react-native-device-activity/ios/TestHarness/reactnativedeviceactivityexample/Images.xcassets/SplashScreenBackground.imageset/image.png diff --git a/apps/example/ios/reactnativedeviceactivityexample/Images.xcassets/kingstinct.imageset/Contents.json b/packages/react-native-device-activity/ios/TestHarness/reactnativedeviceactivityexample/Images.xcassets/kingstinct.imageset/Contents.json similarity index 99% rename from apps/example/ios/reactnativedeviceactivityexample/Images.xcassets/kingstinct.imageset/Contents.json rename to packages/react-native-device-activity/ios/TestHarness/reactnativedeviceactivityexample/Images.xcassets/kingstinct.imageset/Contents.json index 4ec291cf..342129f0 100644 --- a/apps/example/ios/reactnativedeviceactivityexample/Images.xcassets/kingstinct.imageset/Contents.json +++ b/packages/react-native-device-activity/ios/TestHarness/reactnativedeviceactivityexample/Images.xcassets/kingstinct.imageset/Contents.json @@ -18,4 +18,4 @@ "version": 1, "author": "expo" } -} \ No newline at end of file +} diff --git a/apps/example/ios/reactnativedeviceactivityexample/Images.xcassets/kingstinct.imageset/kingstinct.png b/packages/react-native-device-activity/ios/TestHarness/reactnativedeviceactivityexample/Images.xcassets/kingstinct.imageset/kingstinct.png similarity index 100% rename from apps/example/ios/reactnativedeviceactivityexample/Images.xcassets/kingstinct.imageset/kingstinct.png rename to packages/react-native-device-activity/ios/TestHarness/reactnativedeviceactivityexample/Images.xcassets/kingstinct.imageset/kingstinct.png diff --git a/apps/example/ios/reactnativedeviceactivityexample/Info.plist b/packages/react-native-device-activity/ios/TestHarness/reactnativedeviceactivityexample/Info.plist similarity index 100% rename from apps/example/ios/reactnativedeviceactivityexample/Info.plist rename to packages/react-native-device-activity/ios/TestHarness/reactnativedeviceactivityexample/Info.plist diff --git a/apps/example/ios/reactnativedeviceactivityexample/SplashScreen.storyboard b/packages/react-native-device-activity/ios/TestHarness/reactnativedeviceactivityexample/SplashScreen.storyboard similarity index 100% rename from apps/example/ios/reactnativedeviceactivityexample/SplashScreen.storyboard rename to packages/react-native-device-activity/ios/TestHarness/reactnativedeviceactivityexample/SplashScreen.storyboard diff --git a/apps/example/ios/reactnativedeviceactivityexample/Supporting/Expo.plist b/packages/react-native-device-activity/ios/TestHarness/reactnativedeviceactivityexample/Supporting/Expo.plist similarity index 100% rename from apps/example/ios/reactnativedeviceactivityexample/Supporting/Expo.plist rename to packages/react-native-device-activity/ios/TestHarness/reactnativedeviceactivityexample/Supporting/Expo.plist diff --git a/apps/example/ios/reactnativedeviceactivityexample/main.m b/packages/react-native-device-activity/ios/TestHarness/reactnativedeviceactivityexample/main.m similarity index 100% rename from apps/example/ios/reactnativedeviceactivityexample/main.m rename to packages/react-native-device-activity/ios/TestHarness/reactnativedeviceactivityexample/main.m diff --git a/apps/example/ios/reactnativedeviceactivityexample/noop-file.swift b/packages/react-native-device-activity/ios/TestHarness/reactnativedeviceactivityexample/noop-file.swift similarity index 100% rename from apps/example/ios/reactnativedeviceactivityexample/noop-file.swift rename to packages/react-native-device-activity/ios/TestHarness/reactnativedeviceactivityexample/noop-file.swift diff --git a/apps/example/ios/reactnativedeviceactivityexample/reactnativedeviceactivityexample-Bridging-Header.h b/packages/react-native-device-activity/ios/TestHarness/reactnativedeviceactivityexample/reactnativedeviceactivityexample-Bridging-Header.h similarity index 100% rename from apps/example/ios/reactnativedeviceactivityexample/reactnativedeviceactivityexample-Bridging-Header.h rename to packages/react-native-device-activity/ios/TestHarness/reactnativedeviceactivityexample/reactnativedeviceactivityexample-Bridging-Header.h diff --git a/apps/example/ios/reactnativedeviceactivityexample/reactnativedeviceactivityexample.entitlements b/packages/react-native-device-activity/ios/TestHarness/reactnativedeviceactivityexample/reactnativedeviceactivityexample.entitlements similarity index 100% rename from apps/example/ios/reactnativedeviceactivityexample/reactnativedeviceactivityexample.entitlements rename to packages/react-native-device-activity/ios/TestHarness/reactnativedeviceactivityexample/reactnativedeviceactivityexample.entitlements diff --git a/apps/example/ios/Tests/ComparisonTests.swift b/packages/react-native-device-activity/ios/Tests/ComparisonTests.swift similarity index 100% rename from apps/example/ios/Tests/ComparisonTests.swift rename to packages/react-native-device-activity/ios/Tests/ComparisonTests.swift diff --git a/apps/example/ios/Tests/FamilySelectionIdTests.swift b/packages/react-native-device-activity/ios/Tests/FamilySelectionIdTests.swift similarity index 100% rename from apps/example/ios/Tests/FamilySelectionIdTests.swift rename to packages/react-native-device-activity/ios/Tests/FamilySelectionIdTests.swift diff --git a/apps/example/ios/Tests/IsShieldActiveTests.swift b/packages/react-native-device-activity/ios/Tests/IsShieldActiveTests.swift similarity index 93% rename from apps/example/ios/Tests/IsShieldActiveTests.swift rename to packages/react-native-device-activity/ios/Tests/IsShieldActiveTests.swift index ba65062b..465ff63e 100644 --- a/apps/example/ios/Tests/IsShieldActiveTests.swift +++ b/packages/react-native-device-activity/ios/Tests/IsShieldActiveTests.swift @@ -8,6 +8,8 @@ import FamilyControls import ManagedSettings import Testing +// NOTE: These assertions fail on simulator when xcodebuild is run with +// CODE_SIGNING_ALLOWED=NO CODE_SIGNING_REQUIRED=NO. @Suite(.serialized) struct IsShieldActiveTests { @Test func shieldIsNotActive() async throws { diff --git a/apps/example/ios/Tests/SkipTests.swift b/packages/react-native-device-activity/ios/Tests/SkipTests.swift similarity index 100% rename from apps/example/ios/Tests/SkipTests.swift rename to packages/react-native-device-activity/ios/Tests/SkipTests.swift diff --git a/apps/example/ios/Tests/TextReplacementTests.swift b/packages/react-native-device-activity/ios/Tests/TextReplacementTests.swift similarity index 100% rename from apps/example/ios/Tests/TextReplacementTests.swift rename to packages/react-native-device-activity/ios/Tests/TextReplacementTests.swift diff --git a/apps/example/ios/Tests/UnionTests.swift b/packages/react-native-device-activity/ios/Tests/UnionTests.swift similarity index 100% rename from apps/example/ios/Tests/UnionTests.swift rename to packages/react-native-device-activity/ios/Tests/UnionTests.swift diff --git a/packages/react-native-device-activity/jest.runtime.config.js b/packages/react-native-device-activity/jest.runtime.config.js new file mode 100644 index 00000000..0f0f53a2 --- /dev/null +++ b/packages/react-native-device-activity/jest.runtime.config.js @@ -0,0 +1,14 @@ +module.exports = { + testEnvironment: "node", + clearMocks: true, + roots: ["/src"], + testRegex: ".*\\.test\\.ts$", + transform: { + "^.+\\.[jt]sx?$": [ + "babel-jest", + { + configFile: require.resolve("expo-module-scripts/babel.config.cli.js"), + }, + ], + }, +}; diff --git a/packages/react-native-device-activity/package.json b/packages/react-native-device-activity/package.json index 48b40909..b8e9dd4c 100644 --- a/packages/react-native-device-activity/package.json +++ b/packages/react-native-device-activity/package.json @@ -9,11 +9,13 @@ "clean": "expo-module clean", "lint": "expo-module lint", "typecheck": "tsc --noEmit", - "test": "expo-module test", + "test": "CI=1 bun run test:runtime && CI=1 bun run test:plugin", + "test:runtime": "expo-module test --config ./jest.runtime.config.js", + "test:plugin": "expo-module test plugin", "prepublishOnly": "expo-module prepublishOnly && tsc && cp ../../README.md ./README.md", "expo-module": "expo-module", - "open:ios": "xed example/ios", - "open:android": "open -a \"Android Studio\" example/android" + "open:ios": "xed ios/TestHarness", + "open:android": "open -a \"Android Studio\" ../../apps/example/android" }, "keywords": [ "react-native", diff --git a/packages/react-native-device-activity/plugin/__tests__/config-plugin.test.ts b/packages/react-native-device-activity/plugin/__tests__/config-plugin.test.ts new file mode 100644 index 00000000..6e332c73 --- /dev/null +++ b/packages/react-native-device-activity/plugin/__tests__/config-plugin.test.ts @@ -0,0 +1,111 @@ +jest.mock("fs", () => ({ + existsSync: jest.fn(), + mkdirSync: jest.fn(), + cpSync: jest.fn(), + readdirSync: jest.fn(), + lstatSync: jest.fn(), +})); + +const fs = require("fs"); + +const createExpoTargetConfig = require("../../config-plugin/createExpoTargetConfig"); +const getAppGroupFromExpoConfig = require("../../config-plugin/getAppGroupFromExpoConfig"); + +describe("config plugin helpers", () => { + const originalEnv = { ...process.env }; + + beforeEach(() => { + jest.clearAllMocks(); + process.env = { ...originalEnv }; + }); + + afterAll(() => { + process.env = originalEnv; + }); + + describe("getAppGroupFromExpoConfig", () => { + it("extracts appGroup from react-native-device-activity plugin config", () => { + const config = { + plugins: [ + ["react-native-device-activity", { appGroup: "group.primary" }], + ], + }; + + expect(getAppGroupFromExpoConfig(config)).toBe("group.primary"); + }); + + it("extracts appGroup from internal example path when env toggle is enabled", () => { + process.env.INTERNALLY_TEST_EXAMPLE_PROJECT = "true"; + const config = { + plugins: [ + [ + "../../packages/react-native-device-activity/app.plugin.js", + { appGroup: "group.internal" }, + ], + ], + }; + + expect(getAppGroupFromExpoConfig(config)).toBe("group.internal"); + }); + + it("logs and returns undefined when appGroup is missing", () => { + const errorSpy = jest + .spyOn(console, "error") + .mockImplementation(() => {}); + const config = { + plugins: [["react-native-device-activity", {}]], + }; + + expect(getAppGroupFromExpoConfig(config)).toBeUndefined(); + expect(errorSpy).toHaveBeenCalled(); + errorSpy.mockRestore(); + }); + }); + + describe("withCopyTargetFolder", () => { + it("skips copying when copyToTargetFolder is false and env override is absent", () => { + const withCopyTargetFolder = require("../../config-plugin/withCopyTargetFolder"); + const config = { _internal: { projectRoot: "/tmp/example" } }; + + const result = withCopyTargetFolder(config, { + copyToTargetFolder: false, + }); + + expect(result).toBe(config); + expect(fs.cpSync).not.toHaveBeenCalled(); + }); + + it("copies targets when COPY_TO_TARGET_FOLDER is set", () => { + process.env.COPY_TO_TARGET_FOLDER = "true"; + fs.existsSync.mockReturnValue(true); + fs.readdirSync.mockReturnValue(["ShieldAction"]); + fs.lstatSync.mockReturnValue({ isDirectory: () => true }); + + const withCopyTargetFolder = require("../../config-plugin/withCopyTargetFolder"); + const config = { _internal: { projectRoot: "/tmp/example" } }; + + withCopyTargetFolder(config, { copyToTargetFolder: false }); + + expect(fs.cpSync).toHaveBeenCalled(); + }); + }); + + describe("createExpoTargetConfig", () => { + it("returns target config with deterministic entitlements", () => { + const fn = createExpoTargetConfig.createConfig("shield-action"); + const config = { + plugins: [ + ["react-native-device-activity", { appGroup: "group.primary" }], + ], + }; + + expect(fn(config)).toEqual({ + type: "shield-action", + entitlements: { + "com.apple.developer.family-controls": true, + "com.apple.security.application-groups": ["group.primary"], + }, + }); + }); + }); +}); diff --git a/packages/react-native-device-activity/plugin/jest.config.js b/packages/react-native-device-activity/plugin/jest.config.js new file mode 100644 index 00000000..d52d0349 --- /dev/null +++ b/packages/react-native-device-activity/plugin/jest.config.js @@ -0,0 +1 @@ +module.exports = require("expo-module-scripts/jest-preset-plugin"); diff --git a/packages/react-native-device-activity/src/index.test.ts b/packages/react-native-device-activity/src/index.test.ts index b32e1b29..e5f0a024 100644 --- a/packages/react-native-device-activity/src/index.test.ts +++ b/packages/react-native-device-activity/src/index.test.ts @@ -1,32 +1,70 @@ -// todo: skipping for now +jest.mock("expo-modules-core", () => { + class MockEventEmitter { + addListener() { + return { remove: jest.fn() }; + } -describe("test", () => { - test("Should export sheet picker views", () => { + removeAllListeners() {} + } + + return { + EventEmitter: MockEventEmitter, + EventSubscription: class {}, + requireNativeViewManager: jest.fn(() => () => null), + }; +}); + +describe("index runtime wrapper", () => { + beforeEach(() => { + jest.clearAllMocks(); + jest.resetModules(); + }); + + test("delegates stopMonitoring to native module", () => { jest.isolateModules(() => { - const module = require("./"); - expect(module.DeviceActivitySelectionSheetView).toBeDefined(); - expect(module.DeviceActivitySelectionSheetViewPersisted).toBeDefined(); + const mockNativeModule = { + stopMonitoring: jest.fn(), + startMonitoring: jest.fn(), + }; + + jest.doMock("./ReactNativeDeviceActivityModule", () => ({ + __esModule: true, + default: mockNativeModule, + })); + + const { stopMonitoring } = require("./index"); + const activities = ["activity-a"]; + + stopMonitoring(activities); + + expect(mockNativeModule.stopMonitoring).toHaveBeenCalledWith(activities); }); }); - test("Should call stopMonitoring", () => { - const mockStopMonitoring = jest.fn(); - jest.mock("./ReactNativeDeviceActivityModule", () => ({ - stopMonitoring: mockStopMonitoring, - })); - const { stopMonitoring } = require("./"); - stopMonitoring(); - expect(mockStopMonitoring).toHaveBeenCalled(); - }); + test("delegates startMonitoring to native module", async () => { + await jest.isolateModulesAsync(async () => { + const mockNativeModule = { + stopMonitoring: jest.fn(), + startMonitoring: jest.fn().mockResolvedValue(undefined), + }; + + jest.doMock("./ReactNativeDeviceActivityModule", () => ({ + __esModule: true, + default: mockNativeModule, + })); - test("Should call startMonitoring", () => { - jest.resetAllMocks(); - const mockStartMonitoring = jest.fn(); - jest.mock("./ReactNativeDeviceActivityModule", () => ({ - startMonitoring: mockStartMonitoring, - })); - const { startMonitoring } = require("./"); - startMonitoring("test", {}, []); - expect(mockStartMonitoring).toHaveBeenCalled(); + const { startMonitoring } = require("./index"); + + await startMonitoring( + "activity-a", + { + intervalStart: { hour: 0, minute: 0 }, + intervalEnd: { hour: 23, minute: 59 }, + }, + [], + ); + + expect(mockNativeModule.startMonitoring).toHaveBeenCalled(); + }); }); }); diff --git a/apps/example/targets/ActivityMonitorExtension/generated.entitlements b/packages/react-native-device-activity/targets/ActivityMonitorExtension/generated.entitlements similarity index 100% rename from apps/example/targets/ActivityMonitorExtension/generated.entitlements rename to packages/react-native-device-activity/targets/ActivityMonitorExtension/generated.entitlements diff --git a/apps/example/targets/ShieldAction/generated.entitlements b/packages/react-native-device-activity/targets/ShieldAction/generated.entitlements similarity index 100% rename from apps/example/targets/ShieldAction/generated.entitlements rename to packages/react-native-device-activity/targets/ShieldAction/generated.entitlements diff --git a/apps/example/targets/ShieldConfiguration/PrivacyInfo.xcprivacy b/packages/react-native-device-activity/targets/ShieldConfiguration/PrivacyInfo.xcprivacy similarity index 100% rename from apps/example/targets/ShieldConfiguration/PrivacyInfo.xcprivacy rename to packages/react-native-device-activity/targets/ShieldConfiguration/PrivacyInfo.xcprivacy diff --git a/apps/example/targets/ShieldConfiguration/generated.entitlements b/packages/react-native-device-activity/targets/ShieldConfiguration/generated.entitlements similarity index 100% rename from apps/example/targets/ShieldConfiguration/generated.entitlements rename to packages/react-native-device-activity/targets/ShieldConfiguration/generated.entitlements