├── .DS_Store
├── index.js
├── android
├── src
│ └── main
│ │ ├── AndroidManifest.xml
│ │ └── java
│ │ └── com
│ │ └── opensettings
│ │ ├── OpenSettingsPackage.java
│ │ └── OpenSettings.java
└── build.gradle
├── React Native Open Settings.xcodeproj
├── project.xcworkspace
│ ├── contents.xcworkspacedata
│ └── xcuserdata
│ │ └── Morrissey.xcuserdatad
│ │ └── UserInterfaceState.xcuserstate
├── xcuserdata
│ └── Morrissey.xcuserdatad
│ │ └── xcschemes
│ │ ├── xcschememanagement.plist
│ │ └── React Native Open Settings.xcscheme
└── project.pbxproj
├── RNOpenSettings.h
├── package.json
├── RNOpenSettings.m
└── README.md
/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lunarmayor/react-native-open-settings/HEAD/.DS_Store
--------------------------------------------------------------------------------
/index.js:
--------------------------------------------------------------------------------
1 | var RNOpenSettings = require('react-native').NativeModules.RNOpenSettings;
2 | module.exports = RNOpenSettings;
3 |
--------------------------------------------------------------------------------
/android/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/React Native Open Settings.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/React Native Open Settings.xcodeproj/project.xcworkspace/xcuserdata/Morrissey.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lunarmayor/react-native-open-settings/HEAD/React Native Open Settings.xcodeproj/project.xcworkspace/xcuserdata/Morrissey.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/RNOpenSettings.h:
--------------------------------------------------------------------------------
1 | //
2 | // React_Native_Open_Settings.h
3 | // React Native Open Settings
4 | //
5 | // Created by Michael Morrissey on 11/4/15.
6 | // Copyright © 2015 Michael Morrissey. All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 |
12 | @interface RNOpenSettings : NSObject
13 |
14 | @end
15 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "react-native-open-settings",
3 | "version": "1.0.0",
4 | "description": "open app settings in react native",
5 | "main": "index.js",
6 | "scripts": {
7 | "test": "echo \"Error: no test specified\" && exit 1"
8 | },
9 | "keywords": [
10 | "react-native"
11 | ],
12 | "author": "Michael Morrissey",
13 | "license": "ISC",
14 | "repository": "https://github.com/lunarmayor/react-native-open-settings"
15 | }
16 |
--------------------------------------------------------------------------------
/android/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 |
3 | android {
4 | compileSdkVersion 23
5 | buildToolsVersion "23.0.1"
6 |
7 | defaultConfig {
8 | minSdkVersion 16
9 | targetSdkVersion 22
10 | versionCode 1
11 | versionName "1.0"
12 |
13 | }
14 | lintOptions {
15 | warning 'InvalidPackage'
16 | }
17 | }
18 |
19 | dependencies {
20 | compile 'com.facebook.react:react-native:+'
21 | }
22 |
--------------------------------------------------------------------------------
/RNOpenSettings.m:
--------------------------------------------------------------------------------
1 | //
2 | // React_Native_Open_Settings.m
3 | // React Native Open Settings
4 | //
5 | // Created by Michael Morrissey on 11/4/15.
6 | // Copyright © 2015 Michael Morrissey. All rights reserved.
7 | //
8 |
9 | #import "RNOpenSettings.h"
10 |
11 | @implementation RNOpenSettings
12 |
13 | RCT_EXPORT_MODULE(RNOpenSettings);
14 |
15 | RCT_EXPORT_METHOD(openSettings) {
16 | [[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];
17 | }
18 |
19 | @end
20 |
--------------------------------------------------------------------------------
/React Native Open Settings.xcodeproj/xcuserdata/Morrissey.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | React Native Open Settings.xcscheme
8 |
9 | orderHint
10 | 0
11 |
12 |
13 | SuppressBuildableAutocreation
14 |
15 | 190C8BA91BEAADCC00CD505E
16 |
17 | primary
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/android/src/main/java/com/opensettings/OpenSettingsPackage.java:
--------------------------------------------------------------------------------
1 | package com.opensettings;
2 |
3 | import com.facebook.react.ReactPackage;
4 | import com.facebook.react.bridge.JavaScriptModule;
5 | import com.facebook.react.bridge.NativeModule;
6 | import com.facebook.react.bridge.ReactApplicationContext;
7 | import com.facebook.react.uimanager.ViewManager;
8 |
9 | import java.util.ArrayList;
10 | import java.util.Collections;
11 | import java.util.List;
12 |
13 | public class OpenSettingsPackage implements ReactPackage {
14 |
15 | // Deprecated RN 0.47
16 | public List> createJSModules() {
17 | return Collections.emptyList();
18 | }
19 |
20 | @Override
21 | public List createViewManagers(ReactApplicationContext reactContext) {
22 | return Collections.emptyList();
23 | }
24 |
25 | @Override
26 | public List createNativeModules(
27 | ReactApplicationContext reactContext) {
28 | List modules = new ArrayList<>();
29 |
30 | modules.add(new OpenSettings(reactContext));
31 |
32 | return modules;
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/android/src/main/java/com/opensettings/OpenSettings.java:
--------------------------------------------------------------------------------
1 | package com.opensettings;
2 |
3 | import android.content.Intent;
4 | import android.net.Uri;
5 | import android.provider.Settings;
6 |
7 | import com.facebook.react.bridge.ReactApplicationContext;
8 | import com.facebook.react.bridge.ReactContext;
9 | import com.facebook.react.bridge.ReactContextBaseJavaModule;
10 | import com.facebook.react.bridge.ReactMethod;
11 |
12 | public class OpenSettings extends ReactContextBaseJavaModule {
13 |
14 | private ReactContext reactContext;
15 |
16 | public OpenSettings(ReactApplicationContext reactContext) {
17 | super(reactContext);
18 | this.reactContext = reactContext;
19 | }
20 |
21 | @Override
22 | public String getName() {
23 | return "RNOpenSettings";
24 | }
25 |
26 | //region React Native Methods
27 | @ReactMethod
28 | public void openSettings() {
29 | final Intent i = new Intent();
30 | i.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
31 | i.addCategory(Intent.CATEGORY_DEFAULT);
32 | i.setData(Uri.parse("package:" + reactContext.getPackageName()));
33 | i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
34 | i.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
35 | i.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
36 | reactContext.startActivity(i);
37 | }
38 | //endregion
39 | }
40 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # react-native-open-settings
2 |
3 | [](http://badge.fury.io/js/react-native-open-settings)
5 |
6 | Open your apps settings in the Settings app :P
7 |
8 | ## Install
9 | ```
10 | npm install react-native-open-settings
11 | ```
12 |
13 | ### iOS
14 | Add `React Native Open Settings` to project libraries.
15 |
16 | ### Android
17 |
18 | - Edit `build.gradle` to look like this:
19 | ```java
20 | apply plugin: 'com.android.application'
21 |
22 | android {
23 | ...
24 | }
25 |
26 | dependencies {
27 | ...
28 | + compile project(':react-native-open-settings')
29 | }
30 | ```
31 |
32 | - In `settings.gradle`, insert the following code:
33 | ```java
34 | include ':react-native-open-settings'
35 | project(':react-native-open-settings').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-open-settings/android')
36 | ```
37 |
38 | - Edit your `MainActivity.java` to look like this:
39 | ```java
40 | package com.myapp;
41 |
42 | ....
43 | import com.opensettings.OpenSettingsPackage
44 |
45 | public class MainActivity extends extends ReactActivity {
46 |
47 | @Override
48 | protected List getPackages() {
49 | return Arrays.asList(
50 | new MainReactPackage(),
51 | new OpenSettingsPackage()
52 | );
53 | }
54 | ...
55 | }
56 | ```
57 |
58 | ## Usage
59 |
60 | Require the `react-native-open-settings` module.
61 |
62 | ```javascript
63 | import OpenSettings from 'react-native-open-settings';
64 | ```
65 |
66 | And then, where you want to open the settings, just do
67 | ```javascript
68 | OpenSettings.openSettings()
69 | ```
70 |
71 | Have fun!
72 |
--------------------------------------------------------------------------------
/React Native Open Settings.xcodeproj/xcuserdata/Morrissey.xcuserdatad/xcschemes/React Native Open Settings.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
32 |
33 |
34 |
35 |
45 |
46 |
52 |
53 |
54 |
55 |
56 |
57 |
63 |
64 |
70 |
71 |
72 |
73 |
75 |
76 |
79 |
80 |
81 |
--------------------------------------------------------------------------------
/React Native Open Settings.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 46;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | 190C8BAE1BEAADCC00CD505E /* RNOpenSettings.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 190C8BAD1BEAADCC00CD505E /* RNOpenSettings.h */; };
11 | 190C8BB01BEAADCC00CD505E /* RNOpenSettings.m in Sources */ = {isa = PBXBuildFile; fileRef = 190C8BAF1BEAADCC00CD505E /* RNOpenSettings.m */; };
12 | /* End PBXBuildFile section */
13 |
14 | /* Begin PBXCopyFilesBuildPhase section */
15 | 190C8BA81BEAADCC00CD505E /* CopyFiles */ = {
16 | isa = PBXCopyFilesBuildPhase;
17 | buildActionMask = 2147483647;
18 | dstPath = "include/$(PRODUCT_NAME)";
19 | dstSubfolderSpec = 16;
20 | files = (
21 | 190C8BAE1BEAADCC00CD505E /* RNOpenSettings.h in CopyFiles */,
22 | );
23 | runOnlyForDeploymentPostprocessing = 0;
24 | };
25 | /* End PBXCopyFilesBuildPhase section */
26 |
27 | /* Begin PBXFileReference section */
28 | 190C8BAA1BEAADCC00CD505E /* libReact Native Open Settings.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libReact Native Open Settings.a"; sourceTree = BUILT_PRODUCTS_DIR; };
29 | 190C8BAD1BEAADCC00CD505E /* RNOpenSettings.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RNOpenSettings.h; sourceTree = ""; };
30 | 190C8BAF1BEAADCC00CD505E /* RNOpenSettings.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RNOpenSettings.m; sourceTree = ""; };
31 | /* End PBXFileReference section */
32 |
33 | /* Begin PBXFrameworksBuildPhase section */
34 | 190C8BA71BEAADCC00CD505E /* Frameworks */ = {
35 | isa = PBXFrameworksBuildPhase;
36 | buildActionMask = 2147483647;
37 | files = (
38 | );
39 | runOnlyForDeploymentPostprocessing = 0;
40 | };
41 | /* End PBXFrameworksBuildPhase section */
42 |
43 | /* Begin PBXGroup section */
44 | 190C8BA11BEAADCC00CD505E = {
45 | isa = PBXGroup;
46 | children = (
47 | 190C8BAD1BEAADCC00CD505E /* RNOpenSettings.h */,
48 | 190C8BAF1BEAADCC00CD505E /* RNOpenSettings.m */,
49 | 190C8BAB1BEAADCC00CD505E /* Products */,
50 | );
51 | sourceTree = "";
52 | };
53 | 190C8BAB1BEAADCC00CD505E /* Products */ = {
54 | isa = PBXGroup;
55 | children = (
56 | 190C8BAA1BEAADCC00CD505E /* libReact Native Open Settings.a */,
57 | );
58 | name = Products;
59 | sourceTree = "";
60 | };
61 | /* End PBXGroup section */
62 |
63 | /* Begin PBXNativeTarget section */
64 | 190C8BA91BEAADCC00CD505E /* React Native Open Settings */ = {
65 | isa = PBXNativeTarget;
66 | buildConfigurationList = 190C8BB31BEAADCC00CD505E /* Build configuration list for PBXNativeTarget "React Native Open Settings" */;
67 | buildPhases = (
68 | 190C8BA61BEAADCC00CD505E /* Sources */,
69 | 190C8BA71BEAADCC00CD505E /* Frameworks */,
70 | 190C8BA81BEAADCC00CD505E /* CopyFiles */,
71 | );
72 | buildRules = (
73 | );
74 | dependencies = (
75 | );
76 | name = "React Native Open Settings";
77 | productName = "React Native Open Settings";
78 | productReference = 190C8BAA1BEAADCC00CD505E /* libReact Native Open Settings.a */;
79 | productType = "com.apple.product-type.library.static";
80 | };
81 | /* End PBXNativeTarget section */
82 |
83 | /* Begin PBXProject section */
84 | 190C8BA21BEAADCC00CD505E /* Project object */ = {
85 | isa = PBXProject;
86 | attributes = {
87 | LastUpgradeCheck = 0700;
88 | ORGANIZATIONNAME = "Michael Morrissey";
89 | TargetAttributes = {
90 | 190C8BA91BEAADCC00CD505E = {
91 | CreatedOnToolsVersion = 7.0.1;
92 | };
93 | };
94 | };
95 | buildConfigurationList = 190C8BA51BEAADCC00CD505E /* Build configuration list for PBXProject "React Native Open Settings" */;
96 | compatibilityVersion = "Xcode 3.2";
97 | developmentRegion = English;
98 | hasScannedForEncodings = 0;
99 | knownRegions = (
100 | en,
101 | );
102 | mainGroup = 190C8BA11BEAADCC00CD505E;
103 | productRefGroup = 190C8BAB1BEAADCC00CD505E /* Products */;
104 | projectDirPath = "";
105 | projectRoot = "";
106 | targets = (
107 | 190C8BA91BEAADCC00CD505E /* React Native Open Settings */,
108 | );
109 | };
110 | /* End PBXProject section */
111 |
112 | /* Begin PBXSourcesBuildPhase section */
113 | 190C8BA61BEAADCC00CD505E /* Sources */ = {
114 | isa = PBXSourcesBuildPhase;
115 | buildActionMask = 2147483647;
116 | files = (
117 | 190C8BB01BEAADCC00CD505E /* RNOpenSettings.m in Sources */,
118 | );
119 | runOnlyForDeploymentPostprocessing = 0;
120 | };
121 | /* End PBXSourcesBuildPhase section */
122 |
123 | /* Begin XCBuildConfiguration section */
124 | 190C8BB11BEAADCC00CD505E /* Debug */ = {
125 | isa = XCBuildConfiguration;
126 | buildSettings = {
127 | ALWAYS_SEARCH_USER_PATHS = NO;
128 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
129 | CLANG_CXX_LIBRARY = "libc++";
130 | CLANG_ENABLE_MODULES = YES;
131 | CLANG_ENABLE_OBJC_ARC = YES;
132 | CLANG_WARN_BOOL_CONVERSION = YES;
133 | CLANG_WARN_CONSTANT_CONVERSION = YES;
134 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
135 | CLANG_WARN_EMPTY_BODY = YES;
136 | CLANG_WARN_ENUM_CONVERSION = YES;
137 | CLANG_WARN_INT_CONVERSION = YES;
138 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
139 | CLANG_WARN_UNREACHABLE_CODE = YES;
140 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
141 | COPY_PHASE_STRIP = NO;
142 | DEBUG_INFORMATION_FORMAT = dwarf;
143 | ENABLE_STRICT_OBJC_MSGSEND = YES;
144 | ENABLE_TESTABILITY = YES;
145 | GCC_C_LANGUAGE_STANDARD = gnu99;
146 | GCC_DYNAMIC_NO_PIC = NO;
147 | GCC_NO_COMMON_BLOCKS = YES;
148 | GCC_OPTIMIZATION_LEVEL = 0;
149 | GCC_PREPROCESSOR_DEFINITIONS = (
150 | "DEBUG=1",
151 | "$(inherited)",
152 | );
153 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
154 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
155 | GCC_WARN_UNDECLARED_SELECTOR = YES;
156 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
157 | GCC_WARN_UNUSED_FUNCTION = YES;
158 | GCC_WARN_UNUSED_VARIABLE = YES;
159 | IPHONEOS_DEPLOYMENT_TARGET = 9.0;
160 | MTL_ENABLE_DEBUG_INFO = YES;
161 | ONLY_ACTIVE_ARCH = YES;
162 | SDKROOT = iphoneos;
163 | };
164 | name = Debug;
165 | };
166 | 190C8BB21BEAADCC00CD505E /* Release */ = {
167 | isa = XCBuildConfiguration;
168 | buildSettings = {
169 | ALWAYS_SEARCH_USER_PATHS = NO;
170 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
171 | CLANG_CXX_LIBRARY = "libc++";
172 | CLANG_ENABLE_MODULES = YES;
173 | CLANG_ENABLE_OBJC_ARC = YES;
174 | CLANG_WARN_BOOL_CONVERSION = YES;
175 | CLANG_WARN_CONSTANT_CONVERSION = YES;
176 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
177 | CLANG_WARN_EMPTY_BODY = YES;
178 | CLANG_WARN_ENUM_CONVERSION = YES;
179 | CLANG_WARN_INT_CONVERSION = YES;
180 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
181 | CLANG_WARN_UNREACHABLE_CODE = YES;
182 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
183 | COPY_PHASE_STRIP = NO;
184 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
185 | ENABLE_NS_ASSERTIONS = NO;
186 | ENABLE_STRICT_OBJC_MSGSEND = YES;
187 | GCC_C_LANGUAGE_STANDARD = gnu99;
188 | GCC_NO_COMMON_BLOCKS = YES;
189 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
190 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
191 | GCC_WARN_UNDECLARED_SELECTOR = YES;
192 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
193 | GCC_WARN_UNUSED_FUNCTION = YES;
194 | GCC_WARN_UNUSED_VARIABLE = YES;
195 | IPHONEOS_DEPLOYMENT_TARGET = 9.0;
196 | MTL_ENABLE_DEBUG_INFO = NO;
197 | SDKROOT = iphoneos;
198 | VALIDATE_PRODUCT = YES;
199 | };
200 | name = Release;
201 | };
202 | 190C8BB41BEAADCC00CD505E /* Debug */ = {
203 | isa = XCBuildConfiguration;
204 | buildSettings = {
205 | HEADER_SEARCH_PATHS = (
206 | "$(SRCROOT)/../../React/**",
207 | "$(SRCROOT)/../react-native/React/**",
208 | );
209 | OTHER_LDFLAGS = "-ObjC";
210 | PRODUCT_NAME = "$(TARGET_NAME)";
211 | SKIP_INSTALL = YES;
212 | };
213 | name = Debug;
214 | };
215 | 190C8BB51BEAADCC00CD505E /* Release */ = {
216 | isa = XCBuildConfiguration;
217 | buildSettings = {
218 | HEADER_SEARCH_PATHS = (
219 | "$(SRCROOT)/../../React/**",
220 | "$(SRCROOT)/../react-native/React/**",
221 | );
222 | OTHER_LDFLAGS = "-ObjC";
223 | PRODUCT_NAME = "$(TARGET_NAME)";
224 | SKIP_INSTALL = YES;
225 | };
226 | name = Release;
227 | };
228 | /* End XCBuildConfiguration section */
229 |
230 | /* Begin XCConfigurationList section */
231 | 190C8BA51BEAADCC00CD505E /* Build configuration list for PBXProject "React Native Open Settings" */ = {
232 | isa = XCConfigurationList;
233 | buildConfigurations = (
234 | 190C8BB11BEAADCC00CD505E /* Debug */,
235 | 190C8BB21BEAADCC00CD505E /* Release */,
236 | );
237 | defaultConfigurationIsVisible = 0;
238 | defaultConfigurationName = Release;
239 | };
240 | 190C8BB31BEAADCC00CD505E /* Build configuration list for PBXNativeTarget "React Native Open Settings" */ = {
241 | isa = XCConfigurationList;
242 | buildConfigurations = (
243 | 190C8BB41BEAADCC00CD505E /* Debug */,
244 | 190C8BB51BEAADCC00CD505E /* Release */,
245 | );
246 | defaultConfigurationIsVisible = 0;
247 | defaultConfigurationName = Release;
248 | };
249 | /* End XCConfigurationList section */
250 | };
251 | rootObject = 190C8BA21BEAADCC00CD505E /* Project object */;
252 | }
253 |
--------------------------------------------------------------------------------