{"id":14985812,"url":"https://github.com/chrisgriffith/ionic-native-mocks","last_synced_at":"2025-04-05T08:03:44.036Z","repository":{"id":22367656,"uuid":"93868486","full_name":"chrisgriffith/ionic-native-mocks","owner":"chrisgriffith","description":"Ionic Native Mocks are designed to be used as placeholders during development for the actual Ionic Native modules.","archived":false,"fork":false,"pushed_at":"2023-07-19T09:37:23.000Z","size":1508,"stargazers_count":204,"open_issues_count":14,"forks_count":40,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-04-03T03:11:13.903Z","etag":null,"topics":["cordova-plugin","ionic","ionic-native","ionic-native-mocks"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/chrisgriffith.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-06-09T14:45:39.000Z","updated_at":"2024-12-05T05:59:21.000Z","dependencies_parsed_at":"2024-06-18T19:52:06.407Z","dependency_job_id":"d74a523a-c4ec-4e31-afe0-f4dfd8390028","html_url":"https://github.com/chrisgriffith/ionic-native-mocks","commit_stats":{"total_commits":80,"total_committers":9,"mean_commits":8.88888888888889,"dds":0.5125,"last_synced_commit":"db3b8c60a97b548d85afc9500c6d1d8defa95440"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chrisgriffith%2Fionic-native-mocks","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chrisgriffith%2Fionic-native-mocks/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chrisgriffith%2Fionic-native-mocks/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chrisgriffith%2Fionic-native-mocks/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chrisgriffith","download_url":"https://codeload.github.com/chrisgriffith/ionic-native-mocks/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247305930,"owners_count":20917207,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cordova-plugin","ionic","ionic-native","ionic-native-mocks"],"created_at":"2024-09-24T14:11:43.529Z","updated_at":"2025-04-05T08:03:44.005Z","avatar_url":"https://github.com/chrisgriffith.png","language":"TypeScript","readme":"# Ionic Native Mocks\n\nIonic Native Mocks are designed to be used as placeholders during development for the actual Ionic Native modules. [Ionic Native](https://github.com/ionic-team/ionic-native) is a curated set of wrappers for [Apache Cordova](https://cordova.apache.org/) plugins that make adding any native functionality you need to your [Ionic](https://ionicframework.com/) mobile application easier.\n\nIonic Native wraps plugin callbacks in a Promise or Observable, providing a common interface for all plugins and making it easy to use plugins with Angular change detection.\n\nHowever, once you integrate these plugins into your Ionic application, use of a device or emulator is required for development and testing which can slow your workflow.\n\n## Installation\n\nThis project allows developers to use Ionic Native Mocks in place of the actual Ionic Native modules. They can be installed in via to methods. \n1) via npm: Installing these prebuilt mocks is easy but they are not easily customized.\n2) via GitHub and manually added to your Ionic project: Installing this way means the mocks can be customized to return specific data, like a specific parsing of a QR code.\n\n### Installation via npm\n\nRun following command to install a Ionic Native Mock into your project.\n```bash\nnpm install @ionic-native-mocks/[plug-in] --save\n```\n\nFor instance, to install the camera mock:\n```bash\nnpm install @ionic-native-mocks/camera --save\n```\n\nYou also need to install the Ionic Native package for each plugin you want to add. Please see the [Ionic Native documentation](https://ionicframework.com/docs/native/) for complete instructions on how to add and use the plugins.\n\n## Documentation\n\nFor the full Ionic Native documentation, please visit [https://ionicframework.com/docs/native/](https://ionicframework.com/docs/native/).\n\n### Basic Usage\n\nTo use a plugin, import and add the plugin provider to your `@NgModule`, and then inject it where you wish to use it.\n\n```typescript\n// app.module.ts\nimport { Camera } from '@ionic-native/camera';\nimport { CameraMock } from '@ionic-native-mocks/camera';\n...\n\n@NgModule({\n  ...\n\n  providers: [\n    ...\n    { provide: Camera, useClass: CameraMock }\n    ...\n  ]\n  ...\n})\nexport class AppModule { }\n```\n\n```typescript\nimport { Platform } from 'ionic-angular';\nimport { Camera, CameraOptions } from '@ionic-native/camera';\n\n@Component({ ... })\nexport class MyComponent {\n\n  constructor(private camera: Camera, private platform: Platform) {\n\n    platform.ready().then(() =\u003e {\n\n      const options: CameraOptions = {\n        quality: 100,\n        destinationType: this.camera.DestinationType.DATA_URL,\n        encodingType: this.camera.EncodingType.JPEG,\n        mediaType: this.camera.MediaType.PICTURE\n      }\n\n      this.camera.getPicture(options).then((imageData) =\u003e {\n        // imageData is either a base64 encoded string or a file URI\n        // If it's base64:\n        console.log(imageData);\n        let base64Image = 'data:image/jpeg;base64,' + imageData;\n      }, (err) =\u003e {\n        // Handle error\n      });\n    });\n  }\n}\n```\n### Customization\nTo learn how to customize an Ionic Native Mock, see the guide at: https://chrisgriffith.wordpress.com/2017/08/21/customizing-ionic-native-mocks/ (https://chrisgriffith.wordpress.com/2017/08/21/customizing-ionic-native-mocks/)\n\n## Missing a mock? Found a problem?  \nLet us know or submit a PR!\n\n# Credits\n\nChris Griffith - [@chrisgriffith](https://github.com/chrisgriffith)\n\nLeif Wells - [@leifwells](https://github.com/leifwells)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchrisgriffith%2Fionic-native-mocks","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchrisgriffith%2Fionic-native-mocks","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchrisgriffith%2Fionic-native-mocks/lists"}