Skip to content

Commit

Permalink
chore: initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
natanfeitosa committed Aug 4, 2023
1 parent 0f3e315 commit c18a7c7
Show file tree
Hide file tree
Showing 73 changed files with 9,974 additions and 2,284 deletions.
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,6 @@ end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.java]
indent_size = 4
14 changes: 7 additions & 7 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ To run the example app on Android:
yarn example android
```

To run the example app on iOS:
<!-- To run the example app on iOS:
```sh
yarn example ios
```
``` -->

Make sure your code passes TypeScript and ESLint. Run the following to verify:

Expand All @@ -47,13 +47,13 @@ To fix formatting errors, run the following:
yarn lint --fix
```

Remember to add tests for your change if possible. Run the unit tests by:
<!-- Remember to add tests for your change if possible. Run the unit tests by:
```sh
yarn test
```
``` -->

To edit the Objective-C or Swift files, open `example/ios/RNWallpapersExample.xcworkspace` in XCode and find the source files at `Pods > Development Pods > rn-wallpapers`.
<!-- To edit the Objective-C or Swift files, open `example/ios/RNWallpapersExample.xcworkspace` in XCode and find the source files at `Pods > Development Pods > rn-wallpapers`. -->

To edit the Java or Kotlin files, open `example/android` in Android studio and find the source files at `rn-wallpapers` under `Android`.

Expand All @@ -78,7 +78,7 @@ Our pre-commit hooks verify that your commit message matches this format when co
We use [TypeScript](https://www.typescriptlang.org/) for type checking, [ESLint](https://eslint.org/) with [Prettier](https://prettier.io/) for linting and formatting the code, and [Jest](https://jestjs.io/) for testing.

Our pre-commit hooks verify that the linter and tests pass when committing.

<!--
### Publishing to npm
We use [release-it](https://github.com/release-it/release-it) to make it easier to publish new versions. It handles common tasks like bumping version based on semver, creating tags and releases etc.
Expand All @@ -87,7 +87,7 @@ To publish new versions, run the following:
```sh
yarn release
```
``` -->

### Scripts

Expand Down
30 changes: 28 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,42 @@ A lightweight library for setting wallpapers

```sh
npm install rn-wallpapers

// or with yarn
yarn add rn-wallpapers
```

## Usage

```js
import { multiply } from 'rn-wallpapers';
import { setWallpaper, TYPE_SCREEN } from 'rn-wallpapers';

// ...

const result = await multiply(3, 7);

await setWallpaper(
{
uri: 'https://i0.wp.com/techwek.com/wp-content/uploads/2021/01/wallpaper-gotas-de-chuva.jpg',
headers: {
// your custom headers ...
}
},
TYPE_SCREEN.LOCK // Sets the wallpaper on Lock Screen only
);

await setWallpaper(
{
uri: 'https://i0.wp.com/techwek.com/wp-content/uploads/2021/01/wallpaper-gotas-de-chuva.jpg'
},
TYPE_SCREEN.HOME // (default) Sets the wallpaper on Home Screen only
);

await setWallpaper(
{
uri: 'https://i0.wp.com/techwek.com/wp-content/uploads/2021/01/wallpaper-gotas-de-chuva.jpg'
},
TYPE_SCREEN.BOTH // Sets the wallpaper on both screen
);
```

## Contributing
Expand Down
9 changes: 7 additions & 2 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def supportsNamespace() {

android {
if (supportsNamespace()) {
namespace "com.rnwallpapers"
namespace "com.natanapps.rnwallpapers"

sourceSets {
main {
Expand Down Expand Up @@ -85,6 +85,11 @@ repositories {


dependencies {
implementation "com.github.bumptech.glide:glide:${getExtOrDefault('glideVersion')}"
implementation "com.github.bumptech.glide:annotations:${getExtOrDefault('glideVersion')}"
annotationProcessor 'androidx.annotation:annotation:1.0.0'
annotationProcessor "com.github.bumptech.glide:glide:${getExtOrDefault('glideVersion')}"

// For < 0.71, this will be from the local maven repo
// For > 0.71, this will be replaced by `com.facebook.react:react-android:$version` by react gradle plugin
//noinspection GradleDynamicVersion
Expand All @@ -95,6 +100,6 @@ if (isNewArchitectureEnabled()) {
react {
jsRootDir = file("../src/")
libraryName = "RNWallpapers"
codegenJavaPackageName = "com.rnwallpapers"
codegenJavaPackageName = "com.natanapps.rnwallpapers"
}
}
3 changes: 3 additions & 0 deletions android/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@ RNWallpapers_minSdkVersion=21
RNWallpapers_targetSdkVersion=31
RNWallpapers_compileSdkVersion=31
RNWallpapers_ndkversion=21.4.7075529

RNWallpapers_glideVersion=4.9.0
RNWallpapers_excludeRNGlide=false
4 changes: 2 additions & 2 deletions android/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.rnwallpapers">
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.natanapps.rnwallpapers">
<uses-permission android:name="android.permission.SET_WALLPAPER" />
</manifest>
1 change: 1 addition & 0 deletions android/src/main/AndroidManifestNew.xml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.SET_WALLPAPER" />
</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.natanapps.rnwallpapers;

import com.bumptech.glide.annotation.GlideModule;
import com.bumptech.glide.module.AppGlideModule;

@GlideModule
public class RNGlideModule extends AppGlideModule {}
Loading

0 comments on commit c18a7c7

Please sign in to comment.