Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import android.os.Build
import android.os.Bundle
import android.util.Log
import android.view.KeyEvent
import android.view.MotionEvent
import android.view.View
import android.view.WindowManager
import android.widget.Toast
Expand All @@ -29,7 +28,6 @@ import com.mendix.developerapp.firebase.FCMNotificationHandler
import com.mendix.developerapp.firebase.MENDIX_AD_CAMPAIGN_CHANNEL
import com.mendix.developerapp.home.HomeViewModel
import com.mendix.developerapp.mendixapp.MendixProjectFragment
import com.mendix.developerapp.utilities.GlobalTouchEventListener
import com.mendix.developerapp.utilities.getWarningFilterValue
import com.mendix.developerapp.utilities.supportsAR
import com.mendix.mendixnative.fragment.BackButtonHandler
Expand Down Expand Up @@ -209,12 +207,6 @@ class MainActivity : AppCompatActivity(), DefaultHardwareBackBtnHandler, LaunchS
})
}

override fun dispatchTouchEvent(ev: MotionEvent?): Boolean {
return if ((currentFragment as? GlobalTouchEventListener)?.dispatchTouchEvent(ev) == true) {
true
} else super.dispatchTouchEvent(ev)
}

override fun onBackPressed() {
if ((currentFragment as? BackButtonHandler)?.onBackPressed() != true) {
super.onBackPressed()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.mendix.developerapp

import com.facebook.react.devsupport.interfaces.DevBundleDownloadListener
import com.mendix.developerapp.loading.BundleDownloadListenerHolder
import com.mendix.developerapp.sampelapps.SampleAppsManager
import com.mendix.developerapp.splashscreen.SplashScreenPresenter
import com.mendix.developerapp.util.imageBackground
Expand All @@ -16,6 +18,11 @@ class MainApplication : BaseApplication() {
var splashImagePath = splashBackground(backgroundImage)
}

val bundleDownloadListenerHolder = BundleDownloadListenerHolder()

override val devBundleDownloadListener: DevBundleDownloadListener
get() = bundleDownloadListenerHolder

override fun getUseDeveloperSupport(): Boolean {
return SampleAppsManager.sampleAppJSBundlePath == null
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package com.mendix.developerapp.loading

import com.facebook.react.devsupport.interfaces.DevBundleDownloadListener

/**
* A delegating [DevBundleDownloadListener] that forwards calls to a mutable [delegate].
*
* This holder is set at ReactHost creation time (Application init). The actual delegate
* is wired up later when the Fragment/ViewModel is created, and cleared on destroy.
*/
class BundleDownloadListenerHolder : DevBundleDownloadListener {
var delegate: DevBundleDownloadListener? = null

override fun onSuccess() {
delegate?.onSuccess()
}

override fun onProgress(status: String?, done: Int?, total: Int?) {
delegate?.onProgress(status, done, total)
}

override fun onFailure(cause: Exception) {
delegate?.onFailure(cause)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ package com.mendix.developerapp.mendixapp

import android.os.Bundle
import androidx.navigation.fragment.findNavController
import com.facebook.react.devsupport.DefaultDevLoadingViewImplementation
import com.facebook.react.devsupport.setBundleDownloadListener
import com.mendix.developerapp.MainApplication
import com.mendix.mendixnative.react.MxConfiguration

class MendixProjectFragment : MendixProjectFragmentBase() {
Expand All @@ -19,11 +18,16 @@ class MendixProjectFragment : MendixProjectFragmentBase() {

super.onCreate(savedInstanceState)

// Setting up our download listener
setBundleDownloadListener(reactHost?.devSupportManager, viewModel.devServerCallback)
// Wire the ViewModel's download listener into the application-level holder.
// The holder was injected into the DevSupportManager at ReactHost creation time.
(requireActivity().application as MainApplication)
.bundleDownloadListenerHolder.delegate = viewModel.devServerCallback
}

// This now uses built-in RN mechanism to show bundling progress.
DefaultDevLoadingViewImplementation.setDevLoadingEnabled(true);
override fun onDestroy() {
(requireActivity().application as? MainApplication)
?.bundleDownloadListenerHolder?.delegate = null
super.onDestroy()
}

override fun onCloseProjectSelected() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,10 @@ import android.widget.FrameLayout
import androidx.fragment.app.viewModels
import com.mendix.developerapp.MendixBaseFragment
import com.mendix.developerapp.loading.ProjectLoaderViewModel
import com.mendix.developerapp.utilities.GlobalTouchEventListener
import com.zoontek.rnbootsplash.RNBootSplash
import com.mendix.developerapp.R

open class MendixProjectFragmentBase : MendixBaseFragment(), GlobalTouchEventListener {
open class MendixProjectFragmentBase : MendixBaseFragment() {
protected val viewModel: ProjectLoaderViewModel by viewModels()

override fun onCreateView(
Expand Down
9 changes: 3 additions & 6 deletions ios/DeveloperApp/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,17 @@ import UIKit
import Firebase
import GoogleMaps
import UserNotifications
import React_RCTAppDelegate
import ReactAppDependencyProvider
import MendixNative
import React

@UIApplicationMain
@main
class AppDelegate: ReactAppProvider {

var shouldLaunchLastApp: Bool = false
var previewingSampleApp: Bool = false

override func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
SessionCookieStore.restore() //iOS does not persist session cookies across app restarts, this helps persisting session cookies to match behaviour with Android
setUpProvider(dependencyProvider: RCTAppDependencyProvider())
setUpProvider()
clearKeychainIfNecessary()
setUpDevice()
setUpGoogleMaps()
Expand Down Expand Up @@ -72,7 +69,7 @@ extension AppDelegate {
//RootView
extension AppDelegate {
private func updateRootViewController(_ storyboard: UIStoryboard) {
window = MendixReactWindow(frame: UIScreen.main.bounds)
window = UIWindow(frame: UIScreen.main.bounds)
window?.rootViewController = storyboard.instantiateInitialViewController()
window?.makeKeyAndVisible()
window?.overrideUserInterfaceStyle = .light // Force Light Mode
Expand Down
13 changes: 0 additions & 13 deletions ios/DeveloperApp/Extension/MendixReactWindow+Extension.swift

This file was deleted.

2 changes: 1 addition & 1 deletion ios/DeveloperApp/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
<key>NSPhotoLibraryUsageDescription</key>
<string>To use that feature the app needs access to your photo library.</string>
<key>Native Binary Version</key>
<integer>31</integer>
<integer>32</integer>
<key>NativeOTAEnabled</key>
<true/>
<key>RCTNewArchEnabled</key>
Expand Down
3 changes: 1 addition & 2 deletions ios/DeveloperApp/MendixApp/MendixAppViewController.swift
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import UIKit
import MendixNative
import React_RCTAppDelegate

class MendixAppViewController: UIViewController, ReactNativeDelegate {
class MendixAppViewController: UIViewController, ReactNativeDelegateInternal {
override func becomeFirstResponder() -> Bool {
return true
}
Expand Down
Loading