Skip to content

Commit b39d4ce

Browse files
Merge pull request #16 from mendix/release/mx-11.6
edge to edge improvements
2 parents d4e7055 + 90f43d6 commit b39d4ce

File tree

12 files changed

+183
-37
lines changed

12 files changed

+183
-37
lines changed

.yarn/patches/@op-engineering-op-sqlite-npm-15.0.7-39fbf4933a.patch

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,18 @@ index 5e1c1de234e7bdb131769728fc862d389f9995a5..dc21c6503ffe18f3ae1cf99f327e8aa1
193193
void install(jsi::Runtime &rt,
194194
const std::shared_ptr<react::CallInvoker> &invoker,
195195
const char *base_path, const char *crsqlite_path,
196+
diff --git a/cpp/bindings.h b/cpp/bindings.h
197+
index 91511ab8dff0cbd34c6b8b844c1783c39d4317cb..cc73dfe4405d568cbfbbfa5a9c879a1d88f260bf 100644
198+
--- a/cpp/bindings.h
199+
+++ b/cpp/bindings.h
200+
@@ -14,6 +14,7 @@ void install(jsi::Runtime &rt,
201+
const char *base_path, const char *crsqlite_path,
202+
const char *sqlite_vec_path);
203+
void invalidate();
204+
+bool deleteAllDbs();
205+
void expoUpdatesWorkaround(const char *base_path);
206+
207+
} // namespace opsqlite
196208
diff --git a/op-sqlite.podspec b/op-sqlite.podspec
197209
index 375cc3ef0838a3cffb87ec970f636880a8676bb3..e6fce21630ed00aa863f2baae7b3d04de783dcb0 100644
198210
--- a/op-sqlite.podspec
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
package com.mendix.mendixnative.react
2+
3+
import android.util.Log
4+
import com.facebook.react.bridge.ReactApplicationContext
5+
6+
class NavigationModeModule(val context: ReactApplicationContext) {
7+
8+
companion object {
9+
const val TAG = "NavigationModeModule"
10+
const val NAVIGATION_BAR_INTERACTION_MODE_THREE_BUTTON = 0
11+
const val NAVIGATION_BAR_INTERACTION_MODE_TWO_BUTTON = 1
12+
const val NAVIGATION_BAR_INTERACTION_MODE_GESTURE = 2
13+
}
14+
15+
fun isNavigationBarActive(): Boolean {
16+
Log.d(TAG, "=== isNavigationBarActive called (sync) ===")
17+
return try {
18+
Log.d(TAG, "Context: $context")
19+
20+
val resources = context.resources
21+
Log.d(TAG, "Resources: $resources")
22+
23+
val resourceId = resources.getIdentifier(
24+
"config_navBarInteractionMode",
25+
"integer",
26+
"android"
27+
)
28+
Log.d(TAG, "Resource ID: $resourceId")
29+
30+
val mode = if (resourceId > 0) {
31+
val retrievedMode = resources.getInteger(resourceId)
32+
Log.d(TAG, "Retrieved mode from resources: $retrievedMode")
33+
retrievedMode
34+
} else {
35+
Log.w(TAG, "Resource not found, defaulting to THREE_BUTTON (0)")
36+
NAVIGATION_BAR_INTERACTION_MODE_THREE_BUTTON
37+
}
38+
39+
Log.d(TAG, "Final mode value: $mode")
40+
41+
// Navigation bar is active for three-button and two-button modes
42+
val isActive = mode == NAVIGATION_BAR_INTERACTION_MODE_THREE_BUTTON ||
43+
mode == NAVIGATION_BAR_INTERACTION_MODE_TWO_BUTTON
44+
45+
Log.d(TAG, "Is navigation bar active: $isActive")
46+
Log.d(TAG, "Returning: $isActive")
47+
48+
isActive
49+
50+
} catch (e: Exception) {
51+
Log.e(TAG, "Error in isNavigationBarActive", e)
52+
false
53+
}
54+
}
55+
56+
fun getNavigationBarHeight(): Double {
57+
Log.d(TAG, "=== getNavigationBarHeight called (sync) ===")
58+
return try {
59+
val resources = context.resources
60+
61+
val resourceId = resources.getIdentifier("navigation_bar_height", "dimen", "android")
62+
val height = if (resourceId > 0) {
63+
val heightPx = resources.getDimensionPixelSize(resourceId)
64+
// Convert to dp for React Native
65+
val density = resources.displayMetrics.density
66+
val heightDp = heightPx / density
67+
Log.d(TAG, "Navigation bar height: ${heightPx}px = ${heightDp}dp")
68+
heightDp.toDouble()
69+
} else {
70+
Log.w(TAG, "Navigation bar height resource not found, returning 0")
71+
0.0
72+
}
73+
74+
height
75+
76+
} catch (e: Exception) {
77+
Log.e(TAG, "Error in getNavigationBarHeight", e)
78+
0.0
79+
}
80+
}
81+
}

android/src/main/java/com/mendixnative/MendixNativeModule.kt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import com.mendix.mendixnative.encryption.MendixEncryptedStorageModule
1010
import com.mendix.mendixnative.react.MxConfiguration
1111
import com.mendix.mendixnative.react.NativeErrorHandler
1212
import com.mendix.mendixnative.react.NativeReloadHandler
13+
import com.mendix.mendixnative.react.NavigationModeModule
1314
import com.mendix.mendixnative.react.cookie.NativeCookieModule
1415
import com.mendix.mendixnative.react.download.NativeDownloadModule
1516
import com.mendix.mendixnative.react.fs.NativeFsModule
@@ -168,6 +169,14 @@ class MendixNativeModule(reactContext: ReactApplicationContext) : NativeMendixNa
168169
NativeErrorHandler(reactApplicationContext).handle(message, stackTrace)
169170
}
170171

172+
override fun navigationModeIsNavigationBarActive(): Boolean {
173+
return NavigationModeModule(reactApplicationContext).isNavigationBarActive()
174+
}
175+
176+
override fun navigationModeGetNavigationBarHeight(): Double {
177+
return NavigationModeModule(reactApplicationContext).getNavigationBarHeight()
178+
}
179+
171180
companion object {
172181
const val NAME = "MendixNative"
173182
}

example/android/app/src/main/java/mendixnative/example/MainApplication.kt

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,18 @@ import com.facebook.react.defaults.DefaultReactNativeHost
1212
import com.facebook.react.soloader.OpenSourceMergedSoMapping
1313
import com.facebook.soloader.SoLoader
1414

15-
class MainApplication : Application(), ReactApplication {
15+
//Start - For MendixApplication compatibility only, not part of React Native template
16+
import com.mendix.mendixnative.MendixApplication
17+
import com.mendix.mendixnative.react.splash.MendixSplashScreenPresenter
18+
import com.mendix.mendixnative.react.MxConfiguration
19+
20+
class SplashScreenPresenter: MendixSplashScreenPresenter {
21+
override fun show(activity: android.app.Activity) {}
22+
override fun hide(activity: android.app.Activity) {}
23+
}
24+
//End - For MendixApplication compatibility only, not part of React Native template
25+
26+
class MainApplication : Application(), MendixApplication {
1627

1728
override val reactNativeHost: ReactNativeHost =
1829
object : DefaultReactNativeHost(this) {
@@ -35,10 +46,19 @@ class MainApplication : Application(), ReactApplication {
3546

3647
override fun onCreate() {
3748
super.onCreate()
49+
MxConfiguration.runtimeUrl = "http://10.0.2.2:8081" //For MendixApplication compatibility only, not part of React Native template
3850
SoLoader.init(this, OpenSourceMergedSoMapping)
3951
if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
4052
// If you opted-in for the New Architecture, we load the native entry point for this app.
4153
load()
4254
}
4355
}
56+
57+
//Start - For MendixApplication compatibility only, not part of React Native template
58+
override fun getUseDeveloperSupport() = false
59+
override fun createSplashScreenPresenter() = SplashScreenPresenter()
60+
override fun getPackages(): List<ReactPackage> = PackageList(this).packages
61+
override fun getJSBundleFile() = null
62+
override fun getAppSessionId() = null
63+
//End - For MendixApplication compatibility only, not part of React Native template
4464
}
Lines changed: 31 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,46 @@
11
import UIKit
22
import React
3+
import React_RCTAppDelegate
4+
import ReactAppDependencyProvider
35
import MendixNative
46

57
@main
6-
class AppDelegate: ReactAppProvider {
8+
class AppDelegate: RCTAppDelegate {
79

810
override func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
9-
super.setUpProvider()
11+
12+
self.moduleName = "App"
13+
self.dependencyProvider = RCTAppDependencyProvider()
14+
self.initialProps = [:]
1015
super.application(application, didFinishLaunchingWithOptions: launchOptions)
11-
changeRoot(to: Home())
16+
17+
//Start - For MendixApplication compatibility only, not part of React Native template
18+
MxConfiguration.update(from:
19+
MendixApp.init(
20+
identifier: nil,
21+
bundleUrl: bundleURL()!,
22+
runtimeUrl: URL(string: "http://localhost:8081")!,
23+
warningsFilter: .none,
24+
isDeveloperApp: false,
25+
clearDataAtLaunch: false,
26+
splashScreenPresenter: nil,
27+
reactLoading: nil,
28+
enableThreeFingerGestures: false
29+
)
30+
)
31+
//End - For MendixApplication compatibility only, not part of React Native template
1232
return true
1333
}
1434

15-
open override func bundleURL() -> URL? {
16-
return RCTBundleURLProvider.sharedSettings().jsBundleURL(forBundleRoot: "index")
35+
override func sourceURL(for bridge: RCTBridge) -> URL? {
36+
self.bundleURL()
1737
}
18-
}
1938

20-
class Home: UIViewController {
21-
22-
lazy var button: UIButton = {
23-
let button = UIButton(type: .system)
24-
button.setTitle("Open React App", for: .normal)
25-
button.translatesAutoresizingMaskIntoConstraints = false
26-
button.addTarget(self, action: #selector(openApp), for: .touchUpInside)
27-
return button
28-
}()
29-
30-
override func viewDidLoad() {
31-
super.viewDidLoad()
32-
view.backgroundColor = .white
33-
view.addSubview(button)
34-
NSLayoutConstraint.activate([
35-
button.centerXAnchor.constraint(equalTo: view.centerXAnchor),
36-
button.centerYAnchor.constraint(equalTo: view.centerYAnchor)
37-
])
38-
}
39-
40-
@objc func openApp() {
41-
ReactAppProvider.shared()?.setReactViewController(UIViewController())
39+
override func bundleURL() -> URL? {
40+
#if DEBUG
41+
RCTBundleURLProvider.sharedSettings().jsBundleURL(forBundleRoot: "index")
42+
#else
43+
Bundle.main.url(forResource: "main", withExtension: "jsbundle")
44+
#endif
4245
}
4346
}

example/ios/Podfile.lock

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ PODS:
88
- hermes-engine (0.77.3):
99
- hermes-engine/Pre-built (= 0.77.3)
1010
- hermes-engine/Pre-built (0.77.3)
11-
- MendixNative (0.0.1):
11+
- MendixNative (0.1.2):
1212
- DoubleConversion
1313
- glog
1414
- hermes-engine
@@ -34,16 +34,14 @@ PODS:
3434
- RNCAsyncStorage
3535
- SSZipArchive
3636
- Yoga
37-
- op-sqlite (12.0.2):
37+
- op-sqlite (15.0.7):
3838
- DoubleConversion
3939
- glog
4040
- hermes-engine
4141
- OpenSSL-Universal
4242
- RCT-Folly (= 2024.11.18.00)
4343
- RCTRequired
4444
- RCTTypeSafety
45-
- React
46-
- React-callinvoker
4745
- React-Core
4846
- React-debug
4947
- React-Fabric
@@ -1827,8 +1825,8 @@ SPEC CHECKSUMS:
18271825
fmt: a40bb5bd0294ea969aaaba240a927bd33d878cdd
18281826
glog: eb93e2f488219332457c3c4eafd2738ddc7e80b8
18291827
hermes-engine: b2187dbe13edb0db8fcb2a93a69c1987a30d98a4
1830-
MendixNative: d76c461cfe93066190b9f1c21d01a4960e1f7ce2
1831-
op-sqlite: f364fb409143a1194b76909630c050c6e91245e9
1828+
MendixNative: 0405210432ee514e2d7906fe5714f719eb6d7c75
1829+
op-sqlite: 12554de3e1a0cb86cbad3cf1f0c50450f57d3855
18321830
OpenSSL-Universal: 6082b0bf950e5636fe0d78def171184e2b3899c2
18331831
RCT-Folly: e78785aa9ba2ed998ea4151e314036f6c49e6d82
18341832
RCTDeprecation: 6ee92578d332db1d4e03267d3ae98bcf8b780863

example/src/App.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
import { Text, View, StyleSheet } from 'react-native';
2+
import { AndroidNavigationBar } from 'mendix-native';
23

34
export default function App() {
45
const runtime = (global as any).nativeFabricUIManager
56
? 'New Architecture'
67
: 'Legacy Architecture';
78

9+
console.log('Navigation Bar Height:', AndroidNavigationBar.height);
10+
console.log('Is Navigation Bar Active:', AndroidNavigationBar.isActive);
11+
812
return (
913
<View style={styles.container}>
1014
<View style={styles.archContainer}>

ios/MendixNative.mm

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,5 +140,14 @@ - (void)fsReadAsText:(nonnull NSString *)filePath resolve:(nonnull RCTPromiseRes
140140
reject(@"NOT_SPPORTED", @"Read as text is not supported on iOS", nil);
141141
}
142142

143+
- (nonnull NSNumber *)navigationModeGetNavigationBarHeight {
144+
return [NSNumber numberWithBool:NO];
145+
}
146+
147+
148+
- (nonnull NSNumber *)navigationModeIsNavigationBarActive {
149+
return [NSNumber numberWithDouble:0.0];
150+
}
151+
143152

144153
@end

src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ export * from './reload-handler';
88
export * from './encrypted-storage';
99
export * from './error-handler';
1010
export * from './file-system';
11+
export * from './navigation-mode';

src/navigation-mode.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import Mx from './specs/NativeMendixNative';
2+
3+
export const AndroidNavigationBar = {
4+
height: Mx.navigationModeGetNavigationBarHeight(),
5+
isActive: Mx.navigationModeIsNavigationBarActive(),
6+
};

0 commit comments

Comments
 (0)