@amazon-devices/expo-system-ui 2.0.9000000001 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/build/ExpoSystemUI.kepler.js +2 -2
  2. package/build/ExpoSystemUI.kepler.js.map +1 -1
  3. package/lib/aarch64-release/libexpo-system-ui-3.so +0 -0
  4. package/lib/armv7-release/libexpo-system-ui-3.so +0 -0
  5. package/lib/x86_64-release/libexpo-system-ui-3.so +0 -0
  6. package/package.json +1 -1
  7. package/react-native.config.js +5 -4
  8. package/.eslintrc.js +0 -2
  9. package/CHANGELOG.md +0 -116
  10. package/CMakeLists.txt +0 -46
  11. package/THIRD_PARTY_NOTICES.txt +0 -4
  12. package/android/build.gradle +0 -112
  13. package/android/src/main/AndroidManifest.xml +0 -2
  14. package/android/src/main/java/expo/modules/systemui/SystemUIModule.kt +0 -74
  15. package/android/src/main/java/expo/modules/systemui/SystemUIPackage.kt +0 -11
  16. package/android/src/main/java/expo/modules/systemui/SystemUIReactActivityLifecycleListener.kt +0 -18
  17. package/android/src/main/java/expo/modules/systemui/singletons/SystemUI.kt +0 -36
  18. package/android/src/main/res/values/strings.xml +0 -4
  19. package/app.plugin.js +0 -1
  20. package/expo-module.config.json +0 -10
  21. package/ios/ExpoSystemUI/ExpoSystemUIModule.swift +0 -72
  22. package/ios/ExpoSystemUI.podspec +0 -31
  23. package/kepler/ExpoSystemUI.cpp +0 -47
  24. package/kepler/ExpoSystemUI.h +0 -29
  25. package/kepler/ExpoSystemUIImpl.cpp +0 -39
  26. package/kepler/ExpoSystemUIImpl.h +0 -29
  27. package/kepler/ExpoSystemUITurboModule.cpp +0 -57
  28. package/kepler/ExpoSystemUITurboModule.h +0 -32
  29. package/kepler/KeplerInit.cpp +0 -28
  30. package/kepler/test/ExpoSystemUI.cpp +0 -154
  31. package/kepler-compatibility.json +0 -7
  32. package/plugin/babel.config.js +0 -1
  33. package/plugin/build/withAndroidRootViewBackgroundColor.d.ts +0 -6
  34. package/plugin/build/withAndroidRootViewBackgroundColor.js +0 -40
  35. package/plugin/build/withAndroidUserInterfaceStyle.d.ts +0 -8
  36. package/plugin/build/withAndroidUserInterfaceStyle.js +0 -42
  37. package/plugin/build/withIosRootViewBackgroundColor.d.ts +0 -5
  38. package/plugin/build/withIosRootViewBackgroundColor.js +0 -41
  39. package/plugin/build/withIosUserInterfaceStyle.d.ts +0 -5
  40. package/plugin/build/withIosUserInterfaceStyle.js +0 -38
  41. package/plugin/build/withSystemUI.d.ts +0 -3
  42. package/plugin/build/withSystemUI.js +0 -17
  43. package/plugin/src/withAndroidRootViewBackgroundColor.ts +0 -47
  44. package/plugin/src/withAndroidUserInterfaceStyle.ts +0 -53
  45. package/plugin/src/withIosRootViewBackgroundColor.ts +0 -41
  46. package/plugin/src/withIosUserInterfaceStyle.ts +0 -47
  47. package/plugin/src/withSystemUI.ts +0 -19
  48. package/plugin/tsconfig.json +0 -9
  49. package/src/ExpoSystemUI.kepler.ts +0 -27
  50. package/src/ExpoSystemUI.ts +0 -2
  51. package/src/ExpoSystemUI.web.ts +0 -21
  52. package/src/SystemUI.ts +0 -35
  53. package/tsconfig.json +0 -9
@@ -1,11 +1,11 @@
1
1
  import { TurboModuleRegistry } from '@amazon-devices/keplerscript-turbomodule-api';
2
- const nativeModule = TurboModuleRegistry.getEnforcing('ExpoSystemUI');
2
+ const nativeModule = TurboModuleRegistry.getEnforcing('ExpoSystemUIAppTM');
3
3
  const module = {
4
4
  async getBackgroundColorAsync() {
5
5
  return nativeModule.getBackgroundColorAsync();
6
6
  },
7
7
  async setBackgroundColorAsync(color) {
8
- return color
8
+ return color != null
9
9
  ? nativeModule.setBackgroundColorAsync(color)
10
10
  : nativeModule.resetBackgroundColorAsync();
11
11
  },
@@ -1 +1 @@
1
- {"version":3,"file":"ExpoSystemUI.kepler.js","sourceRoot":"","sources":["../src/ExpoSystemUI.kepler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAQ5F,MAAM,YAAY,GAAG,mBAAmB,CAAC,YAAY,CAAO,cAAc,CAAS,CAAC;AAOpF,MAAM,MAAM,GAAmB;IAC7B,KAAK,CAAC,uBAAuB;QAC3B,OAAO,YAAY,CAAC,uBAAuB,EAAE,CAAC;IAChD,CAAC;IACD,KAAK,CAAC,uBAAuB,CAAC,KAAoB;QAChD,OAAO,KAAK;YACV,CAAC,CAAC,YAAY,CAAC,uBAAuB,CAAC,KAAK,CAAC;YAC7C,CAAC,CAAC,YAAY,CAAC,yBAAyB,EAAE,CAAC;IAC/C,CAAC;CACF,CAAC;AAEF,eAAe,MAAM,CAAC","sourcesContent":["import { KeplerTurboModule, TurboModuleRegistry } from '@amazon-devices/keplerscript-turbomodule-api';\n\ninterface Spec extends KeplerTurboModule {\n readonly getBackgroundColorAsync: () => Promise<string>;\n readonly resetBackgroundColorAsync: () => Promise<void>;\n readonly setBackgroundColorAsync: (color: number) => Promise<void>;\n}\n\nconst nativeModule = TurboModuleRegistry.getEnforcing<Spec>('ExpoSystemUI') as Spec;\n\ninterface KeplerSystemUI {\n readonly getBackgroundColorAsync: () => Promise<string | null>;\n readonly setBackgroundColorAsync: (color: number | null) => Promise<void | null>;\n}\n\nconst module: KeplerSystemUI = {\n async getBackgroundColorAsync() {\n return nativeModule.getBackgroundColorAsync();\n },\n async setBackgroundColorAsync(color: number | null) {\n return color\n ? nativeModule.setBackgroundColorAsync(color)\n : nativeModule.resetBackgroundColorAsync();\n },\n};\n\nexport default module;\n"]}
1
+ {"version":3,"file":"ExpoSystemUI.kepler.js","sourceRoot":"","sources":["../src/ExpoSystemUI.kepler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAQ5F,MAAM,YAAY,GAAG,mBAAmB,CAAC,YAAY,CAAO,mBAAmB,CAAS,CAAC;AAOzF,MAAM,MAAM,GAAmB;IAC7B,KAAK,CAAC,uBAAuB;QAC3B,OAAO,YAAY,CAAC,uBAAuB,EAAE,CAAC;IAChD,CAAC;IACD,KAAK,CAAC,uBAAuB,CAAC,KAAoB;QAChD,OAAO,KAAK,IAAI,IAAI;YAClB,CAAC,CAAC,YAAY,CAAC,uBAAuB,CAAC,KAAK,CAAC;YAC7C,CAAC,CAAC,YAAY,CAAC,yBAAyB,EAAE,CAAC;IAC/C,CAAC;CACF,CAAC;AAEF,eAAe,MAAM,CAAC","sourcesContent":["import { KeplerTurboModule, TurboModuleRegistry } from '@amazon-devices/keplerscript-turbomodule-api';\n\ninterface Spec extends KeplerTurboModule {\n readonly getBackgroundColorAsync: () => Promise<string>;\n readonly resetBackgroundColorAsync: () => Promise<void>;\n readonly setBackgroundColorAsync: (color: number) => Promise<void>;\n}\n\nconst nativeModule = TurboModuleRegistry.getEnforcing<Spec>('ExpoSystemUIAppTM') as Spec;\n\ninterface KeplerSystemUI {\n readonly getBackgroundColorAsync: () => Promise<string | null>;\n readonly setBackgroundColorAsync: (color: number | null) => Promise<void | null>;\n}\n\nconst module: KeplerSystemUI = {\n async getBackgroundColorAsync() {\n return nativeModule.getBackgroundColorAsync();\n },\n async setBackgroundColorAsync(color: number | null) {\n return color != null\n ? nativeModule.setBackgroundColorAsync(color)\n : nativeModule.resetBackgroundColorAsync();\n },\n};\n\nexport default module;\n"]}
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name": "@amazon-devices/expo-system-ui", "version": "2.0.9000000001+2.7.0", "description": "Interact with system UI elements", "main": "build/SystemUI.js", "types": "build/SystemUI.d.ts", "scripts": {"build": "expo-module build", "clean": "expo-module clean", "lint": "expo-module lint", "test": "expo-module test", "prepublishOnly": "expo-module prepublishOnly", "expo-module": "expo-module"}, "kepler": {"temporary-alias-for-package": {"name": "expo-system-ui", "version": "2.7.0"}}, "keywords": ["react-native", "expo", "background-color", "user-interface", "appearance"], "repository": {"type": "git", "url": "https://github.com/expo/expo.git", "directory": "packages/expo-system-ui"}, "bugs": {"url": "https://github.com/expo/expo/issues"}, "author": "650 Industries, Inc.", "license": "See license in LICENSE", "homepage": "https://docs.expo.dev/versions/latest/sdk/system-ui", "dependencies": {"@react-native/normalize-color": "^2.0.0", "debug": "^4.3.2"}, "jest": {"preset": "expo-module-scripts"}, "devDependencies": {"expo-module-scripts": "^3.0.0"}, "peerDependencies": {"expo": "^50.0.0-alpha.1"}}
1
+ {"name": "@amazon-devices/expo-system-ui", "version": "3.0.0+2.7.0", "description": "Interact with system UI elements", "main": "build/SystemUI.js", "types": "build/SystemUI.d.ts", "scripts": {"build": "expo-module build", "clean": "expo-module clean", "lint": "expo-module lint", "test": "expo-module test", "prepublishOnly": "expo-module prepublishOnly", "expo-module": "expo-module"}, "kepler": {"temporary-alias-for-package": {"name": "expo-system-ui", "version": "2.7.0"}}, "keywords": ["react-native", "expo", "background-color", "user-interface", "appearance"], "repository": {"type": "git", "url": "https://github.com/expo/expo.git", "directory": "packages/expo-system-ui"}, "bugs": {"url": "https://github.com/expo/expo/issues"}, "author": "650 Industries, Inc.", "license": "See license in LICENSE", "homepage": "https://docs.expo.dev/versions/latest/sdk/system-ui", "dependencies": {"@react-native/normalize-color": "^2.0.0", "debug": "^4.3.2"}, "jest": {"preset": "expo-module-scripts"}, "devDependencies": {"expo-module-scripts": "^3.0.0"}, "peerDependencies": {"react-native": "*", "expo": "*"}, "files": ["build", "lib", "react-native.config.js"]}
@@ -10,10 +10,11 @@ module.exports = {
10
10
  platforms: {
11
11
  kepler: {
12
12
  autolink: {
13
- ExpoSystemUILib: {
14
- provider: 'system',
15
- libraryName: 'libexpo-system-ui-2.so.2',
16
- turbomodules: ['ExpoSystemUI'],
13
+ ExpoSystemUIAppLib: {
14
+ provider: 'application',
15
+ linkDynamic: true,
16
+ libraryName: 'libexpo-system-ui-3.so',
17
+ turbomodules: ['ExpoSystemUIAppTM'],
17
18
  },
18
19
  },
19
20
  },
package/.eslintrc.js DELETED
@@ -1,2 +0,0 @@
1
- // @generated by expo-module-scripts
2
- module.exports = require('expo-module-scripts/eslintrc.base.js');
package/CHANGELOG.md DELETED
@@ -1,116 +0,0 @@
1
- # Changelog
2
-
3
- ## Unpublished
4
-
5
- ### 🛠 Breaking changes
6
-
7
- ### 🎉 New features
8
-
9
- ### 🐛 Bug fixes
10
-
11
- ### 💡 Others
12
-
13
- ## 2.7.0 — 2023-10-17
14
-
15
- ### 🛠 Breaking changes
16
-
17
- - Dropped support for Android SDK 21 and 22. ([#24201](https://github.com/expo/expo/pull/24201) by [@behenate](https://github.com/behenate))
18
-
19
- ## 2.6.0 — 2023-09-04
20
-
21
- ### 🎉 New features
22
-
23
- - Added support for React Native 0.73. ([#24018](https://github.com/expo/expo/pull/24018) by [@kudo](https://github.com/kudo))
24
-
25
- ## 2.5.0 — 2023-08-02
26
-
27
- _This version does not introduce any user-facing changes._
28
-
29
- ## 2.4.0 — 2023-06-21
30
-
31
- ### 🎉 New features
32
-
33
- - Persist user selected background color and restore automatically on iOS. Added `restoreBackgroundColorAsync` to restore it on Android. ([#22773](https://github.com/expo/expo/pull/22773) by [@alanhughes](https://github.com/alanjhughes))
34
-
35
- ### 🐛 Bug fixes
36
-
37
- - Fixed Android build warnings for Gradle version 8. ([#22537](https://github.com/expo/expo/pull/22537), [#22609](https://github.com/expo/expo/pull/22609) by [@kudo](https://github.com/kudo))
38
-
39
- ## 2.3.0 — 2023-05-08
40
-
41
- ### 💡 Others
42
-
43
- - Android: Switch from deprecated `toLowerCase` to `lowercase` function ([#22225](https://github.com/expo/expo/pull/22225) by [@hbiede](https://github.com/hbiede))
44
-
45
- ## 2.2.1 — 2023-02-09
46
-
47
- _This version does not introduce any user-facing changes._
48
-
49
- ## 2.2.0 — 2023-02-03
50
-
51
- ### 💡 Others
52
-
53
- - On Android bump `compileSdkVersion` and `targetSdkVersion` to `33`. ([#20721](https://github.com/expo/expo/pull/20721) by [@lukmccall](https://github.com/lukmccall))
54
-
55
- ## 2.1.0 — 2022-12-30
56
-
57
- ### 🎉 New features
58
-
59
- - Migrated Android codebase to use the new Expo modules API. ([#20221](https://github.com/expo/expo/pull/20221) by [@alanhughes](https://github.com/alanjhughes))
60
-
61
- ## 2.0.1 — 2022-10-28
62
-
63
- _This version does not introduce any user-facing changes._
64
-
65
- ## 2.0.0 — 2022-10-25
66
-
67
- ### 🛠 Breaking changes
68
-
69
- - [plugin] Upgrade minimum runtime requirement to Node 14 (LTS). ([#18204](https://github.com/expo/expo/pull/18204) by [@EvanBacon](https://github.com/EvanBacon))
70
- - Bumped iOS deployment target to 13.0 and deprecated support for iOS 12. ([#18873](https://github.com/expo/expo/pull/18873) by [@tsapeta](https://github.com/tsapeta))
71
-
72
- ### 💡 Others
73
-
74
- - [plugin] Migrate import from @expo/config-plugins to expo/config-plugins and @expo/config-types to expo/config. ([#18855](https://github.com/expo/expo/pull/18855) by [@brentvatne](https://github.com/brentvatne))
75
- - Drop `@expo/config-plugins` dependency in favor of peer dependency on `expo`. ([#18595](https://github.com/expo/expo/pull/18595) by [@EvanBacon](https://github.com/EvanBacon))
76
-
77
- ## 1.3.0 — 2022-07-07
78
-
79
- ### 🐛 Bug fixes
80
-
81
- - Fix color setting on web. ([#17558](https://github.com/expo/expo/pull/17558) by [@EvanBacon](https://github.com/EvanBacon))
82
-
83
- ### 💡 Others
84
-
85
- - Migrated Expo modules definitions to the new naming convention. ([#17193](https://github.com/expo/expo/pull/17193) by [@tsapeta](https://github.com/tsapeta))
86
-
87
- ## 1.2.0 — 2022-04-18
88
-
89
- ### 💡 Others
90
-
91
- - Updated `@expo/config-plugins` from `4.0.2` to `4.0.14` ([#15621](https://github.com/expo/expo/pull/15621) by [@EvanBacon](https://github.com/EvanBacon))
92
-
93
- ### ⚠️ Notices
94
-
95
- - On Android bump `compileSdkVersion` to `31`, `targetSdkVersion` to `31` and `Java` version to `11`. ([#16941](https://github.com/expo/expo/pull/16941) by [@bbarthec](https://github.com/bbarthec))
96
-
97
- ## 1.1.1 - 2022-02-01
98
-
99
- ### 🐛 Bug fixes
100
-
101
- - Fix `Plugin with id 'maven' not found` build error from Android Gradle 7. ([#16080](https://github.com/expo/expo/pull/16080) by [@kudo](https://github.com/kudo))
102
-
103
- ## 1.1.0 — 2021-12-03
104
-
105
- ### 🛠 Breaking changes
106
-
107
- - Change iOS to set the background color of the first view controller in the hierarchy instead of the current active view controller. ([#15146](https://github.com/expo/expo/pull/15146) by [@EvanBacon](https://github.com/EvanBacon))
108
-
109
- ### 🎉 New features
110
-
111
- - iOS now sets the background color of the base window to support native-stack modals. ([#15146](https://github.com/expo/expo/pull/15146) by [@EvanBacon](https://github.com/EvanBacon))
112
- - Initial background color on iOS will now be set inside the module instead of in the template. ([#15146](https://github.com/expo/expo/pull/15146) by [@EvanBacon](https://github.com/EvanBacon))
113
-
114
- ### 🐛 Bug fixes
115
-
116
- - Fix `getBackgroundColorAsync` return type. ([#15127](https://github.com/expo/expo/pull/15127) by [@EvanBacon](https://github.com/EvanBacon))
package/CMakeLists.txt DELETED
@@ -1,46 +0,0 @@
1
- #
2
- # Copyright 2024 Amazon.com, Inc. or its affiliates. All rights reserved.
3
- #
4
- # AMAZON PROPRIETARY/CONFIDENTIAL
5
- #
6
- # You may not use this file except in compliance with the terms and conditions
7
- # set forth in the accompanying LICENSE.TXT file.
8
- #
9
- # THESE MATERIALS ARE PROVIDED ON AN "AS IS" BASIS. AMAZON SPECIFICALLY
10
- # DISCLAIMS, WITH RESPECT TO THESE MATERIALS, ALL WARRANTIES, EXPRESS,
11
- # IMPLIED, OR STATUTORY, INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY,
12
- # FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
13
- #
14
- set(PACKAGE_NAME "expo-system-ui")
15
- set(AUTO_LINK_PACKAGE_NAME "${PACKAGE_NAME}-${KEPLER_REACT_NATIVE_MAJOR_VERSION}")
16
- set(SOURCES_KEPLER kepler/ExpoSystemUIImpl.cpp kepler/ExpoSystemUI.cpp kepler/ExpoSystemUITurboModule.cpp)
17
-
18
- add_library(${PACKAGE_NAME} STATIC ${SOURCES_KEPLER})
19
-
20
- target_link_libraries(
21
- ${PACKAGE_NAME}
22
- PUBLIC
23
- keplerui::keplerscript-${KEPLER_REACT_NATIVE_MAJOR_VERSION}
24
- )
25
-
26
- add_library(${AUTO_LINK_PACKAGE_NAME} SHARED kepler/KeplerInit.cpp)
27
-
28
- set_target_properties(${AUTO_LINK_PACKAGE_NAME} PROPERTIES SOVERSION ${KEPLER_REACT_NATIVE_MAJOR_VERSION}.${KEPLER_REACT_NATIVE_MINOR_VERSION})
29
-
30
- target_link_libraries(
31
- ${AUTO_LINK_PACKAGE_NAME}
32
- PRIVATE
33
- ${PACKAGE_NAME}
34
- )
35
-
36
- # Helps in checking undefined references
37
- add_executable(${AUTO_LINK_PACKAGE_NAME}_exe kepler/KeplerInit.cpp)
38
- target_link_libraries(${AUTO_LINK_PACKAGE_NAME}_exe
39
- PRIVATE
40
- ${AUTO_LINK_PACKAGE_NAME}
41
- keplerui::keplerscript-${KEPLER_REACT_NATIVE_MAJOR_VERSION}
42
- )
43
-
44
- install(TARGETS ${AUTO_LINK_PACKAGE_NAME}
45
- LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
46
- )
@@ -1,4 +0,0 @@
1
- License from package.json:
2
- ==============================
3
-
4
- MIT
@@ -1,112 +0,0 @@
1
- apply plugin: 'com.android.library'
2
- apply plugin: 'kotlin-android'
3
- apply plugin: 'maven-publish'
4
-
5
- group = 'host.exp.exponent'
6
- version = '2.7.0'
7
-
8
- def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
9
- if (expoModulesCorePlugin.exists()) {
10
- apply from: expoModulesCorePlugin
11
- applyKotlinExpoModulesCorePlugin()
12
- // Remove this check, but keep the contents after SDK49 support is dropped
13
- if (safeExtGet("expoProvidesDefaultConfig", false)) {
14
- useExpoPublishing()
15
- useCoreDependencies()
16
- }
17
- }
18
-
19
- buildscript {
20
- // Simple helper that allows the root project to override versions declared by this library.
21
- ext.safeExtGet = { prop, fallback ->
22
- rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
23
- }
24
-
25
- // Ensures backward compatibility
26
- ext.getKotlinVersion = {
27
- if (ext.has("kotlinVersion")) {
28
- ext.kotlinVersion()
29
- } else {
30
- ext.safeExtGet("kotlinVersion", "1.8.10")
31
- }
32
- }
33
-
34
- repositories {
35
- mavenCentral()
36
- }
37
-
38
- dependencies {
39
- classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${getKotlinVersion()}")
40
- }
41
- }
42
-
43
- // Remove this if and it's contents, when support for SDK49 is dropped
44
- if (!safeExtGet("expoProvidesDefaultConfig", false)) {
45
- afterEvaluate {
46
- publishing {
47
- publications {
48
- release(MavenPublication) {
49
- from components.release
50
- }
51
- }
52
- repositories {
53
- maven {
54
- url = mavenLocal().url
55
- }
56
- }
57
- }
58
- }
59
- }
60
-
61
- android {
62
- // Remove this if and it's contents, when support for SDK49 is dropped
63
- if (!safeExtGet("expoProvidesDefaultConfig", false)) {
64
- compileSdkVersion safeExtGet("compileSdkVersion", 33)
65
-
66
- defaultConfig {
67
- minSdkVersion safeExtGet("minSdkVersion", 23)
68
- targetSdkVersion safeExtGet("targetSdkVersion", 33)
69
- }
70
-
71
- publishing {
72
- singleVariant("release") {
73
- withSourcesJar()
74
- }
75
- }
76
-
77
- lintOptions {
78
- abortOnError false
79
- }
80
- }
81
-
82
- def agpVersion = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION
83
- if (agpVersion.tokenize('.')[0].toInteger() < 8) {
84
- compileOptions {
85
- sourceCompatibility JavaVersion.VERSION_11
86
- targetCompatibility JavaVersion.VERSION_11
87
- }
88
-
89
- kotlinOptions {
90
- jvmTarget = JavaVersion.VERSION_11.majorVersion
91
- }
92
- }
93
-
94
- namespace "expo.modules.systemui"
95
- defaultConfig {
96
- versionCode 1
97
- versionName '2.7.0'
98
- }
99
- }
100
-
101
- dependencies {
102
- // Remove this if and it's contents, when support for SDK49 is dropped
103
- if (!safeExtGet("expoProvidesDefaultConfig", false)) {
104
- implementation project(':expo-modules-core')
105
- implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${getKotlinVersion()}"
106
- }
107
-
108
- //noinspection GradleDynamicVersion
109
- implementation 'com.facebook.react:react-native:+'
110
- implementation 'androidx.core:core:1.6.0'
111
- implementation 'androidx.appcompat:appcompat:1.2.0'
112
- }
@@ -1,2 +0,0 @@
1
- <manifest>
2
- </manifest>
@@ -1,74 +0,0 @@
1
- package expo.modules.systemui
2
-
3
- import android.content.Context
4
- import android.content.SharedPreferences
5
- import android.content.res.Configuration
6
- import android.graphics.Color
7
- import android.graphics.drawable.ColorDrawable
8
- import androidx.appcompat.app.AppCompatDelegate
9
- import expo.modules.kotlin.exception.Exceptions
10
- import expo.modules.kotlin.functions.Queues
11
- import expo.modules.kotlin.modules.Module
12
- import expo.modules.kotlin.modules.ModuleDefinition
13
-
14
- const val PREFERENCE_KEY = "expoRootBackgroundColor"
15
-
16
- class SystemUIModule : Module() {
17
- private val currentActivity
18
- get() = appContext.currentActivity ?: throw Exceptions.MissingActivity()
19
- private val context: Context
20
- get() = appContext.reactContext ?: throw Exceptions.ReactContextLost()
21
- private val prefs: SharedPreferences
22
- get() = context.getSharedPreferences("expo_ui_preferences", Context.MODE_PRIVATE)
23
- ?: throw Exceptions.ReactContextLost()
24
-
25
- private val systemBackgroundColor
26
- get() = when (AppCompatDelegate.getDefaultNightMode()) {
27
- AppCompatDelegate.MODE_NIGHT_YES -> Color.BLACK
28
- AppCompatDelegate.MODE_NIGHT_NO -> Color.WHITE
29
- AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM -> {
30
- when (context.resources.configuration.uiMode and Configuration.UI_MODE_NIGHT_MASK) {
31
- Configuration.UI_MODE_NIGHT_YES -> Color.BLACK
32
- Configuration.UI_MODE_NIGHT_NO -> Color.WHITE
33
- else -> Color.WHITE
34
- }
35
- }
36
- else -> Color.WHITE
37
- }
38
-
39
- override fun definition() = ModuleDefinition {
40
- Name("ExpoSystemUI")
41
-
42
- AsyncFunction("setBackgroundColorAsync") { color: Int? ->
43
- color?.let {
44
- prefs.edit()
45
- .putInt(PREFERENCE_KEY, it)
46
- .apply()
47
- } ?: prefs.edit()
48
- .remove(PREFERENCE_KEY)
49
- .apply()
50
- setBackgroundColor(color ?: systemBackgroundColor)
51
- }.runOnQueue(Queues.MAIN)
52
-
53
- AsyncFunction("getBackgroundColorAsync") {
54
- val background = currentActivity.window.decorView.background
55
- return@AsyncFunction if (background is ColorDrawable) {
56
- colorToHex((background.mutate() as ColorDrawable).color)
57
- } else {
58
- null
59
- }
60
- }
61
- }
62
-
63
- private fun setBackgroundColor(color: Int) {
64
- val rootView = currentActivity.window?.decorView
65
- val colorInt = Color.parseColor(colorToHex(color))
66
- rootView?.setBackgroundColor(colorInt)
67
- }
68
-
69
- companion object {
70
- fun colorToHex(color: Int): String {
71
- return String.format("#%02x%02x%02x", Color.red(color), Color.green(color), Color.blue(color))
72
- }
73
- }
74
- }
@@ -1,11 +0,0 @@
1
- package expo.modules.systemui
2
-
3
- import android.content.Context
4
- import expo.modules.core.interfaces.Package
5
- import expo.modules.core.interfaces.ReactActivityLifecycleListener
6
-
7
- class SystemUIPackage : Package {
8
- override fun createReactActivityLifecycleListeners(activityContext: Context): List<ReactActivityLifecycleListener> {
9
- return listOf(SystemUIReactActivityLifecycleListener(activityContext))
10
- }
11
- }
@@ -1,18 +0,0 @@
1
- package expo.modules.systemui
2
-
3
- import android.app.Activity
4
- import android.content.Context
5
- import android.os.Bundle
6
- import expo.modules.core.interfaces.ReactActivityLifecycleListener
7
- import expo.modules.systemui.singletons.SystemUI
8
-
9
- // EXPO_VERSIONING_NEEDS_EXPOVIEW_R
10
-
11
- class SystemUIReactActivityLifecycleListener(activityContext: Context) : ReactActivityLifecycleListener {
12
- override fun onCreate(activity: Activity, savedInstanceState: Bundle?) {
13
- SystemUI.setUserInterfaceStyle(getUserInterfaceStyle(activity))
14
- }
15
-
16
- private fun getUserInterfaceStyle(context: Context): String =
17
- context.getString(R.string.expo_system_ui_user_interface_style).lowercase()
18
- }
@@ -1,36 +0,0 @@
1
- package expo.modules.systemui.singletons
2
-
3
- import android.os.Build
4
- import android.util.Log
5
- import androidx.appcompat.app.AppCompatDelegate
6
-
7
- object SystemUI {
8
- private const val TAG = "SystemUI"
9
-
10
- private fun setUserInterfaceStyle(
11
- style: String?,
12
- successCallback: () -> Unit,
13
- failureCallback: (reason: String) -> Unit
14
- ) {
15
-
16
- val mode = if (style == null) {
17
- AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM
18
- } else when (style) {
19
- "automatic" -> {
20
- if (Build.VERSION.SDK_INT < Build.VERSION_CODES.P) {
21
- AppCompatDelegate.MODE_NIGHT_AUTO_BATTERY
22
- } else AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM
23
- }
24
- "dark" -> AppCompatDelegate.MODE_NIGHT_YES
25
- "", "light" -> AppCompatDelegate.MODE_NIGHT_NO
26
- else -> return failureCallback("Invalid user interface style: \"$style\"")
27
- }
28
- AppCompatDelegate.setDefaultNightMode(mode)
29
- successCallback()
30
- }
31
-
32
- @JvmStatic
33
- fun setUserInterfaceStyle(style: String) {
34
- setUserInterfaceStyle(style, {}, { m -> Log.e(TAG, m) })
35
- }
36
- }
@@ -1,4 +0,0 @@
1
- <?xml version="1.0" encoding="utf-8"?>
2
- <resources>
3
- <string name="expo_system_ui_user_interface_style" translatable="false">light</string>
4
- </resources>
package/app.plugin.js DELETED
@@ -1 +0,0 @@
1
- module.exports = require('./plugin/build/withSystemUI');
@@ -1,10 +0,0 @@
1
- {
2
- "name": "expo-system-ui",
3
- "platforms": ["ios", "android"],
4
- "ios": {
5
- "modules": ["ExpoSystemUIModule"]
6
- },
7
- "android": {
8
- "modules": ["expo.modules.systemui.SystemUIModule"]
9
- }
10
- }
@@ -1,72 +0,0 @@
1
- // Copyright 2021-present 650 Industries. (AKA Expo) All rights reserved.
2
-
3
- import ExpoModulesCore
4
-
5
- public class ExpoSystemUIModule: Module {
6
- private static let colorKey = "ExpoSystemUI.backgroundColor"
7
- public func definition() -> ModuleDefinition {
8
- Name("ExpoSystemUI")
9
-
10
- OnCreate {
11
- // TODO: Maybe read from the app manifest instead of from Info.plist.
12
- // Set / reset the initial color on reload and app start.
13
- let color = UserDefaults.standard.integer(forKey: Self.colorKey)
14
-
15
- if color > 0 {
16
- Self.setBackgroundColorAsync(color: color)
17
- } else {
18
- Self.setBackgroundColorAsync(color: nil)
19
- }
20
- }
21
-
22
- AsyncFunction("getBackgroundColorAsync") { () -> String? in
23
- Self.getBackgroundColor()
24
- }
25
-
26
- AsyncFunction("setBackgroundColorAsync") { (color: Int?) in
27
- Self.setBackgroundColorAsync(color: color)
28
- }
29
- }
30
-
31
- static func getBackgroundColor() -> String? {
32
- var color: String?
33
- EXUtilities.performSynchronously {
34
- // Get the root view controller of the delegate window.
35
- if let window = UIApplication.shared.delegate?.window, let backgroundColor = window?.rootViewController?.view.backgroundColor?.cgColor {
36
- color = EXUtilities.hexString(with: backgroundColor)
37
- }
38
- }
39
- return color
40
- }
41
-
42
- static func setBackgroundColorAsync(color: Int?) {
43
- EXUtilities.performSynchronously {
44
- if color == nil {
45
- if let window = UIApplication.shared.delegate?.window {
46
- UserDefaults.standard.removeObject(forKey: colorKey)
47
- let interfaceStyle = window?.traitCollection.userInterfaceStyle
48
- window?.backgroundColor = nil
49
-
50
- switch interfaceStyle {
51
- case .dark:
52
- window?.rootViewController?.view.backgroundColor = .black
53
- case .light:
54
- window?.rootViewController?.view.backgroundColor = .white
55
- default:
56
- window?.rootViewController?.view.backgroundColor = .white
57
- }
58
- }
59
- return
60
- }
61
- UserDefaults.standard.set(color, forKey: colorKey)
62
- let backgroundColor = EXUtilities.uiColor(color)
63
- // Set the app-wide window, this could have future issues when running multiple React apps,
64
- // i.e. dev client can't use expo-system-ui.
65
- // Without setting the window backgroundColor, native-stack modals will show the wrong color.
66
- if let window = UIApplication.shared.delegate?.window {
67
- window?.backgroundColor = backgroundColor
68
- window?.rootViewController?.view.backgroundColor = backgroundColor
69
- }
70
- }
71
- }
72
- }
@@ -1,31 +0,0 @@
1
- require 'json'
2
-
3
- package = JSON.parse(File.read(File.join(__dir__, '..', 'package.json')))
4
-
5
- Pod::Spec.new do |s|
6
- s.name = 'ExpoSystemUI'
7
- s.version = package['version']
8
- s.summary = package['description']
9
- s.description = package['description']
10
- s.license = package['license']
11
- s.author = package['author']
12
- s.homepage = package['homepage']
13
- s.platform = :ios, '13.0'
14
- s.swift_version = '5.4'
15
- s.source = { git: 'https://github.com/expo/expo.git' }
16
- s.static_framework = true
17
-
18
- s.dependency 'ExpoModulesCore'
19
-
20
- # Swift/Objective-C compatibility
21
- s.pod_target_xcconfig = {
22
- 'DEFINES_MODULE' => 'YES'
23
- }
24
-
25
- if !$ExpoUseSources&.include?(package['name']) && ENV['EXPO_USE_SOURCE'].to_i == 0 && File.exist?("#{s.name}.xcframework") && Gem::Version.new(Pod::VERSION) >= Gem::Version.new('1.10.0')
26
- s.source_files = "#{s.name}/**/*.h"
27
- s.vendored_frameworks = "#{s.name}.xcframework"
28
- else
29
- s.source_files = "#{s.name}/**/*.{h,m,swift}"
30
- end
31
- end
@@ -1,47 +0,0 @@
1
- /*
2
- * Copyright (c) 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
- *
4
- * PROPRIETARY/CONFIDENTIAL
5
- *
6
- * Use is subject to license terms.
7
- */
8
-
9
- #include "ExpoSystemUI.h"
10
-
11
- #include <KeplerScript/logger/KPLog.h>
12
- #include <Volta/graphics/Color.h>
13
-
14
- ExpoSystemUI::ExpoSystemUI(volta::react::IKeplerUIManager& uiManager) : syncDelegate(uiManager) {}
15
-
16
- volta::react::Promise ExpoSystemUI::getBackgroundColorAsync() {
17
- return volta::react::Promise([this](std::shared_ptr<volta::react::Promise> promise) {
18
- try {
19
- auto rgbColorStr = syncDelegate.getBackgroundColor();
20
- promise->resolve(rgbColorStr);
21
- } catch (std::exception& e) {
22
- promise->reject(std::string{"getBackgroundColorAsync error: " + std::string(e.what())});
23
- }
24
- });
25
- }
26
-
27
- volta::react::Promise ExpoSystemUI::resetBackgroundColorAsync() {
28
- return volta::react::Promise([this](std::shared_ptr<volta::react::Promise> promise) {
29
- try {
30
- syncDelegate.resetBackgroundColor();
31
- promise->resolve();
32
- } catch (std::exception& e) {
33
- promise->reject(std::string{"resetBackgroundColorAsync error: " + std::string(e.what())});
34
- }
35
- });
36
- }
37
-
38
- volta::react::Promise ExpoSystemUI::setBackgroundColorAsync(int64_t color) {
39
- return volta::react::Promise([this, color](std::shared_ptr<volta::react::Promise> promise) {
40
- try {
41
- syncDelegate.setBackgroundColor(color);
42
- promise->resolve();
43
- } catch (std::exception& e) {
44
- promise->reject(std::string{"setBackgroundColorAsync error: " + std::string(e.what())});
45
- }
46
- });
47
- }