diff --git a/BlackBerry Dynamics Software Development Kit.pdf b/BlackBerry Dynamics Software Development Kit.pdf deleted file mode 100644 index 270ca54..0000000 Binary files a/BlackBerry Dynamics Software Development Kit.pdf and /dev/null differ diff --git a/README.md b/README.md index 53738d7..ea07612 100644 --- a/README.md +++ b/README.md @@ -4,45 +4,54 @@ This page provides an overview on how to use the BlackBerry Dynamics SDK for Rea # Supportability #### Development environment - Mac OS - - Windows 10 (Android only) + - Windows 10, 11 (Android only) #### Node.js - 12.x (for React Native version < 0.68.0) - - 14.x (for React Native version >= 0.68.0) + - 18.x +#### Ruby + - 2.7.5 (for React Native version >=0.70.x) +**React Native official [documenation](https://reactnative.dev/docs/0.70/environment-setup)**. +React Native uses a .ruby-version file to make sure that your version of Ruby is aligned with what is needed. Currently, macOS 13.2 is shipped with Ruby 2.6.10, which is not what is required by this version of React Native (2.7.5). Our suggestion is to install a Ruby version manager and to install the proper version of Ruby in your system. #### Package manager - yarn #### React Native - - 0.64.x (deprecated) - - 0.65.x (deprecated) - - 0.66.x - - 0.67.x - - 0.68.x (0.68.2 is latest supported) + - 0.66.x (deprecated) + - 0.67.x (deprecated) + - 0.68.x (deprecated) + - 0.69.x (deprecated) + - 0.70.x + - 0.71.x + - 0.72.x #### iOS - Xcode 12+ - iOS 14+ (for BlackBerry Dynamics SDK for iOS v11.1) - - iOS 15+ (for BlackBerry Dynamics SDK for iOS v11.2) + - iOS 15+ (for BlackBerry Dynamics SDK for iOS v11.2, v12.0) - cocoapods 1.10.2+ #### Android - Java 8 (for React Native version < 0.68.0) - Java 11 (for React Native version >= 0.68.0) - Android 9+, API 28+ (for BlackBerry Dynamics SDK for Android v11.1) - - Android 10+, API 29+ (for BlackBerry Dynamics SDK for Android v11.2) + - Android 10+, API 29+ (for BlackBerry Dynamics SDK for Android v11.2, v12.0) - NDK 20.1.5948944 (for React Native version < 0.66.0) - NDK 21.4.7075529 (for React Native version >= 0.66.0) #### BlackBerry Dynamics Dynamics SDK for iOS and Android are now installed as part of the [Base](https://github.com/blackberry/BlackBerry-Dynamics-React-Native-SDK/tree/master/modules/BlackBerry-Dynamics-for-React-Native-Base) module using CocoaPods & Gradle. -By default, `BlackBerry-Dynamics-for-React-Native-Base` module will integrate **11.1** (11.1.0.62) version of BlackBerry Dynamics SDK for Android and iOS. -To integrate **11.2** version see "Using other released version" [instructions](https://github.com/blackberry/BlackBerry-Dynamics-React-Native-SDK/tree/master/modules/BlackBerry-Dynamics-for-React-Native-Base#dynamics-sdk-dependency) for both iOS and Android platforms in [BlackBerry-Dynamics-for-React-Native-Base](https://github.com/blackberry/BlackBerry-Dynamics-React-Native-SDK/tree/master/modules/BlackBerry-Dynamics-for-React-Native-Base#dynamics-sdk-dependency). +By default, `BlackBerry-Dynamics-for-React-Native-Base` module will integrate **12.0** version of BlackBerry Dynamics SDK for Android (12.0.1.79) and iOS (12.0.1.79). +Currently, the **other** supported versions are 11.1 and 11.2. +To integrate **11.1** or **11.2** version see "Using other released version" [instructions](https://github.com/blackberry/BlackBerry-Dynamics-React-Native-SDK/tree/master/modules/BlackBerry-Dynamics-for-React-Native-Base#dynamics-sdk-dependency) for both iOS and Android platforms in [BlackBerry-Dynamics-for-React-Native-Base](https://github.com/blackberry/BlackBerry-Dynamics-React-Native-SDK/tree/master/modules/BlackBerry-Dynamics-for-React-Native-Base#dynamics-sdk-dependency). BlackBerry Dynamics SDK for iOS - BlackBerry Dynamics SDK for iOS v11.1, check environment requirements [here](https://docs.blackberry.com/en/development-tools/blackberry-dynamics-sdk-ios/11_1). - BlackBerry Dynamics SDK for iOS v11.2, check environment requirements [here](https://docs.blackberry.com/en/development-tools/blackberry-dynamics-sdk-ios/11_2). + - BlackBerry Dynamics SDK for iOS v12.0, check environment requirements [here](https://docs.blackberry.com/en/development-tools/blackberry-dynamics-sdk-ios/12_0). BlackBerry Dynamics SDK for Android - BlackBerry Dynamics SDK for Android v11.1, check environment requirements [here](https://docs.blackberry.com/en/development-tools/blackberry-dynamics-sdk-android/11_1). - BlackBerry Dynamics SDK for Android v11.2, check environment requirements [here](https://docs.blackberry.com/en/development-tools/blackberry-dynamics-sdk-android/11_2). + - BlackBerry Dynamics SDK for Android v12.0, check environment requirements [here](https://docs.blackberry.com/en/development-tools/blackberry-dynamics-sdk-android/12_0). #### BlackBerry Dynamics Launcher - - BlackBerry Dynamics Launcher library for iOS v3.5, check details [here](https://docs.blackberry.com/en/development-tools/blackberry-dynamics-launcher-framework-for-ios/3_5). - - BlackBerry Dynamics Launcher library for Android v3.5, check details [here](https://docs.blackberry.com/en/development-tools/blackberry-dynamics-launcher-framework-for-android/3_5). + - BlackBerry Dynamics Launcher library for iOS v12.0, check details [here](https://docs.blackberry.com/en/development-tools/blackberry-dynamics-launcher-framework-for-ios/12_0). + - BlackBerry Dynamics Launcher library for Android v12.0, check details [here](https://docs.blackberry.com/en/development-tools/blackberry-dynamics-launcher-framework-for-android/12_0). # Features #### Integration with BlackBerry Dynamics @@ -77,23 +86,86 @@ To implement some ICC capabilities in a Dynamics React Native application `Black #### Launcher integration `BlackBerry-Dynamics-for-React-Native-Launcher` provides Launcher integration in Dynamics React Native application. -#### Android SafetyNet -BlackBerry UEM version 12.10 and later supports [SafetyNet](https://developers.google.com/android/reference/com/google/android/gms/safetynet/SafetyNet) attestation for BlackBerry Dynamics apps. You can use SafetyNet to extend BlackBerry's root and exploit detection by adding checks for device tampering and application integrity. For more information about SafetyNet attestation, implementation considerations, and instructions for enabling the feature, see the [BlackBerry UEM Configuration Guide](https://docs.blackberry.com/en/endpoint-management/blackberry-uem/current/installation-configuration/configuration). This chapter details considerations for developers who want to enable SafetyNet support for their BlackBerry Dynamics apps. -###### Adding the GDSafetyNet library to the app project -The BlackBerry Dynamics SDK for Android version 5.0 and later includes a GDSafetyNet library. To support SafetyNet, add this library to the app project dependencies along with the main GDLibrary. +#### Android Play Integrity attestation +BlackBerry UEM version 12.18 and later supports Play Integrity attestation for BlackBerry Dynamics apps. BlackBerry UEM version 12.17 and earlier supports [SafetyNet](https://developers.google.com/android/reference/com/google/android/gms/safetynet/SafetyNet) attestation for BlackBerry Dynamics apps. For information on SafetyNet attestation, refer to previous versions of the [SDK documentation](https://docs.blackberry.com/en/development-tools/blackberry-dynamics-sdk-android/11_1/blackberry-dynamics-sdk-android-devguide/Implementing-SafetyNet-attestation-for-BlackBerry-Dynamics-apps). -The GDSafetyNet library includes all of the client-side source code that is required to support SafetyNet. No additional app code is required. The GDSafetyNet library requires Google Play Services 11.0 or later to use device SafetyNet APIs. Verify that your BlackBerry Dynamics app is dependent on only a single version of Google Play Services. +You can use Play Integrity to extend BlackBerry root and exploit detection and to enhance app security and integrity. For more information about Play Integrity attestation, implementation considerations, and instructions for enabling the feature, see the [BlackBerry UEM documentation](https://docs.blackberry.com/en/endpoint-management/blackberry-uem/12_17/administration/device-features-it-policies/managing-attestation). This chapter details considerations for developers who want to enable Play Integrity support for their BlackBerry Dynamics apps. + +To support Play Integrity, you must complete the [Play Integrity prerequisites](https://docs.blackberry.com/en/development-tools/blackberry-dynamics-sdk-android/11_2/blackberry-dynamics-sdk-android-devguide/Implementing-SafetyNet-attestation-for-BlackBerry-Dynamics-apps/prerequisites-for-play-integrity-attestation), add a [new library component to the app project](https://docs.blackberry.com/en/development-tools/blackberry-dynamics-sdk-android/11_2/blackberry-dynamics-sdk-android-devguide/Implementing-SafetyNet-attestation-for-BlackBerry-Dynamics-apps/Adding-the-GDSafetyNet-library-to-the-app-project), and [update the BlackBerry Dynamics application policy file](https://docs.blackberry.com/en/development-tools/blackberry-dynamics-sdk-android/11_2/blackberry-dynamics-sdk-android-devguide/Implementing-SafetyNet-attestation-for-BlackBerry-Dynamics-apps/Updating-the-BlackBerry-Dynamics-application-policy-file). +##### Prerequisites for Play Integrity attestation +Play Integrity attestation is dependent on configurations made within the [Google Play console](https://play.google.com/console/). Use the following steps to configure Play Integrity attestation for your apps: + - In the Google Play console, select the app you want to configure for Play Integrity attestation, then click Setup > App Integrity. + - On the Integrity API tab, in the Device Integrity section, ensure that the checkboxes for MEETS_BASIC_INTEGRITY and MEETS_STRONG_INTEGRITY are enabled. + - On the App Signing tab, make note of the SHA-256 certificate fingerprint for the App signing key certificate and the Upload key certificate. These certificate fingerprints are used when you configure your [BlackBerry Dynamics application policy file](https://docs.blackberry.com/en/development-tools/blackberry-dynamics-sdk-android/11_2/blackberry-dynamics-sdk-android-devguide/Implementing-SafetyNet-attestation-for-BlackBerry-Dynamics-apps/Updating-the-BlackBerry-Dynamics-application-policy-file). +> After completeing the task: +> - For more information on the Google Play Console, see the [Google Play console documentation](https://support.google.com/googleplay/android-developer/answer/6112435?hl=en&ref_topic=3450769&sjid=349614303780083206-NA). +> - For more information on device integrity, see the [Android developer documentation](https://developer.android.com/google/play/integrity/verdict#device-integrity-field). +##### Adding the GDSafetyNet library to the app project +The BlackBerry Dynamics SDK for Android version 5.0 and later includes a GDSafetyNet library. To support Play Integrity, you must add this library to the app project dependencies along with the main GDLibrary. + +The GDSafetyNet library includes all of the client-side source code that is required to support Play Integrity. No additional app code is required. The GDSafetyNet library requires Google Play Services 11.0 or later to use device Play Integrity APIs. Verify that your BlackBerry Dynamics app is dependent on only a single version of Google Play Services. + +If your app does not use Google Play Services, you can add the following to the build.gradle file: +``` +implementation ('com.blackberry.blackberrydynamics:android_handheld_gd_safetynet:$DYNAMICS_SDK_VERSION') +``` +If your app uses the Google Play Services SDK, you can add the following to the build.gradle file (where xx.x.x is the specific play-services version): ``` implementation 'com.google.android.gms:play-services-safetynet:xx.x.x' -implementation 'com.blackberry.blackberrydynamics:android_handheld_gd_safetynet:+' +implementation("com.blackberry.blackberrydynamics:android_handheld_gd_safetynet:$DYNAMICS_SDK_VERSION") { + transitive = false; +} ``` It can be added in `BlackBerry-Dynamics-for-React-Native-Base/android/gd.gradle` before Base module is added to the application. -###### Completing SafetyNet registration -You must [obtain an API key from Google](https://developer.android.com/training/safetynet/attestation#add-api-key) and add it to the app’s AndroidManifest.xml file in the element: +##### Updating the BlackBerry Dynamics application policy file +During a Play Integrity attestation process, BlackBerry UEM uses the app response to verify that it is communicating with the official version of the app. You must provide this information in the application policy file. + +In order to configure Play Integrity, you will need to provide a Play App signing key. You have two options for a Play app signing key: you can use the Google Play generated app signing key or upload your own private app signing key. For information on finding your app signing keys in your Google Play Console, see "Prerequisites for Play Integrity attestation". The digest hash in your application policy file must correspond to your Play app signing key in your Google Play Console. + +Example: ``` - + + + + + + Play Integrity Attestation Supported + + + + + + + + blackberry.appMetadata.android.apkCertificateDigestSha256 + DD:83:CA:47:09:FA:C5:33:75:FE:F4:A1:B5:FB:F4:A8:E8:C2:7A:DF:AF:24: +0D:7B:E3:BA:BD:FB:A9:2B:F9:D6 + + + + + blackberry.appMetadata.android.apkPackageName + com.good.gd.example.services.greetings.client + + + + + snet + + Play Integrity + + + ``` -More details can be found [here](https://docs.blackberry.com/en/development-tools/blackberry-dynamics-sdk-android/10_0/blackberry-dynamics-sdk-android-devguide/Implementing-SafetyNet-attestation-for-BlackBerry-Dynamics-apps). +The app is uniquely identified by the combination of the official package name (in the example above, blackberry.appMetadata.android.apkPackageName) and the digest hash of the official signing key (in the example above, blackberry.appMetadata.android.apkCertificateDigestSha256). + +After you update the application policy file, coordinate with the BlackBerry UEM administrator to upload the app to UEM (see [Deploying your BlackBerry Dynamics app](https://docs.blackberry.com/en/development-tools/blackberry-dynamics-sdk-android/11_2/blackberry-dynamics-sdk-android-devguide/lqi1489679309982)) and to upload the application policy file in the management console (see [Manage settings for a BlackBerry Dynamics app](https://docs.blackberry.com/en/endpoint-management/blackberry-uem/12_14/administration/blackberry-dynamics/vvq1471962941016) in the UEM Administration Guide). Before the administrator uploads the application policy file, verify that the Android app package ID has been specified or that the [app source file has been uploaded](https://docs.blackberry.com/en/endpoint-management/blackberry-uem/12_14/administration/blackberry-dynamics/Adding-Dynamics-apps/zjx1471960344735/cfn1476451456557); both settings are configured in the app entitlement settings (Android tab) in the management console. + +UEM validates the format of the input package name and digest hash. If you update the application policy file and upload the app again, it can take up to 24 hours for the change to synchronize to all UEM instances. When the app is uploaded again, it is removed from the current list of apps that are enabled for attestation and must be added again. + +More details about testing the app can be found [here](https://docs.blackberry.com/en/development-tools/blackberry-dynamics-sdk-android/11_2/blackberry-dynamics-sdk-android-devguide/Implementing-SafetyNet-attestation-for-BlackBerry-Dynamics-apps/Testing-the-app). # Package contents #### Modules @@ -151,7 +223,7 @@ To integrate BlackBerry Dynamics into a new React Native application please foll ### Integrate into existing React Native application To integrate BlackBerry Dynamics into existing React Native application: - - Check you are using `0.66.x` or higher version of React Native. + - Check you are using `0.70.x` or higher version of React Native. - [React Native Upgrade Helper](https://react-native-community.github.io/upgrade-helper/) may be used to upgrade your application prior to integrating BlackBerry Dynamics. Confirm the application builds and works correctly after upgrade. @@ -181,6 +253,10 @@ To integrate BlackBerry Dynamics into existing React Native application: Flipper cannot be used together with BlackBerry Dynamics SDK for React Native on iOS in debug configuration as it disables some BlackBerry Dynamics functionality related to secure networking. Flipper is disabled on iOS by default. If your Dynamics React Native application on iOS does not use Secure Connectivity feature (`BlackBerry-Dynamics-for-React-Native-Networking` module) you can enable Flipper by uncommenting `use_flipper!()` line in `Podfile` of your application. +### Flipper is disabled on Android +Flipper cannot be used together with BlackBerry Dynamics SDK for React Native on Android in debug configuration as it disables some BlackBerry Dynamics functionality related to secure networking. +Flipper is disabled on Android by default. If your Dynamics React Native application on Android does not use Secure Connectivity feature (`BlackBerry-Dynamics-for-React-Native-Networking` module) you can enable Flipper by uncommenting `initializeFlipper(this, getReactNativeHost().getReactInstanceManager());` line in `MainApplication.java` for ReactNative less than 71 version or uncommenting `ReactNativeFlipper.initializeFlipper(this, getReactNativeHost().getReactInstanceManager());` line in `MainApplication.java` for ReactNative greater than or equal to 71 version of your application. + ## Known issues ### Conflict between default and secure SQLite library on iOS BlackBerry Dynamcis SDK for iOS uses secure *SQLite* library to provide secure DB connection and management. @@ -204,3 +280,32 @@ To resolve the conflict **`sqlite3`** dependency should be removed in */nod Apps targeting Android 12 and higher are required to specify an explicit value for `android:exported` when the corresponding component has an intent filter defined. More details can be found [here](https://developer.android.com/guide/topics/manifest/activity-element#exported). React Native `0.68` and higher supports Android 12+ by default by setting appropriate setting in AndroidManifest.xml. For React Native versions `<= 0.67` setting `android:exported` should be set manually. + +## Known React-Native issues +### React Native Build Failed for iOS for Xcode 14.3 (14E222b) +There is a known react-native [issue](https://github.com/facebook/react-native/issues/36739#issuecomment-1495818734) with XCode 14.3 (14E222b) which is fixed in 0.71.6, 0.70.8 and 0.69.9 +### Metro server error on `0.72.0`, `0.72.1` React Native versions +There is an issue with loading Metro server on `0.72.0` and `0.72.1` versions when the error message is displayed during app load in Metro server: "Cannot read properties of undefined (reading 'addHelper')". The issue can be fixed by adding the following devDependency to the project: +`$ yarn add @babel/traverse@7.22.8 --dev` + +### Issue with `activesupport` CocoaPods dependency on React Native versions `< 0.72.6` +There is an issue with `activesupport` Ruby gem when creating new React Native project with version `< 0.72.6`: +``` +✖ Installing CocoaPods dependencies (this may take a few minutes) +error /Users/uvarl/AwesomeProject/vendor/bundle/ruby/2.7.0/gems/activesupport-7.1.1/lib/active_support/core_ext/array/conversions.rb:108:in `': undefined method `deprecator' for ActiveSupport:Module (NoMethodError) +``` +##### Workaround +Create/update Gemfile in the root of your project and add this dependency: +``` +gem 'activesupport', '~> 7.0.8' +``` +Run following commands: +``` +$ bundle update activesupport +$ bundle exec pod install +``` +> NOTE: Same issue can occur when running Dynamics React Native sample apps. Please make sure that version `7.0.8` of `activesupport` Ruby gem is installed locally: +``` +gem uninstall activesupport --version 7.x.x +gem install activesupport --version 7.0.8 +``` diff --git a/SampleApplications/AppKinetics/.bundle/config b/SampleApplications/AppKinetics/.bundle/config new file mode 100644 index 0000000..848943b --- /dev/null +++ b/SampleApplications/AppKinetics/.bundle/config @@ -0,0 +1,2 @@ +BUNDLE_PATH: "vendor/bundle" +BUNDLE_FORCE_RUBY_PLATFORM: 1 diff --git a/SampleApplications/AppKinetics/.flowconfig b/SampleApplications/AppKinetics/.flowconfig index 1319ea1..3782e44 100644 --- a/SampleApplications/AppKinetics/.flowconfig +++ b/SampleApplications/AppKinetics/.flowconfig @@ -5,23 +5,13 @@ ; Ignore "BUCK" generated dirs /\.buckd/ -; Ignore unexpected extra "@providesModule" -.*/node_modules/.*/node_modules/fbjs/.* - -; Ignore duplicate module providers -; For RN Apps installed via npm, "Libraries" folder is inside -; "node_modules/react-native" but in the source repo it is in the root -node_modules/react-native/Libraries/react-native/React.js - ; Ignore polyfills node_modules/react-native/Libraries/polyfills/.* -; These should not be required directly -; require from fbjs/lib instead: require('fbjs/lib/warning') -node_modules/warning/.* - ; Flow doesn't support platforms -.*/Libraries/Utilities/HMRLoadingView.js +.*/Libraries/Utilities/LoadingView.js + +.*/node_modules/resolve/test/resolver/malformed_package_json/package\.json$ [untyped] .*/node_modules/@react-native-community/cli/.*/.* @@ -29,50 +19,30 @@ node_modules/warning/.* [include] [libs] -node_modules/react-native/Libraries/react-native/react-native-interface.js +node_modules/react-native/interface.js node_modules/react-native/flow/ [options] emoji=true -esproposal.optional_chaining=enable -esproposal.nullish_coalescing=enable +exact_by_default=true + +format.bracket_spacing=false module.file_ext=.js module.file_ext=.json module.file_ext=.ios.js -module.system=haste -module.system.haste.use_name_reducers=true -# get basename -module.system.haste.name_reducers='^.*/\([a-zA-Z0-9$_.-]+\.js\(\.flow\)?\)$' -> '\1' -# strip .js or .js.flow suffix -module.system.haste.name_reducers='^\(.*\)\.js\(\.flow\)?$' -> '\1' -# strip .ios suffix -module.system.haste.name_reducers='^\(.*\)\.ios$' -> '\1' -module.system.haste.name_reducers='^\(.*\)\.android$' -> '\1' -module.system.haste.name_reducers='^\(.*\)\.native$' -> '\1' -module.system.haste.paths.blacklist=.*/__tests__/.* -module.system.haste.paths.blacklist=.*/__mocks__/.* -module.system.haste.paths.whitelist=/node_modules/react-native/Libraries/.* -module.system.haste.paths.whitelist=/node_modules/react-native/RNTester/.* -module.system.haste.paths.whitelist=/node_modules/react-native/IntegrationTests/.* -module.system.haste.paths.blacklist=/node_modules/react-native/Libraries/react-native/react-native-implementation.js -module.system.haste.paths.blacklist=/node_modules/react-native/Libraries/Animated/src/polyfills/.* - munge_underscores=true -module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> 'RelativeImageStub' +module.name_mapper='^react-native/\(.*\)$' -> '/node_modules/react-native/\1' +module.name_mapper='^@?[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> '/node_modules/react-native/Libraries/Image/RelativeImageStub' suppress_type=$FlowIssue suppress_type=$FlowFixMe suppress_type=$FlowFixMeProps suppress_type=$FlowFixMeState -suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(\\)? *\\(site=[a-z,_]*react_native\\(_ios\\)?_\\(oss\\|fb\\)[a-z,_]*\\)?)\\) -suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(\\)? *\\(site=[a-z,_]*react_native\\(_ios\\)?_\\(oss\\|fb\\)[a-z,_]*\\)?)\\)?:? #[0-9]+ -suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError - [lints] sketchy-null-number=warn sketchy-null-mixed=warn @@ -81,10 +51,7 @@ untyped-type-import=warn nonstrict-import=warn deprecated-type=warn unsafe-getters-setters=warn -inexact-spread=warn unnecessary-invariant=warn -signature-verification-failure=warn -deprecated-utility=error [strict] deprecated-type @@ -96,4 +63,4 @@ untyped-import untyped-type-import [version] -^0.98.0 +^0.182.0 diff --git a/SampleApplications/AppKinetics/.gitattributes b/SampleApplications/AppKinetics/.gitattributes deleted file mode 100644 index d42ff18..0000000 --- a/SampleApplications/AppKinetics/.gitattributes +++ /dev/null @@ -1 +0,0 @@ -*.pbxproj -text diff --git a/SampleApplications/AppKinetics/.gitignore b/SampleApplications/AppKinetics/.gitignore index 828cc88..2423126 100644 --- a/SampleApplications/AppKinetics/.gitignore +++ b/SampleApplications/AppKinetics/.gitignore @@ -20,7 +20,7 @@ DerivedData *.hmap *.ipa *.xcuserstate -project.xcworkspace +ios/.xcode.env.local # Android/IntelliJ # @@ -29,6 +29,8 @@ build/ .gradle local.properties *.iml +*.hprof +.cxx/ # node.js # @@ -40,6 +42,7 @@ yarn-error.log buck-out/ \.buckd/ *.keystore +!debug.keystore # fastlane # @@ -48,12 +51,14 @@ buck-out/ # For more information about the recommended setup visit: # https://docs.fastlane.tools/best-practices/source-control/ -*/fastlane/report.xml -*/fastlane/Preview.html -*/fastlane/screenshots +**/fastlane/report.xml +**/fastlane/Preview.html +**/fastlane/screenshots +**/fastlane/test_output # Bundle artifact *.jsbundle -# CocoaPods +# Ruby / CocoaPods /ios/Pods/ +/vendor/bundle/ diff --git a/SampleApplications/AppKinetics/.node-version b/SampleApplications/AppKinetics/.node-version new file mode 100644 index 0000000..b6a7d89 --- /dev/null +++ b/SampleApplications/AppKinetics/.node-version @@ -0,0 +1 @@ +16 diff --git a/SampleApplications/AppKinetics/.prettierrc.js b/SampleApplications/AppKinetics/.prettierrc.js index 5c4de1a..2b54074 100644 --- a/SampleApplications/AppKinetics/.prettierrc.js +++ b/SampleApplications/AppKinetics/.prettierrc.js @@ -1,6 +1,7 @@ module.exports = { + arrowParens: 'avoid', + bracketSameLine: true, bracketSpacing: false, - jsxBracketSameLine: true, singleQuote: true, trailingComma: 'all', }; diff --git a/SampleApplications/AppKinetics/.ruby-version b/SampleApplications/AppKinetics/.ruby-version new file mode 100644 index 0000000..a603bb5 --- /dev/null +++ b/SampleApplications/AppKinetics/.ruby-version @@ -0,0 +1 @@ +2.7.5 diff --git a/SampleApplications/AppKinetics/Gemfile b/SampleApplications/AppKinetics/Gemfile new file mode 100644 index 0000000..5efda89 --- /dev/null +++ b/SampleApplications/AppKinetics/Gemfile @@ -0,0 +1,6 @@ +source 'https://rubygems.org' + +# You may use http://rbenv.org/ or https://rvm.io/ to install and use this version +ruby '2.7.5' + +gem 'cocoapods', '~> 1.11', '>= 1.11.2' diff --git a/SampleApplications/AppKinetics/README.md b/SampleApplications/AppKinetics/README.md index ec32832..eda2a16 100644 --- a/SampleApplications/AppKinetics/README.md +++ b/SampleApplications/AppKinetics/README.md @@ -44,18 +44,23 @@ Open the sample app directory in Terminal window: Install dependencies: `$ yarn` -NOTE: AppKinetics sample is based on `0.66.4` version of React Native. There is a possibility to upgrade to `0.67.x` or `0.68.x` versions (`0.67.0` - `0.67.4`, `0.68.0` - `0.68.2`) by running one of following commands: -`$ react-native upgrade 0.6x.x` +> NOTE: AppKinetics sample is based on `0.70.0` version of React Native. There is a possibility to upgrade to `0.70.x`, `0.71.x`, `0.72.x` versions (`0.70.1` - `0.70.10`, `0.71.0` - `0.71.13`, `0.72.0` - `0.72.4`) by running one of following commands: +`$ npx react-native upgrade 0.70.x` for example: -`$ react-native upgrade 0.67.4` +`$ npx react-native upgrade 0.70.10` or -`$ react-native upgrade 0.68.2` +`$ npx react-native upgrade 0.71.13` +or +`$ npx react-native upgrade 0.72.4` Generate ios and android directories: -`$ react-native eject` +`$ npx react-native eject` Generate ios and android directories: -`$ react-native eject` +`$ npx react-native eject` + +> There is a known issue with loading Metro server on `0.72.0` and `0.72.1` versions when the error message is displayed during app load in Metro server: "Cannot read properties of undefined (reading 'addHelper')". The issue can be fixed by adding the following devDependency to the project: +`$ yarn add @babel/traverse@7.22.8 --dev` ## Install Dynamics modules #### Prerequisites @@ -76,17 +81,23 @@ It is suggested to use **`com.blackberry.bbd.example.cdv.appkinetics.server`** h $ yarn add /modules/BlackBerry-Dynamics-for-React-Native-AppKinetics ##### iOS +Different `ruby` versions might be install on the machine. Especially it is related to React Native v`0.70.x` projects. +Depending on your Mac configuration following error can occur when running `pod install` command: +``` +Traceback (most recent call last): + 4: from /Users/vtaliar/.rvm/gems/ruby-2.7.5/bin/ruby_executable_hooks:22:in `
' + 3: from /Users/vtaliar/.rvm/gems/ruby-2.7.5/bin/ruby_executable_hooks:22:in `eval' + 2: from /Users/vtaliar/.rvm/gems/ruby-2.7.5/bin/pod:23:in `
' + 1: from /Users/vtaliar/.rvm/rubies/ruby-2.7.5/lib/ruby/2.7.0/rubygems.rb:296:in `activate_bin_path' +/Users/vtaliar/.rvm/rubies/ruby-2.7.5/lib/ruby/2.7.0/rubygems.rb:277:in `find_spec_for_exe': can't find gem cocoapods (>= 0.a) with executable pod (Gem::GemNotFoundException) +``` +More details can be found [here](https://medium.com/@pk60905/bundle-install-and-bundle-update-80f3d6f52214). + +`$ bundle install` - needed on some `0.70.x` versions to fix the issue above `$ cd ios` `$ pod install` `$ cd ..` -#### How to run application -##### iOS -`$ react-native run-ios` - -##### Android -`$ react-native run-android` - #### How to secure FileSystem $ yarn add /modules/BlackBerry-Dynamics-for-React-Native-FileSystem @@ -101,10 +112,10 @@ It is suggested to use **`com.blackberry.bbd.example.cdv.appkinetics.server`** h #### How to run application ##### iOS -`$ react-native run-ios` +`$ npx react-native run-ios` ##### Android -`$ react-native run-android` +`$ npx react-native run-android` ## Prepare files that will be sent to other app In order to send files to other Dynamics applications files need to be stored in appropriate location. @@ -136,29 +147,51 @@ Native Dynamics AppKinetics sample is a service provider of **`transfer-file`** 4. Install and activate ## Examples of usage -##### 0.66.4 +##### 0.70.0 `$ cd /SampleApplications/AppKinetics` `$ yarn` -`$ react-native eject` +`$ git init` +`$ npx react-native eject` `$ yarn add /modules/BlackBerry-Dynamics-for-React-Native-Base` `$ yarn set-bundle-id` It is suggested to use **`com.blackberry.bbd.example.cdv.appkinetics.client`** here. An app with this ID is already configured on UEM as a service provider of **`transfer-file`** service, so it can both send and receive files. `$ yarn add /modules/BlackBerry-Dynamics-for-React-Native-AppKinetics` `$ yarn add /modules/BlackBerry-Dynamics-for-React-Native-FileSystem` `$ yarn add /modules/BlackBerry-Dynamics-for-React-Native-Networking` -For iOS: +For iOS: +`$ bundle install` +`$ cd ios` +`$ pod install` +`$ cd ..` +`$ npx react-native run-ios` +For Android: +`$ npx react-native run-android` +##### 0.70.10 +`$ cd /SampleApplications/AppKinetics` +`$ yarn` +`$ git init` +`$ npx react-native upgrade 0.70.10` +`$ npx react-native eject` +`$ yarn add /modules/BlackBerry-Dynamics-for-React-Native-Base` +`$ yarn set-bundle-id` +It is suggested to use **`com.blackberry.bbd.example.cdv.appkinetics.client`** here. An app with this ID is already configured on UEM as a service provider of **`transfer-file`** service, so it can both send and receive files. +`$ yarn add /modules/BlackBerry-Dynamics-for-React-Native-AppKinetics` +`$ yarn add /modules/BlackBerry-Dynamics-for-React-Native-FileSystem` +`$ yarn add /modules/BlackBerry-Dynamics-for-React-Native-Networking` +For iOS: `$ cd ios` `$ pod install` `$ cd ..` -`$ react-native run-ios` +`$ npx react-native run-ios` For Android: -`$ react-native run-android` -##### 0.68.2 +`$ npx react-native run-android` +##### 0.72.0 `$ cd /SampleApplications/AppKinetics` `$ yarn` -`$ cd .. ; git init ; cd AppKinetics` -`$ react-native upgrade 0.68.2` -`$ react-native eject` +`$ yarn add @babel/traverse@7.22.8 --dev` - OPTIONAL: needed on `0.72.0`, `0.72.1` versions to fix the error mentioned above in Metro server +`$ git init` +`$ npx react-native upgrade 0.72.0` +`$ npx react-native eject` `$ yarn add /modules/BlackBerry-Dynamics-for-React-Native-Base` `$ yarn set-bundle-id` It is suggested to use **`com.blackberry.bbd.example.cdv.appkinetics.client`** here. An app with this ID is already configured on UEM as a service provider of **`transfer-file`** service, so it can both send and receive files. @@ -169,6 +202,6 @@ For iOS: `$ cd ios` `$ pod install` `$ cd ..` -`$ react-native run-ios` +`$ npx react-native run-ios` For Android: -`$ react-native run-android` +`$ npx react-native run-android` diff --git a/SampleApplications/AppKinetics/package.json b/SampleApplications/AppKinetics/package.json index 6ebc099..8e96544 100644 --- a/SampleApplications/AppKinetics/package.json +++ b/SampleApplications/AppKinetics/package.json @@ -12,8 +12,8 @@ "@fortawesome/fontawesome-svg-core": "^1.2.34", "@fortawesome/free-solid-svg-icons": "^5.15.2", "@fortawesome/react-native-fontawesome": "^0.2.6", - "react": "17.0.2", - "react-native": "0.66.4", + "react": "18.1.0", + "react-native": "0.70.0", "react-native-svg": "^12.1.0" }, "devDependencies": { @@ -21,12 +21,11 @@ "@babel/runtime": "^7.12.5", "@react-native-community/eslint-config": "^2.0.0", "babel-jest": "^26.6.3", - "eslint": "7.14.0", + "eslint": "^7.32.0", "jest": "^26.6.3", - "metro-react-native-babel-preset": "^0.66.2", - "react-test-renderer": "17.0.2", - "react-native-eject": "^0.1.2", - "react-native-codegen": "^0.0.7" + "metro-react-native-babel-preset": "^0.72.1", + "react-native-eject": "^0.2.0", + "react-test-renderer": "18.1.0" }, "license": "SEE LICENSE IN LICENSE", "jest": { diff --git a/SampleApplications/BasicNetworking/.bundle/config b/SampleApplications/BasicNetworking/.bundle/config new file mode 100644 index 0000000..848943b --- /dev/null +++ b/SampleApplications/BasicNetworking/.bundle/config @@ -0,0 +1,2 @@ +BUNDLE_PATH: "vendor/bundle" +BUNDLE_FORCE_RUBY_PLATFORM: 1 diff --git a/SampleApplications/BasicNetworking/.eslintrc.js b/SampleApplications/BasicNetworking/.eslintrc.js new file mode 100644 index 0000000..40c6dcd --- /dev/null +++ b/SampleApplications/BasicNetworking/.eslintrc.js @@ -0,0 +1,4 @@ +module.exports = { + root: true, + extends: '@react-native-community', +}; diff --git a/SampleApplications/BasicNetworking/.flowconfig b/SampleApplications/BasicNetworking/.flowconfig index 47d80d9..3782e44 100644 --- a/SampleApplications/BasicNetworking/.flowconfig +++ b/SampleApplications/BasicNetworking/.flowconfig @@ -5,65 +5,62 @@ ; Ignore "BUCK" generated dirs /\.buckd/ -; Ignore unexpected extra "@providesModule" -.*/node_modules/.*/node_modules/fbjs/.* +; Ignore polyfills +node_modules/react-native/Libraries/polyfills/.* -; Ignore duplicate module providers -; For RN Apps installed via npm, "Libraries" folder is inside -; "node_modules/react-native" but in the source repo it is in the root -.*/Libraries/react-native/React.js +; Flow doesn't support platforms +.*/Libraries/Utilities/LoadingView.js -; Ignore polyfills -.*/Libraries/polyfills/.* +.*/node_modules/resolve/test/resolver/malformed_package_json/package\.json$ -; Ignore metro -.*/node_modules/metro/.* +[untyped] +.*/node_modules/@react-native-community/cli/.*/.* [include] [libs] -node_modules/react-native/Libraries/react-native/react-native-interface.js +node_modules/react-native/interface.js node_modules/react-native/flow/ [options] emoji=true -esproposal.optional_chaining=enable -esproposal.nullish_coalescing=enable - -module.system=haste -module.system.haste.use_name_reducers=true -# get basename -module.system.haste.name_reducers='^.*/\([a-zA-Z0-9$_.-]+\.js\(\.flow\)?\)$' -> '\1' -# strip .js or .js.flow suffix -module.system.haste.name_reducers='^\(.*\)\.js\(\.flow\)?$' -> '\1' -# strip .ios suffix -module.system.haste.name_reducers='^\(.*\)\.ios$' -> '\1' -module.system.haste.name_reducers='^\(.*\)\.android$' -> '\1' -module.system.haste.name_reducers='^\(.*\)\.native$' -> '\1' -module.system.haste.paths.blacklist=.*/__tests__/.* -module.system.haste.paths.blacklist=.*/__mocks__/.* -module.system.haste.paths.blacklist=/node_modules/react-native/Libraries/Animated/src/polyfills/.* -module.system.haste.paths.whitelist=/node_modules/react-native/Libraries/.* - -munge_underscores=true +exact_by_default=true -module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> 'RelativeImageStub' +format.bracket_spacing=false module.file_ext=.js -module.file_ext=.jsx module.file_ext=.json -module.file_ext=.native.js +module.file_ext=.ios.js + +munge_underscores=true + +module.name_mapper='^react-native/\(.*\)$' -> '/node_modules/react-native/\1' +module.name_mapper='^@?[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> '/node_modules/react-native/Libraries/Image/RelativeImageStub' suppress_type=$FlowIssue suppress_type=$FlowFixMe suppress_type=$FlowFixMeProps suppress_type=$FlowFixMeState -suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\) -suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+ -suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy -suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError +[lints] +sketchy-null-number=warn +sketchy-null-mixed=warn +sketchy-number=warn +untyped-type-import=warn +nonstrict-import=warn +deprecated-type=warn +unsafe-getters-setters=warn +unnecessary-invariant=warn + +[strict] +deprecated-type +nonstrict-import +sketchy-null +unclear-type +unsafe-getters-setters +untyped-import +untyped-type-import [version] -^0.92.0 +^0.182.0 diff --git a/SampleApplications/BasicNetworking/.gitattributes b/SampleApplications/BasicNetworking/.gitattributes deleted file mode 100644 index d42ff18..0000000 --- a/SampleApplications/BasicNetworking/.gitattributes +++ /dev/null @@ -1 +0,0 @@ -*.pbxproj -text diff --git a/SampleApplications/BasicNetworking/.gitignore b/SampleApplications/BasicNetworking/.gitignore index 5d64756..2423126 100644 --- a/SampleApplications/BasicNetworking/.gitignore +++ b/SampleApplications/BasicNetworking/.gitignore @@ -20,7 +20,7 @@ DerivedData *.hmap *.ipa *.xcuserstate -project.xcworkspace +ios/.xcode.env.local # Android/IntelliJ # @@ -29,6 +29,8 @@ build/ .gradle local.properties *.iml +*.hprof +.cxx/ # node.js # @@ -40,6 +42,7 @@ yarn-error.log buck-out/ \.buckd/ *.keystore +!debug.keystore # fastlane # @@ -48,9 +51,14 @@ buck-out/ # For more information about the recommended setup visit: # https://docs.fastlane.tools/best-practices/source-control/ -*/fastlane/report.xml -*/fastlane/Preview.html -*/fastlane/screenshots +**/fastlane/report.xml +**/fastlane/Preview.html +**/fastlane/screenshots +**/fastlane/test_output # Bundle artifact *.jsbundle + +# Ruby / CocoaPods +/ios/Pods/ +/vendor/bundle/ diff --git a/SampleApplications/BasicNetworking/.node-version b/SampleApplications/BasicNetworking/.node-version new file mode 100644 index 0000000..b6a7d89 --- /dev/null +++ b/SampleApplications/BasicNetworking/.node-version @@ -0,0 +1 @@ +16 diff --git a/SampleApplications/BasicNetworking/.prettierrc.js b/SampleApplications/BasicNetworking/.prettierrc.js new file mode 100644 index 0000000..2b54074 --- /dev/null +++ b/SampleApplications/BasicNetworking/.prettierrc.js @@ -0,0 +1,7 @@ +module.exports = { + arrowParens: 'avoid', + bracketSameLine: true, + bracketSpacing: false, + singleQuote: true, + trailingComma: 'all', +}; diff --git a/SampleApplications/BasicNetworking/.ruby-version b/SampleApplications/BasicNetworking/.ruby-version new file mode 100644 index 0000000..a603bb5 --- /dev/null +++ b/SampleApplications/BasicNetworking/.ruby-version @@ -0,0 +1 @@ +2.7.5 diff --git a/SampleApplications/BasicNetworking/App.js b/SampleApplications/BasicNetworking/App.js index f98147e..b649d4c 100644 --- a/SampleApplications/BasicNetworking/App.js +++ b/SampleApplications/BasicNetworking/App.js @@ -1,5 +1,5 @@ /** - * Copyright (c) 2020 BlackBerry Limited. All Rights Reserved. + * Copyright (c) 2023 BlackBerry Limited. All Rights Reserved. *  * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -46,11 +46,26 @@ export default class App extends Component { if(Platform.OS === 'android') { async function requestReadExternalStoragePermission() { try { - const granted = await PermissionsAndroid.request( - PermissionsAndroid.PERMISSIONS.READ_EXTERNAL_STORAGE, - ) - if (granted !== PermissionsAndroid.RESULTS.GRANTED) { - alert("Permission denied, add READ_EXTERNAL_STORAGE permission in AndroidManifest.xml and re-build the app."); + if(Platform.Version < 33) { + const granted = await PermissionsAndroid.request( + PermissionsAndroid.PERMISSIONS.READ_EXTERNAL_STORAGE, + ) + if (granted !== PermissionsAndroid.RESULTS.GRANTED) { + alert("Permission denied, add READ_EXTERNAL_STORAGE permission in AndroidManifest.xml and re-build the app."); + } + } + else { + const granted = await PermissionsAndroid.requestMultiple( + [ PermissionsAndroid.PERMISSIONS.READ_MEDIA_IMAGES, + PermissionsAndroid.PERMISSIONS.READ_MEDIA_VIDEO, + PermissionsAndroid.PERMISSIONS.READ_MEDIA_AUDIO, + ] + ); + if (granted["android.permission.READ_MEDIA_IMAGES"] !== "granted" || + granted["android.permission.READ_MEDIA_VIDEO"] !== "granted"|| + granted["android.permission.READ_MEDIA_VIDEO"] !== "granted") { + alert("Permission denied, add READ_MEDIA_* permissions in AndroidManifest.xml and re-build the app."); + } } } catch (err) { diff --git a/SampleApplications/BasicNetworking/Gemfile b/SampleApplications/BasicNetworking/Gemfile new file mode 100644 index 0000000..5efda89 --- /dev/null +++ b/SampleApplications/BasicNetworking/Gemfile @@ -0,0 +1,6 @@ +source 'https://rubygems.org' + +# You may use http://rbenv.org/ or https://rvm.io/ to install and use this version +ruby '2.7.5' + +gem 'cocoapods', '~> 1.11', '>= 1.11.2' diff --git a/SampleApplications/BasicNetworking/README.md b/SampleApplications/BasicNetworking/README.md index 0656759..b0780b2 100644 --- a/SampleApplications/BasicNetworking/README.md +++ b/SampleApplications/BasicNetworking/README.md @@ -8,15 +8,20 @@ Open the sample app directory in Terminal window: Install dependencies: `$ yarn` -> NOTE: BasicNetworking sample is based on `0.66.4` version of React Native. There is a possibility to upgrade to `0.67.x` or `0.68.x` versions (`0.67.0` - `0.67.4`, `0.68.0` - `0.68.2`) by running one of following commands: -`$ react-native upgrade 0.6x.x` +> NOTE: BasicNetworking sample is based on `0.70.0` version of React Native. There is a possibility to upgrade to `0.70.x`, `0.71.x`, `0.72.x` versions (`0.70.1` - `0.70.10`, `0.71.0` - `0.71.13`, `0.72.0` - `0.72.4`) by running one of following commands: +`$ npx react-native upgrade 0.70.x` for example: -`$ react-native upgrade 0.67.4` +`$ npx react-native upgrade 0.70.10` or -`$ react-native upgrade 0.68.2` +`$ npx react-native upgrade 0.71.13` +or +`$ npx react-native upgrade 0.72.4` Generate ios and android directories: -`$ react-native eject` +`$ npx react-native eject` + +> There is a known issue with loading Metro server on `0.72.0` and `0.72.1` versions when the error message is displayed during app load in Metro server: "Cannot read properties of undefined (reading 'addHelper')". The issue can be fixed by adding the following devDependency to the project: +`$ yarn add @babel/traverse@7.22.8 --dev` ## Dynamics modules #### Prerequisites @@ -36,22 +41,53 @@ There are some dependencies that need to be installed before using `BlackBerry-D $ yarn add /modules/BlackBerry-Dynamics-for-React-Native-Networking ##### iOS +Different `ruby` versions might be install on the machine. Especially it is related to React Native v`0.70.x` projects. +Depending on your Mac configuration following error can occur when running `pod install` command: +``` +Traceback (most recent call last): + 4: from /Users/vtaliar/.rvm/gems/ruby-2.7.5/bin/ruby_executable_hooks:22:in `
' + 3: from /Users/vtaliar/.rvm/gems/ruby-2.7.5/bin/ruby_executable_hooks:22:in `eval' + 2: from /Users/vtaliar/.rvm/gems/ruby-2.7.5/bin/pod:23:in `
' + 1: from /Users/vtaliar/.rvm/rubies/ruby-2.7.5/lib/ruby/2.7.0/rubygems.rb:296:in `activate_bin_path' +/Users/vtaliar/.rvm/rubies/ruby-2.7.5/lib/ruby/2.7.0/rubygems.rb:277:in `find_spec_for_exe': can't find gem cocoapods (>= 0.a) with executable pod (Gem::GemNotFoundException) +``` +More details can be found [here](https://medium.com/@pk60905/bundle-install-and-bundle-update-80f3d6f52214). + +`$ bundle install` - needed on some `0.70.x` versions to fix the issue above `$ cd ios` `$ pod install` `$ cd ..` #### How to run application ##### iOS -`$ react-native run-ios` +`$ npx react-native run-ios` ##### Android -`$ react-native run-android` +`$ npx react-native run-android` #### Examples of usage -##### 0.66.4 +##### 0.70.0 +`$ cd /SampleApplications/BasicNetworking` +`$ yarn` +`$ git init` +`$ npx react-native eject` +`$ yarn add /modules/BlackBerry-Dynamics-for-React-Native-Base` +`$ yarn set-bundle-id` +`$ yarn add /modules/BlackBerry-Dynamics-for-React-Native-Networking` +For iOS: +`$ bundle install` +`$ cd ios` +`$ pod install` +`$ cd ..` +`$ npx react-native run-ios` +For Android: +`$ npx react-native run-android` +##### 0.70.10 `$ cd /SampleApplications/BasicNetworking` `$ yarn` -`$ react-native eject` +`$ git init` +`$ npx react-native upgrade 0.70.10` +`$ npx react-native eject` `$ yarn add /modules/BlackBerry-Dynamics-for-React-Native-Base` `$ yarn set-bundle-id` `$ yarn add /modules/BlackBerry-Dynamics-for-React-Native-Networking` @@ -59,15 +95,16 @@ For iOS: `$ cd ios` `$ pod install` `$ cd ..` -`$ react-native run-ios` +`$ npx react-native run-ios` For Android: -`$ react-native run-android` -##### 0.68.2 +`$ npx react-native run-android` +##### 0.72.0 `$ cd /SampleApplications/BasicNetworking` `$ yarn` -`$ cd .. ; git init ; cd BasicNetworking` -`$ react-native upgrade 0.68.2` -`$ react-native eject` +`$ yarn add @babel/traverse@7.22.8 --dev` - OPTIONAL: needed on `0.72.0`, `0.72.1` versions to fix the error mentioned above in Metro server +`$ git init` +`$ npx react-native upgrade 0.72.0` +`$ npx react-native eject` `$ yarn add /modules/BlackBerry-Dynamics-for-React-Native-Base` `$ yarn set-bundle-id` `$ yarn add /modules/BlackBerry-Dynamics-for-React-Native-Networking` @@ -75,6 +112,6 @@ For iOS: `$ cd ios` `$ pod install` `$ cd ..` -`$ react-native run-ios` +`$ npx react-native run-ios` For Android: -`$ react-native run-android` +`$ npx react-native run-android` diff --git a/SampleApplications/BasicNetworking/package.json b/SampleApplications/BasicNetworking/package.json index 2b6dec5..97e9d1b 100644 --- a/SampleApplications/BasicNetworking/package.json +++ b/SampleApplications/BasicNetworking/package.json @@ -3,13 +3,18 @@ "version": "1.0.0", "description": "BlackBerry Dynamics BasicNetworking sample", "scripts": { - "install": "node ./scripts/setStoragePermissions.js" + "install": "node ./scripts/setStoragePermissions.js", + "android": "react-native run-android", + "ios": "react-native run-ios", + "start": "react-native start", + "test": "jest", + "lint": "eslint ." }, "dependencies": { "js-base64": "^2.5.1", - "react": "17.0.2", - "react-native": "0.66.4", - "react-native-document-picker": "^3.2.4", + "react": "18.1.0", + "react-native": "0.70.0", + "react-native-document-picker": "^9.0.1", "url": "^0.11.0" }, "devDependencies": { @@ -17,12 +22,12 @@ "@babel/runtime": "^7.12.5", "@react-native-community/eslint-config": "^2.0.0", "babel-jest": "^26.6.3", - "eslint": "7.14.0", + "eslint": "^7.32.0", "jest": "^26.6.3", - "metro-react-native-babel-preset": "^0.66.2", - "react-test-renderer": "17.0.2", - "react-native-eject": "^0.1.2", - "react-native-codegen": "^0.0.7" + "metro-react-native-babel-preset": "^0.72.1", + "react-test-renderer": "18.1.0", + "react-native-eject": "^0.2.0" + }, "license": "SEE LICENSE IN LICENSE", "jest": { diff --git a/SampleApplications/BasicNetworking/scripts/setStoragePermissions.js b/SampleApplications/BasicNetworking/scripts/setStoragePermissions.js index 0f40450..d51aa22 100755 --- a/SampleApplications/BasicNetworking/scripts/setStoragePermissions.js +++ b/SampleApplications/BasicNetworking/scripts/setStoragePermissions.js @@ -1,5 +1,5 @@ /** - * Copyright (c) 2020 BlackBerry Limited. All Rights Reserved. + * Copyright (c) 2023 BlackBerry Limited. All Rights Reserved. *  * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,7 +29,10 @@ var androidManifestContent = fs.readFileSync(projectTemplateAndroidManifest, 'utf-8'); if (androidManifestContent.indexOf('android.permission.READ_EXTERNAL_STORAGE') < 0) { - var permissionStrings = ` + var permissionStrings = ` + + + /\.buckd/ -; Ignore unexpected extra "@providesModule" -.*/node_modules/.*/node_modules/fbjs/.* +; Ignore polyfills +node_modules/react-native/Libraries/polyfills/.* -; Ignore duplicate module providers -; For RN Apps installed via npm, "Libraries" folder is inside -; "node_modules/react-native" but in the source repo it is in the root -.*/Libraries/react-native/React.js +; Flow doesn't support platforms +.*/Libraries/Utilities/LoadingView.js -; Ignore polyfills -.*/Libraries/polyfills/.* +.*/node_modules/resolve/test/resolver/malformed_package_json/package\.json$ -; Ignore metro -.*/node_modules/metro/.* +[untyped] +.*/node_modules/@react-native-community/cli/.*/.* [include] [libs] -node_modules/react-native/Libraries/react-native/react-native-interface.js +node_modules/react-native/interface.js node_modules/react-native/flow/ [options] emoji=true -esproposal.optional_chaining=enable -esproposal.nullish_coalescing=enable - -module.system=haste -module.system.haste.use_name_reducers=true -# get basename -module.system.haste.name_reducers='^.*/\([a-zA-Z0-9$_.-]+\.js\(\.flow\)?\)$' -> '\1' -# strip .js or .js.flow suffix -module.system.haste.name_reducers='^\(.*\)\.js\(\.flow\)?$' -> '\1' -# strip .ios suffix -module.system.haste.name_reducers='^\(.*\)\.ios$' -> '\1' -module.system.haste.name_reducers='^\(.*\)\.android$' -> '\1' -module.system.haste.name_reducers='^\(.*\)\.native$' -> '\1' -module.system.haste.paths.blacklist=.*/__tests__/.* -module.system.haste.paths.blacklist=.*/__mocks__/.* -module.system.haste.paths.blacklist=/node_modules/react-native/Libraries/Animated/src/polyfills/.* -module.system.haste.paths.whitelist=/node_modules/react-native/Libraries/.* - -munge_underscores=true +exact_by_default=true -module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> 'RelativeImageStub' +format.bracket_spacing=false module.file_ext=.js -module.file_ext=.jsx module.file_ext=.json -module.file_ext=.native.js +module.file_ext=.ios.js + +munge_underscores=true + +module.name_mapper='^react-native/\(.*\)$' -> '/node_modules/react-native/\1' +module.name_mapper='^@?[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> '/node_modules/react-native/Libraries/Image/RelativeImageStub' suppress_type=$FlowIssue suppress_type=$FlowFixMe suppress_type=$FlowFixMeProps suppress_type=$FlowFixMeState -suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\) -suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+ -suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy -suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError +[lints] +sketchy-null-number=warn +sketchy-null-mixed=warn +sketchy-number=warn +untyped-type-import=warn +nonstrict-import=warn +deprecated-type=warn +unsafe-getters-setters=warn +unnecessary-invariant=warn + +[strict] +deprecated-type +nonstrict-import +sketchy-null +unclear-type +unsafe-getters-setters +untyped-import +untyped-type-import [version] -^0.92.0 +^0.182.0 diff --git a/SampleApplications/ClipboardTestApp/.gitattributes b/SampleApplications/ClipboardTestApp/.gitattributes deleted file mode 100644 index d42ff18..0000000 --- a/SampleApplications/ClipboardTestApp/.gitattributes +++ /dev/null @@ -1 +0,0 @@ -*.pbxproj -text diff --git a/SampleApplications/ClipboardTestApp/.gitignore b/SampleApplications/ClipboardTestApp/.gitignore index 5d64756..2423126 100644 --- a/SampleApplications/ClipboardTestApp/.gitignore +++ b/SampleApplications/ClipboardTestApp/.gitignore @@ -20,7 +20,7 @@ DerivedData *.hmap *.ipa *.xcuserstate -project.xcworkspace +ios/.xcode.env.local # Android/IntelliJ # @@ -29,6 +29,8 @@ build/ .gradle local.properties *.iml +*.hprof +.cxx/ # node.js # @@ -40,6 +42,7 @@ yarn-error.log buck-out/ \.buckd/ *.keystore +!debug.keystore # fastlane # @@ -48,9 +51,14 @@ buck-out/ # For more information about the recommended setup visit: # https://docs.fastlane.tools/best-practices/source-control/ -*/fastlane/report.xml -*/fastlane/Preview.html -*/fastlane/screenshots +**/fastlane/report.xml +**/fastlane/Preview.html +**/fastlane/screenshots +**/fastlane/test_output # Bundle artifact *.jsbundle + +# Ruby / CocoaPods +/ios/Pods/ +/vendor/bundle/ diff --git a/SampleApplications/ClipboardTestApp/.node-version b/SampleApplications/ClipboardTestApp/.node-version new file mode 100644 index 0000000..b6a7d89 --- /dev/null +++ b/SampleApplications/ClipboardTestApp/.node-version @@ -0,0 +1 @@ +16 diff --git a/SampleApplications/ClipboardTestApp/.prettierrc.js b/SampleApplications/ClipboardTestApp/.prettierrc.js new file mode 100644 index 0000000..2b54074 --- /dev/null +++ b/SampleApplications/ClipboardTestApp/.prettierrc.js @@ -0,0 +1,7 @@ +module.exports = { + arrowParens: 'avoid', + bracketSameLine: true, + bracketSpacing: false, + singleQuote: true, + trailingComma: 'all', +}; diff --git a/SampleApplications/ClipboardTestApp/.ruby-version b/SampleApplications/ClipboardTestApp/.ruby-version new file mode 100644 index 0000000..a603bb5 --- /dev/null +++ b/SampleApplications/ClipboardTestApp/.ruby-version @@ -0,0 +1 @@ +2.7.5 diff --git a/SampleApplications/ClipboardTestApp/App.js b/SampleApplications/ClipboardTestApp/App.js index afe74dd..7f04b97 100644 --- a/SampleApplications/ClipboardTestApp/App.js +++ b/SampleApplications/ClipboardTestApp/App.js @@ -1,11 +1,13 @@ /** - * Copyright (c) 2021 BlackBerry Limited. All Rights Reserved. + * Copyright (c) 2023 BlackBerry Limited. All Rights Reserved. + * Some modifications to the original Clipboard module example + * from https://github.com/react-native-clipboard/clipboard/blob/v1.11.1/example/App.tsx * - * Licensed under the Apache License, Version 2.0 (the "License"); + * 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 * - *    http://www.apache.org/licenses/LICENSE-2.0 + *    http://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, @@ -14,99 +16,195 @@ * limitations under the License. */ -import React, { Component } from 'react'; - -import { Platform, StyleSheet, View, Text, TextInput, Button } from 'react-native'; -// import TextInput from 'BlackBerry-Dynamics-for-React-Native-TextInput'; -// import Text from 'BlackBerry-Dynamics-for-React-Native-Text'; -import Clipboard from 'BlackBerry-Dynamics-for-React-Native-Clipboard'; - -type Props = {}; -export default class App extends Component { - constructor(props) { - super(props); - this.state = { - clipboardText: "", - textInputText: "" - }; - } - - get_Text_From_Clipboard = async () => { - var textHolder = await Clipboard.getString(); - console.log('getting value from clipboard: ' + textHolder) - this.setState({ - clipboardText: textHolder - }) - } - - set_Text_Into_Clipboard = async () => { - console.log('setting value to clipboard: ' + this.state.textInputText) - await Clipboard.setString(this.state.textInputText); - } - - render() { - return ( - +import React, {useEffect, useState} from 'react'; +import { + StyleSheet, + Text, + View, + Button, + TextInput, + Alert, + SafeAreaView, + Platform, + Image, +} from 'react-native'; +import Clipboard, { + useClipboard, +} from 'BlackBerry-Dynamics-for-React-Native-Clipboard'; - this.setState({textInputText: value})} - /> +// Small icon of a plus for demo purposes +const TEST_IMAGE = + 'iVBORw0KGgoAAAANSUhEUgAAADMAAAAzCAYAAAA6oTAqAAAAEXRFWHRTb2Z0d2FyZQBwbmdjcnVzaEB1SfMAAABQSURBVGje7dSxCQBACARB+2/ab8BEeQNhFi6WSYzYLYudDQYGBgYGBgYGBgYGBgYGBgZmcvDqYGBgmhivGQYGBgYGBgYGBgYGBgYGBgbmQw+P/eMrC5UTVAAAAABJRU5ErkJggg=='; + +const changeListener = () => { + console.info('Clipboard changed!'); +}; + +const App = () => { + const [userInputText, setUserInputText] = useState(''); + const [textFromClipboard, setTextFromClipboard] = useClipboard(); + const [isURL, setIsURL] = useState(false); // iOS only + const [isNumber, setIsNumber] = useState(false); // iOS only + const [imageIos, setImageIos] = useState(null); // iOS only + const [imageAndroid, setImageAndroid] = useState(''); // Android only + + const checkStringType = async () => { + const checkClipboardHasURL = await Clipboard.hasURL(); + const checkClipboardHasNumber = await Clipboard.hasNumber(); + setIsURL(checkClipboardHasURL); + setIsNumber(checkClipboardHasNumber); + }; - -