|
1 | 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP |
2 | 2 |
|
3 | | -exports[`withRNOrientationMainActivity updates the MainActivity.kt with both import and method implementation 1`] = ` |
| 3 | +exports[`withRNOrientationMainActivity skips the MainActivity.kt configuration import when it's already set 1`] = ` |
4 | 4 | "package com.orientationdirectorexample |
5 | 5 |
|
6 | | -import android.content.Intent |
7 | 6 | import android.content.res.Configuration |
8 | 7 | import android.os.Bundle |
9 | 8 | import com.facebook.react.ReactActivity |
10 | 9 | import com.facebook.react.ReactActivityDelegate |
11 | 10 | import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.fabricEnabled |
12 | 11 | import com.facebook.react.defaults.DefaultReactActivityDelegate |
13 | 12 |
|
14 | | -// React Native Orientation Director @generated begin @react-native-orientation-director/library-import - expo prebuild (DO NOT MODIFY) sync-dd77fee7fe624fed474053ea60c3105920a01a6a |
| 13 | +// React Native Orientation Director @generated begin @react-native-orientation-director/system-intent-import - expo prebuild (DO NOT MODIFY) sync-e6b9f54e19ab3cfd8689165dc8aa1ae37ba84e44 |
| 14 | +import android.content.Intent |
| 15 | +// React Native Orientation Director @generated end @react-native-orientation-director/system-intent-import |
| 16 | +// React Native Orientation Director @generated begin @react-native-orientation-director/library-import - expo prebuild (DO NOT MODIFY) sync-7169e02357214d7bab1282e0a498c9c731ada6ad |
15 | 17 | import com.orientationdirector.implementation.ConfigurationChangedBroadcastReceiver |
| 18 | +// React Native Orientation Director @generated end @react-native-orientation-director/library-import |
| 19 | +class MainActivity : ReactActivity() { |
| 20 | +
|
| 21 | + /** |
| 22 | + * Returns the name of the main component registered from JavaScript. This is used to schedule |
| 23 | + * rendering of the component. |
| 24 | + */ |
| 25 | + override fun getMainComponentName(): String = "OrientationDirectorExample" |
| 26 | +
|
| 27 | + /** |
| 28 | + * Returns the instance of the [ReactActivityDelegate]. We use [DefaultReactActivityDelegate] |
| 29 | + * which allows you to enable New Architecture with a single boolean flags [fabricEnabled] |
| 30 | + */ |
| 31 | + override fun createReactActivityDelegate(): ReactActivityDelegate = |
| 32 | + DefaultReactActivityDelegate(this, mainComponentName, fabricEnabled) |
| 33 | +
|
| 34 | + override fun onCreate(savedInstanceState: Bundle?) { |
| 35 | + super.onCreate(null) |
| 36 | + } |
| 37 | +// React Native Orientation Director @generated begin @react-native-orientation-director/supportedInterfaceOrientationsFor-implementation - expo prebuild (DO NOT MODIFY) sync-7a5cdf10057b2ddf1bcf4593bf408862cbed5473 |
| 38 | +
|
| 39 | + override fun onConfigurationChanged(newConfig: Configuration) { |
| 40 | + super.onConfigurationChanged(newConfig) |
| 41 | +
|
| 42 | + val orientationDirectorCustomAction = |
| 43 | + packageName + "." + ConfigurationChangedBroadcastReceiver.CUSTOM_INTENT_ACTION |
| 44 | +
|
| 45 | + val intent = |
| 46 | + Intent(orientationDirectorCustomAction).apply { |
| 47 | + putExtra("newConfig", newConfig) |
| 48 | + setPackage(packageName) |
| 49 | + } |
16 | 50 |
|
| 51 | + this.sendBroadcast(intent) |
| 52 | + } |
| 53 | +
|
| 54 | +// React Native Orientation Director @generated end @react-native-orientation-director/supportedInterfaceOrientationsFor-implementation |
| 55 | +
|
| 56 | +} |
| 57 | +" |
| 58 | +`; |
| 59 | +
|
| 60 | +exports[`withRNOrientationMainActivity skips the MainActivity.kt intent import when it's already set 1`] = ` |
| 61 | +"package com.orientationdirectorexample |
| 62 | +
|
| 63 | +import android.content.Intent |
| 64 | +import android.os.Bundle |
| 65 | +import com.facebook.react.ReactActivity |
| 66 | +import com.facebook.react.ReactActivityDelegate |
| 67 | +import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.fabricEnabled |
| 68 | +import com.facebook.react.defaults.DefaultReactActivityDelegate |
| 69 | +
|
| 70 | +// React Native Orientation Director @generated begin @react-native-orientation-director/system-configuration-import - expo prebuild (DO NOT MODIFY) sync-e946440a29a0e93549862b7c63f1655b232ef6fb |
| 71 | +import android.content.res.Configuration |
| 72 | +// React Native Orientation Director @generated end @react-native-orientation-director/system-configuration-import |
| 73 | +// React Native Orientation Director @generated begin @react-native-orientation-director/library-import - expo prebuild (DO NOT MODIFY) sync-7169e02357214d7bab1282e0a498c9c731ada6ad |
| 74 | +import com.orientationdirector.implementation.ConfigurationChangedBroadcastReceiver |
| 75 | +// React Native Orientation Director @generated end @react-native-orientation-director/library-import |
| 76 | +class MainActivity : ReactActivity() { |
| 77 | +
|
| 78 | + /** |
| 79 | + * Returns the name of the main component registered from JavaScript. This is used to schedule |
| 80 | + * rendering of the component. |
| 81 | + */ |
| 82 | + override fun getMainComponentName(): String = "OrientationDirectorExample" |
| 83 | +
|
| 84 | + /** |
| 85 | + * Returns the instance of the [ReactActivityDelegate]. We use [DefaultReactActivityDelegate] |
| 86 | + * which allows you to enable New Architecture with a single boolean flags [fabricEnabled] |
| 87 | + */ |
| 88 | + override fun createReactActivityDelegate(): ReactActivityDelegate = |
| 89 | + DefaultReactActivityDelegate(this, mainComponentName, fabricEnabled) |
| 90 | +
|
| 91 | + override fun onCreate(savedInstanceState: Bundle?) { |
| 92 | + super.onCreate(null) |
| 93 | + } |
| 94 | +// React Native Orientation Director @generated begin @react-native-orientation-director/supportedInterfaceOrientationsFor-implementation - expo prebuild (DO NOT MODIFY) sync-7a5cdf10057b2ddf1bcf4593bf408862cbed5473 |
| 95 | +
|
| 96 | + override fun onConfigurationChanged(newConfig: Configuration) { |
| 97 | + super.onConfigurationChanged(newConfig) |
| 98 | +
|
| 99 | + val orientationDirectorCustomAction = |
| 100 | + packageName + "." + ConfigurationChangedBroadcastReceiver.CUSTOM_INTENT_ACTION |
| 101 | +
|
| 102 | + val intent = |
| 103 | + Intent(orientationDirectorCustomAction).apply { |
| 104 | + putExtra("newConfig", newConfig) |
| 105 | + setPackage(packageName) |
| 106 | + } |
| 107 | +
|
| 108 | + this.sendBroadcast(intent) |
| 109 | + } |
| 110 | +
|
| 111 | +// React Native Orientation Director @generated end @react-native-orientation-director/supportedInterfaceOrientationsFor-implementation |
| 112 | +
|
| 113 | +} |
| 114 | +" |
| 115 | +`; |
| 116 | +
|
| 117 | +exports[`withRNOrientationMainActivity updates the MainActivity.kt with both imports and method implementation 1`] = ` |
| 118 | +"package com.orientationdirectorexample |
| 119 | +
|
| 120 | +import android.os.Bundle |
| 121 | +import com.facebook.react.ReactActivity |
| 122 | +import com.facebook.react.ReactActivityDelegate |
| 123 | +import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.fabricEnabled |
| 124 | +import com.facebook.react.defaults.DefaultReactActivityDelegate |
| 125 | +
|
| 126 | +// React Native Orientation Director @generated begin @react-native-orientation-director/system-intent-import - expo prebuild (DO NOT MODIFY) sync-e6b9f54e19ab3cfd8689165dc8aa1ae37ba84e44 |
| 127 | +import android.content.Intent |
| 128 | +// React Native Orientation Director @generated end @react-native-orientation-director/system-intent-import |
| 129 | +// React Native Orientation Director @generated begin @react-native-orientation-director/system-configuration-import - expo prebuild (DO NOT MODIFY) sync-e946440a29a0e93549862b7c63f1655b232ef6fb |
| 130 | +import android.content.res.Configuration |
| 131 | +// React Native Orientation Director @generated end @react-native-orientation-director/system-configuration-import |
| 132 | +// React Native Orientation Director @generated begin @react-native-orientation-director/library-import - expo prebuild (DO NOT MODIFY) sync-7169e02357214d7bab1282e0a498c9c731ada6ad |
| 133 | +import com.orientationdirector.implementation.ConfigurationChangedBroadcastReceiver |
17 | 134 | // React Native Orientation Director @generated end @react-native-orientation-director/library-import |
18 | 135 | class MainActivity : ReactActivity() { |
19 | 136 |
|
|
0 commit comments