Skip to content

armgit / core

Public Imported from GitHub
0

100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps

Console settings improvements (#903)

Eric Bariaux885ec0bb46da
diff --git a/console/android/GenericApp/app/build.gradle b/console/android/GenericApp/app/build.gradle
index ee30d20a9..e34171569 100644
--- a/console/android/GenericApp/app/build.gradle
+++ b/console/android/GenericApp/app/build.gradle
@@ -10,7 +10,7 @@ android {
applicationId "io.openremote.app"
minSdkVersion 25
targetSdkVersion 32
- versionCode 32
+ versionCode 40
versionName "1.0.10"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
@@ -31,21 +31,26 @@ android {
}
compileOptions {
- sourceCompatibility JavaVersion.VERSION_11
- targetCompatibility JavaVersion.VERSION_11
+ sourceCompatibility JavaVersion.VERSION_17
+ targetCompatibility JavaVersion.VERSION_17
+ }
+
+ kotlinOptions {
+ jvmTarget = '17'
}
}
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
- implementation 'androidx.core:core-ktx:1.7.0'
- implementation 'androidx.appcompat:appcompat:1.4.1'
- implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
+ implementation 'androidx.core:core-ktx:1.8.0'
+ implementation 'androidx.appcompat:appcompat:1.4.2'
+ implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.preference:preference-ktx:1.2.0'
- implementation "com.google.android.gms:play-services-location:19.0.1"
- implementation "com.fasterxml.jackson.module:jackson-module-kotlin:2.11.1"
+ implementation "com.google.android.gms:play-services-location:20.0.0"
+ implementation "com.fasterxml.jackson.module:jackson-module-kotlin:2.13.1"
implementation platform('com.google.firebase:firebase-bom:26.0.0')
implementation 'com.google.firebase:firebase-messaging-ktx'
- implementation 'com.google.android.material:material:1.5.0'
+ implementation 'com.google.android.material:material:1.6.1'
implementation project(':ORLib')
+ implementation 'androidx.legacy:legacy-support-v4:1.0.0'
}
diff --git a/console/android/GenericApp/app/src/main/AndroidManifest.xml b/console/android/GenericApp/app/src/main/AndroidManifest.xml
index dfbe3122e..bf0e24140 100644
--- a/console/android/GenericApp/app/src/main/AndroidManifest.xml
+++ b/console/android/GenericApp/app/src/main/AndroidManifest.xml
@@ -19,7 +19,6 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/OpenRemoteTheme">
-
<meta-data
android:name="com.google.firebase.messaging.default_notification_icon"
android:resource="@drawable/ic_notification" />
@@ -44,17 +43,20 @@
android:name="android.app.shortcuts"
android:resource="@xml/shortcuts" />
</activity>
- <activity
- android:name=".ui.ProjectActivity"
- android:exported="true"
- android:label="@string/title_activity_project"
- android:screenOrientation="portrait" />
<activity
android:name="io.openremote.orlib.ui.OrMainActivity"
android:screenOrientation="portrait" />
<activity
android:name="io.openremote.orlib.ui.OrPrivacyPolicyActivity"
android:screenOrientation="portrait" />
+ <activity
+ android:name=".ui.ProjectWizardActivity"
+ android:exported="false"
+ android:screenOrientation="portrait" />
+ <activity
+ android:name=".ui.ProjectListActivity"
+ android:exported="false"
+ android:screenOrientation="portrait"/>
<service
android:name="io.openremote.orlib.service.ORFirebaseMessagingService"
@@ -78,4 +80,4 @@
android:exported="true" />
</application>
-</manifest>
\ No newline at end of file
+</manifest>
diff --git a/console/android/GenericApp/app/src/main/ic_launcher-playstore.png b/console/android/GenericApp/app/src/main/ic_launcher-playstore.png
index 4061aa956..5299cf64f 100644
Binary files a/console/android/GenericApp/app/src/main/ic_launcher-playstore.png and b/console/android/GenericApp/app/src/main/ic_launcher-playstore.png differ
diff --git a/console/android/GenericApp/app/src/main/java/io/openremote/app/model/ORAppInfo.kt b/console/android/GenericApp/app/src/main/java/io/openremote/app/model/ORAppInfo.kt
new file mode 100644
index 000000000..973713822
--- /dev/null
+++ b/console/android/GenericApp/app/src/main/java/io/openremote/app/model/ORAppInfo.kt
@@ -0,0 +1,8 @@
+package io.openremote.app.model
+
+data class ORAppInfo(
+ val consoleAppIncompatible: Boolean,
+ val realms: List<String>,
+ val providers: List<String>,
+ val description: String
+)
diff --git a/console/android/GenericApp/app/src/main/java/io/openremote/app/model/ORConsoleConfig.kt b/console/android/GenericApp/app/src/main/java/io/openremote/app/model/ORConsoleConfig.kt
new file mode 100644
index 000000000..ec320a95c
--- /dev/null
+++ b/console/android/GenericApp/app/src/main/java/io/openremote/app/model/ORConsoleConfig.kt
@@ -0,0 +1,9 @@
+package io.openremote.app.model
+
+data class ORConsoleConfig (
+ val showAppTextInput: Boolean,
+ val showRealmTextInput: Boolean,
+ val app: String?,
+ val allowedApps: List<String>?,
+ val apps: Map<String, ORAppInfo>?
+)
diff --git a/console/android/GenericApp/app/src/main/java/io/openremote/app/model/ProjectItem.kt b/console/android/GenericApp/app/src/main/java/io/openremote/app/model/ProjectItem.kt
new file mode 100644
index 000000000..943fe240e
--- /dev/null
+++ b/console/android/GenericApp/app/src/main/java/io/openremote/app/model/ProjectItem.kt
@@ -0,0 +1,8 @@
+package io.openremote.app.model
+
+data class ProjectItem (
+ val host: String,
+ val app: String,
+ val realm: String?,
+ val url: String
+)
diff --git a/console/android/ORLib/src/main/java/io/openremote/orlib/network/ApiManager.kt b/console/android/GenericApp/app/src/main/java/io/openremote/app/network/ApiManager.kt
similarity index 80%
rename from console/android/ORLib/src/main/java/io/openremote/orlib/network/ApiManager.kt
rename to console/android/GenericApp/app/src/main/java/io/openremote/app/network/ApiManager.kt
index a77f31f6e..92cf94fb9 100644
--- a/console/android/ORLib/src/main/java/io/openremote/orlib/network/ApiManager.kt
+++ b/console/android/GenericApp/app/src/main/java/io/openremote/app/network/ApiManager.kt
@@ -1,11 +1,14 @@
-package io.openremote.orlib.network
+package io.openremote.app.network
import android.net.Uri
import android.util.Log
import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
-import io.openremote.orlib.models.ORAppConfig
+import com.fasterxml.jackson.module.kotlin.readValue
+import io.openremote.app.model.ORAppInfo
+import io.openremote.app.model.ORConsoleConfig
import java.net.HttpURLConnection
import java.net.URL
+import javax.net.ssl.HttpsURLConnection
import kotlin.concurrent.thread
@@ -13,26 +16,28 @@ typealias ResponseBlock<T> = (statusCode: Int, model: T?, error: Throwable?) ->
class ApiManager(private val baseUrl: String) {
+ val mapper = jacksonObjectMapper()
+
enum class HttpMethod {
GET,
POST,
PUT,
}
- fun getAppConfig(realm: String, callback: ResponseBlock<ORAppConfig>?) {
- val uri = Uri.parse(baseUrl)
- val url = URL("${uri.scheme}://${uri.host}/consoleappconfig/${realm}.json")
- with(url.openConnection() as HttpURLConnection) {
- requestMethod = HttpMethod.GET.toString()
- setRequestProperty("Accept", "application/json")
- thread(start = true) {
- parseResponse(this, callback)
- }
- }
+ fun getApps(callback: ResponseBlock<List<String>>?) {
+ get(arrayOf("apps"), callback)
+ }
+
+ fun getAppInfos(callback: ResponseBlock<Map<String, ORAppInfo>>?) {
+ get(arrayOf("apps", "info"), callback)
+ }
+
+ fun getConsoleConfig(callback: ResponseBlock<ORConsoleConfig>?) {
+ get(arrayOf("apps", "consoleConfig"), callback)
}
/*********************************Private functions*******************************/
- private fun createUrlRequest(
+ fun createUrlRequest(
method: HttpMethod,
pathComponents: Array<String>,
queryParameters: Map<String, Any>? = null
@@ -50,8 +55,7 @@ class ApiManager(private val baseUrl: String) {
}
val url = URL(builder.build().toString())
- with(url.openConnection() as HttpURLConnection) {
-
+ with(url.openConnection() as HttpsURLConnection) {
requestMethod = method.toString()
setRequestProperty("Accept", "application/json")
@@ -64,7 +68,7 @@ class ApiManager(private val baseUrl: String) {
}
}
- private inline fun <reified T : Any> get(
+ inline fun <reified T : Any> get(
pathComponents: Array<String>,
noinline callback: ResponseBlock<T>?,
queryParameters: Map<String, Any>? = null
@@ -102,7 +106,7 @@ class ApiManager(private val baseUrl: String) {
}
}
- private inline fun <reified T : Any> parseResponse(
+ inline fun <reified T : Any> parseResponse(
httpConnection: HttpURLConnection,
noinline callback: ResponseBlock<T>?
) {
@@ -110,9 +114,8 @@ class ApiManager(private val baseUrl: String) {
val parsedResult = try {
if (this.responseCode in 200..299) {
Triple(
- this.responseCode, jacksonObjectMapper().readValue(
- this.inputStream.bufferedReader().readText(),
- T::class.java
+ this.responseCode, mapper.readValue<T>(
+ this.inputStream.bufferedReader().readText()
), null
)
} else {
@@ -134,8 +137,8 @@ class ApiManager(private val baseUrl: String) {
private fun HttpURLConnection.writeBody(item: Any) {
val outputWriter = outputStream.bufferedWriter()
outputWriter.write(
- jacksonObjectMapper().writeValueAsString(item)
+ mapper.writeValueAsString(item)
)
outputWriter.flush()
}
-}
\ No newline at end of file
+}
diff --git a/console/android/GenericApp/app/src/main/java/io/openremote/app/ui/AppSelectionFragment.kt b/console/android/GenericApp/app/src/main/java/io/openremote/app/ui/AppSelectionFragment.kt
new file mode 100644
index 000000000..51cb2bf3f
--- /dev/null
+++ b/console/android/GenericApp/app/src/main/java/io/openremote/app/ui/AppSelectionFragment.kt
@@ -0,0 +1,253 @@
+package io.openremote.app.ui
+
+import android.os.Bundle
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import android.widget.AdapterView
+import android.widget.ArrayAdapter
+import androidx.core.widget.doOnTextChanged
+import androidx.fragment.app.Fragment
+import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
+import com.fasterxml.jackson.module.kotlin.readValue
+import io.openremote.app.R
+import io.openremote.app.databinding.FragmentAppSelectionBinding
+import io.openremote.app.model.ORAppInfo
+
+private const val ARG_APP_LIST = "appList"
+private const val ARG_APP_MAP = "appMap"
+private const val ARG_SHOW_APP_TEXT_INPUT = "showAppTextInput"
+private const val ARG_SHOW_REALM_TEXT_INPUT = "showRealmTextInput"
+
+/**
+ * A simple [Fragment] subclass.
+ * Use the [AppSelectionFragment.newInstance] factory method to
+ * create an instance of this fragment.
+ */
+class AppSelectionFragment : Fragment() {
+ private lateinit var binding: FragmentAppSelectionBinding
+ private lateinit var parentActivity: ProjectWizardActivity
+
+ lateinit var appArrayAdapter: ArrayAdapter<String>
+
+ private var appList: List<String>? = null
+ private var appMap: Map<String, ORAppInfo>? = null
+ private var showAppTextInput: Boolean = false
+ private var showRealmTextInput: Boolean = false
+ private val mapper = jacksonObjectMapper()
+
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+
+ parentActivity = requireActivity() as ProjectWizardActivity
+
+ arguments?.let {
+ it.getString(ARG_APP_LIST)?.let {
+ appList = mapper.readValue<List<String>>(it)
+ }
+ it.getString(ARG_APP_MAP)?.let {
+ appMap = mapper.readValue<Map<String, ORAppInfo>>(it)
+ }
+ showAppTextInput = it.getBoolean(ARG_SHOW_APP_TEXT_INPUT, false)
+ showRealmTextInput = it.getBoolean(ARG_SHOW_REALM_TEXT_INPUT, false)
+ }
+
+ if (!appList.isNullOrEmpty()) {
+ if (appList!!.size == 1) {
+ parentActivity.app = appList!![0]
+ parentFragmentManager.beginTransaction()
+ .replace(
+ R.id.fragmentContainer,
+ RealmSelectionFragment.newInstance(
+ realmList = null,
+ showRealmTextInput = showRealmTextInput
+ )
+ )
+ .addToBackStack(ProjectWizardActivity.TAG)
+ .commit()
+ }
+ }
+
+ if (!appMap.isNullOrEmpty()) {
+ if (appMap!!.size == 1) {
+ parentActivity.app = appMap!!.keys.elementAt(0)
+ parentActivity.consoleProviders = appMap!!.values.elementAt(0).providers
+ parentFragmentManager.beginTransaction()
+ .replace(
+ R.id.fragmentContainer,
+ RealmSelectionFragment.newInstance(
+ realmList = appMap!!.values.elementAt(0).realms,
+ showRealmTextInput = showRealmTextInput
+ )
+ )
+ .addToBackStack(ProjectWizardActivity.TAG)
+ .commit()
+ }
+ }
+ }
+
+ override fun onCreateView(
+ inflater: LayoutInflater, container: ViewGroup?,
+ savedInstanceState: Bundle?
+ ): View {
+ // Inflate the layout for this fragment
+ binding = FragmentAppSelectionBinding.inflate(inflater, container, false);
+ val view: View = binding.root
+
+ if (showAppTextInput) {
+ binding.appInputLayout.visibility = View.VISIBLE
+ binding.appInput.doOnTextChanged { text, start, before, count ->
+ parentActivity.app = text.toString()
+ }
+ } else {
+ if (appList != null) {
+ appArrayAdapter = ArrayAdapter(
+ requireActivity(),
+ android.R.layout.simple_spinner_dropdown_item,
+ appList!!
+ )
+ binding.appSpinner.adapter = appArrayAdapter
+ binding.appSpinner.visibility = View.VISIBLE
+ }
+
+ if (appMap != null) {
+ appArrayAdapter = ArrayAdapter(
+ requireActivity(),
+ android.R.layout.simple_spinner_dropdown_item,
+ appMap!!.keys.toList()
+ )
+ binding.appSpinner.adapter = appArrayAdapter
+ binding.appSpinner.visibility = View.VISIBLE
+ }
+
+ binding.appSpinner.onItemSelectedListener =
+ object : AdapterView.OnItemSelectedListener {
+ override fun onItemSelected(
+ parent: AdapterView<*>?,
+ view: View?,
+ position: Int,
+ id: Long
+ ) {
+ parentActivity.app = appArrayAdapter.getItem(position)
+ parentActivity.consoleProviders =
+ appMap?.values?.elementAt(position)?.providers
+ }
+
+ override fun onNothingSelected(p0: AdapterView<*>?) {
+ parentActivity.app = null
+ parentActivity.consoleProviders = null
+ }
+ }
+ }
+
+ binding.backButton.setOnClickListener {
+ parentFragmentManager.popBackStack()
+ }
+
+ binding.nextButton.setOnClickListener {
+ if (parentActivity.app != null) {
+ val appInfo = appMap?.get(parentActivity.app)
+ if (appInfo == null) {
+ parentActivity.apiManager.getAppInfos { statusCode, appInfoMap, error ->
+ parentActivity.binding.progressBar.visibility = View.INVISIBLE
+ when (statusCode) {
+ in 200..299 -> {
+ appInfoMap?.let {
+ val appInfo = it[parentActivity.app]
+ if (appInfo != null) {
+ parentFragmentManager.beginTransaction()
+ .replace(
+ R.id.fragmentContainer,
+ RealmSelectionFragment.newInstance(
+ realmList = appInfo.realms,
+ showRealmTextInput = showRealmTextInput
+ )
+ )
+ .addToBackStack(ProjectWizardActivity.TAG)
+ .commit()
+ } else {
+ parentFragmentManager.beginTransaction()
+ .replace(
+ R.id.fragmentContainer,
+ RealmSelectionFragment.newInstance(
+ realmList = null,
+ showRealmTextInput = showRealmTextInput
+ )
+ )
+ .addToBackStack(ProjectWizardActivity.TAG)
+ .commit()
+ }
+ }
+ }
+ 404 -> {
+ parentFragmentManager.beginTransaction()
+ .replace(
+ R.id.fragmentContainer,
+ RealmSelectionFragment.newInstance(
+ realmList = null,
+ showRealmTextInput = showRealmTextInput
+ )
+ )
+ .addToBackStack(ProjectWizardActivity.TAG)
+ .commit()
+ }
+ else -> {
+ parentActivity.runOnUiThread {
+ binding.errorView.visibility = View.VISIBLE
+ binding.errorTextView.text =
+ getString(R.string.error_getting_app_info)
+ }
+ }
+ }
+ }
+ } else {
+ parentFragmentManager.beginTransaction()
+ .replace(
+ R.id.fragmentContainer,
+ RealmSelectionFragment.newInstance(
+ realmList = appInfo.realms,
+ showRealmTextInput = showRealmTextInput
+ )
+ )
+ .addToBackStack(ProjectWizardActivity.TAG)
+ .commit()
+ }
+ } else {
+ parentActivity.runOnUiThread {
+ binding.errorView.visibility = View.VISIBLE
+ binding.errorTextView.text = getString(R.string.select_app_first)
+ }
+ }
+ }
+
+ return view
+ }
+
+ companion object {
+ /**
+ * Use this factory method to create a new instance of
+ * this fragment using the provided parameters.
+ *
+ * @return A new instance of fragment AppSelectionFragment.
+ */
+ @JvmStatic
+ fun newInstance(
+ appList: List<String>?,
+ appMap: Map<String, ORAppInfo>?,
+ showAppTextInput: Boolean = false,
+ showRealmTextInput: Boolean = false
+ ) =
+ AppSelectionFragment().apply {
+ arguments = Bundle().apply {
+ appList?.let {
+ putString(ARG_APP_LIST, mapper.writeValueAsString(it))
+ }
+ appMap?.let {
+ putString(ARG_APP_MAP, mapper.writeValueAsString(it))
+ }
+ putBoolean(ARG_SHOW_REALM_TEXT_INPUT, showRealmTextInput)
+ putBoolean(ARG_SHOW_APP_TEXT_INPUT, showAppTextInput)
+ }
+ }
+ }
+}
diff --git a/console/android/GenericApp/app/src/main/java/io/openremote/app/ui/HostSelectionFragment.kt b/console/android/GenericApp/app/src/main/java/io/openremote/app/ui/HostSelectionFragment.kt
new file mode 100644
index 000000000..af8bb2eeb
--- /dev/null
+++ b/console/android/GenericApp/app/src/main/java/io/openremote/app/ui/HostSelectionFragment.kt
@@ -0,0 +1,271 @@
+package io.openremote.app.ui
+
+import android.os.Bundle
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import android.webkit.URLUtil
+import androidx.fragment.app.Fragment
+import io.openremote.app.R
+import io.openremote.app.databinding.FragmentHostSelectionBinding
+import io.openremote.app.model.ORAppInfo
+import io.openremote.app.model.ORConsoleConfig
+import io.openremote.app.network.ApiManager
+
+
+/**
+ * A simple [Fragment] subclass.
+ * Use the [HostSelectionFragment.newInstance] factory method to
+ * create an instance of this fragment.
+ */
+class HostSelectionFragment : Fragment() {
+ private lateinit var binding: FragmentHostSelectionBinding
+ private lateinit var parentActivity: ProjectWizardActivity
+
+ override fun onCreateView(
+ inflater: LayoutInflater, container: ViewGroup?,
+ savedInstanceState: Bundle?
+ ): View {
+
+ parentActivity = requireActivity() as ProjectWizardActivity
+
+ // Inflate the layout for this fragment
+ binding = FragmentHostSelectionBinding.inflate(inflater, container, false);
+ val view: View = binding.root
+
+
+ binding.connectButton.setOnClickListener {
+ if (!binding.hostInput.text.isNullOrBlank()) {
+ connectToHost(binding.hostInput.text.toString())
+ }
+ parentActivity.host = binding.hostInput.text.toString()
+ }
+
+ binding.backButton.setOnClickListener {
+ activity?.finish()
+ }
+
+ return view
+ }
+
+ private fun connectToHost(host: String) {
+ parentActivity.binding.progressBar.visibility = View.VISIBLE
+ val url =
+ if (URLUtil.isValidUrl(host)) host.plus("/api/master") else "https://${host}.openremote.app/api/master"
+ parentActivity.apiManager = ApiManager(url)
+ parentActivity.apiManager.getConsoleConfig { statusCode, consoleConfig, error ->
+ when (statusCode) {
+ in 200..299 -> {
+ consoleConfig?.let { config ->
+ if (config.app != null) {
+ parentActivity.app = config.app
+ val appInfo = config.apps?.get(config.app)
+ if (appInfo != null) {
+ parentActivity.binding.progressBar.visibility = View.INVISIBLE
+ processAppInfo(config, appInfo)
+ } else {
+ parentActivity.apiManager.getAppInfos { statusCode, appInfoMap, error ->
+ parentActivity.binding.progressBar.visibility = View.INVISIBLE
+ when (statusCode) {
+ in 200..299 -> {
+ if (appInfoMap != null) {
+ val appInfo = appInfoMap[config.app!!]
+ if (appInfo != null) {
+ processAppInfo(config, appInfo)
+ } else {
+ parentFragmentManager.beginTransaction()
+ .replace(
+ R.id.fragmentContainer,
+ AppSelectionFragment.newInstance(
+ appList = config.allowedApps,
+ appMap = config.apps,
+ showAppTextInput = config.showAppTextInput,
+ showRealmTextInput = config.showRealmTextInput
+ )
+ )
+ .addToBackStack(ProjectWizardActivity.TAG)
+ .commit()
+ }
+ } else {
+ parentFragmentManager.beginTransaction()
+ .replace(
+ R.id.fragmentContainer,
+ AppSelectionFragment.newInstance(
+ appList = config.allowedApps,
+ appMap = config.apps,
+ showAppTextInput = config.showAppTextInput,
+ showRealmTextInput = config.showRealmTextInput
+ )
+ )
+ .addToBackStack(ProjectWizardActivity.TAG)
+ .commit()
+ }
+ }
+ 404 -> { //no appconfig
+ parentActivity.goToMainActivity(
+ parentActivity.app!!,
+ "master"
+ )
+ }
+ else -> {
+ binding.errorView.visibility = View.VISIBLE
+ parentActivity.runOnUiThread {
+ binding.errorView.visibility = View.VISIBLE
+ binding.errorTextView.text =
+ resources.getText(R.string.error_getting_app_info)
+ }
+ }
+ }
+ }
+ }
+ } else {
+ parentActivity.binding.progressBar.visibility = View.INVISIBLE
+ parentFragmentManager.beginTransaction()
+ .replace(
+ R.id.fragmentContainer,
+ AppSelectionFragment.newInstance(
+ appList = config.allowedApps,
+ appMap = config.apps,
+ showAppTextInput = config.showAppTextInput,
+ showRealmTextInput = config.showRealmTextInput
+ )
+ )
+ .addToBackStack(ProjectWizardActivity.TAG)
+ .commit()
+ }
+ }
+ }
+ 404 -> { //no console_config.json
+ parentActivity.apiManager.getAppInfos { statusCode, appInfoMap, error ->
+ parentActivity.binding.progressBar.visibility = View.INVISIBLE
+ when (statusCode) {
+ in 200..299 -> {
+ if (appInfoMap?.isNotEmpty() == true) {
+ parentFragmentManager.beginTransaction()
+ .replace(
+ R.id.fragmentContainer,
+ AppSelectionFragment.newInstance(
+ appList = null,
+ appMap = appInfoMap
+ )
+ )
+ .addToBackStack(ProjectWizardActivity.TAG)
+ .commit()
+ } else {
+ parentActivity.apiManager.getApps { statusCode, apps, error ->
+ if (apps?.isNotEmpty() == true) {
+ parentFragmentManager.beginTransaction()
+ .replace(
+ R.id.fragmentContainer,
+ AppSelectionFragment.newInstance(
+ appList = apps,
+ appMap = null
+ )
+ )
+ .addToBackStack(ProjectWizardActivity.TAG)
+ .commit()
+ } else {
+ //TODO remove inserting manager app after all manager instances are updated with console_settings_improvement branch
+ val tempApps = arrayListOf("manager")
+ parentFragmentManager.beginTransaction()
+ .replace(
+ R.id.fragmentContainer,
+ AppSelectionFragment.newInstance(
+ appList = tempApps,
+ appMap = null,
+ showAppTextInput = true
+ )
+ )
+ .addToBackStack(ProjectWizardActivity.TAG)
+ .commit()
+
+// parentActivity.runOnUiThread {
+// binding.errorView.visibility = View.VISIBLE
+// binding.errorTextView.text =
+// getString(R.string.no_apps_found)
+// }
+ }
+ }
+ }
+ }
+ else -> {
+ parentActivity.apiManager.getApps { statusCode, apps, error ->
+ if (apps?.isNotEmpty() == true) {
+ parentFragmentManager.beginTransaction()
+ .replace(
+ R.id.fragmentContainer,
+ AppSelectionFragment.newInstance(
+ appList = apps,
+ appMap = null,
+ showAppTextInput = true
+ )
+ )
+ .addToBackStack(ProjectWizardActivity.TAG)
+ .commit()
+ } else {
+ //TODO remove inserting manager app after all manager instances are updated with console_settings_improvement branch
+ val tempApps = arrayListOf("manager")
+ parentFragmentManager.beginTransaction()
+ .replace(
+ R.id.fragmentContainer,
+ AppSelectionFragment.newInstance(
+ appList = tempApps,
+ appMap = null
+ )
+ )
+ .addToBackStack(ProjectWizardActivity.TAG)
+ .commit()
+// parentActivity.runOnUiThread {
+// binding.errorView.visibility = View.VISIBLE
+// binding.errorTextView.text =
+// getString(R.string.no_apps_found)
+// }
+ }
+ }
+ }
+ }
+ }
+ }
+ else -> {
+ parentActivity.binding.progressBar.visibility = View.INVISIBLE
+ parentActivity.runOnUiThread {
+ binding.errorView.visibility = View.VISIBLE
+ binding.errorTextView.text =
+ resources.getText(R.string.could_not_connect_to_domain)
+ }
+ }
+ }
+ }
+ }
+
+ private fun processAppInfo(config: ORConsoleConfig, appInfo: ORAppInfo) {
+ parentActivity.consoleProviders = appInfo.providers
+ if (appInfo.consoleAppIncompatible) {
+ parentActivity.runOnUiThread {
+ binding.errorView.visibility = View.VISIBLE
+ binding.errorTextView.text = getString(R.string.app_incompatible)
+ }
+ } else if (parentActivity.app != null) {
+ parentActivity.goToMainActivity(
+ parentActivity.app!!,
+ consoleProviders = appInfo.providers
+ )
+ } else {
+ parentFragmentManager.beginTransaction()
+ .replace(
+ R.id.fragmentContainer,
+ RealmSelectionFragment.newInstance(
+ realmList = appInfo.realms,
+ showRealmTextInput = config.showRealmTextInput
+ )
+ )
+ .addToBackStack(ProjectWizardActivity.TAG)
+ .commit()
+ }
+ }
+
+ companion object {
+ @JvmStatic
+ fun newInstance() = HostSelectionFragment()
+ }
+}
diff --git a/console/android/GenericApp/app/src/main/java/io/openremote/app/ui/ProjectActivity.kt b/console/android/GenericApp/app/src/main/java/io/openremote/app/ui/ProjectActivity.kt
deleted file mode 100644
index b09ac1eba..000000000
--- a/console/android/GenericApp/app/src/main/java/io/openremote/app/ui/ProjectActivity.kt
+++ /dev/null
@@ -1,78 +0,0 @@
-package io.openremote.app.ui
-
-import android.app.Activity
-import android.content.Intent
-import android.content.SharedPreferences
-import android.os.Bundle
-import android.view.View
-import android.view.inputmethod.EditorInfo
-import android.webkit.URLUtil
-import android.widget.Toast
-import androidx.preference.PreferenceManager
-import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
-import io.openremote.app.databinding.ActivityProjectBinding
-import io.openremote.orlib.ORConstants
-import io.openremote.orlib.network.ApiManager
-import io.openremote.orlib.ui.OrMainActivity
-
-class ProjectActivity : Activity() {
-
- private lateinit var binding: ActivityProjectBinding
- private lateinit var sharedPreferences: SharedPreferences
-
- var host: String? = null
-
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- binding = ActivityProjectBinding.inflate(layoutInflater)
- val view = binding.root
- setContentView(view)
-
- sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this)
-
- binding.realmInput.setOnEditorActionListener { textView, actionId, keyEvent ->
- if (actionId == EditorInfo.IME_ACTION_GO) {
- if (!binding.projectInput.text.isNullOrBlank() && !binding.realmInput.text.isNullOrBlank()) {
- requestAppConfig(binding.projectInput.text.toString(), binding.realmInput.text.toString())
- }
- true
- } else {
- false
- }
- }
-
- binding.connectButton.setOnClickListener {
- if (!binding.projectInput.text.isNullOrBlank() && !binding.realmInput.text.isNullOrBlank()) {
- requestAppConfig(binding.projectInput.text.toString(), binding.realmInput.text.toString())
- }
- }
- }
-
- private fun requestAppConfig(project: String, realm: String) {
- binding.progressBar.visibility = View.VISIBLE
- host = if (URLUtil.isValidUrl(project)) project else "https://${project}.openremote.app/"
- val url = if (URLUtil.isValidUrl(project)) project.plus("/api/${realm}") else "https://${project}.openremote.app/api/${realm}"
- val apiManager = ApiManager(url)
- apiManager.getAppConfig(realm) { statusCode, appConfig, error ->
- binding.progressBar.visibility = View.INVISIBLE
- if (statusCode in 200..299) {
- sharedPreferences.edit().putString(ORConstants.HOST_KEY, host)
- .putString(ORConstants.REALM_KEY, realm)
- .apply()
- val intent = Intent(this@ProjectActivity, OrMainActivity::class.java)
- intent.putExtra(ORConstants.APP_CONFIG_KEY, jacksonObjectMapper().writeValueAsString(appConfig))
- intent.putExtra(ORConstants.BASE_URL_KEY, host)
- startActivity(intent)
- finish()
- } else {
- runOnUiThread {
- Toast.makeText(
- this,
- "Error occurred getting app config. Check your input and try again",
- Toast.LENGTH_LONG
- ).show()
- }
- }
- }
- }
-}
diff --git a/console/android/GenericApp/app/src/main/java/io/openremote/app/ui/ProjectListActivity.kt b/console/android/GenericApp/app/src/main/java/io/openremote/app/ui/ProjectListActivity.kt
new file mode 100644
index 000000000..b61509bfb
--- /dev/null
+++ b/console/android/GenericApp/app/src/main/java/io/openremote/app/ui/ProjectListActivity.kt
@@ -0,0 +1,132 @@
+package io.openremote.app.ui
+
+import android.content.Intent
+import android.graphics.Canvas
+import android.graphics.Color
+import android.graphics.PorterDuff
+import android.graphics.drawable.ColorDrawable
+import android.os.Bundle
+import android.view.Menu
+import android.view.MenuItem
+import androidx.appcompat.app.AppCompatActivity
+import androidx.appcompat.widget.Toolbar
+import androidx.core.content.ContextCompat
+import androidx.core.view.setPadding
+import androidx.preference.PreferenceManager
+import androidx.recyclerview.widget.ItemTouchHelper
+import androidx.recyclerview.widget.LinearLayoutManager
+import androidx.recyclerview.widget.RecyclerView
+import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
+import com.fasterxml.jackson.module.kotlin.readValue
+import io.openremote.app.R
+import io.openremote.app.databinding.ActivityProjectListBinding
+import io.openremote.app.model.ProjectItem
+import io.openremote.app.util.Constants
+import io.openremote.orlib.ORConstants
+import io.openremote.orlib.ui.OrMainActivity
+
+
+class ProjectListActivity : AppCompatActivity() {
+ lateinit var binding: ActivityProjectListBinding
+ lateinit var projectListAdapter: ProjectListAdapter
+
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+
+ binding = ActivityProjectListBinding.inflate(layoutInflater)
+ val view = binding.root
+ setContentView(view)
+
+ val toolbar: Toolbar = findViewById(R.id.settings_toolbar);
+ setSupportActionBar(toolbar)
+ supportActionBar?.setDisplayShowTitleEnabled(false)
+
+ val projectItems = PreferenceManager.getDefaultSharedPreferences(this)
+ .getString(Constants.PROJECT_LIST, null)?.let {
+ jacksonObjectMapper().readValue<List<ProjectItem>>(it).toMutableList()
+ } ?: mutableListOf()
+
+ projectListAdapter = ProjectListAdapter(projectItems.toMutableList().asReversed(), this::goToMainActivity)
+ binding.projectList.adapter = projectListAdapter
+ binding.projectList.layoutManager = LinearLayoutManager(this);
+
+ val background = ColorDrawable(Color.parseColor("#bf1515"))
+ val xMark = ContextCompat.getDrawable(this, android.R.drawable.ic_menu_close_clear_cancel)?.apply {
+ setColorFilter(Color.WHITE, PorterDuff.Mode.SRC_ATOP)
+ }
+ val xMarkMargin = 24
+
+ val swipeHandler = object : ItemTouchHelper.SimpleCallback(0, ItemTouchHelper.LEFT or ItemTouchHelper.RIGHT) {
+
+ override fun onMove(recyclerView: RecyclerView, viewHolder: RecyclerView.ViewHolder, target: RecyclerView.ViewHolder): Boolean {
+ return false
+ }
+
+ override fun onSwiped(viewHolder: RecyclerView.ViewHolder, direction: Int) {
+ val projectItems = projectListAdapter.items.toMutableList().asReversed()
+ projectItems.removeAt(viewHolder.adapterPosition)
+ PreferenceManager.getDefaultSharedPreferences(this@ProjectListActivity)
+ .edit()
+ .putString(Constants.PROJECT_LIST, jacksonObjectMapper().writeValueAsString(projectItems))
+ .apply()
+ projectListAdapter.remove(viewHolder.adapterPosition)
+ }
+
+ override fun onChildDraw(c: Canvas, recyclerView: RecyclerView, viewHolder: RecyclerView.ViewHolder, dX: Float, dY: Float, actionState: Int, isCurrentlyActive: Boolean) {
+ if (viewHolder.adapterPosition < 0) return
+
+ val itemView = viewHolder.itemView // the view being swiped
+
+ // draw the red background, based on the offset of the swipe (dX)
+ background.apply {
+ setBounds(itemView.right + dX.toInt(), itemView.top, itemView.right, itemView.bottom)
+ draw(c)
+ }
+
+ // draw the symbol
+ xMark?.apply {
+ val xt = itemView.top + (itemView.bottom - itemView.top - xMark.intrinsicHeight) / 2
+ setBounds(
+ itemView.right - xMarkMargin - xMark.intrinsicWidth,
+ xt,
+ itemView.right - xMarkMargin,
+ xt + xMark.intrinsicHeight
+ )
+ draw(c)
+ }
+ super.onChildDraw(c, recyclerView, viewHolder, dX, dY, actionState, isCurrentlyActive)
+ }
+ }
+ val touchHelper = ItemTouchHelper(swipeHandler)
+ touchHelper.attachToRecyclerView(binding.projectList)
+ }
+
+ override fun onCreateOptionsMenu(menu: Menu?): Boolean {
+ menuInflater.inflate(R.menu.projects_menu, menu)
+ val menuItem = menu?.findItem(R.id.add);
+ menuItem?.actionView?.setOnClickListener {
+ this.onOptionsItemSelected(menuItem)
+ }
+ menuItem?.actionView?.setPadding(10)
+ return super.onCreateOptionsMenu(menu)
+ }
+
+ override fun onOptionsItemSelected(item: MenuItem): Boolean {
+ when (item.itemId){
+ R.id.add -> {
+ val intent = Intent(this, ProjectWizardActivity::class.java)
+ startActivity(intent)
+ }
+ }
+ return super.onOptionsItemSelected(item)
+ }
+
+ private fun goToMainActivity(url: String) {
+ val intent = Intent(this, OrMainActivity::class.java)
+ intent.putExtra(ORConstants.BASE_URL_KEY, url)
+ runOnUiThread {
+ startActivity(intent)
+ finish()
+ }
+ }
+}
diff --git a/console/android/GenericApp/app/src/main/java/io/openremote/app/ui/ProjectListAdapter.kt b/console/android/GenericApp/app/src/main/java/io/openremote/app/ui/ProjectListAdapter.kt
new file mode 100644
index 000000000..bb7c7ebfe
--- /dev/null
+++ b/console/android/GenericApp/app/src/main/java/io/openremote/app/ui/ProjectListAdapter.kt
@@ -0,0 +1,61 @@
+package io.openremote.app.ui
+
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import androidx.recyclerview.widget.RecyclerView
+import io.openremote.app.databinding.RowProjectItemBinding
+import io.openremote.app.model.ProjectItem
+
+class ProjectListAdapter(val items: MutableList<ProjectItem>, private val goToMainActivity: (url: String) -> (Unit)) : RecyclerView.Adapter<ProjectListAdapter.ViewHolder>() {
+
+ // create new views
+ override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
+ val inflater = LayoutInflater.from(parent.context)
+ val binding = RowProjectItemBinding.inflate(inflater, parent, false)
+ return ViewHolder(binding, goToMainActivity)
+ }
+
+ // binds the list items to a view
+ override fun onBindViewHolder(holder: ViewHolder, position: Int) {
+ holder.bindProjectItem(items[position])
+ }
+
+ // return the number of the items in the list
+ override fun getItemCount(): Int {
+ return items.size
+ }
+
+ fun remove(position: Int) {
+ this.items.removeAt(position)
+ this.notifyDataSetChanged()
+ }
+
+ // Holds the views for adding it to image and text
+ class ViewHolder(private val binding: RowProjectItemBinding, private val goToMainActivity: (url: String) -> (Unit)) : RecyclerView.ViewHolder(binding.root), View.OnClickListener {
+
+ lateinit var url: String
+
+ init {
+ binding.root.setOnClickListener(this)
+ }
+
+ fun bindProjectItem(projectItem: ProjectItem) {
+ this.url = projectItem.url
+ binding.host.text = projectItem.host
+ projectItem.app.run {
+ binding.app.visibility = View.VISIBLE
+ binding.app.text = this
+ }
+ projectItem.realm?.run {
+ binding.realm.visibility = View.VISIBLE
+ binding.realm.text = this
+ }
+ }
+
+ override fun onClick(view: View?) {
+ goToMainActivity(url)
+ }
+ }
+}
+
diff --git a/console/android/GenericApp/app/src/main/java/io/openremote/app/ui/ProjectWizardActivity.kt b/console/android/GenericApp/app/src/main/java/io/openremote/app/ui/ProjectWizardActivity.kt
new file mode 100644
index 000000000..28397543e
--- /dev/null
+++ b/console/android/GenericApp/app/src/main/java/io/openremote/app/ui/ProjectWizardActivity.kt
@@ -0,0 +1,84 @@
+package io.openremote.app.ui
+
+import android.content.Intent
+import android.os.Bundle
+import android.webkit.URLUtil
+import androidx.fragment.app.FragmentActivity
+import androidx.preference.PreferenceManager
+import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
+import com.fasterxml.jackson.module.kotlin.readValue
+import io.openremote.app.R
+import io.openremote.app.databinding.ActivityProjectWizardBinding
+import io.openremote.app.model.ProjectItem
+import io.openremote.app.network.ApiManager
+import io.openremote.app.util.Constants
+import io.openremote.orlib.ORConstants
+import io.openremote.orlib.ui.OrMainActivity
+
+class ProjectWizardActivity : FragmentActivity() {
+
+ lateinit var binding: ActivityProjectWizardBinding
+ lateinit var apiManager: ApiManager
+
+ var host: String? = null
+ var app: String? = null
+ var realm: String? = null
+ var consoleProviders: List<String>? = null
+
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+
+ binding = ActivityProjectWizardBinding.inflate(layoutInflater)
+ val view = binding.root
+ setContentView(view)
+
+ supportFragmentManager.beginTransaction()
+ .add(R.id.fragmentContainer, HostSelectionFragment.newInstance())
+ .addToBackStack(TAG)
+ .commit()
+ }
+
+ fun goToMainActivity(
+ appName: String = "manager",
+ realm: String? = null,
+ consoleProviders: List<String>? = null
+ ) {
+ val preferences = PreferenceManager.getDefaultSharedPreferences(this)
+ val projectItems = preferences.getString(Constants.PROJECT_LIST, null)?.let {
+ jacksonObjectMapper().readValue<List<ProjectItem>>(it).toMutableList()
+ } ?: mutableListOf()
+
+ val intent = Intent(this, OrMainActivity::class.java)
+ var url = if (URLUtil.isValidUrl(host)) host else "https://${host}.openremote.app"
+ url = if (realm != null) "$url/${appName}/?realm=$realm" else "$url/$appName"
+ if (consoleProviders?.any() == true) {
+ url = if (url.contains("?")) url.plus("&") else url.plus("?")
+ url = url.plus("consoleProviders=${consoleProviders.joinToString(" ")}")
+ }
+
+ projectItems.add(ProjectItem(host!!, appName, realm, url))
+ preferences
+ .edit()
+ .putString(Constants.PROJECT_LIST, jacksonObjectMapper().writeValueAsString(projectItems))
+ .apply()
+
+ intent.putExtra(ORConstants.BASE_URL_KEY, url)
+ runOnUiThread {
+ startActivity(intent)
+ finish()
+ }
+ }
+
+ companion object {
+ const val TAG = "ProjectWizardActivity"
+ }
+
+ override fun onBackPressed() {
+ val f = supportFragmentManager.findFragmentById(R.id.fragmentContainer)
+ if (f is HostSelectionFragment) {
+ finish()
+ } else {
+ super.onBackPressed()
+ }
+ }
+}
diff --git a/console/android/GenericApp/app/src/main/java/io/openremote/app/ui/RealmSelectionFragment.kt b/console/android/GenericApp/app/src/main/java/io/openremote/app/ui/RealmSelectionFragment.kt
new file mode 100644
index 000000000..a11cf7584
--- /dev/null
+++ b/console/android/GenericApp/app/src/main/java/io/openremote/app/ui/RealmSelectionFragment.kt
@@ -0,0 +1,147 @@
+package io.openremote.app.ui
+
+import android.os.Bundle
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import android.widget.AdapterView
+import android.widget.ArrayAdapter
+import androidx.core.widget.doOnTextChanged
+import androidx.fragment.app.Fragment
+import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
+import com.fasterxml.jackson.module.kotlin.readValue
+import io.openremote.app.R
+import io.openremote.app.databinding.FragmentRealmSelectionBinding
+
+private const val ARG_REALM_LIST = "realmList"
+private const val ARG_SHOW_REALM_TEXT_INPUT = "showRealmTextInput"
+
+
+/**
+ * A simple [Fragment] subclass.
+ * Use the [RealmSelectionFragment.newInstance] factory method to
+ * create an instance of this fragment.
+ */
+class RealmSelectionFragment : Fragment() {
+ private lateinit var binding: FragmentRealmSelectionBinding
+ private lateinit var parentActivity: ProjectWizardActivity
+
+ lateinit var realmArrayAdapter: ArrayAdapter<String>
+
+ private var realmList: List<String>? = null
+ private var showRealmTextInput: Boolean = false
+
+ private val mapper = jacksonObjectMapper()
+
+
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+
+ parentActivity = requireActivity() as ProjectWizardActivity
+
+ arguments?.let {
+ it.getString(ARG_REALM_LIST)?.let {
+ realmList = mapper.readValue<List<String>>(it)
+ }
+ showRealmTextInput = it.getBoolean(ARG_SHOW_REALM_TEXT_INPUT, false)
+ }
+
+ if (!realmList.isNullOrEmpty()) {
+ if (realmList!!.size == 1) {
+ parentActivity.realm = realmList!![0]
+ parentActivity.goToMainActivity(
+ parentActivity.app!!,
+ parentActivity.realm,
+ parentActivity.consoleProviders
+ )
+ }
+ }
+ }
+
+ override fun onCreateView(
+ inflater: LayoutInflater, container: ViewGroup?,
+ savedInstanceState: Bundle?
+ ): View {
+ // Inflate the layout for this fragment
+ binding = FragmentRealmSelectionBinding.inflate(inflater, container, false);
+ val view: View = binding.root
+
+ if (showRealmTextInput) {
+ binding.realmInputLayout.visibility = View.VISIBLE
+ binding.realmInput.doOnTextChanged { text, start, before, count ->
+ parentActivity.realm = text.toString()
+ }
+ } else {
+ if (realmList != null) {
+ realmArrayAdapter = ArrayAdapter(
+ requireActivity(),
+ android.R.layout.simple_spinner_dropdown_item,
+ realmList!!
+ )
+ binding.realmSpinner.adapter = realmArrayAdapter
+ binding.realmSpinner.visibility = View.VISIBLE
+
+ binding.realmSpinner.onItemSelectedListener =
+ object : AdapterView.OnItemSelectedListener {
+ override fun onItemSelected(
+ parent: AdapterView<*>?,
+ view: View?,
+ position: Int,
+ id: Long
+ ) {
+ parentActivity.realm = realmArrayAdapter.getItem(position)
+ }
+
+ override fun onNothingSelected(p0: AdapterView<*>?) {
+ parentActivity.realm = null
+ }
+ }
+ } else {
+ binding.realmInputLayout.visibility = View.VISIBLE
+ binding.realmInput.doOnTextChanged { text, start, before, count ->
+ parentActivity.realm = text.toString()
+ }
+ }
+ }
+
+ binding.finishButton.setOnClickListener {
+ if (parentActivity.realm != null) {
+ parentActivity.goToMainActivity(
+ parentActivity.app!!,
+ parentActivity.realm,
+ parentActivity.consoleProviders
+ )
+ } else {
+ parentActivity.runOnUiThread {
+ binding.errorView.visibility = View.VISIBLE
+ binding.errorTextView.text = getString(R.string.select_realm_first)
+ }
+ }
+ }
+
+ binding.backButton.setOnClickListener {
+ parentFragmentManager.popBackStack()
+ }
+
+ return view
+ }
+
+ companion object {
+ /**
+ * Use this factory method to create a new instance of
+ * this fragment using the provided parameters.
+ *
+ * @return A new instance of fragment RealmSelectionFragment.
+ */
+ @JvmStatic
+ fun newInstance(realmList: List<String>?, showRealmTextInput: Boolean = false) =
+ RealmSelectionFragment().apply {
+ arguments = Bundle().apply {
+ realmList?.let {
+ putString(ARG_REALM_LIST, mapper.writeValueAsString(it))
+ }
+ putBoolean(ARG_SHOW_REALM_TEXT_INPUT, showRealmTextInput)
+ }
+ }
+ }
+}
diff --git a/console/android/GenericApp/app/src/main/java/io/openremote/app/ui/SplashActivity.kt b/console/android/GenericApp/app/src/main/java/io/openremote/app/ui/SplashActivity.kt
index 5aa1e0853..860fbff42 100644
--- a/console/android/GenericApp/app/src/main/java/io/openremote/app/ui/SplashActivity.kt
+++ b/console/android/GenericApp/app/src/main/java/io/openremote/app/ui/SplashActivity.kt
@@ -1,17 +1,21 @@
package io.openremote.app.ui
+import android.annotation.SuppressLint
import android.app.Activity
import android.content.Intent
import android.content.SharedPreferences
import android.os.Bundle
import androidx.preference.PreferenceManager
import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
+import com.fasterxml.jackson.module.kotlin.readValue
import io.openremote.app.databinding.ActivitySplashBinding
+import io.openremote.app.model.ProjectItem
+import io.openremote.app.util.Constants
import io.openremote.orlib.ORConstants
-import io.openremote.orlib.network.ApiManager
import io.openremote.orlib.ui.OrMainActivity
import io.openremote.orlib.ui.OrPrivacyPolicyActivity
+@SuppressLint("CustomSplashScreen")
class SplashActivity : Activity() {
object SplashActivityConstants {
@@ -20,6 +24,7 @@ class SplashActivity : Activity() {
private lateinit var binding: ActivitySplashBinding
private lateinit var sharedPreferences: SharedPreferences
+ private lateinit var projectItems: MutableList<ProjectItem>
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
@@ -28,6 +33,19 @@ class SplashActivity : Activity() {
setContentView(view)
sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this)
+ projectItems = sharedPreferences.getString(Constants.PROJECT_LIST, null)?.let {
+ jacksonObjectMapper().readValue<List<ProjectItem>>(it).toMutableList()
+ } ?: mutableListOf()
+
+ intent.extras?.apply {
+ this.getString(ORConstants.CLEAR_URL)?.apply {
+ projectItems.removeIf { it.url == this }
+ sharedPreferences
+ .edit()
+ .putString(Constants.PROJECT_LIST, jacksonObjectMapper().writeValueAsString(projectItems))
+ .apply()
+ }
+ }
val privacyPolicyAccepted = sharedPreferences.getBoolean("privacyPolicyAccepted", false)
@@ -40,34 +58,30 @@ class SplashActivity : Activity() {
}
private fun startNextActivity() {
- val host = sharedPreferences.getString(ORConstants.HOST_KEY, null)
- val realm = sharedPreferences.getString(ORConstants.REALM_KEY, null)
-
- if (!host.isNullOrBlank() && !realm.isNullOrBlank()) {
- val url = host.plus("/api/${realm}")
- val apiManager = ApiManager(url)
- apiManager.getAppConfig(realm) { statusCode, appConfig, error ->
- if (statusCode in 200..299) {
- val intent = Intent(this@SplashActivity, OrMainActivity::class.java)
- intent.putExtra(ORConstants.APP_CONFIG_KEY, jacksonObjectMapper().writeValueAsString(appConfig))
- intent.putExtra(ORConstants.BASE_URL_KEY, host)
- startActivity(intent)
- finish()
- } else {
- startActivity(Intent(this@SplashActivity, ProjectActivity::class.java))
- finish()
- }
+ when {
+ projectItems.size == 1 -> {
+ val intent = Intent(this, OrMainActivity::class.java)
+ intent.putExtra(ORConstants.BASE_URL_KEY, projectItems[0].url)
+ startActivity(intent)
+ finish()
+ }
+ projectItems.size > 1 -> {
+ startActivity(Intent(this@SplashActivity, ProjectListActivity::class.java))
+ finish()
+ }
+ else -> {
+ startActivity(Intent(this@SplashActivity, ProjectWizardActivity::class.java))
+ finish()
}
- } else {
- startActivity(Intent(this@SplashActivity, ProjectActivity::class.java))
- finish()
}
}
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
- if(requestCode == SplashActivityConstants.SHOW_CONDITIONS_REQUEST) {
+ if (requestCode == SplashActivityConstants.SHOW_CONDITIONS_REQUEST) {
if (resultCode == RESULT_OK) {
- sharedPreferences.edit().putBoolean("privacyPolicyAccepted", true).apply()
+ sharedPreferences.edit()
+ .putBoolean("privacyPolicyAccepted", true)
+ .apply()
startNextActivity()
}
}
diff --git a/console/android/GenericApp/app/src/main/java/io/openremote/app/util/Constants.kt b/console/android/GenericApp/app/src/main/java/io/openremote/app/util/Constants.kt
new file mode 100644
index 000000000..bb302ee22
--- /dev/null
+++ b/console/android/GenericApp/app/src/main/java/io/openremote/app/util/Constants.kt
@@ -0,0 +1,5 @@
+package io.openremote.app.util
+
+object Constants {
+ const val PROJECT_LIST = "PROJECT_LIST"
+}
diff --git a/console/android/GenericApp/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/console/android/GenericApp/app/src/main/res/drawable-v24/ic_launcher_foreground.xml
deleted file mode 100644
index 2b068d114..000000000
--- a/console/android/GenericApp/app/src/main/res/drawable-v24/ic_launcher_foreground.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-<vector xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:aapt="http://schemas.android.com/aapt"
- android:width="108dp"
- android:height="108dp"
- android:viewportWidth="108"
- android:viewportHeight="108">
- <path android:pathData="M31,63.928c0,0 6.4,-11 12.1,-13.1c7.2,-2.6 26,-1.4 26,-1.4l38.1,38.1L107,108.928l-32,-1L31,63.928z">
- <aapt:attr name="android:fillColor">
- <gradient
- android:endX="85.84757"
- android:endY="92.4963"
- android:startX="42.9492"
- android:startY="49.59793"
- android:type="linear">
- <item
- android:color="#44000000"
- android:offset="0.0" />
- <item
- android:color="#00000000"
- android:offset="1.0" />
- </gradient>
- </aapt:attr>
- </path>
- <path
- android:fillColor="#FFFFFF"
- android:fillType="nonZero"
- android:pathData="M65.3,45.828l3.8,-6.6c0.2,-0.4 0.1,-0.9 -0.3,-1.1c-0.4,-0.2 -0.9,-0.1 -1.1,0.3l-3.9,6.7c-6.3,-2.8 -13.4,-2.8 -19.7,0l-3.9,-6.7c-0.2,-0.4 -0.7,-0.5 -1.1,-0.3C38.8,38.328 38.7,38.828 38.9,39.228l3.8,6.6C36.2,49.428 31.7,56.028 31,63.928h46C76.3,56.028 71.8,49.428 65.3,45.828zM43.4,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2c-0.3,-0.7 -0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C45.3,56.528 44.5,57.328 43.4,57.328L43.4,57.328zM64.6,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2s-0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C66.5,56.528 65.6,57.328 64.6,57.328L64.6,57.328z"
- android:strokeWidth="1"
- android:strokeColor="#00000000" />
-</vector>
\ No newline at end of file
diff --git a/console/android/GenericApp/app/src/main/res/drawable/action_item_border.xml b/console/android/GenericApp/app/src/main/res/drawable/action_item_border.xml
new file mode 100644
index 000000000..55cb93418
--- /dev/null
+++ b/console/android/GenericApp/app/src/main/res/drawable/action_item_border.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
+ <corners android:radius="10dp"/>
+ <padding android:left="10dp" android:right="10dp" android:top="10dp" android:bottom="10dp"/>
+ <stroke android:width="1dp" android:color="#CCCCCC"/>
+</shape>
diff --git a/console/android/GenericApp/app/src/main/res/drawable/empty.xml b/console/android/GenericApp/app/src/main/res/drawable/empty.xml
deleted file mode 100644
index a8b409b1d..000000000
--- a/console/android/GenericApp/app/src/main/res/drawable/empty.xml
+++ /dev/null
@@ -1,4 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<selector xmlns:android="http://schemas.android.com/apk/res/android">
-
-</selector>
\ No newline at end of file
diff --git a/console/android/GenericApp/app/src/main/res/drawable/ic_alert_circle.xml b/console/android/GenericApp/app/src/main/res/drawable/ic_alert_circle.xml
new file mode 100644
index 000000000..36f59680c
--- /dev/null
+++ b/console/android/GenericApp/app/src/main/res/drawable/ic_alert_circle.xml
@@ -0,0 +1,10 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24"
+ android:viewportHeight="24">
+ <path
+ android:pathData="M13,13L11,13L11,7L13,7M13,17L11,17L11,15L13,15M12,2C6.477,2 2,6.477 2,12C2,17.523 6.477,22 12,22C17.523,22 22,17.523 22,12C22,6.477 17.523,2 12,2Z"
+ android:fillColor="#a07171"
+ android:strokeColor="#00000000"/>
+</vector>
diff --git a/console/android/GenericApp/app/src/main/res/drawable/ic_launcher_foreground.xml b/console/android/GenericApp/app/src/main/res/drawable/ic_launcher_foreground.xml
new file mode 100644
index 000000000..38953c956
--- /dev/null
+++ b/console/android/GenericApp/app/src/main/res/drawable/ic_launcher_foreground.xml
@@ -0,0 +1,20 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="108dp"
+ android:height="108dp"
+ android:viewportWidth="108"
+ android:viewportHeight="108">
+ <group android:scaleX="0.11364796"
+ android:scaleY="0.11364796"
+ android:translateX="24.906122"
+ android:translateY="24.906122">
+ <path
+ android:pathData="M255.99,485.99c-126.81,0 -229.99,-103.16 -229.99,-229.99h48.17c0,100.27 81.57,181.84 181.83,181.84s181.84,-81.57 181.84,-181.84S356.26,74.17 255.99,74.17V26.01c126.82,0 230.01,103.18 230.01,229.99s-103.18,229.99 -230.01,229.99h0Z"
+ android:fillColor="#c2d500"/>
+ <path
+ android:pathData="M221.17,422.85c-44.55,-9.28 -82.85,-35.39 -107.79,-73.47 -24.94,-38.08 -33.56,-83.63 -24.25,-128.19 9.31,-44.58 35.41,-82.85 73.49,-107.79 38.1,-24.95 83.61,-33.57 128.2,-24.25 92.02,19.2 151.26,109.66 132.04,201.65l-47.14,-9.81c13.76,-66.02 -28.73,-130.92 -94.76,-144.7 -31.99,-6.68 -64.64,-0.5 -91.96,17.41 -27.33,17.88 -46.05,45.35 -52.74,77.34 -6.65,31.97 -0.49,64.63 17.42,91.96 17.88,27.33 45.34,46.06 77.34,52.72l-9.86,47.14h0Z"
+ android:fillColor="#4c9c2e"/>
+ <path
+ android:pathData="M256.14,366.5c-1.86,0 -3.72,-0.04 -5.61,-0.12 -29.46,-1.48 -56.61,-14.34 -76.43,-36.21 -19.82,-21.88 -29.94,-50.16 -28.46,-79.66l48.08,2.39c-0.82,16.64 4.88,32.6 16.07,44.95 11.17,12.35 26.52,19.6 43.13,20.42 16.57,0.75 32.6,-4.88 44.93,-16.06 12.35,-11.16 19.6,-26.49 20.43,-43.12 1.7,-34.34 -24.86,-63.67 -59.2,-65.37l2.4,-48.1c60.87,3.02 107.92,54.98 104.91,115.85 -1.47,29.48 -14.33,56.62 -36.2,76.44 -20.49,18.55 -46.6,28.59 -74.05,28.59h0Z"
+ android:fillColor="#1a5632"/>
+ </group>
+</vector>
diff --git a/console/android/GenericApp/app/src/main/res/drawable/ic_logo_full_no_text_colour.xml b/console/android/GenericApp/app/src/main/res/drawable/ic_logo_full_no_text_colour.xml
new file mode 100644
index 000000000..1ea4d8cff
--- /dev/null
+++ b/console/android/GenericApp/app/src/main/res/drawable/ic_logo_full_no_text_colour.xml
@@ -0,0 +1,48 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="347.69dp"
+ android:height="88.5dp"
+ android:viewportWidth="347.69"
+ android:viewportHeight="88.5">
+ <path
+ android:pathData="M92.34,32.64c7.3,0 12.94,6.18 12.94,12.94s-5.55,12.94 -12.94,12.94 -12.85,-6.09 -12.85,-12.76c0,-7.8 6.36,-13.12 12.85,-13.12ZM92.39,55.68c4.78,0 9.74,-3.79 9.74,-10.23s-5.5,-9.96 -9.74,-9.96c-4.51,0 -9.74,3.7 -9.74,10.23 0,5.73 4.64,9.96 9.74,9.96Z"
+ android:fillColor="#006225"/>
+ <path
+ android:pathData="M164.22,32.75h3.16v4.19h0.09c0.95,-1.49 3.38,-3.8 7.57,-3.8 3.02,0 5.55,0.77 7.8,3.03 1.85,1.81 3.07,4.66 3.07,8.73v13.62h-3.16v-13.62c0,-3.21 -0.99,-5.47 -2.35,-6.79 -1.71,-1.67 -3.97,-2.13 -5.37,-2.13s-3.65,0.45 -5.37,2.13c-1.35,1.31 -2.34,3.57 -2.3,6.79v13.62h-3.16v-25.78Z"
+ android:fillColor="#006225"/>
+ <path
+ android:pathData="M190.17,33.5h5.5v2.21h0.09c1.13,-1.62 2.25,-3.07 5.37,-3.07h0.5v5.82c-5.45,0.23 -5.45,4.51 -5.45,6v14.07h-6v-25.02Z"
+ android:fillColor="#49a942"/>
+ <path
+ android:pathData="M270.2,45.45c0,-7.58 6.18,-13.39 13.35,-13.39s13.26,5.64 13.26,13.3c0,8.21 -6.31,13.39 -13.26,13.39 -7.44,0 -13.35,-6.13 -13.35,-13.3ZM290.8,45.49c0,-4.55 -3.52,-7.94 -7.26,-7.94 -3.11,0 -7.35,2.66 -7.35,7.89 0,4.73 3.56,7.8 7.35,7.8 4.37,0 7.26,-3.79 7.26,-7.75Z"
+ android:fillColor="#49a942"/>
+ <path
+ android:pathData="M300.29,38.23h-3.5v-5.32h3.5v-8.34h6v8.34h3.61v5.32h-3.61v19.7h-6v-19.7Z"
+ android:fillColor="#49a942"/>
+ <path
+ android:pathData="M256.86,32.81c-3.05,0 -5.81,1.33 -7.8,3.47 -1.99,-2.14 -4.75,-3.47 -7.8,-3.47 -6.05,0 -10.97,5.22 -10.97,11.64v14.33h6.29v-14.33c0,-2.95 2.1,-5.34 4.67,-5.34s4.48,2.19 4.65,4.95c0,0.13 -0.02,0.26 -0.02,0.39v14.33h6.3v-0.04h0.04v-14.29c0,-0.13 -0.01,-0.26 -0.02,-0.39 0.18,-2.76 2.19,-4.95 4.65,-4.95s4.67,2.4 4.67,5.34v14.29h6.29v-14.29c0,-6.42 -4.92,-11.64 -10.97,-11.64Z"
+ android:fillColor="#49a942"/>
+ <path
+ android:pathData="M107.92,33.25h3.16v33.35h-3.16z"
+ android:fillColor="#006225"/>
+ <path
+ android:pathData="M120.79,32.64c-6.49,0 -12.85,5.3 -12.87,13.08h3.16c0,-6.54 5.24,-10.24 9.75,-10.24 4.25,0 9.75,3.47 9.75,9.96s-4.97,10.23 -9.75,10.23c-2.38,0 -4.65,-0.93 -6.4,-2.49v3.61c1.86,1.08 4.03,1.72 6.36,1.72 7.41,0 12.96,-6.22 12.96,-12.94s-5.65,-12.94 -12.96,-12.94Z"
+ android:fillColor="#006225"/>
+ <path
+ android:pathData="M159.6,38.95c-1.76,-3.07 -5.59,-6.27 -11,-6.31 -7.17,0.13 -12.8,6 -12.8,12.98s5.95,12.89 12.85,12.89c5.68,0 10.41,-3.74 12.13,-8.66h-3.34c-1.13,3.07 -4.33,5.73 -8.84,5.82 -4.82,0 -9.33,-4.1 -9.56,-8.93h0c-0.14,-1.31 -0.19,-3.28 0.47,-4.77h0c1.55,-4.46 5.7,-6.5 9.12,-6.5 3.92,0 8.66,2.62 9.65,8.43h-14.15v2.84h17.35c0.14,-2.39 -0.23,-5.14 -1.89,-7.8Z"
+ android:fillColor="#006225"/>
+ <path
+ android:pathData="M227.79,45.08c0,-6.31 -5,-13.16 -12.94,-13.16s-13.16,6.49 -13.16,13.57 5.77,13.26 13.21,13.26c5.86,0 10.64,-4.19 12.08,-8.7h-6.31c-1.13,2.07 -3.11,3.2 -5.77,3.2 -4.15,0 -6.47,-3.29 -6.86,-4.97 -0.36,-1.11 -0.72,-2.93 -0.21,-4.99h-0.01c0.03,-0.12 0.07,-0.23 0.1,-0.35 0.01,-0.04 0.02,-0.07 0.03,-0.11 1.26,-4.26 4.81,-5.41 6.95,-5.41 2.97,0 6.09,1.85 6.76,5.86h-10.53v4.82h16.3c0.18,-0.81 0.36,-1.85 0.36,-3.02Z"
+ android:fillColor="#49a942"/>
+ <path
+ android:pathData="M335.97,45.08c0,-6.31 -5,-13.16 -12.94,-13.16s-13.17,6.49 -13.17,13.57 5.77,13.26 13.21,13.26c5.86,0 10.64,-4.19 12.08,-8.7h-6.31c-1.13,2.07 -3.11,3.2 -5.77,3.2 -4.14,0 -6.47,-3.29 -6.86,-4.97 -0.36,-1.11 -0.72,-2.93 -0.21,-4.99h-0.01c0.03,-0.12 0.07,-0.23 0.1,-0.35 0.01,-0.04 0.02,-0.07 0.03,-0.11 1.26,-4.26 4.81,-5.41 6.95,-5.41 2.98,0 6.09,1.85 6.76,5.86h-10.91v4.82h16.68c0.18,-0.81 0.36,-1.85 0.36,-3.02Z"
+ android:fillColor="#49a942"/>
+ <path
+ android:pathData="M38.8,73.19c-17.32,0 -31.42,-14.09 -31.42,-31.42h6.58c0,13.7 11.14,24.84 24.84,24.84s24.84,-11.14 24.84,-24.84 -11.14,-24.84 -24.84,-24.84v-6.58c17.32,0 31.42,14.09 31.42,31.41s-14.09,31.42 -31.42,31.42h0Z"
+ android:fillColor="#c1d82f"/>
+ <path
+ android:pathData="M34.04,64.57c-6.09,-1.27 -11.32,-4.83 -14.72,-10.04 -3.41,-5.2 -4.58,-11.42 -3.31,-17.51 1.27,-6.09 4.84,-11.32 10.04,-14.72 5.2,-3.41 11.42,-4.58 17.51,-3.31 12.57,2.62 20.66,14.98 18.04,27.54l-6.44,-1.34c1.88,-9.02 -3.93,-17.88 -12.94,-19.77 -4.37,-0.91 -8.83,-0.07 -12.56,2.38 -3.73,2.44 -6.29,6.19 -7.2,10.56 -0.91,4.37 -0.07,8.83 2.38,12.56 2.44,3.73 6.19,6.29 10.56,7.2l-1.34,6.44h0Z"
+ android:fillColor="#49a942"/>
+ <path
+ android:pathData="M38.82,56.87c-0.25,0 -0.51,0 -0.77,-0.02 -4.02,-0.2 -7.73,-1.96 -10.44,-4.95 -2.71,-2.99 -4.09,-6.85 -3.89,-10.88l6.57,0.33c-0.11,2.27 0.67,4.45 2.2,6.14 1.53,1.69 3.62,2.68 5.89,2.79 2.26,0.1 4.45,-0.67 6.14,-2.19 1.69,-1.52 2.68,-3.62 2.79,-5.89 0.23,-4.69 -3.4,-8.7 -8.09,-8.93l0.33,-6.57c8.32,0.41 14.74,7.51 14.33,15.82 -0.2,4.03 -1.96,7.73 -4.95,10.44 -2.8,2.53 -6.37,3.91 -10.11,3.91h0Z"
+ android:fillColor="#006225"/>
+</vector>
diff --git a/console/android/GenericApp/app/src/main/res/drawable/ic_plus_green.xml b/console/android/GenericApp/app/src/main/res/drawable/ic_plus_green.xml
new file mode 100644
index 000000000..a286070ba
--- /dev/null
+++ b/console/android/GenericApp/app/src/main/res/drawable/ic_plus_green.xml
@@ -0,0 +1,10 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24"
+ android:viewportHeight="24">
+ <path
+ android:pathData="M19,13L13,13L13,19L11,19L11,13L5,13L5,11L11,11L11,5L13,5L13,11L19,11L19,13Z"
+ android:fillColor="#49a942"
+ android:strokeColor="#00000000"/>
+</vector>
diff --git a/console/android/GenericApp/app/src/main/res/drawable/rounded_corner.xml b/console/android/GenericApp/app/src/main/res/drawable/rounded_corner.xml
new file mode 100644
index 000000000..ba949aa93
--- /dev/null
+++ b/console/android/GenericApp/app/src/main/res/drawable/rounded_corner.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android">
+ <corners android:radius="10dp"/>
+ <solid android:color="@color/medium_green"></solid>
+</shape>
diff --git a/console/android/GenericApp/app/src/main/res/layout/activity_project.xml b/console/android/GenericApp/app/src/main/res/layout/activity_project.xml
deleted file mode 100644
index 9f4c24931..000000000
--- a/console/android/GenericApp/app/src/main/res/layout/activity_project.xml
+++ /dev/null
@@ -1,112 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<androidx.constraintlayout.widget.ConstraintLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:app="http://schemas.android.com/apk/res-auto"
- xmlns:tools="http://schemas.android.com/tools"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:background="@color/white"
- android:padding="@dimen/box_inset_layout_padding"
- tools:context=".ui.ProjectActivity"
- tools:deviceIds="wear">
-
-
- <ImageView
- android:id="@+id/imageView"
- android:layout_width="0dp"
- android:layout_height="240dp"
- android:layout_marginStart="24dp"
- android:layout_marginTop="24dp"
- android:layout_marginEnd="24dp"
- android:src="@drawable/or_logo"
- app:layout_constraintEnd_toEndOf="parent"
- app:layout_constraintStart_toStartOf="parent"
- app:layout_constraintTop_toTopOf="parent" />
-
- <TextView
- android:id="@+id/textView"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginStart="24dp"
- android:layout_marginTop="32dp"
- android:layout_marginEnd="24dp"
- android:text="Connect to your application"
- android:textAppearance="@style/TextAppearance.AppCompat.Large"
- app:layout_constraintEnd_toEndOf="parent"
- app:layout_constraintStart_toStartOf="parent"
- app:layout_constraintTop_toBottomOf="@+id/imageView" />
-
- <com.google.android.material.textfield.TextInputLayout
- android:id="@+id/project_input_layout"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginStart="24dp"
- android:layout_marginTop="24dp"
- android:layout_marginEnd="24dp"
- android:hint="Project"
- app:layout_constraintEnd_toEndOf="parent"
- app:layout_constraintStart_toStartOf="parent"
- app:layout_constraintTop_toBottomOf="@+id/textView"
- android:padding="5dp"
- app:boxCornerRadiusBottomEnd="8dp"
- app:boxCornerRadiusTopEnd="8dp"
- app:boxCornerRadiusBottomStart="8dp"
- app:boxCornerRadiusTopStart="8dp"
- android:background="@color/bright_grey">
-
- <com.google.android.material.textfield.TextInputEditText
- android:id="@+id/project_input"
- android:layout_width="match_parent"
- android:layout_height="40dp"
- android:singleLine="true"
- android:imeOptions="actionNext"/>
- </com.google.android.material.textfield.TextInputLayout>
-
- <com.google.android.material.textfield.TextInputLayout
- android:id="@+id/realm_input_layout"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginStart="24dp"
- android:layout_marginTop="16dp"
- android:layout_marginEnd="24dp"
- android:hint="Realm"
- app:layout_constraintEnd_toEndOf="parent"
- app:layout_constraintStart_toStartOf="parent"
- app:layout_constraintTop_toBottomOf="@+id/project_input_layout"
- android:padding="5dp"
- android:background="@color/bright_grey">
-
- <com.google.android.material.textfield.TextInputEditText
- android:id="@+id/realm_input"
- android:layout_width="match_parent"
- android:layout_height="40dp"
- android:singleLine="true"
- android:imeOptions="actionGo"/>
- </com.google.android.material.textfield.TextInputLayout>
-
- <Button
- android:id="@+id/connect_button"
- android:layout_width="100dp"
- android:layout_height="wrap_content"
- android:layout_marginTop="24dp"
- android:layout_marginEnd="24dp"
- android:background="@color/medium_green"
- android:text="Connect"
- android:textColor="@color/white"
- app:layout_constraintEnd_toEndOf="parent"
- app:layout_constraintTop_toBottomOf="@+id/realm_input_layout" />
-
- <ProgressBar
- android:id="@+id/progressBar"
- style="@style/Widget.AppCompat.ProgressBar"
- android:layout_width="48dp"
- android:layout_height="wrap_content"
- android:layout_alignParentTop="true"
- android:background="@android:color/transparent"
- android:visibility="invisible"
- app:layout_constraintBottom_toBottomOf="parent"
- app:layout_constraintEnd_toEndOf="parent"
- app:layout_constraintStart_toStartOf="parent"
- app:layout_constraintTop_toTopOf="parent" />
-
-</androidx.constraintlayout.widget.ConstraintLayout>
diff --git a/console/android/GenericApp/app/src/main/res/layout/activity_project_list.xml b/console/android/GenericApp/app/src/main/res/layout/activity_project_list.xml
new file mode 100644
index 000000000..aa8184a8a
--- /dev/null
+++ b/console/android/GenericApp/app/src/main/res/layout/activity_project_list.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="utf-8"?>
+<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ tools:context=".ui.ProjectListActivity">
+
+ <com.google.android.material.appbar.AppBarLayout
+ android:id="@+id/app_bar"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toTopOf="parent">
+
+ <androidx.appcompat.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/settings_toolbar"
+ android:layout_width="match_parent"
+ android:layout_height="?actionBarSize"
+ android:background="@color/bright_grey">
+
+ <ImageView
+ android:layout_width="180dp"
+ android:layout_height="36dp"
+ android:src="@drawable/ic_logo_full_no_text_colour" />
+
+ </androidx.appcompat.widget.Toolbar>
+ </com.google.android.material.appbar.AppBarLayout>
+
+ <androidx.recyclerview.widget.RecyclerView
+ android:id="@+id/projectList"
+ android:layout_width="match_parent"
+ android:layout_height="0dp"
+ app:layout_constraintTop_toBottomOf="@+id/app_bar"
+ tools:listitem="@layout/row_project_item" />
+
+</androidx.constraintlayout.widget.ConstraintLayout>
diff --git a/console/android/GenericApp/app/src/main/res/layout/activity_project_wizard.xml b/console/android/GenericApp/app/src/main/res/layout/activity_project_wizard.xml
new file mode 100644
index 000000000..348aa69e1
--- /dev/null
+++ b/console/android/GenericApp/app/src/main/res/layout/activity_project_wizard.xml
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="utf-8"?>
+<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:background="@color/bright_grey"
+ android:padding="@dimen/box_inset_layout_padding"
+ tools:context=".ui.ProjectWizardActivity"
+ tools:deviceIds="wear">
+
+ <LinearLayout
+ android:id="@+id/imageView"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:paddingTop="24dp"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toTopOf="parent">
+
+ <ImageView
+ android:id="@+id/image"
+ android:layout_width="48dp"
+ android:layout_height="48dp"
+ android:layout_marginStart="24dp"
+ android:layout_marginEnd="24dp"
+ android:src="@drawable/or_splash" />
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="match_parent"
+ android:text="@string/connect_to_app"
+ android:gravity="center_vertical"
+ android:textSize="24sp" />
+
+ </LinearLayout>
+ <androidx.fragment.app.FragmentContainerView
+ android:id="@+id/fragmentContainer"
+ android:layout_width="match_parent"
+ android:layout_height="0dp"
+ android:layout_marginTop="24dp"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintTop_toBottomOf="@+id/imageView" />
+
+ <ProgressBar
+ android:id="@+id/progressBar"
+ style="@style/Widget.AppCompat.ProgressBar"
+ android:layout_width="48dp"
+ android:layout_height="wrap_content"
+ android:layout_alignParentTop="true"
+ android:background="@android:color/transparent"
+ android:visibility="invisible"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toTopOf="parent" />
+
+</androidx.constraintlayout.widget.ConstraintLayout>
diff --git a/console/android/GenericApp/app/src/main/res/layout/fragment_app_selection.xml b/console/android/GenericApp/app/src/main/res/layout/fragment_app_selection.xml
new file mode 100644
index 000000000..21ee459b2
--- /dev/null
+++ b/console/android/GenericApp/app/src/main/res/layout/fragment_app_selection.xml
@@ -0,0 +1,151 @@
+<?xml version="1.0" encoding="utf-8"?>
+<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ tools:context=".ui.HostSelectionFragment">
+
+ <androidx.cardview.widget.CardView
+ android:id="@+id/card_view"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginStart="24dp"
+ android:layout_marginEnd="24dp"
+ app:cardCornerRadius="8dp"
+ app:cardElevation="0dp"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toTopOf="parent">
+
+ <androidx.constraintlayout.widget.ConstraintLayout
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+
+ <TextView
+ android:id="@+id/input_title"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginStart="10dp"
+ android:layout_marginTop="10dp"
+ android:text="@string/select_an_app"
+ android:textStyle="bold"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toTopOf="parent" />
+
+ <androidx.cardview.widget.CardView
+ android:id="@+id/error_view"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="7dp"
+ android:layout_marginBottom="7dp"
+ android:visibility="gone"
+ app:cardBackgroundColor="@color/error_red_background"
+ app:cardCornerRadius="8dp"
+ app:cardElevation="0dp"
+ app:layout_constraintBottom_toTopOf="@+id/input_barrier"
+ app:layout_constraintEnd_toEndOf="@id/next_button"
+ app:layout_constraintStart_toStartOf="@id/input_title"
+ app:layout_constraintTop_toBottomOf="@+id/input_title">
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:layout_gravity="center_vertical"
+ android:padding="14dp">
+
+ <ImageView
+ android:layout_width="36dp"
+ android:layout_height="36dp"
+ android:layout_gravity="center_vertical"
+ android:src="@drawable/ic_alert_circle" />
+
+ <TextView
+ android:id="@+id/error_text_view"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:layout_marginStart="10dp"
+ android:gravity="center_vertical"
+ android:text="@string/could_not_connect_to_domain"
+ android:textColor="@color/error_red_text"
+ android:textSize="16sp"
+ android:textStyle="bold" />
+ </LinearLayout>
+
+ </androidx.cardview.widget.CardView>
+
+ <androidx.constraintlayout.widget.Barrier
+ android:id="@+id/input_barrier"
+ android:layout_width="0dp"
+ android:layout_height="0dp"
+ app:barrierDirection="bottom"
+ app:constraint_referenced_ids="app_spinner, app_input_layout"
+ app:layout_constraintEnd_toEndOf="@+id/next_button"
+ app:layout_constraintStart_toStartOf="@+id/input_title"
+ app:layout_constraintTop_toBottomOf="@id/error_view" />
+
+ <Spinner
+ android:id="@+id/app_spinner"
+ android:layout_width="0dp"
+ android:layout_height="60dp"
+ android:layout_marginTop="14dp"
+ android:background="@color/bright_grey"
+ android:visibility="gone"
+ app:layout_constraintEnd_toEndOf="@+id/next_button"
+ app:layout_constraintStart_toStartOf="@+id/input_title"
+ app:layout_constraintTop_toBottomOf="@id/error_view" />
+
+ <com.google.android.material.textfield.TextInputLayout
+ android:id="@+id/app_input_layout"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="14dp"
+ android:background="@color/bright_grey"
+ android:hint="@string/app"
+ android:padding="5dp"
+ android:visibility="gone"
+ app:layout_constraintEnd_toEndOf="@id/next_button"
+ app:layout_constraintStart_toStartOf="@id/input_title"
+ app:layout_constraintTop_toBottomOf="@id/error_view">
+
+ <com.google.android.material.textfield.TextInputEditText
+ android:id="@+id/app_input"
+ android:layout_width="match_parent"
+ android:layout_height="40dp"
+ android:singleLine="true" />
+ </com.google.android.material.textfield.TextInputLayout>
+
+ <Button
+ android:id="@+id/next_button"
+ android:layout_width="100dp"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="14dp"
+ android:layout_marginEnd="14dp"
+ android:layout_marginBottom="14dp"
+ android:background="@drawable/rounded_corner"
+ android:text="@string/next"
+ android:textColor="@color/white"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintTop_toBottomOf="@+id/input_barrier" />
+
+ <Button
+ android:id="@+id/back_button"
+ style="?android:attr/borderlessButtonStyle"
+ android:layout_width="100dp"
+ android:layout_height="wrap_content"
+ android:layout_marginStart="14dp"
+ android:layout_marginTop="14dp"
+ android:layout_marginBottom="14dp"
+ android:background="@color/white"
+ android:text="@string/back"
+ android:textColor="@color/medium_grey"
+ android:textStyle="bold"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@+id/input_barrier" />
+ </androidx.constraintlayout.widget.ConstraintLayout>
+ </androidx.cardview.widget.CardView>
+
+</androidx.constraintlayout.widget.ConstraintLayout>
+
diff --git a/console/android/GenericApp/app/src/main/res/layout/fragment_host_selection.xml b/console/android/GenericApp/app/src/main/res/layout/fragment_host_selection.xml
new file mode 100644
index 000000000..f1e81bb36
--- /dev/null
+++ b/console/android/GenericApp/app/src/main/res/layout/fragment_host_selection.xml
@@ -0,0 +1,132 @@
+<?xml version="1.0" encoding="utf-8"?>
+<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ tools:context=".ui.HostSelectionFragment">
+
+ <androidx.cardview.widget.CardView
+ android:id="@+id/card_view"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginStart="24dp"
+ android:layout_marginEnd="24dp"
+ app:cardCornerRadius="8dp"
+ app:cardElevation="0dp"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toTopOf="parent">
+
+ <androidx.constraintlayout.widget.ConstraintLayout
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+
+ <TextView
+ android:id="@+id/input_title"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginStart="10dp"
+ android:layout_marginTop="10dp"
+ android:text="@string/enter_app_domain"
+ android:textStyle="bold"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toTopOf="parent" />
+
+ <androidx.cardview.widget.CardView
+ android:id="@+id/error_view"
+ android:layout_width="0dp"
+ android:layout_height="80dp"
+ android:layout_marginTop="7dp"
+ android:layout_marginBottom="7dp"
+ android:visibility="gone"
+ app:cardBackgroundColor="@color/error_red_background"
+ app:cardCornerRadius="8dp"
+ app:cardElevation="0dp"
+ app:layout_constraintBottom_toTopOf="@+id/project_input_layout"
+ app:layout_constraintEnd_toEndOf="@id/project_input_layout"
+ app:layout_constraintStart_toStartOf="@id/input_title"
+ app:layout_constraintTop_toBottomOf="@+id/input_title">
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:layout_gravity="center_vertical"
+ android:padding="14dp">
+
+ <ImageView
+ android:layout_width="36dp"
+ android:layout_height="36dp"
+ android:layout_gravity="center_vertical"
+ android:src="@drawable/ic_alert_circle" />
+
+ <TextView
+ android:id="@+id/error_text_view"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:layout_marginStart="10dp"
+ android:gravity="center_vertical"
+ android:text="@string/could_not_connect_to_domain"
+ android:textColor="@color/error_red_text"
+ android:textSize="16sp"
+ android:textStyle="bold" />
+ </LinearLayout>
+
+ </androidx.cardview.widget.CardView>
+
+ <com.google.android.material.textfield.TextInputLayout
+ android:id="@+id/project_input_layout"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="14dp"
+ android:background="@color/bright_grey"
+ android:hint="@string/domain"
+ android:padding="5dp"
+ app:boxCornerRadiusBottomEnd="8dp"
+ app:boxCornerRadiusBottomStart="8dp"
+ app:boxCornerRadiusTopEnd="8dp"
+ app:boxCornerRadiusTopStart="8dp"
+ app:layout_constraintEnd_toEndOf="@id/connect_button"
+ app:layout_constraintStart_toStartOf="@+id/input_title"
+ app:layout_constraintTop_toBottomOf="@id/error_view">
+
+ <com.google.android.material.textfield.TextInputEditText
+ android:id="@+id/host_input"
+ android:layout_width="match_parent"
+ android:layout_height="40dp"
+ android:singleLine="true" />
+ </com.google.android.material.textfield.TextInputLayout>
+
+ <Button
+ android:id="@+id/connect_button"
+ android:layout_width="100dp"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="14dp"
+ android:layout_marginEnd="14dp"
+ android:layout_marginBottom="14dp"
+ android:background="@drawable/rounded_corner"
+ android:text="@string/next"
+ android:textColor="@color/white"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintTop_toBottomOf="@+id/project_input_layout" />
+
+ <Button
+ android:id="@+id/back_button"
+ style="?android:attr/borderlessButtonStyle"
+ android:layout_width="100dp"
+ android:layout_height="wrap_content"
+ android:layout_marginStart="14dp"
+ android:layout_marginTop="14dp"
+ android:layout_marginBottom="14dp"
+ android:background="@color/white"
+ android:text="@string/back"
+ android:textColor="@color/medium_grey"
+ android:textStyle="bold"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@+id/project_input_layout" />
+ </androidx.constraintlayout.widget.ConstraintLayout>
+ </androidx.cardview.widget.CardView>
+
+</androidx.constraintlayout.widget.ConstraintLayout>
diff --git a/console/android/GenericApp/app/src/main/res/layout/fragment_realm_selection.xml b/console/android/GenericApp/app/src/main/res/layout/fragment_realm_selection.xml
new file mode 100644
index 000000000..453c99097
--- /dev/null
+++ b/console/android/GenericApp/app/src/main/res/layout/fragment_realm_selection.xml
@@ -0,0 +1,150 @@
+<?xml version="1.0" encoding="utf-8"?>
+<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ tools:context=".ui.HostSelectionFragment">
+
+ <androidx.cardview.widget.CardView
+ android:id="@+id/card_view"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginStart="24dp"
+ android:layout_marginEnd="24dp"
+ app:cardCornerRadius="8dp"
+ app:cardElevation="0dp"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toTopOf="parent">
+
+ <androidx.constraintlayout.widget.ConstraintLayout
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+
+ <TextView
+ android:id="@+id/input_title"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginStart="10dp"
+ android:layout_marginTop="10dp"
+ android:text="@string/select_the_realm"
+ android:textStyle="bold"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toTopOf="parent" />
+
+ <androidx.cardview.widget.CardView
+ android:id="@+id/error_view"
+ android:layout_width="0dp"
+ android:layout_height="80dp"
+ android:layout_marginTop="7dp"
+ android:layout_marginBottom="7dp"
+ android:visibility="gone"
+ app:cardBackgroundColor="@color/error_red_background"
+ app:cardCornerRadius="8dp"
+ app:cardElevation="0dp"
+ app:layout_constraintBottom_toTopOf="@+id/input_barrier"
+ app:layout_constraintEnd_toEndOf="@id/finish_button"
+ app:layout_constraintStart_toStartOf="@id/input_title"
+ app:layout_constraintTop_toBottomOf="@+id/input_title">
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:layout_gravity="center_vertical"
+ android:padding="14dp">
+
+ <ImageView
+ android:layout_width="36dp"
+ android:layout_height="36dp"
+ android:layout_gravity="center_vertical"
+ android:src="@drawable/ic_alert_circle" />
+
+ <TextView
+ android:id="@+id/error_text_view"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:layout_marginStart="10dp"
+ android:gravity="center_vertical"
+ android:text="@string/could_not_connect_to_domain"
+ android:textColor="@color/error_red_text"
+ android:textSize="16sp"
+ android:textStyle="bold" />
+ </LinearLayout>
+
+ </androidx.cardview.widget.CardView>
+
+ <androidx.constraintlayout.widget.Barrier
+ android:id="@+id/input_barrier"
+ android:layout_width="0dp"
+ android:layout_height="0dp"
+ app:barrierDirection="bottom"
+ app:constraint_referenced_ids="realm_spinner, realm_input_layout"
+ app:layout_constraintEnd_toEndOf="@+id/finish_button"
+ app:layout_constraintStart_toStartOf="@+id/input_title"
+ app:layout_constraintTop_toBottomOf="@id/error_view" />
+
+ <Spinner
+ android:id="@+id/realm_spinner"
+ android:layout_width="0dp"
+ android:layout_height="60dp"
+ android:layout_marginTop="14dp"
+ android:background="@color/bright_grey"
+ android:visibility="gone"
+ app:layout_constraintEnd_toEndOf="@+id/finish_button"
+ app:layout_constraintStart_toStartOf="@+id/input_title"
+ app:layout_constraintTop_toBottomOf="@id/error_view" />
+
+ <com.google.android.material.textfield.TextInputLayout
+ android:id="@+id/realm_input_layout"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="14dp"
+ android:background="@color/bright_grey"
+ android:hint="@string/realm"
+ android:padding="5dp"
+ android:visibility="gone"
+ app:layout_constraintEnd_toEndOf="@id/finish_button"
+ app:layout_constraintStart_toStartOf="@id/input_title"
+ app:layout_constraintTop_toBottomOf="@id/error_view">
+
+ <com.google.android.material.textfield.TextInputEditText
+ android:id="@+id/realm_input"
+ android:layout_width="match_parent"
+ android:layout_height="40dp"
+ android:singleLine="true" />
+ </com.google.android.material.textfield.TextInputLayout>
+
+ <Button
+ android:id="@+id/finish_button"
+ android:layout_width="100dp"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="14dp"
+ android:layout_marginEnd="14dp"
+ android:layout_marginBottom="14dp"
+ android:background="@drawable/rounded_corner"
+ android:text="@string/finish"
+ android:textColor="@color/white"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintTop_toBottomOf="@+id/input_barrier" />
+
+ <Button
+ android:id="@+id/back_button"
+ style="?android:attr/borderlessButtonStyle"
+ android:layout_width="100dp"
+ android:layout_height="wrap_content"
+ android:layout_marginStart="14dp"
+ android:layout_marginTop="14dp"
+ android:layout_marginBottom="14dp"
+ android:background="@color/white"
+ android:text="@string/back"
+ android:textColor="@color/medium_grey"
+ android:textStyle="bold"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@+id/input_barrier" />
+ </androidx.constraintlayout.widget.ConstraintLayout>
+ </androidx.cardview.widget.CardView>
+
+</androidx.constraintlayout.widget.ConstraintLayout>
diff --git a/console/android/GenericApp/app/src/main/res/layout/menu_item.xml b/console/android/GenericApp/app/src/main/res/layout/menu_item.xml
new file mode 100644
index 000000000..8043f1d91
--- /dev/null
+++ b/console/android/GenericApp/app/src/main/res/layout/menu_item.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:clickable="true">
+
+ <LinearLayout
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:background="@drawable/action_item_border">
+
+ <ImageView
+ android:id="@+id/imageViewEdit"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:src="@drawable/ic_plus_green" />
+
+ <TextView
+ android:id="@+id/tvEdit"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center_vertical"
+ android:layout_marginStart="5dp"
+ android:text="@string/add"
+ android:textColor="@color/medium_green"
+ android:textStyle="bold" />
+ </LinearLayout>
+</LinearLayout>
diff --git a/console/android/GenericApp/app/src/main/res/layout/row_project_item.xml b/console/android/GenericApp/app/src/main/res/layout/row_project_item.xml
new file mode 100644
index 000000000..675eb909d
--- /dev/null
+++ b/console/android/GenericApp/app/src/main/res/layout/row_project_item.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="utf-8"?>
+<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ app:cardElevation="3dp"
+ android:elevation="3dp">
+ <androidx.constraintlayout.widget.ConstraintLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content">
+ <TextView
+ android:id="@+id/host"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="12dp"
+ android:layout_marginStart="12dp"
+ android:textStyle="bold"
+ android:text="host"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toTopOf="parent" />
+
+ <TextView
+ android:id="@+id/app"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginStart="12dp"
+ android:layout_marginBottom="12dp"
+ android:text="app"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@id/host" />
+
+ <TextView
+ android:id="@+id/realm"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginStart="12dp"
+ android:paddingBottom="12dp"
+ android:text="realm"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@id/app" />
+ </androidx.constraintlayout.widget.ConstraintLayout>
+</androidx.cardview.widget.CardView>
diff --git a/console/android/GenericApp/app/src/main/res/menu/projects_menu.xml b/console/android/GenericApp/app/src/main/res/menu/projects_menu.xml
new file mode 100644
index 000000000..007d0ddc6
--- /dev/null
+++ b/console/android/GenericApp/app/src/main/res/menu/projects_menu.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<menu xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto">
+
+ <item
+ android:id="@+id/add"
+ app:actionLayout="@layout/menu_item"
+ android:title="@string/add"
+ app:showAsAction="always">
+ </item>
+</menu>
+
+
diff --git a/console/android/GenericApp/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/console/android/GenericApp/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
deleted file mode 100644
index 036d09bc5..000000000
--- a/console/android/GenericApp/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
- <background android:drawable="@color/ic_launcher_background"/>
- <foreground android:drawable="@mipmap/ic_launcher_foreground"/>
-</adaptive-icon>
\ No newline at end of file
diff --git a/console/android/GenericApp/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/console/android/GenericApp/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
deleted file mode 100644
index 036d09bc5..000000000
--- a/console/android/GenericApp/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
- <background android:drawable="@color/ic_launcher_background"/>
- <foreground android:drawable="@mipmap/ic_launcher_foreground"/>
-</adaptive-icon>
\ No newline at end of file
diff --git a/console/android/GenericApp/app/src/main/res/mipmap-hdpi/ic_launcher.png b/console/android/GenericApp/app/src/main/res/mipmap-hdpi/ic_launcher.png
deleted file mode 100644
index 54cd86b46..000000000
Binary files a/console/android/GenericApp/app/src/main/res/mipmap-hdpi/ic_launcher.png and /dev/null differ
diff --git a/console/android/GenericApp/app/src/main/res/mipmap-hdpi/ic_launcher_round.png b/console/android/GenericApp/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
deleted file mode 100644
index 396d1025a..000000000
Binary files a/console/android/GenericApp/app/src/main/res/mipmap-hdpi/ic_launcher_round.png and /dev/null differ
diff --git a/console/android/GenericApp/app/src/main/res/mipmap-mdpi/ic_launcher.png b/console/android/GenericApp/app/src/main/res/mipmap-mdpi/ic_launcher.png
deleted file mode 100644
index 70392d057..000000000
Binary files a/console/android/GenericApp/app/src/main/res/mipmap-mdpi/ic_launcher.png and /dev/null differ
diff --git a/console/android/GenericApp/app/src/main/res/mipmap-mdpi/ic_launcher_round.png b/console/android/GenericApp/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
deleted file mode 100644
index 3a0e7a10b..000000000
Binary files a/console/android/GenericApp/app/src/main/res/mipmap-mdpi/ic_launcher_round.png and /dev/null differ
diff --git a/console/android/GenericApp/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/console/android/GenericApp/app/src/main/res/mipmap-xhdpi/ic_launcher.png
deleted file mode 100644
index 7f04802ee..000000000
Binary files a/console/android/GenericApp/app/src/main/res/mipmap-xhdpi/ic_launcher.png and /dev/null differ
diff --git a/console/android/GenericApp/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/console/android/GenericApp/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
deleted file mode 100644
index 89b0e6c8f..000000000
Binary files a/console/android/GenericApp/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png and /dev/null differ
diff --git a/console/android/GenericApp/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/console/android/GenericApp/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
deleted file mode 100644
index 57bc10b00..000000000
Binary files a/console/android/GenericApp/app/src/main/res/mipmap-xxhdpi/ic_launcher.png and /dev/null differ
diff --git a/console/android/GenericApp/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/console/android/GenericApp/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
deleted file mode 100644
index 86e48768d..000000000
Binary files a/console/android/GenericApp/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png and /dev/null differ
diff --git a/console/android/GenericApp/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/console/android/GenericApp/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
deleted file mode 100644
index 0dfb6a489..000000000
Binary files a/console/android/GenericApp/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png and /dev/null differ
diff --git a/console/android/GenericApp/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/console/android/GenericApp/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
deleted file mode 100644
index eac166b6e..000000000
Binary files a/console/android/GenericApp/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png and /dev/null differ
diff --git a/console/android/GenericApp/app/src/main/res/values/colors.xml b/console/android/GenericApp/app/src/main/res/values/colors.xml
index 8f707b9e3..ab22ee284 100644
--- a/console/android/GenericApp/app/src/main/res/values/colors.xml
+++ b/console/android/GenericApp/app/src/main/res/values/colors.xml
@@ -12,8 +12,11 @@
<item name="medium_green" type="color">#ff49a942</item>
<item name="light_green" type="color">#ffc1d72f</item>
+ <item name="error_red_background" type="color">#FFE4E4</item>
+ <item name="error_red_text" type="color">#A07171</item>
+
<item name="red" type="color">#ffe64a19</item>
<item name="yellow" type="color">#fffbc02d</item>
<item name="blue" type="color">#ff1976d2</item>
<item name="purple" type="color">#ff660092</item>
-</resources>
\ No newline at end of file
+</resources>
diff --git a/console/android/GenericApp/app/src/main/res/values/strings.xml b/console/android/GenericApp/app/src/main/res/values/strings.xml
index 53ada05a1..9bdc0fdf9 100644
--- a/console/android/GenericApp/app/src/main/res/values/strings.xml
+++ b/console/android/GenericApp/app/src/main/res/values/strings.xml
@@ -22,4 +22,23 @@
<string name="background_location_decline">No</string>
<string name="background_location_accept">Yes</string>
<string name="button_accept">Accept</string>
-</resources>
\ No newline at end of file
+ <string name="domain">Domain</string>
+ <string name="next">Next</string>
+ <string name="back">Back</string>
+ <string name="connect_to_app">Connect to your app</string>
+ <string name="enter_app_domain">ENTER THE APP DOMAIN</string>
+ <string name="could_not_connect_to_domain">Could not connect to domain.\nPlease verify address.</string>
+ <string name="select_an_app">SELECT AN APP</string>
+ <string name="app">App</string>
+ <string name="select_the_realm">SELECT THE REALM</string>
+ <string name="realm">Realm</string>
+ <string name="finish">Finish</string>
+ <!-- TODO: Remove or change this placeholder text -->
+ <string name="hello_blank_fragment">Hello blank fragment</string>
+ <string name="select_app_first">Select app first</string>
+ <string name="error_getting_app_info">Error getting app info</string>
+ <string name="select_realm_first">Select realm first</string>
+ <string name="app_incompatible">Console app isn\'t compatible with the Generic OR app</string>
+ <string name="no_apps_found">No apps found on this domain</string>
+ <string name="add">ADD</string>
+</resources>
diff --git a/console/android/GenericApp/app/src/main/res/values/styles.xml b/console/android/GenericApp/app/src/main/res/values/styles.xml
index b911207b3..1384d75d6 100644
--- a/console/android/GenericApp/app/src/main/res/values/styles.xml
+++ b/console/android/GenericApp/app/src/main/res/values/styles.xml
@@ -7,4 +7,11 @@
<item name="colorAccent">@color/light_green</item>
</style>
-</resources>
\ No newline at end of file
+ <style name="OpenRemoteThemeWithBar" parent="Theme.AppCompat.Light">
+ <item name="android:actionMenuTextColor">@color/dark_grey</item>
+ <item name="colorPrimary">@color/medium_green</item>
+ <item name="colorPrimaryDark">@color/dark_green</item>
+ <item name="colorAccent">@color/light_green</item>
+ </style>
+
+</resources>
diff --git a/console/android/GenericApp/app/src/main/res/xml/shortcuts.xml b/console/android/GenericApp/app/src/main/res/xml/shortcuts.xml
index fb91052d4..e4c53f28a 100644
--- a/console/android/GenericApp/app/src/main/res/xml/shortcuts.xml
+++ b/console/android/GenericApp/app/src/main/res/xml/shortcuts.xml
@@ -8,12 +8,8 @@
android:shortcutShortLabel="@string/Settings">
<intent
android:action="android.intent.action.VIEW"
- android:targetClass="io.openremote.app.ui.SplashActivity"
- android:targetPackage="io.openremote.app" />
- <intent
- android:action="CLEAR_SETTINGS"
- android:targetClass="io.openremote.app.ui.ProjectActivity"
+ android:targetClass="io.openremote.app.ui.ProjectListActivity"
android:targetPackage="io.openremote.app" />
</shortcut>
-</shortcuts>
\ No newline at end of file
+</shortcuts>
diff --git a/console/android/GenericApp/build.gradle b/console/android/GenericApp/build.gradle
index 7f7e152db..9e290db35 100644
--- a/console/android/GenericApp/build.gradle
+++ b/console/android/GenericApp/build.gradle
@@ -1,12 +1,12 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
- ext.kotlin_version = "1.6.10"
+ ext.kotlin_version = "1.7.0"
repositories {
google()
jcenter()
}
dependencies {
- classpath 'com.android.tools.build:gradle:7.1.3'
+ classpath 'com.android.tools.build:gradle:7.2.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.10'
// NOTE: Do not place your application dependencies here; they belong
diff --git a/console/android/ORLib/build.gradle b/console/android/ORLib/build.gradle
index ab19f0b86..7dcface32 100644
--- a/console/android/ORLib/build.gradle
+++ b/console/android/ORLib/build.gradle
@@ -4,12 +4,12 @@ plugins {
}
android {
- compileSdkVersion 31
- buildToolsVersion "30.0.3"
+ compileSdkVersion 32
+ buildToolsVersion "32.0.0"
defaultConfig {
minSdkVersion 25
- targetSdkVersion 31
+ targetSdkVersion 32
versionCode 1
versionName "1.0"
@@ -37,13 +37,13 @@ android {
dependencies {
- implementation 'androidx.core:core-ktx:1.7.0'
- implementation 'androidx.appcompat:appcompat:1.4.1'
- implementation 'com.google.android.material:material:1.5.0'
+ implementation 'androidx.core:core-ktx:1.8.0'
+ implementation 'androidx.appcompat:appcompat:1.4.2'
+ implementation 'com.google.android.material:material:1.6.1'
implementation 'androidx.preference:preference-ktx:1.2.0'
- implementation "com.google.android.gms:play-services-location:19.0.1"
+ implementation "com.google.android.gms:play-services-location:20.0.0"
implementation 'com.google.android.gms:play-services-vision:20.1.3'
- implementation 'com.fasterxml.jackson.module:jackson-module-kotlin:2.13.1'
+ implementation "com.fasterxml.jackson.module:jackson-module-kotlin:2.13.1"
implementation platform('com.google.firebase:firebase-bom:26.0.0')
implementation 'com.google.firebase:firebase-messaging-ktx'
}
diff --git a/console/android/ORLib/src/main/java/io/openremote/orlib/ORConstants.kt b/console/android/ORLib/src/main/java/io/openremote/orlib/ORConstants.kt
index dd288d297..eb0928f6a 100644
--- a/console/android/ORLib/src/main/java/io/openremote/orlib/ORConstants.kt
+++ b/console/android/ORLib/src/main/java/io/openremote/orlib/ORConstants.kt
@@ -7,8 +7,9 @@ object ORConstants {
const val ACTION_BROADCAST = "ACTION_BROADCAST"
const val PUSH_PROVIDER_DISABLED_KEY = "PushProviderDisabled"
const val CONSOLE_ID_KEY = "consoleId"
- const val APP_CONFIG_KEY = "APP_CONFIG_KEY"
const val BASE_URL_KEY = "BASE_URL_KEY"
const val HOST_KEY = "host"
const val REALM_KEY = "realm"
+ const val CLEAR_URL = "CLEAR_URL"
+ const val APP_CONFIG_KEY = "APP_CONFIG_KEY"
}
diff --git a/console/android/ORLib/src/main/java/io/openremote/orlib/service/GeofenceProvider.kt b/console/android/ORLib/src/main/java/io/openremote/orlib/service/GeofenceProvider.kt
index d108e076d..71b7e6761 100644
--- a/console/android/ORLib/src/main/java/io/openremote/orlib/service/GeofenceProvider.kt
+++ b/console/android/ORLib/src/main/java/io/openremote/orlib/service/GeofenceProvider.kt
@@ -165,7 +165,7 @@ class GeofenceProvider(val context: Context) {
private val locationUpdateCallback: LocationCallback by lazy {
object : LocationCallback() {
override fun onLocationResult(locationResult: LocationResult) {
- locationResult.lastLocation.let {
+ locationResult.lastLocation?.let {
locationClient.removeLocationUpdates(this)
locationCallback?.accept(
hashMapOf(
diff --git a/console/android/ORLib/src/main/java/io/openremote/orlib/service/GeofenceTransitionsIntentService.kt b/console/android/ORLib/src/main/java/io/openremote/orlib/service/GeofenceTransitionsIntentService.kt
index 665c83e9d..b8a94c542 100644
--- a/console/android/ORLib/src/main/java/io/openremote/orlib/service/GeofenceTransitionsIntentService.kt
+++ b/console/android/ORLib/src/main/java/io/openremote/orlib/service/GeofenceTransitionsIntentService.kt
@@ -25,7 +25,7 @@ class GeofenceTransitionsIntentService : BroadcastReceiver() {
override fun onReceive(context: Context?, intent: Intent?) {
- val geofencingEvent = GeofencingEvent.fromIntent(intent!!)
+ val geofencingEvent = GeofencingEvent.fromIntent(intent!!) ?: return
if (geofencingEvent.hasError()) {
LOG.warning("Geofence event error : ${geofencingEvent.errorCode}")
@@ -43,7 +43,7 @@ class GeofenceTransitionsIntentService : BroadcastReceiver() {
val geofenceTransition = geofencingEvent.geofenceTransition
val trans = if (geofenceTransition == Geofence.GEOFENCE_TRANSITION_ENTER) "ENTER" else "EXIT"
- geofencingEvent.triggeringGeofences.forEach { geofence ->
+ geofencingEvent.triggeringGeofences?.forEach { geofence ->
val geofenceDefinition = geofenceDefinitions.firstOrNull { it.id == geofence.requestId }
if (geofenceDefinition != null) {
diff --git a/console/android/ORLib/src/main/java/io/openremote/orlib/ui/OrMainActivity.kt b/console/android/ORLib/src/main/java/io/openremote/orlib/ui/OrMainActivity.kt
index 94789711f..b55680d13 100644
--- a/console/android/ORLib/src/main/java/io/openremote/orlib/ui/OrMainActivity.kt
+++ b/console/android/ORLib/src/main/java/io/openremote/orlib/ui/OrMainActivity.kt
@@ -7,35 +7,28 @@ import android.app.DownloadManager
import android.content.*
import android.content.pm.ApplicationInfo
import android.content.pm.PackageManager
-import android.content.res.ColorStateList
import android.graphics.Bitmap
-import android.graphics.Color
import android.net.ConnectivityManager
import android.net.Uri
+import android.net.http.SslError
import android.os.*
import android.view.KeyEvent
import android.view.View
-import android.view.ViewGroup
-import android.view.WindowManager
import android.webkit.*
import android.webkit.ConsoleMessage.MessageLevel
import android.webkit.WebView.WebViewTransport
import android.widget.ProgressBar
-import android.widget.RelativeLayout
import android.widget.Toast
-import androidx.appcompat.widget.PopupMenu
import androidx.core.content.ContextCompat
import androidx.preference.PreferenceManager
import com.fasterxml.jackson.core.JsonProcessingException
import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
-import com.google.android.material.floatingactionbutton.FloatingActionButton
import com.google.firebase.messaging.FirebaseMessaging
import io.openremote.orlib.ORConstants
+import io.openremote.orlib.ORConstants.CLEAR_URL
import io.openremote.orlib.ORConstants.BASE_URL_KEY
import io.openremote.orlib.R
import io.openremote.orlib.databinding.ActivityOrMainBinding
-import io.openremote.orlib.models.ORAppConfig
-import io.openremote.orlib.network.ApiManager
import io.openremote.orlib.service.GeofenceProvider
import io.openremote.orlib.service.QrScannerProvider
import org.json.JSONException
@@ -68,9 +61,10 @@ open class OrMainActivity : Activity() {
private var geofenceProvider: GeofenceProvider? = null
private var qrScannerProvider: QrScannerProvider? = null
private var consoleId: String? = null
- private var appConfig: ORAppConfig? = null
+ private var connectFailCount: Int = 0
+ private var connectFailResetHandler: Handler? = null
+ private var connectFailResetRunnable: Runnable? = null
private var baseUrl: String? = null
-
private var onDownloadCompleteReceiver: BroadcastReceiver = object : BroadcastReceiver() {
override fun onReceive(ctxt: Context, intent: Intent) {
val action = intent.action
@@ -81,34 +75,6 @@ open class OrMainActivity : Activity() {
}
}
- private val clientUrl: String?
- get() {
- var returnValue: String? = null
-
- if (appConfig != null) {
- if (URLUtil.isValidUrl(appConfig!!.initialUrl)) {
- return appConfig!!.initialUrl
- } else {
- sharedPreferences.let { pref ->
- pref.getString(ORConstants.HOST_KEY, null)?.let { host ->
- return host.plus(appConfig!!.initialUrl)
- }
- }
- }
- }
-
-
- sharedPreferences.let { pref ->
- pref.getString(ORConstants.HOST_KEY, null)?.let { host ->
- pref.getString(ORConstants.REALM_KEY, null)?.let { realm ->
- returnValue = host.plus("/api/${realm}")
- }
- }
- }
-
- return returnValue
- }
-
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
binding = ActivityOrMainBinding.inflate(layoutInflater)
@@ -140,138 +106,39 @@ open class OrMainActivity : Activity() {
progressBar?.max = 100
progressBar?.progress = 1
- if (intent.hasExtra(ORConstants.APP_CONFIG_KEY)) {
- appConfig = mapper.readValue(
- intent.getStringExtra(ORConstants.APP_CONFIG_KEY),
- ORAppConfig::class.java
- )
+
+ if (intent.hasExtra(ORConstants.BASE_URL_KEY)) {
+ baseUrl = intent.getStringExtra(ORConstants.BASE_URL_KEY)
}
-
+
if (intent.hasExtra(BASE_URL_KEY)) {
baseUrl = intent.getStringExtra(BASE_URL_KEY)
}
- if (appConfig == null) {
sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this)
val host = sharedPreferences.getString(ORConstants.HOST_KEY, null)
val realm = sharedPreferences.getString(ORConstants.REALM_KEY, null)
- if (!host.isNullOrBlank() && !realm.isNullOrBlank()) {
- val url = host.plus("/api/${realm}")
- val apiManager = ApiManager(url)
- apiManager.getAppConfig(realm) { statusCode, appConfig, error ->
- if (statusCode in 200..299) {
- this.appConfig = appConfig
- processAppConfig()
- }
+
openIntentUrl(intent)
- }
- }
- } else {
- processAppConfig()
- openIntentUrl(intent)
- }
+
+
}
override fun onNewIntent(intent: Intent) {
openIntentUrl(intent)
}
- protected fun processAppConfig() {
- if (appConfig != null) {
-
- if (!appConfig!!.primaryColor.isNullOrBlank()) {
- window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS)
- window.statusBarColor = Color.parseColor(appConfig!!.primaryColor!!)
-
- progressBar?.progressTintList =
- ColorStateList.valueOf(Color.parseColor(appConfig!!.primaryColor!!))
- }
-
- if (appConfig!!.menuEnabled && !appConfig!!.links.isNullOrEmpty()) {
- val floatingActionButton = FloatingActionButton(this)
-
- val layoutParams = RelativeLayout.LayoutParams(
- ViewGroup.LayoutParams.WRAP_CONTENT,
- ViewGroup.LayoutParams.WRAP_CONTENT
- )
-
- val margin = 36
- when (appConfig!!.menuPosition) {
- "BOTTOM_RIGHT" -> {
- layoutParams.addRule(RelativeLayout.ALIGN_PARENT_END)
- layoutParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM)
- layoutParams.marginEnd = margin
- layoutParams.bottomMargin = margin
- }
- "TOP_RIGHT" -> {
- layoutParams.addRule(RelativeLayout.ALIGN_PARENT_END)
- layoutParams.addRule(RelativeLayout.ALIGN_PARENT_TOP)
- layoutParams.marginEnd = margin
- layoutParams.topMargin = margin
- }
- "TOP_LEFT" -> {
- layoutParams.addRule(RelativeLayout.ALIGN_PARENT_START)
- layoutParams.addRule(RelativeLayout.ALIGN_PARENT_TOP)
- layoutParams.marginStart = margin
- layoutParams.topMargin = margin
- }
- else -> {
- layoutParams.addRule(RelativeLayout.ALIGN_PARENT_START)
- layoutParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM)
- layoutParams.marginStart = margin
- layoutParams.bottomMargin = margin
- }
- }
- floatingActionButton.layoutParams = layoutParams
- floatingActionButton.setImageResource(R.drawable.ic_menu)
- if (!appConfig!!.primaryColor.isNullOrBlank()) {
- try {
- floatingActionButton.backgroundTintList =
- ColorStateList.valueOf(Color.parseColor(appConfig!!.primaryColor!!))
- } catch (ex: java.lang.Exception) {
- ex.printStackTrace()
- }
- }
- if (!appConfig!!.secondaryColor.isNullOrBlank()) {
- try {
- floatingActionButton.imageTintList =
- ColorStateList.valueOf(Color.parseColor(appConfig!!.secondaryColor!!))
- } catch (ex: Exception) {
- floatingActionButton.imageTintList = ColorStateList.valueOf(Color.DKGRAY)
- ex.printStackTrace()
- }
- } else {
- floatingActionButton.imageTintList = ColorStateList.valueOf(Color.DKGRAY)
- }
- floatingActionButton.setOnClickListener {
- // We are showing only toast message. However, you can do anything you need.
- val popupMenu = PopupMenu(this@OrMainActivity, it)
- for ((index, link) in appConfig!!.links!!.withIndex()) {
- popupMenu.menu.add(index, index, index, link.displayText)
- }
- popupMenu.setOnMenuItemClickListener { item ->
- loadUrl(appConfig!!.links!![item.itemId].pageLink)
- true
- }
- popupMenu.show()
- }
-
- binding.activityWeb.addView(floatingActionButton)
- }
- }
- }
-
private fun openIntentUrl(intent: Intent) {
when {
intent.hasExtra("appUrl") -> {
- val url = intent.getStringExtra("appUrl")
+ val url = intent.getStringExtra("appUrl")!!
LOG.fine("Loading web view: $url")
loadUrl(url)
}
else -> {
- var url = clientUrl
+ var url = baseUrl
val intentUrl = intent.getStringExtra("appUrl")
if (intentUrl != null) {
url = if (intentUrl.startsWith("http") || intentUrl.startsWith("https")) {
@@ -281,7 +148,7 @@ open class OrMainActivity : Activity() {
}
}
LOG.fine("Loading web view: $url")
- loadUrl(url)
+ loadUrl(url!!)
}
}
}
@@ -327,9 +194,9 @@ open class OrMainActivity : Activity() {
private fun reloadWebView() {
var url = binding.webView.url
if ("about:blank" == url) {
- url = clientUrl
+ url = baseUrl
LOG.fine("Reloading web view: $url")
- loadUrl(url)
+ loadUrl(url!!)
}
}
@@ -532,14 +399,6 @@ open class OrMainActivity : Activity() {
failingUrl: String?
) {
LOG.warning("Error requesting '$failingUrl': $errorCode($description)")
- //TODO should we always ignore image errors?
- if (failingUrl != null && (failingUrl.endsWith("png")
- || failingUrl.endsWith("jpg")
- || failingUrl.endsWith("ico"))
- ) {
- LOG.info("Ignoring error loading image resource")
- return
- }
//TODO should we always ignore image errors and locale json files?
if (failingUrl != null && (failingUrl.endsWith("png")
|| failingUrl.endsWith("jpg")
@@ -551,25 +410,34 @@ open class OrMainActivity : Activity() {
}
// This will be the URL loaded into the webview itself (false for images etc. of the main page)
// Check page load error URL
- if (clientUrl != null) {
- loadUrl(clientUrl)
- Toast.makeText(this, description, Toast.LENGTH_LONG).show()
- } else {
- val launchIntent = packageManager.getLaunchIntentForPackage(packageName)
- if (launchIntent != null) {
- startActivity(launchIntent)
- finish()
- Toast.makeText(applicationContext, description, Toast.LENGTH_LONG).show()
+ if (errorCode >= 500) {
+ if (baseUrl != null && baseUrl != failingUrl && connectFailCount < 10) {
+ loadUrl(baseUrl!!)
+ Toast.makeText(this, description, Toast.LENGTH_SHORT).show()
+ connectFailCount++
+ connectFailResetRunnable?.let { connectFailResetHandler!!.removeCallbacks(it) }
+ connectFailResetRunnable = Runnable {
+ connectFailCount = 0
+ }
+ connectFailResetHandler = Looper.myLooper()?.let { Handler(it) }
+ connectFailResetHandler!!.postDelayed(connectFailResetRunnable!!, 5000)
} else {
- Toast.makeText(this, description, Toast.LENGTH_LONG).show()
+ val launchIntent = packageManager.getLaunchIntentForPackage(packageName)
+ if (launchIntent != null) {
+ launchIntent.putExtra(CLEAR_URL, baseUrl)
+ launchIntent.flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK
+ startActivity(launchIntent)
+ finish()
+ }
+ Toast.makeText(applicationContext, "The main page couldn't be opened", Toast.LENGTH_LONG).show()
}
}
}
- public fun loadUrl(url: String?) {
+ fun loadUrl(url: String) {
webViewLoaded = false
- val temp = url!!.replace(" ", "%20")
- binding.webView.loadUrl(temp)
+ val encodedUrl = url.replace(" ", "%20")
+ binding.webView.loadUrl(encodedUrl)
}
override fun onRequestPermissionsResult(
@@ -620,7 +488,6 @@ open class OrMainActivity : Activity() {
when (messageType) {
"error" -> {
LOG.fine("Received WebApp message, error: " + data?.getString("error"))
- val mainHandler = Handler(mainLooper)
Toast.makeText(
this@OrMainActivity,
"Error occurred ${data?.getString("error")}",
@@ -666,7 +533,7 @@ open class OrMainActivity : Activity() {
action.equals("PROVIDER_ENABLE", ignoreCase = true) -> {
val consoleId = data.getString("consoleId")
(activity as OrMainActivity).consoleId = consoleId
- geofenceProvider?.enable(this@OrMainActivity, clientUrl ?: "",
+ geofenceProvider?.enable(this@OrMainActivity, baseUrl ?: "",
consoleId, object : GeofenceProvider.GeofenceCallback {
override fun accept(responseData: Map<String, Any>) {
notifyClient(responseData)
diff --git a/console/iOS/GenericApp/GenericApp.xcodeproj/project.pbxproj b/console/iOS/GenericApp/GenericApp.xcodeproj/project.pbxproj
index 09e8c0434..9b4d59a30 100644
--- a/console/iOS/GenericApp/GenericApp.xcodeproj/project.pbxproj
+++ b/console/iOS/GenericApp/GenericApp.xcodeproj/project.pbxproj
@@ -7,7 +7,6 @@
objects = {
/* Begin PBXBuildFile section */
- 4C81AA642546B251006ED5DD /* ProjectViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C81AA632546B251006ED5DD /* ProjectViewController.swift */; };
4C8BA085271460B1001084A4 /* libORLib.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4C8BA084271460B1001084A4 /* libORLib.a */; };
4C8BA087271461C7001084A4 /* libORLib.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4C8BA086271461C7001084A4 /* libORLib.a */; };
4CEDA25D25405B1E00C47E3B /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 4CEDA25C25405B1E00C47E3B /* GoogleService-Info.plist */; };
@@ -22,6 +21,10 @@
878D2D19249A490400011484 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 878D2D17249A490400011484 /* LaunchScreen.storyboard */; };
878D2D27249A498900011484 /* NotificationService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 878D2D26249A498900011484 /* NotificationService.swift */; };
878D2D2B249A498900011484 /* NotificationService.appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = 878D2D24249A498900011484 /* NotificationService.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
+ 910893A0285DB30D00D4ABA7 /* WizardAppViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9108939F285DB30D00D4ABA7 /* WizardAppViewController.swift */; };
+ 910893A2285DB37C00D4ABA7 /* WizardDomainViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 910893A1285DB37C00D4ABA7 /* WizardDomainViewController.swift */; };
+ 91543FDE293FA2F20009016E /* SettingsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 91543FDD293FA2F20009016E /* SettingsViewController.swift */; };
+ 91658F952889C15D000FF05C /* WizardRealmViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 91658F942889C15D000FF05C /* WizardRealmViewController.swift */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
@@ -53,7 +56,6 @@
46FD90D41833A0E2C4C7DDA6 /* Pods-NotificationService.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-NotificationService.release.xcconfig"; path = "Target Support Files/Pods-NotificationService/Pods-NotificationService.release.xcconfig"; sourceTree = "<group>"; };
4C38E9C02548089A00E381C6 /* OpenRemote.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = OpenRemote.entitlements; sourceTree = "<group>"; };
4C38E9C12548090200E381C6 /* NotificationService.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = NotificationService.entitlements; sourceTree = "<group>"; };
- 4C81AA632546B251006ED5DD /* ProjectViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProjectViewController.swift; sourceTree = "<group>"; };
4C8BA084271460B1001084A4 /* libORLib.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = libORLib.a; sourceTree = BUILT_PRODUCTS_DIR; };
4C8BA086271461C7001084A4 /* libORLib.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = libORLib.a; sourceTree = BUILT_PRODUCTS_DIR; };
4CEDA25C25405B1E00C47E3B /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = "<group>"; };
@@ -72,6 +74,11 @@
878D2D26249A498900011484 /* NotificationService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationService.swift; sourceTree = "<group>"; };
878D2D28249A498900011484 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
878D2D30249A4D3700011484 /* ORLib.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = ORLib.framework; sourceTree = BUILT_PRODUCTS_DIR; };
+ 9108939F285DB30D00D4ABA7 /* WizardAppViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WizardAppViewController.swift; sourceTree = "<group>"; };
+ 910893A1285DB37C00D4ABA7 /* WizardDomainViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WizardDomainViewController.swift; sourceTree = "<group>"; };
+ 91543FDD293FA2F20009016E /* SettingsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsViewController.swift; sourceTree = "<group>"; };
+ 91658F8F28897BC0000FF05C /* README.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = "<group>"; };
+ 91658F942889C15D000FF05C /* WizardRealmViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WizardRealmViewController.swift; sourceTree = "<group>"; };
A994B3D3E3853BA4D16AA5A8 /* Pods-GenericApp.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-GenericApp.debug.xcconfig"; path = "Target Support Files/Pods-GenericApp/Pods-GenericApp.debug.xcconfig"; sourceTree = "<group>"; };
D61E1E0434CC1446EAF20BA0 /* Pods-GenericApp.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-GenericApp.release.xcconfig"; path = "Target Support Files/Pods-GenericApp/Pods-GenericApp.release.xcconfig"; sourceTree = "<group>"; };
/* End PBXFileReference section */
@@ -120,6 +127,7 @@
878D2D00249A490300011484 = {
isa = PBXGroup;
children = (
+ 91658F8F28897BC0000FF05C /* README.md */,
878D2D0B249A490300011484 /* GenericApp */,
878D2D25249A498900011484 /* NotificationService */,
878D2D0A249A490300011484 /* Products */,
@@ -176,7 +184,10 @@
isa = PBXGroup;
children = (
4CEDA2CD254075D400C47E3B /* SplashViewController.swift */,
- 4C81AA632546B251006ED5DD /* ProjectViewController.swift */,
+ 9108939F285DB30D00D4ABA7 /* WizardAppViewController.swift */,
+ 910893A1285DB37C00D4ABA7 /* WizardDomainViewController.swift */,
+ 91658F942889C15D000FF05C /* WizardRealmViewController.swift */,
+ 91543FDD293FA2F20009016E /* SettingsViewController.swift */,
);
path = UI;
sourceTree = "<group>";
@@ -363,9 +374,12 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
+ 91658F952889C15D000FF05C /* WizardRealmViewController.swift in Sources */,
4CF3439127A13F2200EB5A0E /* String+Utils.swift in Sources */,
- 4C81AA642546B251006ED5DD /* ProjectViewController.swift in Sources */,
+ 91543FDE293FA2F20009016E /* SettingsViewController.swift in Sources */,
878D2D0D249A490300011484 /* AppDelegate.swift in Sources */,
+ 910893A0285DB30D00D4ABA7 /* WizardAppViewController.swift in Sources */,
+ 910893A2285DB37C00D4ABA7 /* WizardDomainViewController.swift in Sources */,
4CEDA2CE254075D400C47E3B /* SplashViewController.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
@@ -524,17 +538,17 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_ENTITLEMENTS = GenericApp/OpenRemote.entitlements;
CODE_SIGN_STYLE = Automatic;
- CURRENT_PROJECT_VERSION = 31;
+ CURRENT_PROJECT_VERSION = 34;
DEVELOPMENT_ASSET_PATHS = "";
DEVELOPMENT_TEAM = 4AC88KZHJZ;
ENABLE_PREVIEWS = YES;
INFOPLIST_FILE = GenericApp/Info.plist;
- IPHONEOS_DEPLOYMENT_TARGET = 13.2;
+ IPHONEOS_DEPLOYMENT_TARGET = 14.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
- MARKETING_VERSION = 1.0.6;
+ MARKETING_VERSION = 1.0.7;
PRODUCT_BUNDLE_IDENTIFIER = io.openremote.app;
PRODUCT_NAME = OpenRemote;
SWIFT_VERSION = 5.0;
@@ -550,17 +564,17 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_ENTITLEMENTS = GenericApp/OpenRemote.entitlements;
CODE_SIGN_STYLE = Automatic;
- CURRENT_PROJECT_VERSION = 31;
+ CURRENT_PROJECT_VERSION = 34;
DEVELOPMENT_ASSET_PATHS = "";
DEVELOPMENT_TEAM = 4AC88KZHJZ;
ENABLE_PREVIEWS = YES;
INFOPLIST_FILE = GenericApp/Info.plist;
- IPHONEOS_DEPLOYMENT_TARGET = 13.2;
+ IPHONEOS_DEPLOYMENT_TARGET = 14.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
- MARKETING_VERSION = 1.0.6;
+ MARKETING_VERSION = 1.0.7;
PRODUCT_BUNDLE_IDENTIFIER = io.openremote.app;
PRODUCT_NAME = OpenRemote;
SWIFT_VERSION = 5.0;
@@ -575,7 +589,7 @@
APPLICATION_EXTENSION_API_ONLY = YES;
CODE_SIGN_ENTITLEMENTS = NotificationService/NotificationService.entitlements;
CODE_SIGN_STYLE = Automatic;
- CURRENT_PROJECT_VERSION = 31;
+ CURRENT_PROJECT_VERSION = 34;
DEVELOPMENT_TEAM = 4AC88KZHJZ;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
@@ -597,13 +611,13 @@
"\"${PODS_CONFIGURATION_BUILD_DIR}/MaterialComponents\"",
);
INFOPLIST_FILE = NotificationService/Info.plist;
- IPHONEOS_DEPLOYMENT_TARGET = 13.2;
+ IPHONEOS_DEPLOYMENT_TARGET = 14.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
- MARKETING_VERSION = 1.0.5;
+ MARKETING_VERSION = 1.0.7;
PRODUCT_BUNDLE_IDENTIFIER = io.openremote.app.NotificationService;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
@@ -619,7 +633,7 @@
APPLICATION_EXTENSION_API_ONLY = YES;
CODE_SIGN_ENTITLEMENTS = NotificationService/NotificationService.entitlements;
CODE_SIGN_STYLE = Automatic;
- CURRENT_PROJECT_VERSION = 31;
+ CURRENT_PROJECT_VERSION = 34;
DEVELOPMENT_TEAM = 4AC88KZHJZ;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
@@ -641,13 +655,13 @@
"\"${PODS_CONFIGURATION_BUILD_DIR}/MaterialComponents\"",
);
INFOPLIST_FILE = NotificationService/Info.plist;
- IPHONEOS_DEPLOYMENT_TARGET = 13.2;
+ IPHONEOS_DEPLOYMENT_TARGET = 14.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
- MARKETING_VERSION = 1.0.5;
+ MARKETING_VERSION = 1.0.7;
PRODUCT_BUNDLE_IDENTIFIER = io.openremote.app.NotificationService;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
diff --git a/console/iOS/GenericApp/GenericApp/AppDelegate.swift b/console/iOS/GenericApp/GenericApp/AppDelegate.swift
index 3cecdf62a..272703711 100644
--- a/console/iOS/GenericApp/GenericApp/AppDelegate.swift
+++ b/console/iOS/GenericApp/GenericApp/AppDelegate.swift
@@ -78,7 +78,11 @@ class AppDelegate: UIResponder, UIApplicationDelegate, URLSessionDelegate {
userDefaults?.removeObject(forKey: DefaultsKey.projectKey)
userDefaults?.removeObject(forKey: DefaultsKey.realmKey)
- self.window?.rootViewController?.dismiss(animated: true, completion: nil)
+
+ // TODO: try displaying a simple image
+
+ (self.window?.rootViewController as? SplashViewController)?.displaySettings = true
+ self.window?.rootViewController?.dismiss(animated: false)
}
}
diff --git a/console/iOS/GenericApp/GenericApp/Storyboard.storyboard b/console/iOS/GenericApp/GenericApp/Storyboard.storyboard
index 66dfabc80..eb446322b 100644
--- a/console/iOS/GenericApp/GenericApp/Storyboard.storyboard
+++ b/console/iOS/GenericApp/GenericApp/Storyboard.storyboard
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="19529" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="oDU-zF-Uvs">
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="21507" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="oDU-zF-Uvs">
<device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
- <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="19519"/>
+ <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="21505"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="System colors in document resources" minToolsVersion="11.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
@@ -20,114 +20,362 @@
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
</view>
<connections>
- <segue destination="i2l-kx-xKH" kind="presentation" identifier="goToProjectView" modalPresentationStyle="fullScreen" id="PNL-Mf-RkC"/>
<segue destination="HSA-l5-YFF" kind="presentation" identifier="goToWebView" modalPresentationStyle="fullScreen" id="5Oq-tw-rj7"/>
+ <segue destination="7TF-fh-Sa5" kind="presentation" identifier="goToWizardDomainView" modalPresentationStyle="fullScreen" id="ttr-A8-IEy"/>
+ <segue destination="uoK-29-uZr" kind="presentation" identifier="goToSettingsView" modalPresentationStyle="fullScreen" id="PCt-br-aki"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="Afh-RU-OvJ" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
- <point key="canvasLocation" x="53" y="375"/>
+ <point key="canvasLocation" x="-13220" y="-1923"/>
</scene>
- <!--Project View Controller-->
- <scene sceneID="VQ6-6b-t86">
+ <!--Viewcontroller-->
+ <scene sceneID="liA-xA-sIe">
+ <objects>
+ <viewController id="HSA-l5-YFF" customClass="ORViewcontroller" customModule="ORLib" sceneMemberID="viewController">
+ <view key="view" contentMode="scaleToFill" id="iMh-t6-rOs">
+ <rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
+ <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+ <viewLayoutGuide key="safeArea" id="eSh-1f-zrb"/>
+ <color key="backgroundColor" systemColor="systemBackgroundColor"/>
+ </view>
+ <navigationItem key="navigationItem" id="kjP-Jz-yAy"/>
+ </viewController>
+ <placeholder placeholderIdentifier="IBFirstResponder" id="06P-nW-O1T" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
+ </objects>
+ <point key="canvasLocation" x="-10752" y="-856"/>
+ </scene>
+ <!--Domain-->
+ <scene sceneID="eX8-PG-EUH">
<objects>
- <viewController id="i2l-kx-xKH" customClass="ProjectViewController" customModule="OpenRemote" customModuleProvider="target" sceneMemberID="viewController">
- <view key="view" contentMode="scaleToFill" id="YE9-2c-hEL">
+ <viewController id="Pi7-Rw-ZSt" customClass="WizardDomainViewController" customModule="OpenRemote" customModuleProvider="target" sceneMemberID="viewController">
+ <view key="view" contentMode="scaleToFill" id="IR5-tW-Kgn">
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
- <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="or_logo" translatesAutoresizingMaskIntoConstraints="NO" id="91w-Qy-cB6">
- <rect key="frame" x="30" y="124" width="354" height="199"/>
+ <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text=" Connect to your app" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="WNe-Oj-DbK">
+ <rect key="frame" x="30" y="112" width="354" height="21"/>
+ <fontDescription key="fontDescription" type="system" pointSize="17"/>
+ <nil key="textColor"/>
+ <nil key="highlightedColor"/>
+ </label>
+ <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="RWD-5Z-rop">
+ <rect key="frame" x="30" y="153" width="354" height="200"/>
+ <subviews>
+ <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Enter the App Domain" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="1O0-Xo-WpU">
+ <rect key="frame" x="10" y="10" width="167" height="21"/>
+ <fontDescription key="fontDescription" type="system" pointSize="17"/>
+ <nil key="textColor"/>
+ <nil key="highlightedColor"/>
+ </label>
+ <button opaque="NO" contentMode="scaleToFill" enabled="NO" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="uoR-Y9-80o" customClass="MDCRaisedButton">
+ <rect key="frame" x="312" y="160" width="32" height="30"/>
+ <state key="normal" title="Next"/>
+ <connections>
+ <action selector="nextButtonpressed:" destination="Pi7-Rw-ZSt" eventType="touchUpInside" id="Ykc-Au-0dS"/>
+ </connections>
+ </button>
+ <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="LdF-6W-ii0" customClass="ORTextInput" customModule="ORLib">
+ <rect key="frame" x="10" y="41" width="334" height="40"/>
+ <color key="backgroundColor" systemColor="systemBackgroundColor"/>
+ <constraints>
+ <constraint firstAttribute="height" constant="40" id="WDD-md-5ng"/>
+ </constraints>
+ <userDefinedRuntimeAttributes>
+ <userDefinedRuntimeAttribute type="string" keyPath="setPlaceholderText" value="Project domain"/>
+ </userDefinedRuntimeAttributes>
+ </view>
+ </subviews>
+ <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
- <constraint firstAttribute="width" secondItem="91w-Qy-cB6" secondAttribute="height" multiplier="16:9" id="bHR-kc-LYU"/>
+ <constraint firstAttribute="trailing" secondItem="LdF-6W-ii0" secondAttribute="trailing" constant="10" id="7HI-7a-FY9"/>
+ <constraint firstItem="1O0-Xo-WpU" firstAttribute="leading" secondItem="RWD-5Z-rop" secondAttribute="leading" constant="10" id="Gk0-LY-3Zh"/>
+ <constraint firstItem="LdF-6W-ii0" firstAttribute="top" secondItem="1O0-Xo-WpU" secondAttribute="bottom" constant="10" id="U4F-ua-FAz"/>
+ <constraint firstAttribute="trailing" secondItem="uoR-Y9-80o" secondAttribute="trailing" constant="10" id="ZU9-2z-kX8"/>
+ <constraint firstItem="LdF-6W-ii0" firstAttribute="leading" secondItem="1O0-Xo-WpU" secondAttribute="leading" id="bP0-p9-L1H"/>
+ <constraint firstAttribute="height" constant="200" id="clp-eC-67U"/>
+ <constraint firstAttribute="bottom" secondItem="uoR-Y9-80o" secondAttribute="bottom" constant="10" id="e6c-aG-29Q"/>
+ <constraint firstItem="1O0-Xo-WpU" firstAttribute="top" secondItem="RWD-5Z-rop" secondAttribute="top" constant="10" id="xYE-g9-yPv"/>
</constraints>
+ </view>
+ <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="or_push_icon" translatesAutoresizingMaskIntoConstraints="NO" id="SQD-g8-nGt">
+ <rect key="frame" x="30" y="114.5" width="16" height="16"/>
</imageView>
- <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Connect to your application" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Kbv-Tf-5fK">
- <rect key="frame" x="30" y="373" width="354" height="21"/>
- <fontDescription key="fontDescription" type="system" weight="semibold" pointSize="17"/>
+ </subviews>
+ <viewLayoutGuide key="safeArea" id="El4-H3-bSM"/>
+ <color key="backgroundColor" white="0.66666666666666663" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+ <constraints>
+ <constraint firstItem="RWD-5Z-rop" firstAttribute="leading" secondItem="El4-H3-bSM" secondAttribute="leading" constant="30" id="83B-XS-r1h"/>
+ <constraint firstItem="WNe-Oj-DbK" firstAttribute="top" secondItem="El4-H3-bSM" secondAttribute="top" constant="20" id="8fa-ya-RZF"/>
+ <constraint firstItem="El4-H3-bSM" firstAttribute="trailing" secondItem="WNe-Oj-DbK" secondAttribute="trailing" constant="30" id="FuU-yE-Y7H"/>
+ <constraint firstItem="WNe-Oj-DbK" firstAttribute="centerY" secondItem="SQD-g8-nGt" secondAttribute="centerY" id="NwQ-mM-iaz"/>
+ <constraint firstItem="SQD-g8-nGt" firstAttribute="leading" secondItem="El4-H3-bSM" secondAttribute="leading" constant="30" id="Rr3-wI-WgK"/>
+ <constraint firstItem="WNe-Oj-DbK" firstAttribute="leading" secondItem="El4-H3-bSM" secondAttribute="leading" constant="30" id="uDA-D1-Xe9"/>
+ <constraint firstItem="RWD-5Z-rop" firstAttribute="width" secondItem="WNe-Oj-DbK" secondAttribute="width" id="xWZ-ez-CNg"/>
+ <constraint firstItem="RWD-5Z-rop" firstAttribute="top" secondItem="WNe-Oj-DbK" secondAttribute="bottom" constant="20" id="ywL-uw-ANf"/>
+ </constraints>
+ </view>
+ <navigationItem key="navigationItem" title="Domain" id="BpY-3s-ku9"/>
+ <connections>
+ <outlet property="domainTextInput" destination="LdF-6W-ii0" id="cU5-lf-fnQ"/>
+ <outlet property="nextButton" destination="uoR-Y9-80o" id="F7l-Qe-lg1"/>
+ <segue destination="ccW-7o-aWn" kind="show" identifier="goToWizardAppView" id="okt-Gc-Qir"/>
+ <segue destination="P3v-2u-Uf5" kind="show" identifier="goToWizardRealmView" id="9ZZ-gO-4Go"/>
+ </connections>
+ </viewController>
+ <placeholder placeholderIdentifier="IBFirstResponder" id="Me9-Tm-nKE" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
+ </objects>
+ <point key="canvasLocation" x="-11252" y="-1922"/>
+ </scene>
+ <!--Realm-->
+ <scene sceneID="Hij-HG-Sfv">
+ <objects>
+ <viewController id="P3v-2u-Uf5" customClass="WizardRealmViewController" customModule="OpenRemote" customModuleProvider="target" sceneMemberID="viewController">
+ <view key="view" contentMode="scaleToFill" id="AsW-xQ-7Do">
+ <rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
+ <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+ <subviews>
+ <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Connect to your app" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="GVA-jq-dIF">
+ <rect key="frame" x="30" y="112" width="354" height="21"/>
+ <fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
- <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="BlP-aM-prv" customClass="ORTextInput" customModule="ORLib">
- <rect key="frame" x="30" y="413" width="354" height="40"/>
+ <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="rds-tC-Xfi">
+ <rect key="frame" x="30" y="153" width="354" height="200"/>
+ <subviews>
+ <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Enter the Realm" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="8fN-pT-WOs">
+ <rect key="frame" x="10" y="10" width="121" height="21"/>
+ <fontDescription key="fontDescription" type="system" pointSize="17"/>
+ <nil key="textColor"/>
+ <nil key="highlightedColor"/>
+ </label>
+ <view hidden="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="QCb-6J-rL4" customClass="ORTextInput" customModule="ORLib">
+ <rect key="frame" x="10" y="41" width="334" height="40"/>
+ <color key="backgroundColor" systemColor="systemBackgroundColor"/>
+ <constraints>
+ <constraint firstAttribute="height" constant="40" id="PuT-Sr-Cz0"/>
+ <constraint firstAttribute="height" relation="greaterThanOrEqual" constant="40" id="aHH-R0-itm"/>
+ </constraints>
+ <userDefinedRuntimeAttributes>
+ <userDefinedRuntimeAttribute type="string" keyPath="setPlaceholderText" value="Realm"/>
+ </userDefinedRuntimeAttributes>
+ </view>
+ <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Jn1-hW-fFq" customClass="MDCRaisedButton">
+ <rect key="frame" x="312" y="160" width="32" height="30"/>
+ <state key="normal" title="Next"/>
+ <connections>
+ <action selector="nextButtonpressed:" destination="Pi7-Rw-ZSt" eventType="touchUpInside" id="lfM-HB-8D1"/>
+ <action selector="nextButtonpressed:" destination="P3v-2u-Uf5" eventType="touchUpInside" id="vMq-g8-g0j"/>
+ </connections>
+ </button>
+ <button hidden="YES" opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="leading" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="pE2-qw-0Zp" userLabel="Realms Selection Button">
+ <rect key="frame" x="10" y="41" width="334" height="40"/>
+ <constraints>
+ <constraint firstAttribute="height" constant="40" id="yHY-R2-PoI"/>
+ </constraints>
+ <state key="normal" title="Button"/>
+ <buttonConfiguration key="configuration" style="plain" title="Select realm"/>
+ <connections>
+ <action selector="selectRealm:" destination="P3v-2u-Uf5" eventType="touchUpInside" id="68N-gt-zek"/>
+ </connections>
+ </button>
+ </subviews>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<constraints>
- <constraint firstAttribute="height" constant="40" id="nJi-N3-4Su"/>
+ <constraint firstAttribute="trailing" secondItem="pE2-qw-0Zp" secondAttribute="trailing" constant="10" id="402-bI-Cp5"/>
+ <constraint firstAttribute="trailing" secondItem="QCb-6J-rL4" secondAttribute="trailing" constant="10" id="F9E-3R-zdq"/>
+ <constraint firstItem="8fN-pT-WOs" firstAttribute="top" secondItem="rds-tC-Xfi" secondAttribute="top" constant="10" id="G7k-sz-LaP"/>
+ <constraint firstItem="QCb-6J-rL4" firstAttribute="top" secondItem="8fN-pT-WOs" secondAttribute="bottom" constant="10" id="Nam-Bq-MQj"/>
+ <constraint firstItem="pE2-qw-0Zp" firstAttribute="top" secondItem="8fN-pT-WOs" secondAttribute="bottom" constant="10" id="Q6R-zK-AuV"/>
+ <constraint firstAttribute="bottom" secondItem="Jn1-hW-fFq" secondAttribute="bottom" constant="10" id="Us2-Xt-PU7"/>
+ <constraint firstItem="pE2-qw-0Zp" firstAttribute="leading" secondItem="8fN-pT-WOs" secondAttribute="leading" id="b55-lA-k2m"/>
+ <constraint firstItem="8fN-pT-WOs" firstAttribute="leading" secondItem="rds-tC-Xfi" secondAttribute="leading" constant="10" id="bZm-mE-U8J"/>
+ <constraint firstAttribute="height" constant="200" id="jNQ-3m-Dix"/>
+ <constraint firstAttribute="trailing" secondItem="Jn1-hW-fFq" secondAttribute="trailing" constant="10" id="te1-Rj-IYd"/>
+ <constraint firstItem="QCb-6J-rL4" firstAttribute="leading" secondItem="8fN-pT-WOs" secondAttribute="leading" id="vde-a8-AsY"/>
</constraints>
- <userDefinedRuntimeAttributes>
- <userDefinedRuntimeAttribute type="string" keyPath="setPlaceholderText" value="Project domain"/>
- </userDefinedRuntimeAttributes>
</view>
- <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="2fd-Z9-umb" customClass="ORTextInput" customModule="ORLib">
- <rect key="frame" x="30" y="483" width="354" height="40"/>
+ </subviews>
+ <viewLayoutGuide key="safeArea" id="C0m-OJ-atI"/>
+ <color key="backgroundColor" white="0.66666666666666663" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+ <constraints>
+ <constraint firstItem="GVA-jq-dIF" firstAttribute="leading" secondItem="C0m-OJ-atI" secondAttribute="leading" constant="30" id="Avn-Cc-29U"/>
+ <constraint firstItem="rds-tC-Xfi" firstAttribute="top" secondItem="GVA-jq-dIF" secondAttribute="bottom" constant="20" id="XdW-U9-RRG"/>
+ <constraint firstItem="GVA-jq-dIF" firstAttribute="top" secondItem="C0m-OJ-atI" secondAttribute="top" constant="20" id="dIk-aD-g8U"/>
+ <constraint firstItem="rds-tC-Xfi" firstAttribute="leading" secondItem="C0m-OJ-atI" secondAttribute="leading" constant="30" id="gGk-Nt-f5f"/>
+ <constraint firstItem="rds-tC-Xfi" firstAttribute="width" secondItem="GVA-jq-dIF" secondAttribute="width" id="inn-zQ-fac"/>
+ <constraint firstItem="C0m-OJ-atI" firstAttribute="trailing" secondItem="GVA-jq-dIF" secondAttribute="trailing" constant="30" id="wjt-sI-o02"/>
+ </constraints>
+ </view>
+ <navigationItem key="navigationItem" title="Realm" id="FZA-KJ-vqn"/>
+ <connections>
+ <outlet property="nextButton" destination="Jn1-hW-fFq" id="7Ex-bk-Rms"/>
+ <outlet property="realmTextInput" destination="QCb-6J-rL4" id="Kf8-36-Kxo"/>
+ <outlet property="realmsSelectionButton" destination="pE2-qw-0Zp" id="rSu-57-Pzp"/>
+ <segue destination="HSA-l5-YFF" kind="presentation" identifier="goToWebView" modalPresentationStyle="fullScreen" id="4Aa-7e-CLQ"/>
+ </connections>
+ </viewController>
+ <placeholder placeholderIdentifier="IBFirstResponder" id="2bO-ip-ceU" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
+ </objects>
+ <point key="canvasLocation" x="-9019" y="-1922"/>
+ </scene>
+ <!--App-->
+ <scene sceneID="gwn-Tt-d11">
+ <objects>
+ <viewController id="ccW-7o-aWn" customClass="WizardAppViewController" customModule="OpenRemote" customModuleProvider="target" sceneMemberID="viewController">
+ <view key="view" contentMode="scaleToFill" id="R9V-9S-UMe">
+ <rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
+ <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+ <subviews>
+ <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Connect to your app" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="a8w-Ut-lvr">
+ <rect key="frame" x="30" y="112" width="354" height="20.5"/>
+ <fontDescription key="fontDescription" type="system" pointSize="17"/>
+ <nil key="textColor"/>
+ <nil key="highlightedColor"/>
+ </label>
+ <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="bYT-CK-7We">
+ <rect key="frame" x="30" y="152.5" width="354" height="200"/>
+ <subviews>
+ <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Select an app" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Q03-kj-Zcn">
+ <rect key="frame" x="10" y="10" width="104" height="21"/>
+ <fontDescription key="fontDescription" type="system" pointSize="17"/>
+ <nil key="textColor"/>
+ <nil key="highlightedColor"/>
+ </label>
+ <view hidden="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Z5X-eO-DYi" customClass="ORTextInput" customModule="ORLib">
+ <rect key="frame" x="0.0" y="44" width="344" height="40"/>
+ <color key="backgroundColor" systemColor="systemBackgroundColor"/>
+ <constraints>
+ <constraint firstAttribute="height" constant="40" id="KH4-Oo-vvf"/>
+ <constraint firstAttribute="height" relation="greaterThanOrEqual" constant="40" id="brF-yc-nEE"/>
+ </constraints>
+ <userDefinedRuntimeAttributes>
+ <userDefinedRuntimeAttribute type="string" keyPath="setPlaceholderText" value="App name"/>
+ </userDefinedRuntimeAttributes>
+ </view>
+ <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="LOC-Pp-fDB" customClass="MDCRaisedButton">
+ <rect key="frame" x="312" y="160" width="32" height="30"/>
+ <state key="normal" title="Next"/>
+ <connections>
+ <action selector="nextButtonpressed:" destination="ccW-7o-aWn" eventType="touchUpInside" id="W6c-eh-5Rb"/>
+ </connections>
+ </button>
+ <button hidden="YES" opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="leading" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Gvc-Wg-7aG">
+ <rect key="frame" x="10" y="41" width="334" height="40"/>
+ <constraints>
+ <constraint firstAttribute="height" relation="greaterThanOrEqual" constant="40" id="Eoz-4h-bOg"/>
+ <constraint firstAttribute="height" constant="40" id="fyT-kh-Gto"/>
+ </constraints>
+ <state key="normal" title="Button"/>
+ <buttonConfiguration key="configuration" style="plain" title="Select app"/>
+ <connections>
+ <action selector="selectApp:" destination="ccW-7o-aWn" eventType="touchUpInside" id="9jx-7m-Qj3"/>
+ </connections>
+ </button>
+ </subviews>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<constraints>
- <constraint firstAttribute="height" constant="40" id="Ddc-Hy-G6Q"/>
+ <constraint firstItem="Gvc-Wg-7aG" firstAttribute="leading" secondItem="Q03-kj-Zcn" secondAttribute="leading" id="3a5-GP-fEM"/>
+ <constraint firstAttribute="trailing" secondItem="Z5X-eO-DYi" secondAttribute="trailing" constant="10" id="4oB-L4-CDY"/>
+ <constraint firstItem="Q03-kj-Zcn" firstAttribute="leading" secondItem="bYT-CK-7We" secondAttribute="leading" constant="10" id="60c-fU-fN8"/>
+ <constraint firstAttribute="trailing" secondItem="Gvc-Wg-7aG" secondAttribute="trailing" constant="10" id="6aA-D8-XCS"/>
+ <constraint firstAttribute="bottom" secondItem="LOC-Pp-fDB" secondAttribute="bottom" constant="10" id="8kh-gu-ZQN"/>
+ <constraint firstAttribute="height" constant="200" id="9oe-Vr-tPl"/>
+ <constraint firstItem="Z5X-eO-DYi" firstAttribute="top" secondItem="Q03-kj-Zcn" secondAttribute="bottom" constant="13" id="Ilv-sc-MBD"/>
+ <constraint firstAttribute="trailing" secondItem="LOC-Pp-fDB" secondAttribute="trailing" constant="10" id="LTl-ff-1k8"/>
+ <constraint firstItem="Q03-kj-Zcn" firstAttribute="top" secondItem="bYT-CK-7We" secondAttribute="top" constant="10" id="Nc0-Aa-MDr"/>
+ <constraint firstItem="Z5X-eO-DYi" firstAttribute="leading" secondItem="Q03-kj-Zcn" secondAttribute="leading" constant="-10" id="ZWs-Mv-85p"/>
+ <constraint firstItem="Gvc-Wg-7aG" firstAttribute="top" secondItem="Q03-kj-Zcn" secondAttribute="bottom" constant="10" id="mNL-Dh-4GR"/>
</constraints>
- <userDefinedRuntimeAttributes>
- <userDefinedRuntimeAttribute type="string" keyPath="setPlaceholderText" value="Realm"/>
- </userDefinedRuntimeAttributes>
</view>
- <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="tdG-Qt-Lhh" customClass="MDCRaisedButton">
- <rect key="frame" x="325" y="603" width="59" height="30"/>
- <state key="normal" title="Connect"/>
- <connections>
- <action selector="connectButtonpressed:" destination="i2l-kx-xKH" eventType="touchUpInside" id="x7E-CE-Jfr"/>
- </connections>
- </button>
</subviews>
- <viewLayoutGuide key="safeArea" id="D5Z-HK-RNC"/>
- <color key="backgroundColor" systemColor="systemBackgroundColor"/>
+ <viewLayoutGuide key="safeArea" id="JdK-us-UvR"/>
+ <color key="backgroundColor" white="0.66666666666666663" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
- <constraint firstItem="tdG-Qt-Lhh" firstAttribute="trailing" secondItem="2fd-Z9-umb" secondAttribute="trailing" id="2el-oM-gye"/>
- <constraint firstItem="D5Z-HK-RNC" firstAttribute="trailing" secondItem="Kbv-Tf-5fK" secondAttribute="trailing" constant="30" id="2jL-yL-nzr"/>
- <constraint firstItem="91w-Qy-cB6" firstAttribute="trailing" secondItem="Kbv-Tf-5fK" secondAttribute="trailing" id="4JQ-ny-GpV"/>
- <constraint firstItem="Kbv-Tf-5fK" firstAttribute="top" secondItem="91w-Qy-cB6" secondAttribute="bottom" constant="50" id="6Xz-rs-f9s"/>
- <constraint firstItem="tdG-Qt-Lhh" firstAttribute="top" secondItem="2fd-Z9-umb" secondAttribute="bottom" constant="80" id="8YO-LN-Y6a"/>
- <constraint firstItem="BlP-aM-prv" firstAttribute="leading" secondItem="Kbv-Tf-5fK" secondAttribute="leading" id="EHO-FA-FcK"/>
- <constraint firstItem="91w-Qy-cB6" firstAttribute="leading" secondItem="Kbv-Tf-5fK" secondAttribute="leading" id="LwD-ts-QIa"/>
- <constraint firstItem="BlP-aM-prv" firstAttribute="top" secondItem="Kbv-Tf-5fK" secondAttribute="bottom" constant="19" id="fEU-7e-c4r"/>
- <constraint firstItem="Kbv-Tf-5fK" firstAttribute="leading" secondItem="D5Z-HK-RNC" secondAttribute="leading" constant="30" id="kBY-W2-5la"/>
- <constraint firstItem="2fd-Z9-umb" firstAttribute="leading" secondItem="BlP-aM-prv" secondAttribute="leading" id="khz-Ar-gHc"/>
- <constraint firstItem="91w-Qy-cB6" firstAttribute="top" secondItem="D5Z-HK-RNC" secondAttribute="top" constant="80" id="mPB-1f-dRx"/>
- <constraint firstItem="2fd-Z9-umb" firstAttribute="top" secondItem="BlP-aM-prv" secondAttribute="bottom" constant="30" id="ptV-cK-szI"/>
- <constraint firstItem="BlP-aM-prv" firstAttribute="trailing" secondItem="Kbv-Tf-5fK" secondAttribute="trailing" id="rBu-cB-S9o"/>
- <constraint firstItem="2fd-Z9-umb" firstAttribute="trailing" secondItem="BlP-aM-prv" secondAttribute="trailing" id="zdw-wG-TuZ"/>
+ <constraint firstItem="JdK-us-UvR" firstAttribute="trailing" secondItem="a8w-Ut-lvr" secondAttribute="trailing" constant="30" id="H8O-bM-YUP"/>
+ <constraint firstItem="bYT-CK-7We" firstAttribute="leading" secondItem="JdK-us-UvR" secondAttribute="leading" constant="30" id="JYy-v5-wnQ"/>
+ <constraint firstItem="bYT-CK-7We" firstAttribute="width" secondItem="a8w-Ut-lvr" secondAttribute="width" id="OlO-sQ-k6C"/>
+ <constraint firstItem="a8w-Ut-lvr" firstAttribute="leading" secondItem="JdK-us-UvR" secondAttribute="leading" constant="30" id="Th5-US-mB9"/>
+ <constraint firstItem="a8w-Ut-lvr" firstAttribute="top" secondItem="JdK-us-UvR" secondAttribute="top" constant="20" id="cpx-du-Fd6"/>
+ <constraint firstItem="bYT-CK-7We" firstAttribute="top" secondItem="a8w-Ut-lvr" secondAttribute="bottom" constant="20" id="hbA-NU-sL8"/>
</constraints>
</view>
+ <navigationItem key="navigationItem" title="App" id="tRh-VI-Btk"/>
<connections>
- <outlet property="connectButton" destination="tdG-Qt-Lhh" id="XHn-UJ-kYr"/>
- <outlet property="projectTextInput" destination="BlP-aM-prv" id="CXN-GZ-wnr"/>
- <outlet property="realmTextInput" destination="2fd-Z9-umb" id="WBg-9f-mUS"/>
- <segue destination="HSA-l5-YFF" kind="presentation" identifier="goToWebView" modalPresentationStyle="fullScreen" id="DyD-E7-g7I"/>
+ <outlet property="appTextInput" destination="Z5X-eO-DYi" id="L02-fU-0VB"/>
+ <outlet property="appsSelectionButton" destination="Gvc-Wg-7aG" id="9fP-P9-zUk"/>
+ <outlet property="nextButton" destination="LOC-Pp-fDB" id="GUN-8i-a9a"/>
+ <segue destination="P3v-2u-Uf5" kind="show" identifier="goToWizardRealmView" id="61Y-JM-NmK"/>
</connections>
</viewController>
- <placeholder placeholderIdentifier="IBFirstResponder" id="n9R-ku-sNp" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
+ <placeholder placeholderIdentifier="IBFirstResponder" id="XDI-fx-2Io" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
</objects>
- <point key="canvasLocation" x="849" y="61"/>
+ <point key="canvasLocation" x="-10274" y="-1922"/>
</scene>
- <!--Viewcontroller-->
- <scene sceneID="liA-xA-sIe">
+ <!--Navigation Controller-->
+ <scene sceneID="0L2-qW-jp0">
<objects>
- <viewController id="HSA-l5-YFF" customClass="ORViewcontroller" customModule="ORLib" sceneMemberID="viewController">
- <view key="view" contentMode="scaleToFill" id="iMh-t6-rOs">
+ <navigationController automaticallyAdjustsScrollViewInsets="NO" id="7TF-fh-Sa5" sceneMemberID="viewController">
+ <toolbarItems/>
+ <navigationBar key="navigationBar" contentMode="scaleToFill" id="iZ9-Dg-hIL">
+ <rect key="frame" x="0.0" y="48" width="414" height="44"/>
+ <autoresizingMask key="autoresizingMask"/>
+ </navigationBar>
+ <nil name="viewControllers"/>
+ <connections>
+ <segue destination="Pi7-Rw-ZSt" kind="relationship" relationship="rootViewController" id="HVQ-FV-Tm2"/>
+ </connections>
+ </navigationController>
+ <placeholder placeholderIdentifier="IBFirstResponder" id="Uzl-KH-s22" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
+ </objects>
+ <point key="canvasLocation" x="-12200" y="-1922"/>
+ </scene>
+ <!--Settings View Controller-->
+ <scene sceneID="UWg-Ah-L22">
+ <objects>
+ <tableViewController id="uoK-29-uZr" customClass="SettingsViewController" customModule="OpenRemote" customModuleProvider="target" sceneMemberID="viewController">
+ <tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="-1" estimatedSectionHeaderHeight="-1" sectionFooterHeight="-1" estimatedSectionFooterHeight="-1" id="gda-jc-Zpb">
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
- <viewLayoutGuide key="safeArea" id="eSh-1f-zrb"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
- </view>
- <navigationItem key="navigationItem" id="kjP-Jz-yAy"/>
- </viewController>
- <placeholder placeholderIdentifier="IBFirstResponder" id="06P-nW-O1T" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
+ <prototypes>
+ <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" reuseIdentifier="ProjectCell" id="Y2L-n2-cJa">
+ <rect key="frame" x="0.0" y="50" width="414" height="43.5"/>
+ <autoresizingMask key="autoresizingMask"/>
+ <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="Y2L-n2-cJa" id="Zgr-l4-ccF">
+ <rect key="frame" x="0.0" y="0.0" width="414" height="43.5"/>
+ <autoresizingMask key="autoresizingMask"/>
+ <subviews>
+ <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Tg5-mN-nGy">
+ <rect key="frame" x="224" y="11" width="42" height="21"/>
+ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
+ <fontDescription key="fontDescription" type="system" pointSize="17"/>
+ <nil key="textColor"/>
+ <nil key="highlightedColor"/>
+ </label>
+ </subviews>
+ </tableViewCellContentView>
+ </tableViewCell>
+ </prototypes>
+ <sections/>
+ <connections>
+ <outlet property="dataSource" destination="uoK-29-uZr" id="r2Z-RZ-Pgh"/>
+ <outlet property="delegate" destination="uoK-29-uZr" id="2g4-I7-4nv"/>
+ </connections>
+ </tableView>
+ </tableViewController>
+ <placeholder placeholderIdentifier="IBFirstResponder" id="Yg6-ke-1om" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
</objects>
- <point key="canvasLocation" x="848" y="745"/>
+ <point key="canvasLocation" x="-13877" y="-1122"/>
</scene>
</scenes>
<inferredMetricsTieBreakers>
- <segue reference="DyD-E7-g7I"/>
+ <segue reference="61Y-JM-NmK"/>
+ <segue reference="4Aa-7e-CLQ"/>
</inferredMetricsTieBreakers>
<resources>
- <image name="or_logo" width="1422.6666259765625" height="806.33331298828125"/>
+ <image name="or_push_icon" width="16" height="16"/>
<systemColor name="systemBackgroundColor">
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</systemColor>
diff --git a/console/iOS/GenericApp/GenericApp/UI/ProjectViewController.swift b/console/iOS/GenericApp/GenericApp/UI/ProjectViewController.swift
deleted file mode 100644
index 18f558573..000000000
--- a/console/iOS/GenericApp/GenericApp/UI/ProjectViewController.swift
+++ /dev/null
@@ -1,111 +0,0 @@
-//
-// ProjectViewController.swift
-// GenericApp
-//
-// Created by Michael Rademaker on 26/10/2020.
-// Copyright © 2020 OpenRemote. All rights reserved.
-//
-
-import UIKit
-import MaterialComponents.MaterialTextFields
-import ORLib
-
-class ProjectViewController: UIViewController {
-
- var projectName: String?
- var realmName: String?
- var appconfig: ORAppConfig?
- var host: String?
-
- @IBOutlet weak var projectTextInput: ORTextInput!
- @IBOutlet weak var realmTextInput: ORTextInput!
- @IBOutlet weak var connectButton: MDCRaisedButton!
-
- override func viewDidLoad() {
- super.viewDidLoad()
-
- let orGreenColor = UIColor(named: "or_green")
-
- connectButton.backgroundColor = orGreenColor
- connectButton.tintColor = UIColor.white
- }
-
- override func viewDidAppear(_ animated: Bool) {
- super.viewDidAppear(animated)
-
- projectTextInput.textField?.delegate = self
- projectTextInput.textField?.autocorrectionType = .no
- projectTextInput.textField?.autocapitalizationType = .none
- projectTextInput.textField?.returnKeyType = .next
-
- realmTextInput.textField?.delegate = self
- realmTextInput.textField?.autocorrectionType = .no
- realmTextInput.textField?.autocapitalizationType = .none
- realmTextInput.textField?.returnKeyType = .continue
- }
-
- override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
- if segue.identifier == "goToWebView" {
- let orViewController = segue.destination as! ORViewcontroller
- orViewController.appConfig = self.appconfig
- }
- }
-
- @IBAction func connectButtonpressed(_ sender: UIButton) {
- if let project = projectName, let realm = realmName {
- requestAppConfig(project, realm)
- }
- }
-}
-
-extension ProjectViewController: UITextFieldDelegate {
-
- func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool {
- if textField == projectTextInput.textField {
- projectName = projectTextInput.textField?.text?.appending(string).trimmingCharacters(in: .whitespacesAndNewlines)
- }
- if textField == realmTextInput.textField {
- realmName = realmTextInput?.textField?.text?.appending(string).trimmingCharacters(in: .whitespacesAndNewlines)
- }
- return true
- }
-
- fileprivate func requestAppConfig(_ project: String, _ realm: String) {
- host = project.isUrl() ? project : "https://\(project).openremote.app/"
- let url = project.isUrl() ? project.appending("/api/\(realm)") : "https://\(project).openremote.app/api/\(realm)"
-
- let apiManager = ApiManager(baseUrl: url)
- apiManager.getAppConfig(realm: realm, callback: { statusCode, orAppConfig, error in
- DispatchQueue.main.async {
- if statusCode == 200 && error == nil {
- let userDefaults = UserDefaults(suiteName: DefaultsKey.groupEntitlement)
- userDefaults?.set(self.host, forKey: DefaultsKey.hostKey)
- userDefaults?.set(realm, forKey: DefaultsKey.realmKey)
- self.appconfig = orAppConfig
-
- self.performSegue(withIdentifier: "goToWebView", sender: self)
- } else {
- let alertView = UIAlertController(title: "Error", message: "Error occurred getting app config. Check your input and try again", preferredStyle: .alert)
- alertView.addAction(UIAlertAction(title: "OK", style: .default, handler: nil))
-
- self.present(alertView, animated: true, completion: nil)
- }
- }
- })
- }
-
- func textFieldShouldReturn(_ textField: UITextField) -> Bool {
- guard let input = textField.text, !input.isEmpty else {
- return false
- }
-
- if textField == projectTextInput.textField {
- realmTextInput.textField?.becomeFirstResponder()
- } else if textField == realmTextInput.textField, let project = projectName, let realm = realmName {
- realmTextInput.textField?.resignFirstResponder()
- requestAppConfig(project, realm)
- }
-
- return true
- }
-}
diff --git a/console/iOS/GenericApp/GenericApp/UI/SettingsViewController.swift b/console/iOS/GenericApp/GenericApp/UI/SettingsViewController.swift
new file mode 100644
index 000000000..c798670df
--- /dev/null
+++ b/console/iOS/GenericApp/GenericApp/UI/SettingsViewController.swift
@@ -0,0 +1,25 @@
+//
+// SettingsViewController.swift
+// GenericApp
+//
+// Created by Eric Bariaux on 06/12/2022.
+// Copyright © 2022 OpenRemote. All rights reserved.
+//
+
+import UIKit
+
+class SettingsViewController: UITableViewController {
+
+ override func viewDidLoad() {
+ super.viewDidLoad()
+ }
+
+ override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
+ return 1;
+ }
+
+ override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
+ return tableView.dequeueReusableCell(withIdentifier: "ProjectCell", for: indexPath)
+ }
+
+}
diff --git a/console/iOS/GenericApp/GenericApp/UI/SplashViewController.swift b/console/iOS/GenericApp/GenericApp/UI/SplashViewController.swift
index f8a14d796..699d255b0 100644
--- a/console/iOS/GenericApp/GenericApp/UI/SplashViewController.swift
+++ b/console/iOS/GenericApp/GenericApp/UI/SplashViewController.swift
@@ -11,40 +11,53 @@ import ORLib
class SplashViewController: UIViewController {
- var appconfig: ORAppConfig?
var host: String?
-
+ var project: ProjectConfig?
+
+ var displaySettings = false
+
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
-
+
+ if (displaySettings) {
+ self.performSegue(withIdentifier: Segues.goToSettingsView, sender: self)
+ displaySettings = false
+ return
+ }
if let userDefaults = UserDefaults(suiteName: DefaultsKey.groupEntitlement),
- let savedHost = userDefaults.string(forKey: DefaultsKey.hostKey),
- let realm = userDefaults.string(forKey: DefaultsKey.realmKey) {
- host = savedHost
- let url = host!.appending("/api/\(realm)")
-
- let apiManager = ApiManager(baseUrl: url)
- apiManager.getAppConfig(realm: realm, callback: { statusCode, orAppConfig, error in
- DispatchQueue.main.async {
- if statusCode == 200 && error == nil {
- self.appconfig = orAppConfig
-
- self.performSegue(withIdentifier: "goToWebView", sender: self)
- } else {
- self.performSegue(withIdentifier: "goToProjectView", sender: self)
- }
+ let projectsData = userDefaults.data(forKey: DefaultsKey.projectsConfigurationKey),
+ let selectedProjectId = userDefaults.string(forKey: DefaultsKey.projectKey) {
+
+ let projects = try? JSONDecoder().decode([ProjectConfig].self, from: projectsData)
+
+ if let projects = projects {
+ print("Known projects \(projects)")
+ print("Selected project \(selectedProjectId)")
+
+ if let selectedProject = projects.first(where: { $0.id == selectedProjectId } ) {
+ project = selectedProject
+ self.performSegue(withIdentifier: Segues.goToWebView, sender: self)
+ return
}
- })
- } else {
- self.performSegue(withIdentifier: "goToProjectView", sender: self)
+ }
}
+ self.performSegue(withIdentifier: Segues.goToWizardDomainView, sender: self)
}
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
- if segue.identifier == "goToWebView" {
+ if segue.identifier == Segues.goToWebView {
let orViewController = segue.destination as! ORViewcontroller
- orViewController.appConfig = self.appconfig
- orViewController.baseUrl = host
+
+ if let project = project {
+
+ // TODO: replace with proper URL creation
+ orViewController.targetUrl = project.targetUrl
+
+// orViewController.baseUrl = host
+ }
+ } else if segue.identifier == Segues.goToSettingsView {
+ let settingsViewController = segue.destination as! SettingsViewController
}
}
+
}
diff --git a/console/iOS/GenericApp/GenericApp/UI/WizardAppViewController.swift b/console/iOS/GenericApp/GenericApp/UI/WizardAppViewController.swift
new file mode 100644
index 000000000..085f7ec3f
--- /dev/null
+++ b/console/iOS/GenericApp/GenericApp/UI/WizardAppViewController.swift
@@ -0,0 +1,142 @@
+//
+// WizardAppViewController.swift
+// GenericApp
+//
+// Created by Eric Bariaux on 18/06/2022.
+// Copyright © 2022 OpenRemote. All rights reserved.
+//
+
+import UIKit
+import MaterialComponents.MaterialTextFields
+import ORLib
+import DropDown
+
+class WizardAppViewController: UIViewController {
+
+ var configManager: ConfigManager?
+
+ var apps: [String]?
+
+ var appName: String?
+
+ @IBOutlet weak var appTextInput: ORTextInput!
+ @IBOutlet weak var nextButton: MDCRaisedButton!
+
+ @IBOutlet weak var appsSelectionButton: UIButton!
+ var dropDown = DropDown()
+
+ override func viewDidLoad() {
+ super.viewDidLoad()
+
+ let orGreenColor = UIColor(named: "or_green")
+
+ nextButton.backgroundColor = orGreenColor
+ nextButton.tintColor = UIColor.white
+ }
+
+ override func viewDidAppear(_ animated: Bool) {
+ super.viewDidAppear(animated)
+
+ appTextInput.textField?.delegate = self
+ appTextInput.textField?.autocorrectionType = .no
+ appTextInput.textField?.autocapitalizationType = .none
+ appTextInput.textField?.returnKeyType = .next
+
+ if let apps = apps {
+ dropDown.anchorView = appsSelectionButton
+ // The list of items to display. Can be changed dynamically
+ dropDown.dataSource = apps
+
+ dropDown.selectionAction = { [weak self] (index, item) in
+ self?.appsSelectionButton.setTitle(item, for: .normal)
+ }
+
+ appsSelectionButton.isHidden = false
+ appTextInput.isHidden = true
+ } else {
+ appsSelectionButton.isHidden = true
+ appTextInput.isHidden = false
+ }
+ }
+
+ @IBAction func selectApp(_ sender: AnyObject) {
+ dropDown.show()
+ }
+
+ override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
+ if segue.identifier == Segues.goToWizardRealmView {
+ switch configManager!.state {
+ case .selectRealm(_, _, let realms):
+ let realmViewController = segue.destination as! WizardRealmViewController
+ realmViewController.realms = realms
+ realmViewController.configManager = self.configManager
+ default:
+ fatalError("Invalid state for segue")
+ }
+ } else if segue.identifier == Segues.goToWebView {
+ let orViewController = segue.destination as! ORViewcontroller
+
+ switch configManager!.state {
+ case .complete(let project):
+ orViewController.targetUrl = project.targetUrl
+ default:
+ fatalError("Invalid state for segue")
+ }
+ }
+ }
+
+ @IBAction func nextButtonpressed(_ sender: UIButton) {
+ selectApp()
+ }
+
+ private func selectApp() {
+ let selectedApp: String?
+ if apps != nil {
+ selectedApp = dropDown.selectedItem
+ } else {
+ selectedApp = appName
+ }
+
+ if let selectedApp = selectedApp {
+ print("Selected app >\(selectedApp)<")
+ _ = try? configManager!.setApp(app: selectedApp)
+
+
+
+ // TODO: check state, can we go to some other screen ?
+
+
+ self.performSegue(withIdentifier: Segues.goToWizardRealmView, sender: self)
+ } else {
+ let alertView = UIAlertController(title: "Error", message: "Please \(apps != nil ? "select" : "enter") an application", preferredStyle: .alert)
+ alertView.addAction(UIAlertAction(title: "OK", style: .default, handler: nil))
+
+ self.present(alertView, animated: true, completion: nil)
+ }
+ }
+}
+
+extension WizardAppViewController: UITextFieldDelegate {
+
+ func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool {
+ if textField == appTextInput.textField {
+ if let s = appTextInput.textField?.text {
+ appName = s.replacingCharacters(in: Range(range, in: s)!, with: string).trimmingCharacters(in: .whitespacesAndNewlines)
+ }
+ }
+ return true
+ }
+
+ func textFieldShouldReturn(_ textField: UITextField) -> Bool {
+ guard let input = textField.text, !input.isEmpty else {
+ return false
+ }
+
+ if textField == appTextInput.textField {
+ appTextInput.textField?.resignFirstResponder()
+ selectApp()
+ }
+
+ return true
+ }
+}
diff --git a/console/iOS/GenericApp/GenericApp/UI/WizardDomainViewController.swift b/console/iOS/GenericApp/GenericApp/UI/WizardDomainViewController.swift
new file mode 100644
index 000000000..76202e04d
--- /dev/null
+++ b/console/iOS/GenericApp/GenericApp/UI/WizardDomainViewController.swift
@@ -0,0 +1,135 @@
+//
+// WizardDomainViewController.swift
+// GenericApp
+//
+// Created by Eric Bariaux on 18/06/2022.
+// Copyright © 2022 OpenRemote. All rights reserved.
+//
+
+import UIKit
+import MaterialComponents.MaterialTextFields
+import ORLib
+
+class WizardDomainViewController: UIViewController {
+
+ var configManager: ConfigManager?
+
+ var domainName: String?
+
+ @IBOutlet weak var domainTextInput: ORTextInput!
+ @IBOutlet weak var nextButton: MDCRaisedButton!
+
+ override func viewDidLoad() {
+ super.viewDidLoad()
+
+ let orGreenColor = UIColor(named: "or_green")
+
+ nextButton.backgroundColor = orGreenColor
+ nextButton.tintColor = UIColor.white
+ }
+
+ override func viewDidAppear(_ animated: Bool) {
+ super.viewDidAppear(animated)
+
+ domainTextInput.textField?.delegate = self
+ domainTextInput.textField?.autocorrectionType = .no
+ domainTextInput.textField?.autocapitalizationType = .none
+ domainTextInput.textField?.returnKeyType = .next
+ }
+
+ override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
+ if segue.identifier == Segues.goToWizardAppView {
+ switch configManager!.state {
+ case .selectApp(_, let apps):
+ let appViewController = segue.destination as! WizardAppViewController
+ appViewController.apps = apps
+ appViewController.configManager = self.configManager
+ default:
+ fatalError("Invalid state for segue")
+ }
+ } else if segue.identifier == Segues.goToWizardRealmView {
+ switch configManager!.state {
+ case .selectRealm(_, _, let realms):
+ let realmViewController = segue.destination as! WizardRealmViewController
+ realmViewController.realms = realms
+ realmViewController.configManager = self.configManager
+ default:
+ fatalError("Invalid state for segue")
+ }
+ } else if segue.identifier == Segues.goToWebView {
+ let orViewController = segue.destination as! ORViewcontroller
+
+ switch configManager!.state {
+ case .complete(let project):
+ orViewController.targetUrl = project.targetUrl
+ default:
+ fatalError("Invalid state for segue")
+ }
+ }
+ }
+
+ @IBAction func nextButtonpressed(_ sender: UIButton) {
+ if let domain = domainName {
+ requestAppConfig(domain)
+ }
+ }
+}
+
+extension WizardDomainViewController: UITextFieldDelegate {
+
+ func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool {
+ if textField == domainTextInput.textField {
+ if let s = domainTextInput.textField?.text {
+ domainName = s.replacingCharacters(in: Range(range, in: s)!, with: string).trimmingCharacters(in: .whitespacesAndNewlines)
+ nextButton.isEnabled = !(domainName?.isEmpty ?? true)
+ } else {
+ nextButton.isEnabled = false
+ }
+ }
+ return true
+ }
+
+ fileprivate func requestAppConfig(_ domain: String) {
+ configManager = ConfigManager(apiManagerFactory: { url in
+ HttpApiManager(baseUrl: url)
+ })
+
+ async {
+ do {
+ let state = try await configManager!.setDomain(domain: domain)
+ print("State \(state)")
+ switch state {
+ case .selectDomain:
+ // Something wrong, we just set the domain
+ let alertView = UIAlertController(title: "Error", message: "Error occurred getting app config. Check your input and try again", preferredStyle: .alert)
+ alertView.addAction(UIAlertAction(title: "OK", style: .default, handler: nil))
+
+ self.present(alertView, animated: true, completion: nil)
+ case .selectApp:
+ self.performSegue(withIdentifier: Segues.goToWizardAppView, sender: self)
+ case .selectRealm:
+ self.performSegue(withIdentifier: Segues.goToWizardRealmView, sender: self)
+ case.complete:
+ self.performSegue(withIdentifier: Segues.goToWebView, sender: self)
+ }
+ } catch {
+ let alertView = UIAlertController(title: "Error", message: "Error occurred getting app config. Check your input and try again", preferredStyle: .alert)
+ alertView.addAction(UIAlertAction(title: "OK", style: .default, handler: nil))
+ self.present(alertView, animated: true, completion: nil)
+ }
+ }
+ }
+
+ func textFieldShouldReturn(_ textField: UITextField) -> Bool {
+ guard let input = textField.text, !input.isEmpty else {
+ return false
+ }
+
+ if textField == domainTextInput.textField, let domain = domainName {
+ domainTextInput.textField?.resignFirstResponder()
+ requestAppConfig(domain)
+ }
+
+ return true
+ }
+}
diff --git a/console/iOS/GenericApp/GenericApp/UI/WizardRealmViewController.swift b/console/iOS/GenericApp/GenericApp/UI/WizardRealmViewController.swift
new file mode 100644
index 000000000..ffa43f36e
--- /dev/null
+++ b/console/iOS/GenericApp/GenericApp/UI/WizardRealmViewController.swift
@@ -0,0 +1,178 @@
+//
+// WizardRealmViewController.swift
+// GenericApp
+//
+// Created by Eric Bariaux on 21/07/2022.
+// Copyright © 2022 OpenRemote. All rights reserved.
+//
+
+import UIKit
+import MaterialComponents.MaterialTextFields
+import ORLib
+import DropDown
+
+
+class WizardRealmViewController: UIViewController {
+
+ var configManager: ConfigManager?
+
+ var realms: [String]?
+
+ var realmName: String?
+
+ @IBOutlet weak var realmTextInput: ORTextInput!
+ @IBOutlet weak var nextButton: MDCRaisedButton!
+
+ @IBOutlet weak var realmsSelectionButton: UIButton!
+ var dropDown = DropDown()
+
+ override func viewDidLoad() {
+ super.viewDidLoad()
+
+ let orGreenColor = UIColor(named: "or_green")
+
+ nextButton.backgroundColor = orGreenColor
+ nextButton.tintColor = UIColor.white
+ }
+
+ override func viewDidAppear(_ animated: Bool) {
+ super.viewDidAppear(animated)
+
+ realmTextInput.textField?.delegate = self
+ realmTextInput.textField?.autocorrectionType = .no
+ realmTextInput.textField?.autocapitalizationType = .none
+ realmTextInput.textField?.returnKeyType = .next
+
+ if let realms = realms {
+ dropDown.anchorView = realmsSelectionButton
+ // The list of items to display. Can be changed dynamically
+ dropDown.dataSource = realms
+
+ dropDown.selectionAction = { [weak self] (index, item) in
+ self?.realmsSelectionButton.setTitle(item, for: .normal)
+ }
+
+ realmsSelectionButton.isHidden = false
+ realmTextInput.isHidden = true
+ } else {
+ realmsSelectionButton.isHidden = true
+ realmTextInput.isHidden = false
+ }
+
+ }
+
+ @IBAction func selectRealm(_ sender: AnyObject) {
+ dropDown.show()
+ }
+
+ override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
+ if segue.identifier == Segues.goToWebView {
+ let orViewController = segue.destination as! ORViewcontroller
+
+ switch configManager!.state {
+ case .complete(let project):
+ orViewController.targetUrl = project.targetUrl
+ default:
+ fatalError("We should never come to this screen in that state")
+ }
+
+
+ // TODO: based on configManager?.appInfos retrieve providers -> this is done by selectRealm on ConfigMgr
+
+
+
+// orViewController.targetUrl = "https://demo.openremote.io/manager/?realm=smartcity&consoleProviders=geofence push storage&consoleAutoEnable=true#!geofences"
+ }
+ }
+
+ @IBAction func nextButtonpressed(_ sender: UIButton) {
+
+ // TODO: handle errors and have a proper error message
+
+
+ // TODO: handle the case realm is selected from menu
+
+
+ let state = try? configManager!.setRealm(realm: realmName)
+ switch state {
+ case let .complete(project):
+ if let userDefaults = UserDefaults(suiteName: DefaultsKey.groupEntitlement) {
+ // TODO: we really want to add to the existing collection
+ do {
+ let data = try JSONEncoder().encode([project])
+ userDefaults.setValue(data, forKey: DefaultsKey.projectsConfigurationKey)
+ userDefaults.setValue(project.id, forKey: DefaultsKey.projectKey)
+ self.performSegue(withIdentifier: Segues.goToWebView, sender: self)
+ } catch {
+ break // Fall through to error message
+ }
+ }
+ default:
+ break // Fall through to error message
+ }
+
+
+ // If we reached here, an error occured
+
+
+ // TODO: proper error message
+ let alertView = UIAlertController(title: "Error", message: "TODO", preferredStyle: .alert)
+ alertView.addAction(UIAlertAction(title: "OK", style: .default, handler: nil))
+ self.present(alertView, animated: true, completion: nil)
+
+ }
+}
+
+extension WizardRealmViewController: UITextFieldDelegate {
+
+ func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool {
+ if textField == realmTextInput.textField {
+ if let s = realmTextInput.textField?.text {
+ realmName = s.replacingCharacters(in: Range(range, in: s)!, with: string).trimmingCharacters(in: .whitespacesAndNewlines)
+ }
+ }
+
+ return true
+ }
+
+ /*
+ fileprivate func requestAppConfig(_ domain: String) {
+ configManager = ConfigManager(apiManagerFactory: { url in
+ HttpApiManager(baseUrl: url)
+ })
+
+ async {
+ let state = try await configManager!.setDomain(domain: domain)
+ print("State \(state)")
+ switch state {
+ case .selectDomain:
+ // Something wrong, we just set the domain
+ let alertView = UIAlertController(title: "Error", message: "Error occurred getting app config. Check your input and try again", preferredStyle: .alert)
+ alertView.addAction(UIAlertAction(title: "OK", style: .default, handler: nil))
+
+ self.present(alertView, animated: true, completion: nil)
+ case .selectApp(_, let apps):
+ self.apps = apps
+ self.performSegue(withIdentifier: "goToWizardAppView", sender: self)
+ case .selectRealm(let baseURL, let realms):
+ self.performSegue(withIdentifier: "goToWizardRealmView", sender: self)
+ case.complete(let baseURL, let app, let realm):
+ self.performSegue(withIdentifier: "goToWebView", sender: self)
+ }
+ }
+ }
+ */
+
+ func textFieldShouldReturn(_ textField: UITextField) -> Bool {
+ guard let input = textField.text, !input.isEmpty else {
+ return false
+ }
+
+ if textField == realmTextInput.textField, let realm = realmName {
+ realmTextInput.textField?.resignFirstResponder()
+// requestAppConfig(domain)
+ }
+
+ return true
+ }
+}
diff --git a/console/iOS/GenericApp/Podfile b/console/iOS/GenericApp/Podfile
index 436ca7da7..0250b30ca 100644
--- a/console/iOS/GenericApp/Podfile
+++ b/console/iOS/GenericApp/Podfile
@@ -4,7 +4,6 @@ platform :ios, '13.0'
use_frameworks!
def shared_pods
- pod 'Popover'
pod 'MaterialComponents/TextFields'
pod 'MaterialComponents/Buttons'
end
@@ -17,6 +16,7 @@ target 'GenericApp' do
pod 'Firebase/Crashlytics'
pod 'Firebase/Analytics'
pod 'IQKeyboardManagerSwift'
+ pod 'DropDown'
end
target 'NotificationService' do
diff --git a/console/iOS/GenericApp/Podfile.lock b/console/iOS/GenericApp/Podfile.lock
index b5566db2c..66faa104d 100644
--- a/console/iOS/GenericApp/Podfile.lock
+++ b/console/iOS/GenericApp/Podfile.lock
@@ -1,93 +1,118 @@
PODS:
- - Firebase/Analytics (7.5.0):
+ - DropDown (2.3.13)
+ - Firebase/Analytics (8.11.0):
- Firebase/Core
- - Firebase/Core (7.5.0):
+ - Firebase/Core (8.11.0):
- Firebase/CoreOnly
- - FirebaseAnalytics (= 7.5.0)
- - Firebase/CoreOnly (7.5.0):
- - FirebaseCore (= 7.5.0)
- - Firebase/Crashlytics (7.5.0):
+ - FirebaseAnalytics (~> 8.11.0)
+ - Firebase/CoreOnly (8.11.0):
+ - FirebaseCore (= 8.11.0)
+ - Firebase/Crashlytics (8.11.0):
- Firebase/CoreOnly
- - FirebaseCrashlytics (~> 7.5.0)
- - Firebase/Messaging (7.5.0):
+ - FirebaseCrashlytics (~> 8.11.0)
+ - Firebase/Messaging (8.11.0):
- Firebase/CoreOnly
- - FirebaseMessaging (~> 7.5.0)
- - FirebaseAnalytics (7.5.0):
- - FirebaseCore (~> 7.0)
- - FirebaseInstallations (~> 7.0)
- - GoogleAppMeasurement (= 7.5.0)
- - GoogleUtilities/AppDelegateSwizzler (~> 7.0)
- - GoogleUtilities/MethodSwizzler (~> 7.0)
- - GoogleUtilities/Network (~> 7.0)
- - "GoogleUtilities/NSData+zlib (~> 7.0)"
- - nanopb (~> 2.30907.0)
- - FirebaseCore (7.5.0):
- - FirebaseCoreDiagnostics (~> 7.4)
- - GoogleUtilities/Environment (~> 7.0)
- - GoogleUtilities/Logger (~> 7.0)
- - FirebaseCoreDiagnostics (7.5.0):
- - GoogleDataTransport (~> 8.0)
- - GoogleUtilities/Environment (~> 7.0)
- - GoogleUtilities/Logger (~> 7.0)
- - nanopb (~> 2.30907.0)
- - FirebaseCrashlytics (7.5.0):
- - FirebaseCore (~> 7.0)
- - FirebaseInstallations (~> 7.0)
- - GoogleDataTransport (~> 8.0)
- - nanopb (~> 2.30907.0)
- - PromisesObjC (~> 1.2)
- - FirebaseInstallations (7.5.0):
- - FirebaseCore (~> 7.0)
- - GoogleUtilities/Environment (~> 7.0)
- - GoogleUtilities/UserDefaults (~> 7.0)
- - PromisesObjC (~> 1.2)
- - FirebaseInstanceID (7.5.0):
- - FirebaseCore (~> 7.0)
- - FirebaseInstallations (~> 7.0)
- - GoogleUtilities/Environment (~> 7.0)
- - GoogleUtilities/UserDefaults (~> 7.0)
- - FirebaseMessaging (7.5.0):
- - FirebaseCore (~> 7.0)
- - FirebaseInstanceID (~> 7.0)
- - GoogleUtilities/AppDelegateSwizzler (~> 7.0)
- - GoogleUtilities/Environment (~> 7.0)
- - GoogleUtilities/Reachability (~> 7.0)
- - GoogleUtilities/UserDefaults (~> 7.0)
- - GoogleAppMeasurement (7.5.0):
- - GoogleUtilities/AppDelegateSwizzler (~> 7.0)
- - GoogleUtilities/MethodSwizzler (~> 7.0)
- - GoogleUtilities/Network (~> 7.0)
- - "GoogleUtilities/NSData+zlib (~> 7.0)"
- - nanopb (~> 2.30907.0)
- - GoogleDataTransport (8.2.0):
- - nanopb (~> 2.30907.0)
- - GoogleUtilities/AppDelegateSwizzler (7.2.2):
+ - FirebaseMessaging (~> 8.11.0)
+ - FirebaseAnalytics (8.11.0):
+ - FirebaseAnalytics/AdIdSupport (= 8.11.0)
+ - FirebaseCore (~> 8.0)
+ - FirebaseInstallations (~> 8.0)
+ - GoogleUtilities/AppDelegateSwizzler (~> 7.7)
+ - GoogleUtilities/MethodSwizzler (~> 7.7)
+ - GoogleUtilities/Network (~> 7.7)
+ - "GoogleUtilities/NSData+zlib (~> 7.7)"
+ - nanopb (~> 2.30908.0)
+ - FirebaseAnalytics/AdIdSupport (8.11.0):
+ - FirebaseCore (~> 8.0)
+ - FirebaseInstallations (~> 8.0)
+ - GoogleAppMeasurement (= 8.11.0)
+ - GoogleUtilities/AppDelegateSwizzler (~> 7.7)
+ - GoogleUtilities/MethodSwizzler (~> 7.7)
+ - GoogleUtilities/Network (~> 7.7)
+ - "GoogleUtilities/NSData+zlib (~> 7.7)"
+ - nanopb (~> 2.30908.0)
+ - FirebaseCore (8.11.0):
+ - FirebaseCoreDiagnostics (~> 8.0)
+ - GoogleUtilities/Environment (~> 7.7)
+ - GoogleUtilities/Logger (~> 7.7)
+ - FirebaseCoreDiagnostics (8.11.0):
+ - GoogleDataTransport (~> 9.1)
+ - GoogleUtilities/Environment (~> 7.7)
+ - GoogleUtilities/Logger (~> 7.7)
+ - nanopb (~> 2.30908.0)
+ - FirebaseCrashlytics (8.11.0):
+ - FirebaseCore (~> 8.0)
+ - FirebaseInstallations (~> 8.0)
+ - GoogleDataTransport (~> 9.1)
+ - GoogleUtilities/Environment (~> 7.7)
+ - nanopb (~> 2.30908.0)
+ - PromisesObjC (< 3.0, >= 1.2)
+ - FirebaseInstallations (8.11.0):
+ - FirebaseCore (~> 8.0)
+ - GoogleUtilities/Environment (~> 7.7)
+ - GoogleUtilities/UserDefaults (~> 7.7)
+ - PromisesObjC (< 3.0, >= 1.2)
+ - FirebaseMessaging (8.11.0):
+ - FirebaseCore (~> 8.0)
+ - FirebaseInstallations (~> 8.0)
+ - GoogleDataTransport (~> 9.1)
+ - GoogleUtilities/AppDelegateSwizzler (~> 7.7)
+ - GoogleUtilities/Environment (~> 7.7)
+ - GoogleUtilities/Reachability (~> 7.7)
+ - GoogleUtilities/UserDefaults (~> 7.7)
+ - nanopb (~> 2.30908.0)
+ - GoogleAppMeasurement (8.11.0):
+ - GoogleAppMeasurement/AdIdSupport (= 8.11.0)
+ - GoogleUtilities/AppDelegateSwizzler (~> 7.7)
+ - GoogleUtilities/MethodSwizzler (~> 7.7)
+ - GoogleUtilities/Network (~> 7.7)
+ - "GoogleUtilities/NSData+zlib (~> 7.7)"
+ - nanopb (~> 2.30908.0)
+ - GoogleAppMeasurement/AdIdSupport (8.11.0):
+ - GoogleAppMeasurement/WithoutAdIdSupport (= 8.11.0)
+ - GoogleUtilities/AppDelegateSwizzler (~> 7.7)
+ - GoogleUtilities/MethodSwizzler (~> 7.7)
+ - GoogleUtilities/Network (~> 7.7)
+ - "GoogleUtilities/NSData+zlib (~> 7.7)"
+ - nanopb (~> 2.30908.0)
+ - GoogleAppMeasurement/WithoutAdIdSupport (8.11.0):
+ - GoogleUtilities/AppDelegateSwizzler (~> 7.7)
+ - GoogleUtilities/MethodSwizzler (~> 7.7)
+ - GoogleUtilities/Network (~> 7.7)
+ - "GoogleUtilities/NSData+zlib (~> 7.7)"
+ - nanopb (~> 2.30908.0)
+ - GoogleDataTransport (9.1.2):
+ - GoogleUtilities/Environment (~> 7.2)
+ - nanopb (~> 2.30908.0)
+ - PromisesObjC (< 3.0, >= 1.2)
+ - GoogleUtilities/AppDelegateSwizzler (7.7.0):
- GoogleUtilities/Environment
- GoogleUtilities/Logger
- GoogleUtilities/Network
- - GoogleUtilities/Environment (7.2.2):
- - PromisesObjC (~> 1.2)
- - GoogleUtilities/Logger (7.2.2):
+ - GoogleUtilities/Environment (7.7.0):
+ - PromisesObjC (< 3.0, >= 1.2)
+ - GoogleUtilities/Logger (7.7.0):
- GoogleUtilities/Environment
- - GoogleUtilities/MethodSwizzler (7.2.2):
+ - GoogleUtilities/MethodSwizzler (7.7.0):
- GoogleUtilities/Logger
- - GoogleUtilities/Network (7.2.2):
+ - GoogleUtilities/Network (7.7.0):
- GoogleUtilities/Logger
- "GoogleUtilities/NSData+zlib"
- GoogleUtilities/Reachability
- - "GoogleUtilities/NSData+zlib (7.2.2)"
- - GoogleUtilities/Reachability (7.2.2):
+ - "GoogleUtilities/NSData+zlib (7.7.0)"
+ - GoogleUtilities/Reachability (7.7.0):
- GoogleUtilities/Logger
- - GoogleUtilities/UserDefaults (7.2.2):
+ - GoogleUtilities/UserDefaults (7.7.0):
- GoogleUtilities/Logger
- - IQKeyboardManagerSwift (6.5.6)
- - MaterialComponents/AnimationTiming (121.0.1)
- - MaterialComponents/Availability (121.0.1)
- - MaterialComponents/Buttons (121.0.1):
+ - IQKeyboardManagerSwift (6.5.9)
+ - MaterialComponents/AnimationTiming (124.2.0)
+ - MaterialComponents/Availability (124.2.0)
+ - MaterialComponents/Buttons (124.2.0):
- MaterialComponents/Elevation
- MaterialComponents/Ink
- MaterialComponents/private/Math
- MaterialComponents/Ripple
+ - MaterialComponents/Shadow
- MaterialComponents/ShadowElevations
- MaterialComponents/ShadowLayer
- MaterialComponents/ShapeLibrary
@@ -95,35 +120,37 @@ PODS:
- MaterialComponents/Typography
- MDFInternationalization
- MDFTextAccessibility
- - MaterialComponents/Elevation (121.0.1):
+ - MaterialComponents/Elevation (124.2.0):
- MaterialComponents/Availability
- MaterialComponents/private/Color
- MaterialComponents/private/Math
- - MaterialComponents/Ink (121.0.1):
+ - MaterialComponents/Ink (124.2.0):
- MaterialComponents/Availability
- MaterialComponents/private/Color
- MaterialComponents/private/Math
- - MaterialComponents/Palettes (121.0.1)
- - MaterialComponents/private/Application (121.0.1)
- - MaterialComponents/private/Color (121.0.1):
+ - MaterialComponents/Palettes (124.2.0)
+ - MaterialComponents/private/Application (124.2.0)
+ - MaterialComponents/private/Color (124.2.0):
- MaterialComponents/Availability
- - MaterialComponents/private/Math (121.0.1)
- - MaterialComponents/Ripple (121.0.1):
+ - MaterialComponents/private/Math (124.2.0)
+ - MaterialComponents/Ripple (124.2.0):
- MaterialComponents/AnimationTiming
- MaterialComponents/Availability
- MaterialComponents/private/Color
- MaterialComponents/private/Math
- - MaterialComponents/ShadowElevations (121.0.1)
- - MaterialComponents/ShadowLayer (121.0.1):
+ - MaterialComponents/Shadow (124.2.0):
+ - MaterialComponents/Availability
+ - MaterialComponents/ShadowElevations (124.2.0)
+ - MaterialComponents/ShadowLayer (124.2.0):
- MaterialComponents/ShadowElevations
- - MaterialComponents/ShapeLibrary (121.0.1):
+ - MaterialComponents/ShapeLibrary (124.2.0):
- MaterialComponents/private/Math
- MaterialComponents/Shapes
- - MaterialComponents/Shapes (121.0.1):
+ - MaterialComponents/Shapes (124.2.0):
- MaterialComponents/private/Color
- MaterialComponents/private/Math
- MaterialComponents/ShadowLayer
- - MaterialComponents/TextFields (121.0.1):
+ - MaterialComponents/TextFields (124.2.0):
- MaterialComponents/AnimationTiming
- MaterialComponents/Buttons
- MaterialComponents/Elevation
@@ -131,38 +158,37 @@ PODS:
- MaterialComponents/private/Math
- MaterialComponents/Typography
- MDFInternationalization
- - MaterialComponents/Typography (121.0.1):
+ - MaterialComponents/Typography (124.2.0):
- MaterialComponents/private/Application
- MaterialComponents/private/Math
- MDFTextAccessibility
- - MDFInternationalization (2.0.0)
- - MDFTextAccessibility (2.0.0)
- - nanopb (2.30907.0):
- - nanopb/decode (= 2.30907.0)
- - nanopb/encode (= 2.30907.0)
- - nanopb/decode (2.30907.0)
- - nanopb/encode (2.30907.0)
- - Popover (1.3.0)
- - PromisesObjC (1.2.12)
+ - MDFInternationalization (3.0.0)
+ - MDFTextAccessibility (2.0.1)
+ - nanopb (2.30908.0):
+ - nanopb/decode (= 2.30908.0)
+ - nanopb/encode (= 2.30908.0)
+ - nanopb/decode (2.30908.0)
+ - nanopb/encode (2.30908.0)
+ - PromisesObjC (2.0.0)
DEPENDENCIES:
+ - DropDown
- Firebase/Analytics
- Firebase/Crashlytics
- Firebase/Messaging
- IQKeyboardManagerSwift
- MaterialComponents/Buttons
- MaterialComponents/TextFields
- - Popover
SPEC REPOS:
trunk:
+ - DropDown
- Firebase
- FirebaseAnalytics
- FirebaseCore
- FirebaseCoreDiagnostics
- FirebaseCrashlytics
- FirebaseInstallations
- - FirebaseInstanceID
- FirebaseMessaging
- GoogleAppMeasurement
- GoogleDataTransport
@@ -172,29 +198,27 @@ SPEC REPOS:
- MDFInternationalization
- MDFTextAccessibility
- nanopb
- - Popover
- PromisesObjC
SPEC CHECKSUMS:
- Firebase: fd5e4d2b756292c6e7ee6faac1eb320225d6e97e
- FirebaseAnalytics: 00b7f74571d346ee1ffb9bf0a2e6f2ffff222bcc
- FirebaseCore: 06a2b68af8901f2244eb989419eb89edc3789b4d
- FirebaseCoreDiagnostics: 35685db68b11fe7d19d2d8b557fd7e3a56ac81cc
- FirebaseCrashlytics: 4d77da03c81dedc92cccbefc758f968dccf64b30
- FirebaseInstallations: a46ae59915f0931e18814164849cd0354bea24ed
- FirebaseInstanceID: 47fcb3b70d6349cfd471f430b01bbd01a7698e8f
- FirebaseMessaging: a2a23671eb281b1eed38b155af8549b335a4a38b
- GoogleAppMeasurement: 65a1071e5f52f63ab03d0a4d814a54fd762d885a
- GoogleDataTransport: 1024b1a4dfbd7a0e92cb20d7e0a6f1fb66b449a4
- GoogleUtilities: 31c5b01f978a70c6cff2afc6272b3f1921614b43
- IQKeyboardManagerSwift: c7df9d2deb356c04522f5c4b7b6e4ce4d8ed94fe
- MaterialComponents: afb3574c87696721741006fbb428d26c7565fc0f
- MDFInternationalization: 010097556d6b09d2c4ea38e0820ea6d37be6a314
- MDFTextAccessibility: 85c09a1bd9c321f494348e632a25063bcda35a53
- nanopb: 59221d7f958fb711001e6a449489542d92ae113e
- Popover: 10e1d9528f81d9504df984b7b3f491292bc1822d
- PromisesObjC: 3113f7f76903778cf4a0586bd1ab89329a0b7b97
+ DropDown: 8a2116376c1981888557f72ec2ffc9a5e0e456ec
+ Firebase: 44dd9724c84df18b486639e874f31436eaa9a20c
+ FirebaseAnalytics: 4e4b13031034e6561ed3bd1d47b6fdabbd6487c6
+ FirebaseCore: 2f4f85b453cc8fea4bb2b37e370007d2bcafe3f0
+ FirebaseCoreDiagnostics: 64d9709d804a6c25bd77841371c1fcfd909d5601
+ FirebaseCrashlytics: 62268addefae79601057818156e8bc69d71fee41
+ FirebaseInstallations: 044eede8a049bce71c4541ee68d6e4364fcbe774
+ FirebaseMessaging: 02e248e8997f71fa8cc9d78e9d49ec1a701ba14a
+ GoogleAppMeasurement: aa3cb422fab2b05d2efac543a5720d1a85b9dea5
+ GoogleDataTransport: 629c20a4d363167143f30ea78320d5a7eb8bd940
+ GoogleUtilities: e0913149f6b0625b553d70dae12b49fc62914fd1
+ IQKeyboardManagerSwift: 6e839c575c4aa1078d58a596e41244e77abe918f
+ MaterialComponents: 1a9b2d9d45b1601ae544de85089adc4c464306d4
+ MDFInternationalization: d697c55307816222a55685c4ccb1044ffb030c12
+ MDFTextAccessibility: f4bb4cc2194286651b59a215fdeaa0e05dc90ba5
+ nanopb: a0ba3315591a9ae0a16a309ee504766e90db0c96
+ PromisesObjC: 68159ce6952d93e17b2dfe273b8c40907db5ba58
-PODFILE CHECKSUM: 7cd5b9883b4c8ac0baef0967b6a31c84f8ce1e6c
+PODFILE CHECKSUM: 64b1205ebb3b9e3d4a819457694203ccba5e144b
-COCOAPODS: 1.11.2
+COCOAPODS: 1.11.3
diff --git a/console/iOS/GenericApp/README.md b/console/iOS/GenericApp/README.md
new file mode 100644
index 000000000..7fed27d21
--- /dev/null
+++ b/console/iOS/GenericApp/README.md
@@ -0,0 +1,31 @@
+# <#Title#>
+
+WizardDomainViewController
+-> user enters URL or domain
+ -> if only domain, URL is https://<domain>.openremote.app
+ -> GET <base URL>/api/master/apps/consoleConfig
+ -> see https://github.com/openremote/openremote/issues/642
+ -> if 404, use defaults
+ -> if 200, read info
+ showAppTextInput: Boolean -> default false
+ showRealmTextInput: Boolean -> default false
+ app: String? -> default nil
+ allowedApps: List<String>? -> default nil/empty
+ apps: Map<String, ORAppInfo>? -> default nil/empty
+
+ -> if allowedApps empty -> GET <base URL>/api/master/apps
+ -> if 200, e.g. ["console_loader","manager"]
+ -> if non 200 -> ???
+
+
+In the end, we want to have a config with all information:
+- URL
+- app
+- realm
+and maybe a name
+
+We can pass this object around in the different wizard screens + information each screen need to render
+We can store this object as the configuration
+
+
+https://test1.openremote.app/<app>/info.json
diff --git a/console/iOS/ORLib/ORLib.xcodeproj/project.pbxproj b/console/iOS/ORLib/ORLib.xcodeproj/project.pbxproj
index c744939d3..22abb4cae 100644
--- a/console/iOS/ORLib/ORLib.xcodeproj/project.pbxproj
+++ b/console/iOS/ORLib/ORLib.xcodeproj/project.pbxproj
@@ -7,43 +7,82 @@
objects = {
/* Begin PBXBuildFile section */
- 4C55FA7528699E3A00928D03 /* ORLib.h in Headers */ = {isa = PBXBuildFile; fileRef = 4C55FA7428699E3A00928D03 /* ORLib.h */; settings = {ATTRIBUTES = (Public, ); }; };
- 4C55FA9028699FC300928D03 /* Media.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 4CC64C3E27C3CDD400A2FA4C /* Media.xcassets */; };
- 4C55FA9128699FCA00928D03 /* StorageProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CF5D05227143F1F00D705BE /* StorageProvider.swift */; };
- 4C55FA9228699FCA00928D03 /* GeofenceProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CF5D05327143F1F00D705BE /* GeofenceProvider.swift */; };
- 4C55FA9328699FCA00928D03 /* PushNotificationProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CF5D05427143F1F00D705BE /* PushNotificationProvider.swift */; };
- 4C55FA9428699FCA00928D03 /* QrScannerProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C0E4A11274BE411008CB352 /* QrScannerProvider.swift */; };
- 4C55FA9528699FCA00928D03 /* ORAppConfig.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CF5D06227143F1F00D705BE /* ORAppConfig.swift */; };
- 4C55FA9628699FCA00928D03 /* ORLinkConfig.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CF5D06327143F1F00D705BE /* ORLinkConfig.swift */; };
- 4C55FA9728699FCA00928D03 /* ORPushNotificationButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CF5D06427143F1F00D705BE /* ORPushNotificationButton.swift */; };
- 4C55FA9828699FCA00928D03 /* ORPushNotificationAction.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CF5D06527143F1F00D705BE /* ORPushNotificationAction.swift */; };
- 4C55FA9928699FCA00928D03 /* ORNotificationResource.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CF5D06727143F1F00D705BE /* ORNotificationResource.swift */; };
- 4C55FA9A28699FCA00928D03 /* ApiManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CF5D06827143F1F00D705BE /* ApiManager.swift */; };
- 4C55FA9B28699FCA00928D03 /* ORTextInput.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CF5D05727143F1F00D705BE /* ORTextInput.swift */; };
- 4C55FA9C28699FCA00928D03 /* ORViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CF5D05827143F1F00D705BE /* ORViewController.swift */; };
- 4C55FA9D28699FCA00928D03 /* ErrorManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CF5D05A27143F1F00D705BE /* ErrorManager.swift */; };
- 4C55FA9E28699FCA00928D03 /* QrScannerViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C2CE793274BB48500416B1A /* QrScannerViewController.swift */; };
- 4C55FA9F28699FCA00928D03 /* ScannerOverlayPreviewLayer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C0E4A0F274BDCE0008CB352 /* ScannerOverlayPreviewLayer.swift */; };
- 4C55FAA028699FCA00928D03 /* Constants.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CF5D05C27143F1F00D705BE /* Constants.swift */; };
- 4C55FAA128699FCA00928D03 /* Window+Utils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CF5D05D27143F1F00D705BE /* Window+Utils.swift */; };
- 4C55FAA228699FCA00928D03 /* UIColor+Utils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CF5D05E27143F1F00D705BE /* UIColor+Utils.swift */; };
- 4C55FAA328699FCA00928D03 /* Reachability.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CF5D05F27143F1F00D705BE /* Reachability.swift */; };
- 4C55FAA428699FCA00928D03 /* String+Utils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CF5D06027143F1F00D705BE /* String+Utils.swift */; };
- 4C55FAA528699FCA00928D03 /* ORLib.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CF5D04A27143EEC00D705BE /* ORLib.swift */; };
- 4C55FAA628699FCA00928D03 /* ORLib.h in Sources */ = {isa = PBXBuildFile; fileRef = 4C55FA7428699E3A00928D03 /* ORLib.h */; };
- 8EF1D557933459E02ED28DD1 /* Pods_ORLib.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4C55FAA928699FF400928D03 /* Pods_ORLib.framework */; };
+ 4C0E4A10274BDCE0008CB352 /* ScannerOverlayPreviewLayer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C0E4A0F274BDCE0008CB352 /* ScannerOverlayPreviewLayer.swift */; };
+ 4C0E4A12274BE411008CB352 /* QrScannerProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C0E4A11274BE411008CB352 /* QrScannerProvider.swift */; };
+ 4C2CE794274BB48500416B1A /* QrScannerViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C2CE793274BB48500416B1A /* QrScannerViewController.swift */; };
+ 4CF5D04B27143EEC00D705BE /* ORLib.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CF5D04A27143EEC00D705BE /* ORLib.swift */; };
+ 4CF5D06927143F2000D705BE /* StorageProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CF5D05227143F1F00D705BE /* StorageProvider.swift */; };
+ 4CF5D06A27143F2000D705BE /* GeofenceProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CF5D05327143F1F00D705BE /* GeofenceProvider.swift */; };
+ 4CF5D06B27143F2000D705BE /* PushNotificationProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CF5D05427143F1F00D705BE /* PushNotificationProvider.swift */; };
+ 4CF5D06D27143F2000D705BE /* ORTextInput.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CF5D05727143F1F00D705BE /* ORTextInput.swift */; };
+ 4CF5D06E27143F2000D705BE /* ORViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CF5D05827143F1F00D705BE /* ORViewController.swift */; };
+ 4CF5D07027143F2000D705BE /* ErrorManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CF5D05A27143F1F00D705BE /* ErrorManager.swift */; };
+ 4CF5D07127143F2000D705BE /* Constants.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CF5D05C27143F1F00D705BE /* Constants.swift */; };
+ 4CF5D07227143F2000D705BE /* Window+Utils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CF5D05D27143F1F00D705BE /* Window+Utils.swift */; };
+ 4CF5D07327143F2000D705BE /* UIColor+Utils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CF5D05E27143F1F00D705BE /* UIColor+Utils.swift */; };
+ 4CF5D07427143F2000D705BE /* Reachability.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CF5D05F27143F1F00D705BE /* Reachability.swift */; };
+ 4CF5D07527143F2000D705BE /* String+Utils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CF5D06027143F1F00D705BE /* String+Utils.swift */; };
+ 4CF5D07727143F2000D705BE /* ORLinkConfig.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CF5D06327143F1F00D705BE /* ORLinkConfig.swift */; };
+ 4CF5D07827143F2000D705BE /* ORPushNotificationButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CF5D06427143F1F00D705BE /* ORPushNotificationButton.swift */; };
+ 4CF5D07927143F2000D705BE /* ORPushNotificationAction.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CF5D06527143F1F00D705BE /* ORPushNotificationAction.swift */; };
+ 4CF5D07A27143F2000D705BE /* ORNotificationResource.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CF5D06727143F1F00D705BE /* ORNotificationResource.swift */; };
+ 4CF5D07B27143F2000D705BE /* HttpApiManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CF5D06827143F1F00D705BE /* HttpApiManager.swift */; };
+ 914F7D4429215D3500655A22 /* test12.json in Resources */ = {isa = PBXBuildFile; fileRef = 914F7D4329215D3500655A22 /* test12.json */; };
+ 9156512A28FC6D6700062E16 /* test9.json in Resources */ = {isa = PBXBuildFile; fileRef = 9156512928FC6D6700062E16 /* test9.json */; };
+ 91658F9128897E55000FF05C /* ORConsoleConfig.swift in Sources */ = {isa = PBXBuildFile; fileRef = 91658F9028897E55000FF05C /* ORConsoleConfig.swift */; };
+ 91658F9328897EDD000FF05C /* ORAppInfo.swift in Sources */ = {isa = PBXBuildFile; fileRef = 91658F9228897EDD000FF05C /* ORAppInfo.swift */; };
+ 91932F9328C66A3C00BABBA3 /* test1.json in Resources */ = {isa = PBXBuildFile; fileRef = 91932F9228C66A3C00BABBA3 /* test1.json */; };
+ 91932F9628C6715C00BABBA3 /* test2.json in Resources */ = {isa = PBXBuildFile; fileRef = 91932F9528C6715C00BABBA3 /* test2.json */; };
+ 91932F9828C6738A00BABBA3 /* test3.json in Resources */ = {isa = PBXBuildFile; fileRef = 91932F9728C6738A00BABBA3 /* test3.json */; };
+ 91932F9B28C673DC00BABBA3 /* test5.json in Resources */ = {isa = PBXBuildFile; fileRef = 91932F9928C673DC00BABBA3 /* test5.json */; };
+ 91932F9C28C673DC00BABBA3 /* test4.json in Resources */ = {isa = PBXBuildFile; fileRef = 91932F9A28C673DC00BABBA3 /* test4.json */; };
+ 91932F9E28C6752C00BABBA3 /* test6.json in Resources */ = {isa = PBXBuildFile; fileRef = 91932F9D28C6752C00BABBA3 /* test6.json */; };
+ 91A9A8F328BF6A3300DF8928 /* Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 91A9A8F228BF6A3300DF8928 /* Tests.swift */; };
+ 91A9A8F428BF6A3300DF8928 /* libORLib.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4CF5D04727143EEC00D705BE /* libORLib.a */; };
+ 91A9A8FB28BF6A4900DF8928 /* ConfigManagerTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 91A9A8FA28BF6A4900DF8928 /* ConfigManagerTest.swift */; };
+ 91A9A8FD28BF6A9900DF8928 /* ConfigManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 91A9A8FC28BF6A9900DF8928 /* ConfigManager.swift */; };
+ 91A9A8FF28BF6C4C00DF8928 /* ApiManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 91A9A8FE28BF6C4C00DF8928 /* ApiManager.swift */; };
+ 91A9A90128BF6EA000DF8928 /* FileApiManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 91A9A90028BF6EA000DF8928 /* FileApiManager.swift */; };
+ 91AA79F128D4D525005B9913 /* ProjectConfig.swift in Sources */ = {isa = PBXBuildFile; fileRef = 91AA79F028D4D525005B9913 /* ProjectConfig.swift */; };
+ 91AA79F328D628E9005B9913 /* Fixture.swift in Sources */ = {isa = PBXBuildFile; fileRef = 91AA79F228D628E9005B9913 /* Fixture.swift */; };
+ 91D2D11828E973BF0030E2FB /* test7.json in Resources */ = {isa = PBXBuildFile; fileRef = 91D2D11728E973BF0030E2FB /* test7.json */; };
+ 91D2D11A28E988B10030E2FB /* test8.json in Resources */ = {isa = PBXBuildFile; fileRef = 91D2D11928E988B10030E2FB /* test8.json */; };
+ 91DD9FEE29102A5800912F79 /* test10.json in Resources */ = {isa = PBXBuildFile; fileRef = 91DD9FED2910280900912F79 /* test10.json */; };
+ 91DD9FF029102A8B00912F79 /* test11.json in Resources */ = {isa = PBXBuildFile; fileRef = 91DD9FEF29102A8B00912F79 /* test11.json */; };
+ ABD81191A88B3D7A8B2E66B6 /* Pods_ORLib.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 41E56A0D7E49334C15A35CB4 /* Pods_ORLib.framework */; };
/* End PBXBuildFile section */
+/* Begin PBXContainerItemProxy section */
+ 91A9A8F528BF6A3300DF8928 /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 4CF5D03F27143EEC00D705BE /* Project object */;
+ proxyType = 1;
+ remoteGlobalIDString = 4CF5D04627143EEC00D705BE;
+ remoteInfo = ORLib;
+ };
+/* End PBXContainerItemProxy section */
+
+/* Begin PBXCopyFilesBuildPhase section */
+ 4CF5D04527143EEC00D705BE /* CopyFiles */ = {
+ isa = PBXCopyFilesBuildPhase;
+ buildActionMask = 2147483647;
+ dstPath = "include/$(PRODUCT_NAME)";
+ dstSubfolderSpec = 16;
+ files = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXCopyFilesBuildPhase section */
+
/* Begin PBXFileReference section */
- 37A59C1C5EEB5A3027F557D0 /* Pods-ORLib.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ORLib.release.xcconfig"; path = "../../../michael/Documents/Projects/OpenRemote/k2/console/iOS/K2/Pods/Target Support Files/Pods-ORLib/Pods-ORLib.release.xcconfig"; sourceTree = "<group>"; };
- 3F2140D7DCE68D42273B346B /* Pods-ORLib.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ORLib.debug.xcconfig"; path = "../../../michael/Documents/Projects/OpenRemote/k2/console/iOS/K2/Pods/Target Support Files/Pods-ORLib/Pods-ORLib.debug.xcconfig"; sourceTree = "<group>"; };
+ 37A59C1C5EEB5A3027F557D0 /* Pods-ORLib.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ORLib.release.xcconfig"; path = "../../../Users/ebariaux/Development/OpenRemote/openremote/console/iOS/GenericApp/Pods/Target Support Files/Pods-ORLib/Pods-ORLib.release.xcconfig"; sourceTree = "<group>"; };
+ 3F2140D7DCE68D42273B346B /* Pods-ORLib.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ORLib.debug.xcconfig"; path = "../../../Users/ebariaux/Development/OpenRemote/openremote/console/iOS/GenericApp/Pods/Target Support Files/Pods-ORLib/Pods-ORLib.debug.xcconfig"; sourceTree = "<group>"; };
+ 41E56A0D7E49334C15A35CB4 /* Pods_ORLib.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_ORLib.framework; sourceTree = BUILT_PRODUCTS_DIR; };
4C0E4A0F274BDCE0008CB352 /* ScannerOverlayPreviewLayer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ScannerOverlayPreviewLayer.swift; sourceTree = "<group>"; };
4C0E4A11274BE411008CB352 /* QrScannerProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = QrScannerProvider.swift; sourceTree = "<group>"; };
4C2CE793274BB48500416B1A /* QrScannerViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = QrScannerViewController.swift; sourceTree = "<group>"; };
- 4C55FA7228699E3A00928D03 /* ORLib.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = ORLib.framework; sourceTree = BUILT_PRODUCTS_DIR; };
- 4C55FA7428699E3A00928D03 /* ORLib.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ORLib.h; sourceTree = "<group>"; };
- 4C55FAA928699FF400928D03 /* Pods_ORLib.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = Pods_ORLib.framework; sourceTree = BUILT_PRODUCTS_DIR; };
4CC64C3E27C3CDD400A2FA4C /* Media.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Media.xcassets; sourceTree = "<group>"; };
+ 4CF5D04727143EEC00D705BE /* libORLib.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libORLib.a; sourceTree = BUILT_PRODUCTS_DIR; };
4CF5D04A27143EEC00D705BE /* ORLib.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ORLib.swift; sourceTree = "<group>"; };
4CF5D05227143F1F00D705BE /* StorageProvider.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StorageProvider.swift; sourceTree = "<group>"; };
4CF5D05327143F1F00D705BE /* GeofenceProvider.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GeofenceProvider.swift; sourceTree = "<group>"; };
@@ -56,20 +95,50 @@
4CF5D05E27143F1F00D705BE /* UIColor+Utils.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIColor+Utils.swift"; sourceTree = "<group>"; };
4CF5D05F27143F1F00D705BE /* Reachability.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Reachability.swift; sourceTree = "<group>"; };
4CF5D06027143F1F00D705BE /* String+Utils.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "String+Utils.swift"; sourceTree = "<group>"; };
- 4CF5D06227143F1F00D705BE /* ORAppConfig.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ORAppConfig.swift; sourceTree = "<group>"; };
4CF5D06327143F1F00D705BE /* ORLinkConfig.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ORLinkConfig.swift; sourceTree = "<group>"; };
4CF5D06427143F1F00D705BE /* ORPushNotificationButton.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ORPushNotificationButton.swift; sourceTree = "<group>"; };
4CF5D06527143F1F00D705BE /* ORPushNotificationAction.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ORPushNotificationAction.swift; sourceTree = "<group>"; };
4CF5D06727143F1F00D705BE /* ORNotificationResource.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ORNotificationResource.swift; sourceTree = "<group>"; };
- 4CF5D06827143F1F00D705BE /* ApiManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ApiManager.swift; sourceTree = "<group>"; };
+ 4CF5D06827143F1F00D705BE /* HttpApiManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HttpApiManager.swift; sourceTree = "<group>"; };
+ 914F7D4329215D3500655A22 /* test12.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = test12.json; sourceTree = "<group>"; };
+ 9156512928FC6D6700062E16 /* test9.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = test9.json; sourceTree = "<group>"; };
+ 91658F9028897E55000FF05C /* ORConsoleConfig.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ORConsoleConfig.swift; sourceTree = "<group>"; };
+ 91658F9228897EDD000FF05C /* ORAppInfo.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ORAppInfo.swift; sourceTree = "<group>"; };
+ 91932F9228C66A3C00BABBA3 /* test1.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = test1.json; sourceTree = "<group>"; };
+ 91932F9428C670D800BABBA3 /* Tests.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = Tests.md; sourceTree = "<group>"; };
+ 91932F9528C6715C00BABBA3 /* test2.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = test2.json; sourceTree = "<group>"; };
+ 91932F9728C6738A00BABBA3 /* test3.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = test3.json; sourceTree = "<group>"; };
+ 91932F9928C673DC00BABBA3 /* test5.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = test5.json; sourceTree = "<group>"; };
+ 91932F9A28C673DC00BABBA3 /* test4.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = test4.json; sourceTree = "<group>"; };
+ 91932F9D28C6752C00BABBA3 /* test6.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = test6.json; sourceTree = "<group>"; };
+ 91A9A8F028BF6A3300DF8928 /* Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = Tests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
+ 91A9A8F228BF6A3300DF8928 /* Tests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Tests.swift; sourceTree = "<group>"; };
+ 91A9A8FA28BF6A4900DF8928 /* ConfigManagerTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConfigManagerTest.swift; sourceTree = "<group>"; };
+ 91A9A8FC28BF6A9900DF8928 /* ConfigManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConfigManager.swift; sourceTree = "<group>"; };
+ 91A9A8FE28BF6C4C00DF8928 /* ApiManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ApiManager.swift; sourceTree = "<group>"; };
+ 91A9A90028BF6EA000DF8928 /* FileApiManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FileApiManager.swift; sourceTree = "<group>"; };
+ 91AA79F028D4D525005B9913 /* ProjectConfig.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProjectConfig.swift; sourceTree = "<group>"; };
+ 91AA79F228D628E9005B9913 /* Fixture.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Fixture.swift; sourceTree = "<group>"; };
+ 91D2D11728E973BF0030E2FB /* test7.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = test7.json; sourceTree = "<group>"; };
+ 91D2D11928E988B10030E2FB /* test8.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = test8.json; sourceTree = "<group>"; };
+ 91DD9FED2910280900912F79 /* test10.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = test10.json; sourceTree = "<group>"; };
+ 91DD9FEF29102A8B00912F79 /* test11.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = test11.json; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
- 4C55FA6F28699E3A00928D03 /* Frameworks */ = {
+ 4CF5D04427143EEC00D705BE /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
- 8EF1D557933459E02ED28DD1 /* Pods_ORLib.framework in Frameworks */,
+ ABD81191A88B3D7A8B2E66B6 /* Pods_ORLib.framework in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 91A9A8ED28BF6A3300DF8928 /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 91A9A8F428BF6A3300DF8928 /* libORLib.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -91,6 +160,7 @@
children = (
4CC64C3E27C3CDD400A2FA4C /* Media.xcassets */,
4CF5D04927143EEC00D705BE /* ORLib */,
+ 91A9A8F128BF6A3300DF8928 /* Tests */,
4CF5D04827143EEC00D705BE /* Products */,
15E46D9A67E43A8180E89721 /* Pods */,
717C35290053DAF6024CFEA7 /* Frameworks */,
@@ -100,7 +170,8 @@
4CF5D04827143EEC00D705BE /* Products */ = {
isa = PBXGroup;
children = (
- 4C55FA7228699E3A00928D03 /* ORLib.framework */,
+ 4CF5D04727143EEC00D705BE /* libORLib.a */,
+ 91A9A8F028BF6A3300DF8928 /* Tests.xctest */,
);
name = Products;
sourceTree = "<group>";
@@ -114,7 +185,7 @@
4CF5D05527143F1F00D705BE /* UI */,
4CF5D05B27143F1F00D705BE /* Utils */,
4CF5D04A27143EEC00D705BE /* ORLib.swift */,
- 4C55FA7428699E3A00928D03 /* ORLib.h */,
+ 91A9A8FC28BF6A9900DF8928 /* ConfigManager.swift */,
);
path = ORLib;
sourceTree = "<group>";
@@ -157,10 +228,12 @@
4CF5D06127143F1F00D705BE /* Models */ = {
isa = PBXGroup;
children = (
- 4CF5D06227143F1F00D705BE /* ORAppConfig.swift */,
4CF5D06327143F1F00D705BE /* ORLinkConfig.swift */,
4CF5D06427143F1F00D705BE /* ORPushNotificationButton.swift */,
4CF5D06527143F1F00D705BE /* ORPushNotificationAction.swift */,
+ 91658F9028897E55000FF05C /* ORConsoleConfig.swift */,
+ 91658F9228897EDD000FF05C /* ORAppInfo.swift */,
+ 91AA79F028D4D525005B9913 /* ProjectConfig.swift */,
);
path = Models;
sourceTree = "<group>";
@@ -169,7 +242,8 @@
isa = PBXGroup;
children = (
4CF5D06727143F1F00D705BE /* ORNotificationResource.swift */,
- 4CF5D06827143F1F00D705BE /* ApiManager.swift */,
+ 4CF5D06827143F1F00D705BE /* HttpApiManager.swift */,
+ 91A9A8FE28BF6C4C00DF8928 /* ApiManager.swift */,
);
path = Network;
sourceTree = "<group>";
@@ -177,34 +251,54 @@
717C35290053DAF6024CFEA7 /* Frameworks */ = {
isa = PBXGroup;
children = (
- 4C55FAA928699FF400928D03 /* Pods_ORLib.framework */,
+ 41E56A0D7E49334C15A35CB4 /* Pods_ORLib.framework */,
);
name = Frameworks;
sourceTree = "<group>";
};
-/* End PBXGroup section */
-
-/* Begin PBXHeadersBuildPhase section */
- 4C55FA6D28699E3A00928D03 /* Headers */ = {
- isa = PBXHeadersBuildPhase;
- buildActionMask = 2147483647;
- files = (
- 4C55FA7528699E3A00928D03 /* ORLib.h in Headers */,
+ 91932F9128C66A0400BABBA3 /* Fixtures */ = {
+ isa = PBXGroup;
+ children = (
+ 91932F9428C670D800BABBA3 /* Tests.md */,
+ 91932F9228C66A3C00BABBA3 /* test1.json */,
+ 91932F9528C6715C00BABBA3 /* test2.json */,
+ 91932F9728C6738A00BABBA3 /* test3.json */,
+ 91932F9A28C673DC00BABBA3 /* test4.json */,
+ 91932F9928C673DC00BABBA3 /* test5.json */,
+ 91932F9D28C6752C00BABBA3 /* test6.json */,
+ 91D2D11728E973BF0030E2FB /* test7.json */,
+ 91D2D11928E988B10030E2FB /* test8.json */,
+ 9156512928FC6D6700062E16 /* test9.json */,
+ 91DD9FED2910280900912F79 /* test10.json */,
+ 91DD9FEF29102A8B00912F79 /* test11.json */,
+ 914F7D4329215D3500655A22 /* test12.json */,
);
- runOnlyForDeploymentPostprocessing = 0;
+ path = Fixtures;
+ sourceTree = "<group>";
};
-/* End PBXHeadersBuildPhase section */
+ 91A9A8F128BF6A3300DF8928 /* Tests */ = {
+ isa = PBXGroup;
+ children = (
+ 91932F9128C66A0400BABBA3 /* Fixtures */,
+ 91A9A8FA28BF6A4900DF8928 /* ConfigManagerTest.swift */,
+ 91A9A8F228BF6A3300DF8928 /* Tests.swift */,
+ 91A9A90028BF6EA000DF8928 /* FileApiManager.swift */,
+ 91AA79F228D628E9005B9913 /* Fixture.swift */,
+ );
+ path = Tests;
+ sourceTree = "<group>";
+ };
+/* End PBXGroup section */
/* Begin PBXNativeTarget section */
- 4C55FA7128699E3A00928D03 /* ORLib */ = {
+ 4CF5D04627143EEC00D705BE /* ORLib */ = {
isa = PBXNativeTarget;
- buildConfigurationList = 4C55FA7628699E3A00928D03 /* Build configuration list for PBXNativeTarget "ORLib" */;
+ buildConfigurationList = 4CF5D04E27143EEC00D705BE /* Build configuration list for PBXNativeTarget "ORLib" */;
buildPhases = (
- 80C5C2C1F10B8430E592373C /* [CP] Check Pods Manifest.lock */,
- 4C55FA6D28699E3A00928D03 /* Headers */,
- 4C55FA6E28699E3A00928D03 /* Sources */,
- 4C55FA6F28699E3A00928D03 /* Frameworks */,
- 4C55FA7028699E3A00928D03 /* Resources */,
+ 8FD1291A07546E0F98084666 /* [CP] Check Pods Manifest.lock */,
+ 4CF5D04327143EEC00D705BE /* Sources */,
+ 4CF5D04427143EEC00D705BE /* Frameworks */,
+ 4CF5D04527143EEC00D705BE /* CopyFiles */,
);
buildRules = (
);
@@ -212,8 +306,26 @@
);
name = ORLib;
productName = ORLib;
- productReference = 4C55FA7228699E3A00928D03 /* ORLib.framework */;
- productType = "com.apple.product-type.framework";
+ productReference = 4CF5D04727143EEC00D705BE /* libORLib.a */;
+ productType = "com.apple.product-type.library.static";
+ };
+ 91A9A8EF28BF6A3300DF8928 /* Tests */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 91A9A8F728BF6A3300DF8928 /* Build configuration list for PBXNativeTarget "Tests" */;
+ buildPhases = (
+ 91A9A8EC28BF6A3300DF8928 /* Sources */,
+ 91A9A8ED28BF6A3300DF8928 /* Frameworks */,
+ 91A9A8EE28BF6A3300DF8928 /* Resources */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ 91A9A8F628BF6A3300DF8928 /* PBXTargetDependency */,
+ );
+ name = Tests;
+ productName = Tests;
+ productReference = 91A9A8F028BF6A3300DF8928 /* Tests.xctest */;
+ productType = "com.apple.product-type.bundle.unit-test";
};
/* End PBXNativeTarget section */
@@ -221,10 +333,13 @@
4CF5D03F27143EEC00D705BE /* Project object */ = {
isa = PBXProject;
attributes = {
- LastSwiftUpdateCheck = 1250;
+ LastSwiftUpdateCheck = 1340;
LastUpgradeCheck = 1250;
TargetAttributes = {
- 4C55FA7128699E3A00928D03 = {
+ 4CF5D04627143EEC00D705BE = {
+ CreatedOnToolsVersion = 12.5.1;
+ };
+ 91A9A8EF28BF6A3300DF8928 = {
CreatedOnToolsVersion = 13.4.1;
};
};
@@ -242,24 +357,36 @@
projectDirPath = "";
projectRoot = "";
targets = (
- 4C55FA7128699E3A00928D03 /* ORLib */,
+ 4CF5D04627143EEC00D705BE /* ORLib */,
+ 91A9A8EF28BF6A3300DF8928 /* Tests */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
- 4C55FA7028699E3A00928D03 /* Resources */ = {
+ 91A9A8EE28BF6A3300DF8928 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
- 4C55FA9028699FC300928D03 /* Media.xcassets in Resources */,
+ 91DD9FF029102A8B00912F79 /* test11.json in Resources */,
+ 91932F9328C66A3C00BABBA3 /* test1.json in Resources */,
+ 9156512A28FC6D6700062E16 /* test9.json in Resources */,
+ 91D2D11828E973BF0030E2FB /* test7.json in Resources */,
+ 91D2D11A28E988B10030E2FB /* test8.json in Resources */,
+ 91DD9FEE29102A5800912F79 /* test10.json in Resources */,
+ 91932F9628C6715C00BABBA3 /* test2.json in Resources */,
+ 91932F9828C6738A00BABBA3 /* test3.json in Resources */,
+ 91932F9C28C673DC00BABBA3 /* test4.json in Resources */,
+ 91932F9E28C6752C00BABBA3 /* test6.json in Resources */,
+ 914F7D4429215D3500655A22 /* test12.json in Resources */,
+ 91932F9B28C673DC00BABBA3 /* test5.json in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
- 80C5C2C1F10B8430E592373C /* [CP] Check Pods Manifest.lock */ = {
+ 8FD1291A07546E0F98084666 /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
@@ -284,106 +411,60 @@
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
- 4C55FA6E28699E3A00928D03 /* Sources */ = {
+ 4CF5D04327143EEC00D705BE /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
- 4C55FA9128699FCA00928D03 /* StorageProvider.swift in Sources */,
- 4C55FA9228699FCA00928D03 /* GeofenceProvider.swift in Sources */,
- 4C55FA9328699FCA00928D03 /* PushNotificationProvider.swift in Sources */,
- 4C55FA9428699FCA00928D03 /* QrScannerProvider.swift in Sources */,
- 4C55FA9528699FCA00928D03 /* ORAppConfig.swift in Sources */,
- 4C55FA9628699FCA00928D03 /* ORLinkConfig.swift in Sources */,
- 4C55FA9728699FCA00928D03 /* ORPushNotificationButton.swift in Sources */,
- 4C55FA9828699FCA00928D03 /* ORPushNotificationAction.swift in Sources */,
- 4C55FA9928699FCA00928D03 /* ORNotificationResource.swift in Sources */,
- 4C55FA9A28699FCA00928D03 /* ApiManager.swift in Sources */,
- 4C55FA9B28699FCA00928D03 /* ORTextInput.swift in Sources */,
- 4C55FA9C28699FCA00928D03 /* ORViewController.swift in Sources */,
- 4C55FA9D28699FCA00928D03 /* ErrorManager.swift in Sources */,
- 4C55FA9E28699FCA00928D03 /* QrScannerViewController.swift in Sources */,
- 4C55FA9F28699FCA00928D03 /* ScannerOverlayPreviewLayer.swift in Sources */,
- 4C55FAA028699FCA00928D03 /* Constants.swift in Sources */,
- 4C55FAA128699FCA00928D03 /* Window+Utils.swift in Sources */,
- 4C55FAA228699FCA00928D03 /* UIColor+Utils.swift in Sources */,
- 4C55FAA328699FCA00928D03 /* Reachability.swift in Sources */,
- 4C55FAA428699FCA00928D03 /* String+Utils.swift in Sources */,
- 4C55FAA528699FCA00928D03 /* ORLib.swift in Sources */,
- 4C55FAA628699FCA00928D03 /* ORLib.h in Sources */,
+ 4CF5D07027143F2000D705BE /* ErrorManager.swift in Sources */,
+ 91658F9328897EDD000FF05C /* ORAppInfo.swift in Sources */,
+ 4CF5D07227143F2000D705BE /* Window+Utils.swift in Sources */,
+ 4C0E4A12274BE411008CB352 /* QrScannerProvider.swift in Sources */,
+ 4CF5D07727143F2000D705BE /* ORLinkConfig.swift in Sources */,
+ 4C2CE794274BB48500416B1A /* QrScannerViewController.swift in Sources */,
+ 4CF5D06E27143F2000D705BE /* ORViewController.swift in Sources */,
+ 4CF5D07327143F2000D705BE /* UIColor+Utils.swift in Sources */,
+ 4CF5D06D27143F2000D705BE /* ORTextInput.swift in Sources */,
+ 91658F9128897E55000FF05C /* ORConsoleConfig.swift in Sources */,
+ 4CF5D07A27143F2000D705BE /* ORNotificationResource.swift in Sources */,
+ 4CF5D07827143F2000D705BE /* ORPushNotificationButton.swift in Sources */,
+ 91A9A8FF28BF6C4C00DF8928 /* ApiManager.swift in Sources */,
+ 4CF5D06A27143F2000D705BE /* GeofenceProvider.swift in Sources */,
+ 4CF5D06927143F2000D705BE /* StorageProvider.swift in Sources */,
+ 4CF5D07127143F2000D705BE /* Constants.swift in Sources */,
+ 4CF5D07B27143F2000D705BE /* HttpApiManager.swift in Sources */,
+ 4CF5D04B27143EEC00D705BE /* ORLib.swift in Sources */,
+ 4CF5D06B27143F2000D705BE /* PushNotificationProvider.swift in Sources */,
+ 91AA79F128D4D525005B9913 /* ProjectConfig.swift in Sources */,
+ 4CF5D07527143F2000D705BE /* String+Utils.swift in Sources */,
+ 4C0E4A10274BDCE0008CB352 /* ScannerOverlayPreviewLayer.swift in Sources */,
+ 4CF5D07427143F2000D705BE /* Reachability.swift in Sources */,
+ 4CF5D07927143F2000D705BE /* ORPushNotificationAction.swift in Sources */,
+ 91A9A8FD28BF6A9900DF8928 /* ConfigManager.swift in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 91A9A8EC28BF6A3300DF8928 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 91A9A90128BF6EA000DF8928 /* FileApiManager.swift in Sources */,
+ 91A9A8F328BF6A3300DF8928 /* Tests.swift in Sources */,
+ 91A9A8FB28BF6A4900DF8928 /* ConfigManagerTest.swift in Sources */,
+ 91AA79F328D628E9005B9913 /* Fixture.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
-/* Begin XCBuildConfiguration section */
- 4C55FA7728699E3A00928D03 /* Debug */ = {
- isa = XCBuildConfiguration;
- baseConfigurationReference = 3F2140D7DCE68D42273B346B /* Pods-ORLib.debug.xcconfig */;
- buildSettings = {
- BUILD_LIBRARY_FOR_DISTRIBUTION = YES;
- CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
- CODE_SIGN_STYLE = Automatic;
- CURRENT_PROJECT_VERSION = 1;
- DEFINES_MODULE = YES;
- DEVELOPMENT_TEAM = 4AC88KZHJZ;
- DYLIB_COMPATIBILITY_VERSION = 1;
- DYLIB_CURRENT_VERSION = 1;
- DYLIB_INSTALL_NAME_BASE = "@rpath";
- GENERATE_INFOPLIST_FILE = YES;
- INFOPLIST_KEY_NSHumanReadableCopyright = "";
- INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
- IPHONEOS_DEPLOYMENT_TARGET = 15.5;
- LD_RUNPATH_SEARCH_PATHS = (
- "$(inherited)",
- "@executable_path/Frameworks",
- "@loader_path/Frameworks",
- );
- MARKETING_VERSION = 1.0;
- PRODUCT_BUNDLE_IDENTIFIER = io.openremote.ORLib;
- PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
- SKIP_INSTALL = YES;
- SWIFT_EMIT_LOC_STRINGS = YES;
- SWIFT_VERSION = 5.0;
- TARGETED_DEVICE_FAMILY = "1,2";
- VERSIONING_SYSTEM = "apple-generic";
- VERSION_INFO_PREFIX = "";
- };
- name = Debug;
- };
- 4C55FA7828699E3A00928D03 /* Release */ = {
- isa = XCBuildConfiguration;
- baseConfigurationReference = 37A59C1C5EEB5A3027F557D0 /* Pods-ORLib.release.xcconfig */;
- buildSettings = {
- BUILD_LIBRARY_FOR_DISTRIBUTION = YES;
- CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
- CODE_SIGN_STYLE = Automatic;
- CURRENT_PROJECT_VERSION = 1;
- DEFINES_MODULE = YES;
- DEVELOPMENT_TEAM = 4AC88KZHJZ;
- DYLIB_COMPATIBILITY_VERSION = 1;
- DYLIB_CURRENT_VERSION = 1;
- DYLIB_INSTALL_NAME_BASE = "@rpath";
- GENERATE_INFOPLIST_FILE = YES;
- INFOPLIST_KEY_NSHumanReadableCopyright = "";
- INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
- IPHONEOS_DEPLOYMENT_TARGET = 15.5;
- LD_RUNPATH_SEARCH_PATHS = (
- "$(inherited)",
- "@executable_path/Frameworks",
- "@loader_path/Frameworks",
- );
- MARKETING_VERSION = 1.0;
- PRODUCT_BUNDLE_IDENTIFIER = io.openremote.ORLib;
- PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
- SKIP_INSTALL = YES;
- SWIFT_EMIT_LOC_STRINGS = YES;
- SWIFT_VERSION = 5.0;
- TARGETED_DEVICE_FAMILY = "1,2";
- VERSIONING_SYSTEM = "apple-generic";
- VERSION_INFO_PREFIX = "";
- };
- name = Release;
+/* Begin PBXTargetDependency section */
+ 91A9A8F628BF6A3300DF8928 /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ target = 4CF5D04627143EEC00D705BE /* ORLib */;
+ targetProxy = 91A9A8F528BF6A3300DF8928 /* PBXContainerItemProxy */;
};
+/* End PBXTargetDependency section */
+
+/* Begin XCBuildConfiguration section */
4CF5D04C27143EEC00D705BE /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
@@ -435,7 +516,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
- IPHONEOS_DEPLOYMENT_TARGET = 13.2;
+ IPHONEOS_DEPLOYMENT_TARGET = 14.0;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
@@ -491,7 +572,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
- IPHONEOS_DEPLOYMENT_TARGET = 13.2;
+ IPHONEOS_DEPLOYMENT_TARGET = 14.0;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
OTHER_LDFLAGS = "$(inherited)";
@@ -502,23 +583,102 @@
};
name = Release;
};
+ 4CF5D04F27143EEC00D705BE /* Debug */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = 3F2140D7DCE68D42273B346B /* Pods-ORLib.debug.xcconfig */;
+ buildSettings = {
+ CODE_SIGN_STYLE = Automatic;
+ DEVELOPMENT_TEAM = 4AC88KZHJZ;
+ OTHER_LDFLAGS = (
+ "-ObjC",
+ "$(inherited)",
+ );
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ SKIP_INSTALL = YES;
+ SWIFT_VERSION = 5.0;
+ TARGETED_DEVICE_FAMILY = "1,2";
+ };
+ name = Debug;
+ };
+ 4CF5D05027143EEC00D705BE /* Release */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = 37A59C1C5EEB5A3027F557D0 /* Pods-ORLib.release.xcconfig */;
+ buildSettings = {
+ CODE_SIGN_STYLE = Automatic;
+ DEVELOPMENT_TEAM = 4AC88KZHJZ;
+ OTHER_LDFLAGS = (
+ "-ObjC",
+ "$(inherited)",
+ );
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ SKIP_INSTALL = YES;
+ SWIFT_VERSION = 5.0;
+ TARGETED_DEVICE_FAMILY = "1,2";
+ };
+ name = Release;
+ };
+ 91A9A8F828BF6A3300DF8928 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
+ CODE_SIGN_STYLE = Automatic;
+ CURRENT_PROJECT_VERSION = 1;
+ DEVELOPMENT_TEAM = 4AC88KZHJZ;
+ GENERATE_INFOPLIST_FILE = YES;
+ IPHONEOS_DEPLOYMENT_TARGET = 15.5;
+ MARKETING_VERSION = 1.0;
+ PRODUCT_BUNDLE_IDENTIFIER = io.openremote.Tests;
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ SWIFT_EMIT_LOC_STRINGS = NO;
+ SWIFT_VERSION = 5.0;
+ TARGETED_DEVICE_FAMILY = "1,2";
+ };
+ name = Debug;
+ };
+ 91A9A8F928BF6A3300DF8928 /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
+ CODE_SIGN_STYLE = Automatic;
+ CURRENT_PROJECT_VERSION = 1;
+ DEVELOPMENT_TEAM = 4AC88KZHJZ;
+ GENERATE_INFOPLIST_FILE = YES;
+ IPHONEOS_DEPLOYMENT_TARGET = 15.5;
+ MARKETING_VERSION = 1.0;
+ PRODUCT_BUNDLE_IDENTIFIER = io.openremote.Tests;
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ SWIFT_EMIT_LOC_STRINGS = NO;
+ SWIFT_VERSION = 5.0;
+ TARGETED_DEVICE_FAMILY = "1,2";
+ };
+ name = Release;
+ };
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
- 4C55FA7628699E3A00928D03 /* Build configuration list for PBXNativeTarget "ORLib" */ = {
+ 4CF5D04227143EEC00D705BE /* Build configuration list for PBXProject "ORLib" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 4CF5D04C27143EEC00D705BE /* Debug */,
+ 4CF5D04D27143EEC00D705BE /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 4CF5D04E27143EEC00D705BE /* Build configuration list for PBXNativeTarget "ORLib" */ = {
isa = XCConfigurationList;
buildConfigurations = (
- 4C55FA7728699E3A00928D03 /* Debug */,
- 4C55FA7828699E3A00928D03 /* Release */,
+ 4CF5D04F27143EEC00D705BE /* Debug */,
+ 4CF5D05027143EEC00D705BE /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
- 4CF5D04227143EEC00D705BE /* Build configuration list for PBXProject "ORLib" */ = {
+ 91A9A8F728BF6A3300DF8928 /* Build configuration list for PBXNativeTarget "Tests" */ = {
isa = XCConfigurationList;
buildConfigurations = (
- 4CF5D04C27143EEC00D705BE /* Debug */,
- 4CF5D04D27143EEC00D705BE /* Release */,
+ 91A9A8F828BF6A3300DF8928 /* Debug */,
+ 91A9A8F928BF6A3300DF8928 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
diff --git a/console/iOS/ORLib/ORLib.xcodeproj/xcuserdata/michael.xcuserdatad/xcschemes/xcschememanagement.plist b/console/iOS/ORLib/ORLib.xcodeproj/xcuserdata/michael.xcuserdatad/xcschemes/xcschememanagement.plist
index 8b0aab2ba..a839ca752 100644
--- a/console/iOS/ORLib/ORLib.xcodeproj/xcuserdata/michael.xcuserdatad/xcschemes/xcschememanagement.plist
+++ b/console/iOS/ORLib/ORLib.xcodeproj/xcuserdata/michael.xcuserdatad/xcschemes/xcschememanagement.plist
@@ -7,7 +7,7 @@
<key>ORLib.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
- <integer>20</integer>
+ <integer>21</integer>
</dict>
</dict>
</dict>
diff --git a/console/iOS/ORLib/ORLib/ConfigManager.swift b/console/iOS/ORLib/ORLib/ConfigManager.swift
new file mode 100644
index 000000000..fdb0285af
--- /dev/null
+++ b/console/iOS/ORLib/ORLib/ConfigManager.swift
@@ -0,0 +1,181 @@
+//
+// ConfigManager.swift
+// ORLib
+//
+// Created by Eric Bariaux on 31/08/2022.
+//
+
+import Foundation
+
+public enum ConfigManagerState: Equatable {
+ case selectDomain
+ case selectApp(String, [String]?) // baseURL, list of apps to choose from
+ case selectRealm(String, String, [String]?) // baseURL, app, list of realms to choose from
+ case complete(ProjectConfig)
+}
+
+public enum ConfigManagerError: Error {
+ case invalidState
+ case communicationError
+ case couldNotLoadAppConfig
+}
+
+public typealias ApiManagerFactory = (String) -> ApiManager
+
+
+public class ConfigManager {
+
+ private var apiManagerFactory: ((String) -> ApiManager)
+ private var apiManager: ApiManager?
+
+ public private(set) var globalAppInfos : [String:ORAppInfo] = [:] // app infos from the top level consoleConfig information
+ public private(set) var appInfos : [String:ORAppInfo] = [:] // app infos from each specific app info.json
+
+ public private(set) var state = ConfigManagerState.selectDomain
+
+ public init(apiManagerFactory: @escaping ApiManagerFactory) {
+ self.apiManagerFactory = apiManagerFactory
+ }
+
+ public func setDomain(domain: String) async throws -> ConfigManagerState {
+ switch state {
+ case .selectDomain:
+ let baseUrl = domain.isValidURL ? domain : "https://\(domain).openremote.app"
+ let url = baseUrl.appending("/api/master")
+
+ apiManager = apiManagerFactory(url)
+
+ guard let api = apiManager else {
+ throw ConfigManagerError.communicationError
+ }
+
+ do {
+ let cc: ORConsoleConfig
+ do {
+ cc = try await api.getConsoleConfig() ?? ORConsoleConfig()
+ if let apps = cc.apps {
+ globalAppInfos = apps
+ }
+ } catch ApiManagerError.communicationError(let httpStatusCode) {
+ if httpStatusCode == 404 || httpStatusCode == 403 {
+ // 403 is for backwards compatibility of older manager
+ cc = ORConsoleConfig()
+ } else {
+ throw ApiManagerError.communicationError(httpStatusCode)
+ }
+ }
+
+ if let selectedApp = cc.app {
+
+ // TODO: we should potentially set the realms, either from console config or from specific app config
+
+
+ state = .selectRealm(baseUrl, selectedApp, nil)
+ return state
+ }
+
+ if cc.showAppTextInput {
+ state = .selectApp(baseUrl, nil)
+ return state
+ }
+
+ // allowedApps == nil -> get list of apps
+ if cc.allowedApps == nil || cc.allowedApps!.isEmpty {
+ do {
+ let apps = try await api.getApps()
+ await state = .selectApp(baseUrl, filterPotentialApps(apiManager: api, potentialApps: apps))
+ } catch ApiManagerError.communicationError(let httpStatusCode) {
+ if httpStatusCode == 404 || httpStatusCode == 403 {
+ if cc.showRealmTextInput {
+ state = .selectRealm(baseUrl, "manager", nil)
+ } else {
+ state = .complete(ProjectConfig(domain: baseUrl, app: "manager", realm: nil))
+ }
+ }
+ }
+ } else {
+ await self.state = .selectApp(baseUrl, filterPotentialApps(apiManager: api, potentialApps: cc.allowedApps))
+ }
+ return state
+ } catch {
+ print("SetDomain -> error: \(error)")
+ throw ConfigManagerError.couldNotLoadAppConfig
+ }
+ case .selectApp,
+ .selectRealm,
+ .complete:
+ throw ConfigManagerError.invalidState
+ }
+
+ }
+
+ private func filterPotentialApps(apiManager: ApiManager, potentialApps: [String]?) async -> [String]? {
+ var filteredApps : [String]?
+ if let appNames = potentialApps {
+ filteredApps = []
+ for appName in appNames {
+ if let appInfo = globalAppInfos[appName] {
+ if !appInfo.consoleAppIncompatible {
+ filteredApps!.append(appName)
+ }
+ } else {
+ do {
+ if let appInfo = try await apiManager.getAppInfo(appName: appName) {
+ if !appInfo.consoleAppIncompatible {
+ appInfos[appName] = appInfo
+ filteredApps!.append(appName)
+ }
+ } else {
+ filteredApps!.append(appName)
+ }
+ } catch {
+ // We couldn't fetch app info, just include app in list
+ filteredApps!.append(appName)
+ }
+ }
+ }
+ }
+ return filteredApps
+ }
+
+ public func setApp(app: String) throws -> ConfigManagerState {
+ switch state {
+ case .selectDomain,
+ .selectRealm,
+ .complete:
+ throw ConfigManagerError.invalidState
+ case .selectApp(let baseURL, _):
+ if let appInfo = globalAppInfos[app] {
+ self.state = .selectRealm(baseURL, app, appInfo.realms)
+ } else if let appInfo = appInfos[app] {
+ self.state = .selectRealm(baseURL, app, appInfo.realms)
+ } else if let appInfo = globalAppInfos["default"] {
+ self.state = .selectRealm(baseURL, app, appInfo.realms)
+ } else {
+ self.state = .selectRealm(baseURL, app, nil)
+ }
+ return state
+ }
+ }
+
+ public func setRealm(realm: String?) throws -> ConfigManagerState {
+ switch state {
+ case .selectDomain,
+ .selectApp:
+ throw ConfigManagerError.invalidState
+ case .complete(let project):
+
+ // TODO: should set the providers on the project config
+
+ self.state = .complete(ProjectConfig(domain: project.baseURL, app: project.app, realm: realm))
+ case .selectRealm(let baseURL, let app, _):
+
+ // TODO: should set the providers on the project config
+
+
+ self.state = .complete(ProjectConfig(domain: baseURL, app: app, realm: realm))
+ }
+ return state
+ }
+
+}
diff --git a/console/iOS/ORLib/ORLib/ConsoleProviders/GeofenceProvider.swift b/console/iOS/ORLib/ORLib/ConsoleProviders/GeofenceProvider.swift
index 874e3df77..18208ba91 100644
--- a/console/iOS/ORLib/ORLib/ConsoleProviders/GeofenceProvider.swift
+++ b/console/iOS/ORLib/ORLib/ConsoleProviders/GeofenceProvider.swift
@@ -14,7 +14,6 @@ public class GeofenceProvider: NSObject, URLSessionDelegate {
let userdefaults = UserDefaults(suiteName: DefaultsKey.groupEntitlement)
var geoPostUrls = [String:[String]]()
var enableCallback : (([String: Any]) -> (Void))?
- var getLocationCallback : (([String: Any]) -> (Void))?
public var baseURL: String = ""
public var consoleId: String = ""
@@ -130,19 +129,6 @@ public class GeofenceProvider: NSObject, URLSessionDelegate {
]
}
- public func getLocation(callback:@escaping ([String: Any]) -> (Void)) {
- if locationManager.authorizationStatus == .denied {
- callback([
- DefaultsKey.actionKey: Actions.getLocation,
- DefaultsKey.providerKey: Providers.geofence,
- DefaultsKey.dataKey: nil
- ])
- } else {
- getLocationCallback = callback
- locationManager.startUpdatingLocation()
- }
- }
-
public func refreshGeofences() {
fetchGeofences()
}
@@ -326,17 +312,6 @@ extension GeofenceProvider: CLLocationManagerDelegate {
}
}
- public func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
- if let lastLocation = locations.last {
- getLocationCallback?([
- DefaultsKey.actionKey: Actions.getLocation,
- DefaultsKey.providerKey: Providers.geofence,
- DefaultsKey.dataKey: ["latitude": lastLocation.coordinate.latitude, "longitude": lastLocation.coordinate.longitude]
- ])
- locationManager.stopUpdatingLocation()
- }
- }
-
public func startMonitoringSignificantLocationChanges() {
locationManager.startMonitoringSignificantLocationChanges()
}
diff --git a/console/iOS/ORLib/ORLib/Models/ORAppConfig.swift b/console/iOS/ORLib/ORLib/Models/ORAppConfig.swift
deleted file mode 100644
index d42c396e0..000000000
--- a/console/iOS/ORLib/ORLib/Models/ORAppConfig.swift
+++ /dev/null
@@ -1,20 +0,0 @@
-//
-// ORAppConfig.swift
-// GenericApp
-//
-// Created by Michael Rademaker on 21/10/2020.
-// Copyright © 2020 OpenRemote. All rights reserved.
-//
-
-import UIKit
-
-public struct ORAppConfig: Codable {
- let realm: String
- let initialUrl: String?
- let url: String
- let menuEnabled: Bool
- let menuPosition: String?
- let primaryColor: String?
- let secondaryColor: String?
- let links: [ORLinkConfig]?
-}
diff --git a/console/iOS/ORLib/ORLib/Models/ORAppInfo.swift b/console/iOS/ORLib/ORLib/Models/ORAppInfo.swift
new file mode 100644
index 000000000..682b9cf26
--- /dev/null
+++ b/console/iOS/ORLib/ORLib/Models/ORAppInfo.swift
@@ -0,0 +1,15 @@
+//
+// ORAppInfo.swift
+// ORLib
+//
+// Created by Eric Bariaux on 21/07/2022.
+//
+
+import Foundation
+
+public struct ORAppInfo: Codable {
+ public var consoleAppIncompatible: Bool
+ public var realms: [String]?
+ public var providers: [String]?
+ public var description: String?
+}
diff --git a/console/iOS/ORLib/ORLib/Models/ORConsoleConfig.swift b/console/iOS/ORLib/ORLib/Models/ORConsoleConfig.swift
new file mode 100644
index 000000000..0f1739ade
--- /dev/null
+++ b/console/iOS/ORLib/ORLib/Models/ORConsoleConfig.swift
@@ -0,0 +1,20 @@
+//
+// ORConsoleConfig.swift
+// ORLib
+//
+// Created by Eric Bariaux on 21/07/2022.
+//
+
+import Foundation
+
+public struct ORConsoleConfig: Codable {
+
+ public init() {
+ }
+
+ public var showAppTextInput = false
+ public var showRealmTextInput = true
+ public var app: String?
+ public var allowedApps: [String]?
+ public var apps: [String:ORAppInfo]?
+}
diff --git a/console/iOS/ORLib/ORLib/Models/ProjectConfig.swift b/console/iOS/ORLib/ORLib/Models/ProjectConfig.swift
new file mode 100644
index 000000000..1b7fb3244
--- /dev/null
+++ b/console/iOS/ORLib/ORLib/Models/ProjectConfig.swift
@@ -0,0 +1,53 @@
+//
+// ProjectConfig.swift
+// ORLib
+//
+// Created by Eric Bariaux on 16/09/2022.
+//
+
+import Foundation
+
+public struct ProjectConfig: Codable, Equatable {
+ public var id: String
+ var projectName = "TODO"
+
+ var domain: String
+ var app: String
+ var realm: String?
+
+ public var providers: [String]?
+
+ var baseURL: String {
+ return domain
+ }
+
+ public var targetUrl: String {
+ let consoleProviders = self.providers?.joined(separator: " ") ?? "geofence push storage"
+ if let realm = realm {
+ return "\(baseURL)/\(app)/?realm=\(realm)&consoleProviders=\(consoleProviders)&consoleAutoEnable=true#!geofences"
+ } else {
+ return "\(baseURL)/\(app)/?consoleProviders=\(consoleProviders)&consoleAutoEnable=true#!geofences"
+ }
+
+ // TODO: what's that &consoleAutoEnable=true#!geofences part of the URL for ?
+ }
+
+
+ public init() {
+ id = UUID().uuidString
+ domain = "demo" // TODO: How to manage this ? Should we have a default init ?
+ app = "manager"
+ }
+
+ public init(domain: String, app: String, realm: String?) {
+ id = UUID().uuidString
+ self.domain = domain
+ self.app = app
+ self.realm = realm
+ }
+
+ public static func ==(lhs: ProjectConfig, rhs: ProjectConfig) -> Bool {
+ return lhs.domain == rhs.domain && lhs.app == rhs.app && lhs.realm == rhs.realm && lhs.providers == rhs.providers
+ }
+
+}
diff --git a/console/iOS/ORLib/ORLib/Network/ApiManager.swift b/console/iOS/ORLib/ORLib/Network/ApiManager.swift
index aee9991cc..09bca83fd 100644
--- a/console/iOS/ORLib/ORLib/Network/ApiManager.swift
+++ b/console/iOS/ORLib/ORLib/Network/ApiManager.swift
@@ -1,174 +1,30 @@
//
// ApiManager.swift
-// GenericApp
+// ORLib
//
-// Created by nuc on 17/06/2020.
-// Copyright © 2020 OpenRemote. All rights reserved.
+// Created by Eric Bariaux on 31/08/2022.
//
-import UIKit
+import Foundation
public typealias ResponseBlock<T: Codable> = (_ statusCode: Int, _ object: T?, _ error: Error?) -> ()
-enum HttpMethod: String {
- case get = "GET"
- case post = "POST"
- case put = "PUT"
- case delete = "DELETE"
- case batch = "BATCH"
+public enum ApiManagerError: Error {
+ case notFound
+ case communicationError(Int)
+ case parsingError(Int)
}
-public class ApiManager: NSObject {
+public protocol ApiManager {
+
+ func getConsoleConfig(callback: ResponseBlock<ORConsoleConfig>?)
- private let baseUrl: URL;
+ func getConsoleConfig() async throws -> ORConsoleConfig?
+
+ func getApps(callback: ResponseBlock<[String]>?)
+
+ func getApps() async throws -> [String]?
+
+ func getAppInfo(appName: String) async throws -> ORAppInfo?
- public init(baseUrl: String) {
- self.baseUrl = URL(string: baseUrl)!
- super.init()
- }
-
- public static var accessToken: String?
-
- let session: URLSession = {
- let config = URLSessionConfiguration.default
- config.httpAdditionalHeaders = ["Content-Type": "application/json", "Accept": "application/json"]
- return URLSession(configuration: config)
- }()
-
- let encoder: JSONEncoder = {
- let encoder = JSONEncoder()
- encoder.keyEncodingStrategy = .convertToSnakeCase
- return encoder
- }()
-
- let decoder: JSONDecoder = {
- let decoder = JSONDecoder()
- decoder.keyDecodingStrategy = .convertFromSnakeCase
- return decoder
- }()
-
- public func getAppConfig(realm: String, callback: ResponseBlock<ORAppConfig>?) {
- var urlRequest = URLRequest(url: URL(string: "\(self.baseUrl.scheme!)://\(self.baseUrl.host!)/consoleappconfig/\(realm).json")!)
- urlRequest.httpMethod = HttpMethod.get.rawValue
-
- if let accessToken = ApiManager.accessToken {
- urlRequest.addValue("Bearer \(accessToken)", forHTTPHeaderField: "Authorization")
- }
-
- session.dataTask(with: urlRequest, completionHandler: { responseData, response, error in
- let httpStatusCode = (response as? HTTPURLResponse)?.statusCode ?? 500
-
- guard let responseData = responseData else {
- callback?(httpStatusCode, nil, error);
- return
- }
-
- guard let responseModel = try? self.decoder.decode(ORAppConfig.self, from: responseData) else {
- print("Couldn't parse response: \(String(data: responseData, encoding: .utf8)!)")
- callback?(httpStatusCode, nil, error);
- return;
- }
-
- callback?(httpStatusCode, responseModel, nil)
- }).resume()
- }
-
- //REST METHODS
- private func createRequest(method: HttpMethod, pathComponents:[String], queryParameters: [String: Any]? = nil) -> URLRequest {
- var url: URL
- if let urlParameters = queryParameters, var components = URLComponents(url: baseUrl, resolvingAgainstBaseURL: false) {
- components.queryItems = urlParameters.map {
- URLQueryItem(name: $0, value: String(describing: $1))
- }
- url = components.url!
- } else {
- url = baseUrl
- }
-
- for pathComponent in pathComponents {
- url = url.appendingPathComponent(pathComponent)
- }
-
- var urlRequest = URLRequest(url: url)
- urlRequest.httpMethod = method.rawValue
-
- if let accessToken = ApiManager.accessToken {
- urlRequest.addValue("Bearer \(accessToken)", forHTTPHeaderField: "Authorization")
- }
-
- return urlRequest
- }
-
- private func get<T: Decodable>(pathComponents: [String], queryParameters: [String: Any]? = nil, callback: ResponseBlock<T>?) {
- let urlRequest = self.createRequest(method: .get, pathComponents: pathComponents, queryParameters: queryParameters)
-
- session.dataTask(with: urlRequest, completionHandler: { responseData, response, error in
- let httpStatusCode = (response as? HTTPURLResponse)?.statusCode ?? 500
-
- guard let responseData = responseData else {
- callback?(httpStatusCode, nil, error);
- return
- }
-
- guard let responseModel = try? self.decoder.decode(T.self, from: responseData) else {
- print("Couldn't parse response: \(String(data: responseData, encoding: .utf8)!)")
- callback?(httpStatusCode, nil, error);
- return;
- }
-
- callback?(httpStatusCode, responseModel, nil)
- }).resume()
- }
-
- private func put<T : Encodable, R : Decodable> (pathComponents:[String], item:T, callback: ResponseBlock<R>?) {
- let urlRequest = createRequest(method: .put, pathComponents: pathComponents)
-
- guard let data = try? encoder.encode(item) else {
- callback?(500, nil , nil)
- return
- }
-
- session.uploadTask(with: urlRequest, from: data, completionHandler: { responseData, response, error in
- let httpStatusCode = (response as? HTTPURLResponse)?.statusCode ?? 500
-
- guard let responseData = responseData else {
- callback?(httpStatusCode, nil, error);
- return
- }
-
- guard let responseModel = try? self.decoder.decode(R.self, from: responseData) else {
- print("Couldn't parse response: \(String(data: responseData, encoding: .utf8)!)")
- callback?(httpStatusCode, nil, error);
- return;
- }
-
- callback?(httpStatusCode, responseModel, nil)
- }).resume()
- }
-
- private func post<T : Encodable, R : Decodable> (pathComponents:[String], item:T, callback: ResponseBlock<R>?) {
- let urlRequest = createRequest(method: .post, pathComponents: pathComponents)
-
- guard let data = try? encoder.encode(item) else {
- callback?(500, nil , nil)
- return
- }
-
- session.uploadTask(with: urlRequest, from: data, completionHandler: { responseData, response, error in
- let httpStatusCode = (response as? HTTPURLResponse)?.statusCode ?? 500
-
- guard let responseData = responseData else {
- callback?(httpStatusCode, nil, error);
- return
- }
-
- guard let responseModel = try? self.decoder.decode(R.self, from: responseData) else {
- print("Couldn't parse response: \(String(data: responseData, encoding: .utf8)!)")
- callback?(httpStatusCode, nil, error);
- return;
- }
-
- callback?(httpStatusCode, responseModel, nil)
- }).resume()
- }
}
diff --git a/console/iOS/ORLib/ORLib/Network/HttpApiManager.swift b/console/iOS/ORLib/ORLib/Network/HttpApiManager.swift
new file mode 100644
index 000000000..75d2b0fa2
--- /dev/null
+++ b/console/iOS/ORLib/ORLib/Network/HttpApiManager.swift
@@ -0,0 +1,288 @@
+//
+// ApiManager.swift
+// GenericApp
+//
+// Created by nuc on 17/06/2020.
+// Copyright © 2020 OpenRemote. All rights reserved.
+//
+
+import UIKit
+
+enum HttpMethod: String {
+ case get = "GET"
+ case post = "POST"
+ case put = "PUT"
+ case delete = "DELETE"
+ case batch = "BATCH"
+}
+
+public class HttpApiManager: NSObject, ApiManager {
+
+ private let baseUrl: URL;
+
+ public init(baseUrl: String) {
+ self.baseUrl = URL(string: baseUrl)!
+ super.init()
+ }
+
+ public static var accessToken: String?
+
+ let session: URLSession = {
+ let config = URLSessionConfiguration.default
+ config.httpAdditionalHeaders = ["Content-Type": "application/json", "Accept": "application/json"]
+ return URLSession(configuration: config)
+ }()
+
+ let encoder: JSONEncoder = {
+ let encoder = JSONEncoder()
+ encoder.keyEncodingStrategy = .convertToSnakeCase
+ return encoder
+ }()
+
+ let decoder: JSONDecoder = {
+ let decoder = JSONDecoder()
+ decoder.keyDecodingStrategy = .convertFromSnakeCase
+ return decoder
+ }()
+
+ public func getConsoleConfig(callback: ResponseBlock<ORConsoleConfig>?) {
+ var urlRequest = URLRequest(url: self.baseUrl.appendingPathComponent("apps").appendingPathComponent("consoleConfig"))
+ urlRequest.httpMethod = HttpMethod.get.rawValue
+
+ session.dataTask(with: urlRequest, completionHandler: { responseData, response, error in
+ let httpStatusCode = (response as? HTTPURLResponse)?.statusCode ?? 500
+
+ guard let responseData = responseData else {
+ callback?(httpStatusCode, nil, error);
+ return
+ }
+
+ guard let responseModel = try? self.decoder.decode(ORConsoleConfig.self, from: responseData) else {
+ print("Couldn't parse response: \(String(data: responseData, encoding: .utf8)!)")
+ callback?(httpStatusCode, nil, error);
+ return;
+ }
+
+ callback?(httpStatusCode, responseModel, nil)
+ }).resume()
+ }
+
+ public func getConsoleConfig() async throws -> ORConsoleConfig? {
+ var urlRequest = URLRequest(url: self.baseUrl.appendingPathComponent("apps").appendingPathComponent("consoleConfig"))
+ urlRequest.httpMethod = HttpMethod.get.rawValue
+
+ return try await withCheckedThrowingContinuation { continuation in
+ session.dataTask(with: urlRequest, completionHandler: { responseData, response, error in
+ let httpStatusCode = (response as? HTTPURLResponse)?.statusCode ?? 500
+
+ if httpStatusCode != 200 {
+ continuation.resume(throwing: ApiManagerError.communicationError(httpStatusCode))
+ return
+ }
+
+ guard let responseData = responseData else {
+ continuation.resume(throwing: ApiManagerError.communicationError(httpStatusCode))
+ return
+ }
+
+ guard let responseModel = try? self.decoder.decode(ORConsoleConfig.self, from: responseData) else {
+ print("Couldn't parse response: \(String(data: responseData, encoding: .utf8)!)")
+ continuation.resume(throwing: ApiManagerError.parsingError(httpStatusCode))
+ return
+ }
+
+ continuation.resume(returning: responseModel)
+ }).resume()
+ }
+ }
+
+ public func getApps(callback: ResponseBlock<[String]>?) {
+ var urlRequest = URLRequest(url: self.baseUrl.appendingPathComponent("apps"))
+ urlRequest.httpMethod = HttpMethod.get.rawValue
+
+ session.dataTask(with: urlRequest, completionHandler: { responseData, response, error in
+ let httpStatusCode = (response as? HTTPURLResponse)?.statusCode ?? 500
+
+ guard let responseData = responseData else {
+ callback?(httpStatusCode, nil, error);
+ return
+ }
+
+ guard let responseModel = try? self.decoder.decode([String].self, from: responseData) else {
+ print("Couldn't parse response: \(String(data: responseData, encoding: .utf8)!)")
+ callback?(httpStatusCode, nil, error);
+ return;
+ }
+
+ callback?(httpStatusCode, responseModel, nil)
+ }).resume()
+ }
+
+ public func getApps() async throws -> [String]? {
+ var urlRequest = URLRequest(url: self.baseUrl.appendingPathComponent("apps"))
+ urlRequest.httpMethod = HttpMethod.get.rawValue
+
+ return try await withCheckedThrowingContinuation { continuation in
+ session.dataTask(with: urlRequest, completionHandler: { responseData, response, error in
+ let httpStatusCode = (response as? HTTPURLResponse)?.statusCode ?? 500
+
+ if httpStatusCode == 404 {
+ continuation.resume(throwing: ApiManagerError.notFound)
+ return
+ }
+
+ if httpStatusCode != 200 {
+ continuation.resume(throwing: ApiManagerError.communicationError(httpStatusCode))
+ return
+ }
+
+ guard let responseData = responseData else {
+ continuation.resume(throwing: ApiManagerError.communicationError(httpStatusCode))
+ return
+ }
+
+ guard let responseModel = try? self.decoder.decode([String].self, from: responseData) else {
+ print("Couldn't parse response: \(String(data: responseData, encoding: .utf8)!)")
+ continuation.resume(throwing: ApiManagerError.parsingError(httpStatusCode))
+ return
+ }
+
+ continuation.resume(returning: responseModel)
+ }).resume()
+ }
+ }
+
+
+ public func getAppInfo(appName: String) async throws -> ORAppInfo? {
+ var urlRequest = URLRequest(url: self.baseUrl.appendingPathComponent("apps").appendingPathComponent(appName).appendingPathComponent("info.json"))
+ urlRequest.httpMethod = HttpMethod.get.rawValue
+
+ return try await withCheckedThrowingContinuation { continuation in
+ session.dataTask(with: urlRequest, completionHandler: { responseData, response, error in
+ let httpStatusCode = (response as? HTTPURLResponse)?.statusCode ?? 500
+
+ if httpStatusCode == 404 {
+ continuation.resume(throwing: ApiManagerError.notFound)
+ return
+ }
+
+ if httpStatusCode != 200 {
+ continuation.resume(throwing: ApiManagerError.communicationError(httpStatusCode))
+ return
+ }
+
+ guard let responseData = responseData else {
+ continuation.resume(throwing: ApiManagerError.communicationError(httpStatusCode))
+ return
+ }
+
+ guard let responseModel = try? self.decoder.decode(ORAppInfo.self, from: responseData) else {
+ print("Couldn't parse response: \(String(data: responseData, encoding: .utf8)!)")
+ continuation.resume(throwing: ApiManagerError.parsingError(httpStatusCode))
+ return
+ }
+
+ continuation.resume(returning: responseModel)
+ }).resume()
+ }
+ }
+
+ //REST METHODS
+ private func createRequest(method: HttpMethod, pathComponents:[String], queryParameters: [String: Any]? = nil) -> URLRequest {
+ var url: URL
+ if let urlParameters = queryParameters, var components = URLComponents(url: baseUrl, resolvingAgainstBaseURL: false) {
+ components.queryItems = urlParameters.map {
+ URLQueryItem(name: $0, value: String(describing: $1))
+ }
+ url = components.url!
+ } else {
+ url = baseUrl
+ }
+
+ for pathComponent in pathComponents {
+ url = url.appendingPathComponent(pathComponent)
+ }
+
+ var urlRequest = URLRequest(url: url)
+ urlRequest.httpMethod = method.rawValue
+
+ if let accessToken = HttpApiManager.accessToken {
+ urlRequest.addValue("Bearer \(accessToken)", forHTTPHeaderField: "Authorization")
+ }
+
+ return urlRequest
+ }
+
+ private func get<T: Decodable>(pathComponents: [String], queryParameters: [String: Any]? = nil, callback: ResponseBlock<T>?) {
+ let urlRequest = self.createRequest(method: .get, pathComponents: pathComponents, queryParameters: queryParameters)
+
+ session.dataTask(with: urlRequest, completionHandler: { responseData, response, error in
+ let httpStatusCode = (response as? HTTPURLResponse)?.statusCode ?? 500
+
+ guard let responseData = responseData else {
+ callback?(httpStatusCode, nil, error);
+ return
+ }
+
+ guard let responseModel = try? self.decoder.decode(T.self, from: responseData) else {
+ print("Couldn't parse response: \(String(data: responseData, encoding: .utf8)!)")
+ callback?(httpStatusCode, nil, error);
+ return;
+ }
+
+ callback?(httpStatusCode, responseModel, nil)
+ }).resume()
+ }
+
+ private func put<T : Encodable, R : Decodable> (pathComponents:[String], item:T, callback: ResponseBlock<R>?) {
+ let urlRequest = createRequest(method: .put, pathComponents: pathComponents)
+
+ guard let data = try? encoder.encode(item) else {
+ callback?(500, nil , nil)
+ return
+ }
+
+ session.uploadTask(with: urlRequest, from: data, completionHandler: { responseData, response, error in
+ let httpStatusCode = (response as? HTTPURLResponse)?.statusCode ?? 500
+
+ guard let responseData = responseData else {
+ callback?(httpStatusCode, nil, error);
+ return
+ }
+
+ guard let responseModel = try? self.decoder.decode(R.self, from: responseData) else {
+ print("Couldn't parse response: \(String(data: responseData, encoding: .utf8)!)")
+ callback?(httpStatusCode, nil, error);
+ return;
+ }
+
+ callback?(httpStatusCode, responseModel, nil)
+ }).resume()
+ }
+
+ private func post<T : Encodable, R : Decodable> (pathComponents:[String], item:T, callback: ResponseBlock<R>?) {
+ let urlRequest = createRequest(method: .post, pathComponents: pathComponents)
+
+ guard let data = try? encoder.encode(item) else {
+ callback?(500, nil , nil)
+ return
+ }
+
+ session.uploadTask(with: urlRequest, from: data, completionHandler: { responseData, response, error in
+ let httpStatusCode = (response as? HTTPURLResponse)?.statusCode ?? 500
+
+ guard let responseData = responseData else {
+ callback?(httpStatusCode, nil, error);
+ return
+ }
+
+ guard let responseModel = try? self.decoder.decode(R.self, from: responseData) else {
+ print("Couldn't parse response: \(String(data: responseData, encoding: .utf8)!)")
+ callback?(httpStatusCode, nil, error);
+ return;
+ }
+
+ callback?(httpStatusCode, responseModel, nil)
+ }).resume()
+ }
+}
diff --git a/console/iOS/ORLib/ORLib/UI/ORViewController.swift b/console/iOS/ORLib/ORLib/UI/ORViewController.swift
index 38b7e1081..6670458c6 100644
--- a/console/iOS/ORLib/ORLib/UI/ORViewController.swift
+++ b/console/iOS/ORLib/ORLib/UI/ORViewController.swift
@@ -22,27 +22,22 @@ import Foundation
import UIKit
import WebKit
import MaterialComponents.MaterialButtons
-import Popover
open class ORViewcontroller : UIViewController {
var data : Data?
- public var menuButton: MDCFloatingButton?
- var menuList: UIView?
var myWebView : WKWebView?
var webProgressBar: UIProgressView?
var defaults : UserDefaults?
var webCfg : WKWebViewConfiguration?
- public var appConfig: ORAppConfig?
- var popover: Popover?
public var geofenceProvider: GeofenceProvider?
public var pushProvider: PushNotificationProvider?
public var storageProvider: StorageProvider?
public var qrProvider: QrScannerProvider?
public var baseUrl: String?
-
- var popoverOptions: [PopoverOption]?
+
+ public var targetUrl: String?
open override func viewDidLoad() {
super.viewDidLoad()
@@ -52,12 +47,13 @@ open class ORViewcontroller : UIViewController {
open override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
- if let applicationConfig = appConfig {
- var url = applicationConfig.initialUrl ?? applicationConfig.url
- if !url.starts(with: "http") {
- url = baseUrl!.appending(url)
+
+ if let targetUrl = targetUrl {
+ if let urlString = targetUrl.stringByURLEncoding() {
+ if let url = URL(string: urlString) {
+ loadURL(url: url)
+ }
}
- loadURL(url: URL(string: url.stringByURLEncoding()!)!)
}
}
@@ -116,90 +112,6 @@ open class ORViewcontroller : UIViewController {
webProgressBar?.trailingAnchor.constraint(equalTo: myWebView!.trailingAnchor).isActive = true
webProgressBar?.topAnchor.constraint(equalTo: myWebView!.topAnchor, constant: -2).isActive = true
webProgressBar?.heightAnchor.constraint(equalToConstant: 2).isActive = true
-
- self.processAppConfig()
- }
-
- public func processAppConfig() {
- if appConfig?.menuEnabled ?? false {
-
- let sbHeight: CGFloat
- if #available(iOS 11.0, *) {
- sbHeight = UIApplication.shared.keyWindow?.safeAreaInsets.top ?? UIApplication.shared.statusBarFrame.height
- } else {
- sbHeight = UIApplication.shared.statusBarFrame.height
- }
-
- let bundle = Bundle(for: ORViewcontroller.self)
-
- menuButton = MDCFloatingButton(shape: .default)
- menuButton?.backgroundColor = UIColor(hexaRGB: appConfig?.primaryColor ?? "#43A047")
- menuButton?.translatesAutoresizingMaskIntoConstraints = false
- menuButton?.addTarget(self, action: #selector(self.pressed(sender:)), for: .touchUpInside)
- menuButton?.setImage(UIImage(named: "ic_menu", in: bundle, compatibleWith: nil), for: .normal)
- menuButton?.setImage(UIImage(named: "ic_menu", in: bundle, compatibleWith: nil), for: .selected)
- menuButton?.setImage(UIImage(named: "ic_menu", in: bundle, compatibleWith: nil), for: .highlighted)
- menuButton?.isHidden = true
-
- if let secondColor = appConfig?.secondaryColor {
- menuButton?.tintColor = UIColor(hexaRGB: secondColor)
- }
-
- view.addSubview(menuButton!)
- view.bringSubviewToFront(menuButton!)
-
- let constraints: Array<NSLayoutConstraint> = {
- if appConfig!.menuPosition == "BOTTOM_RIGHT" {
- self.popoverOptions = [
- .type(.up),
- .arrowSize(.zero),
- ]
- return [
- menuButton!.rightAnchor.constraint(equalTo: self.view.rightAnchor, constant: -20),
- menuButton!.bottomAnchor.constraint(equalTo: self.view.bottomAnchor, constant: -20)
- ]
- } else if appConfig!.menuPosition == "TOP_RIGHT" {
- self.popoverOptions = [
- .type(.down),
- .arrowSize(.zero),
- ]
- return [
- menuButton!.rightAnchor.constraint(equalTo: self.view.rightAnchor, constant: -20),
- menuButton!.topAnchor.constraint(equalTo: self.view.topAnchor, constant: sbHeight)
- ]
- } else if appConfig!.menuPosition == "TOP_LEFT" {
- self.popoverOptions = [
- .type(.down),
- .arrowSize(.zero),
- ]
- return [
- menuButton!.leftAnchor.constraint(equalTo: self.view.leftAnchor, constant: 20),
- menuButton!.topAnchor.constraint(equalTo: self.view.topAnchor, constant: sbHeight)
- ]
- }
- self.popoverOptions = [
- .type(.up),
- .arrowSize(.zero),
-
- ]
- return [
- menuButton!.leftAnchor.constraint(equalTo: self.view.leftAnchor, constant: 20),
- menuButton!.bottomAnchor.constraint(equalTo: self.view.bottomAnchor, constant: -20)
- ]
- }()
-
- NSLayoutConstraint.activate(constraints)
- }
- }
-
- @objc func pressed(sender: UIButton!) {
- let linkCount = appConfig?.links?.count ?? 0
- let tableView = UITableView(frame: CGRect(x: 0, y: 0, width: self.view.frame.width / 2, height: CGFloat(linkCount * 60)))
- tableView.delegate = self
- tableView.dataSource = self
- tableView.isScrollEnabled = false
- self.popover = Popover(options: self.popoverOptions)
- self.popover!.show(tableView, fromView: self.menuButton!)
}
public override func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey : Any]?, context: UnsafeMutableRawPointer?) {
@@ -234,49 +146,30 @@ open class ORViewcontroller : UIViewController {
print("Error requesting '\(failingUrl)': \(errorCode) (\(description))")
let alertView = UIAlertController(title: "Error", message: "Error requesting '\(failingUrl)': \(errorCode) (\(description))", preferredStyle: .alert)
- alertView.addAction(UIAlertAction(title: "OK", style: .default, handler: nil))
- if let applicationConfig = appConfig {
- self.present(alertView, animated: true, completion: nil)
- var url = applicationConfig.url
- if !url.starts(with: "http") {
- url = baseUrl!.appending(url)
- }
- self.myWebView?.load(URLRequest(url: URL(string: url.stringByURLEncoding()!)!))
+ if self.presentingViewController != nil {
+ alertView.addAction(UIAlertAction(title: "OK", style: .default, handler: { _ in self.dismiss(animated: true)} ))
+ } else {
+ alertView.addAction(UIAlertAction(title: "OK", style: .default, handler: nil))
+ }
+ self.present(alertView, animated: true, completion: nil)
+
+ /*
+ if (false) {
+ //TODO need to have case to return to home url of config or go back to wizard to setup project enviroment
+// self.myWebView?.load(URLRequest(url: URL(string: url.stringByURLEncoding()!)!))
} else {
if self.presentingViewController != nil {
self.dismiss(animated: true) {
- self.presentingViewController!.present(alertView, animated: true, completion: nil)
+
+ // TODO: this original code is causing error
+ // self.presentingViewController!.present(alertView, animated: true, completion: nil)
}
} else {
self.present(alertView, animated: true, completion: nil)
}
}
- }
-}
-
-extension ORViewcontroller: UITableViewDelegate {
-
- public func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
- self.popover?.dismiss()
- loadURL(url: URL(string: appConfig!.links![indexPath.row].pageLink.stringByURLEncoding()!)!)
- }
-
- public func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
- return 60
- }
-}
-
-extension ORViewcontroller: UITableViewDataSource {
-
- public func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int{
- return appConfig?.links?.count ?? 0
- }
-
- public func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
- let cell = UITableViewCell(style: .default, reuseIdentifier: nil)
- cell.textLabel?.text = appConfig!.links![indexPath.row].displayText
- return cell
+ */
}
}
@@ -337,28 +230,6 @@ extension ORViewcontroller: WKScriptMessageHandler {
}
case Actions.geofenceRefresh:
geofenceProvider?.refreshGeofences()
- case Actions.getLocation:
- geofenceProvider?.getLocation(callback: { locationData in
- if (locationData["data"] as? [String:Any]) == nil {
- let alertController = UIAlertController(title: "Location permission denied",
- message: "In order to get the location it's necessary to give permissions to the app. Do you want to open the settings?",
- preferredStyle: .alert)
- if let settingsUrl = URL(string: UIApplication.openSettingsURLString), UIApplication.shared.canOpenURL(settingsUrl) {
- alertController.addAction(UIAlertAction(title: "OK", style: .default, handler: { alertAction in
- if UIApplication.shared.canOpenURL(settingsUrl) {
- UIApplication.shared.open(settingsUrl, completionHandler: { (success) in
- print("Settings opened: \(success)") // Prints true
- })
- }
- }))
- alertController.addAction(UIAlertAction(title: "Not now", style: .cancel, handler: nil))
- } else {
- alertController.addAction(UIAlertAction(title: "OK", style: .default, handler: nil))
- }
- self.present(alertController, animated: true, completion: nil)
- }
- self.sendData(data: locationData)
- })
default:
print("Wrong action \(action) for \(provider)")
}
@@ -447,16 +318,6 @@ extension ORViewcontroller: WKNavigationDelegate {
decisionHandler(.cancel)
}
} else {
- if let config = appConfig, let button = menuButton {
- var url = config.url
- if !url.starts(with: "http") {
- url = baseUrl!.appending(url)
- }
- if url == navigationAction.request.url?.absoluteString {
- button.isHidden = false
- }
- }
-
decisionHandler(.allow)
}
}
diff --git a/console/iOS/ORLib/ORLib/Utils/Constants.swift b/console/iOS/ORLib/ORLib/Utils/Constants.swift
index 4c8bd3038..46f788a6b 100644
--- a/console/iOS/ORLib/ORLib/Utils/Constants.swift
+++ b/console/iOS/ORLib/ORLib/Utils/Constants.swift
@@ -21,8 +21,18 @@
import Foundation
import UIKit
+public enum Segues {
+ public static var goToSettingsView = "goToSettingsView"
+ public static var goToWizardDomainView = "goToWizardDomainView"
+ public static var goToWizardAppView = "goToWizardAppView"
+ public static var goToWizardRealmView = "goToWizardRealmView"
+ public static var goToWebView = "goToWebView"
+}
+
public enum DefaultsKey {
public static var groupEntitlement = "group.io.openremote.app"
+ public static let selectedProjectKey = "SELECTED_PROJECT"
+ public static let projectsConfigurationKey = "PROJECTS_CONFIGURATION"
public static let projectKey = "PROJECT"
public static let hostKey = "HOST"
public static let realmKey = "REALM"
@@ -48,7 +58,6 @@ public enum Actions {
public static let geofenceRefresh = "GEOFENCE_REFRESH"
public static let store = "STORE"
public static let retrieve = "RETRIEVE"
- public static let getLocation = "GET_LOCATION"
public static let scanQr = "SCAN_QR"
}
diff --git a/console/iOS/ORLib/ORLib/Utils/String+Utils.swift b/console/iOS/ORLib/ORLib/Utils/String+Utils.swift
index a1aff48ce..b9ea1bf7c 100644
--- a/console/iOS/ORLib/ORLib/Utils/String+Utils.swift
+++ b/console/iOS/ORLib/ORLib/Utils/String+Utils.swift
@@ -19,7 +19,16 @@ extension String {
}
return encodedString
-
}
+
+ var isValidURL: Bool {
+ let detector = try! NSDataDetector(types: NSTextCheckingResult.CheckingType.link.rawValue)
+ if let match = detector.firstMatch(in: self, options: [], range: NSRange(location: 0, length: self.utf16.count)) {
+ // it is a link, if the match covers the whole string
+ return match.range.length == self.utf16.count
+ } else {
+ return false
+ }
+ }
}
diff --git a/console/iOS/ORLib/Tests/ConfigManagerTest.swift b/console/iOS/ORLib/Tests/ConfigManagerTest.swift
new file mode 100644
index 000000000..0783c42a5
--- /dev/null
+++ b/console/iOS/ORLib/Tests/ConfigManagerTest.swift
@@ -0,0 +1,137 @@
+//
+// ConfigManagerTest.swift
+// Tests
+//
+// Created by Eric Bariaux on 31/08/2022.
+//
+
+import XCTest
+
+@testable import ORLib
+
+class ConfigManagerTest: XCTestCase {
+
+ let configManager = ConfigManager(apiManagerFactory: { url in
+ FileApiManager(baseUrl: url)
+ })
+
+ func test0() async throws {
+ var state = try await configManager.setDomain(domain: "test0")
+ XCTAssertEqual(state, ConfigManagerState.selectRealm("https://test0.openremote.app", "manager", nil))
+ state = try configManager.setRealm(realm: "master")
+ XCTAssertEqual(state, ConfigManagerState.complete(ProjectConfig(domain: "https://test0.openremote.app", app: "manager", realm: "master")))
+ }
+
+ func test1() async throws {
+ let state = try await configManager.setDomain(domain: "test1")
+ XCTAssertEqual(state, ConfigManagerState.complete(ProjectConfig(domain: "https://test1.openremote.app", app: "manager", realm: nil)))
+ }
+
+ func test2() async throws {
+ var state = try await configManager.setDomain(domain: "test2")
+ XCTAssertEqual(state, ConfigManagerState.selectRealm("https://test2.openremote.app", "Console 1", nil))
+ state = try configManager.setRealm(realm: nil)
+ XCTAssertEqual(state, ConfigManagerState.complete(ProjectConfig(domain: "https://test2.openremote.app", app: "Console 1", realm: nil)))
+ }
+
+ func test3() async throws {
+ var state = try await configManager.setDomain(domain: "test3")
+ XCTAssertEqual(state, ConfigManagerState.selectRealm("https://test3.openremote.app", "Console 1", nil))
+ state = try configManager.setRealm(realm: "master")
+ XCTAssertEqual(state, ConfigManagerState.complete(ProjectConfig(domain: "https://test3.openremote.app", app: "Console 1", realm: "master")))
+ }
+
+ func test4() async throws {
+ var state = try await configManager.setDomain(domain: "test4")
+ XCTAssertEqual(state, ConfigManagerState.selectApp("https://test4.openremote.app", ["Console 1", "Console 2"]))
+ state = try configManager.setApp(app: "Console 1")
+ XCTAssertEqual(state, ConfigManagerState.selectRealm("https://test4.openremote.app", "Console 1", nil))
+ state = try configManager.setRealm(realm: nil)
+ XCTAssertEqual(state, ConfigManagerState.complete(ProjectConfig(domain: "https://test4.openremote.app", app: "Console 1", realm: nil)))
+ }
+
+ func test5() async throws {
+ var state = try await configManager.setDomain(domain: "test5")
+ XCTAssertEqual(state, ConfigManagerState.selectApp("https://test5.openremote.app", nil))
+ state = try configManager.setApp(app: "Console")
+ XCTAssertEqual(state, ConfigManagerState.selectRealm("https://test5.openremote.app", "Console", nil))
+ state = try configManager.setRealm(realm: "master")
+ XCTAssertEqual(state, ConfigManagerState.complete(ProjectConfig(domain: "https://test5.openremote.app", app: "Console", realm: "master")))
+ }
+
+ func test6() async throws {
+ var state = try await configManager.setDomain(domain: "test6")
+ XCTAssertEqual(state, ConfigManagerState.selectApp("https://test6.openremote.app", ["Console 1", "Console 2"]))
+ state = try configManager.setApp(app: "Console 2")
+ XCTAssertEqual(state, ConfigManagerState.selectRealm("https://test6.openremote.app", "Console 2", nil))
+ state = try configManager.setRealm(realm: "master")
+ XCTAssertEqual(state, ConfigManagerState.complete(ProjectConfig(domain: "https://test6.openremote.app", app: "Console 2", realm: "master")))
+ }
+
+ func test7() async throws {
+ var state = try await configManager.setDomain(domain: "test7")
+ XCTAssertEqual(state, ConfigManagerState.selectApp("https://test7.openremote.app", ["Console 1", "Console 2"]))
+ state = try configManager.setApp(app: "Console 1")
+ XCTAssertEqual(state, ConfigManagerState.selectRealm("https://test7.openremote.app", "Console 1", ["master1", "master2"]))
+ state = try configManager.setRealm(realm: "master1")
+ XCTAssertEqual(state, ConfigManagerState.complete(ProjectConfig(domain: "https://test7.openremote.app", app: "Console 1", realm: "master1")))
+ }
+
+ func test8() async throws {
+ var state = try await configManager.setDomain(domain: "test8")
+ XCTAssertEqual(state, ConfigManagerState.selectApp("https://test8.openremote.app", ["Console 1", "Console 2"]))
+ state = try configManager.setApp(app: "Console 1")
+ XCTAssertEqual(state, ConfigManagerState.selectRealm("https://test8.openremote.app", "Console 1", ["master1", "master2"]))
+ state = try configManager.setRealm(realm: "master1")
+ XCTAssertEqual(state, ConfigManagerState.complete(ProjectConfig(domain: "https://test8.openremote.app", app: "Console 1", realm: "master1")))
+ }
+
+
+ func test8_GoBack() async throws {
+ var state = try await configManager.setDomain(domain: "test8")
+ XCTAssertEqual(state, ConfigManagerState.selectApp("https://test8.openremote.app", ["Console 1", "Console 2"]))
+ state = try configManager.setApp(app: "Console 1")
+ XCTAssertEqual(state, ConfigManagerState.selectRealm("https://test8.openremote.app", "Console 1", ["master1", "master2"]))
+ state = try configManager.setRealm(realm: "master1")
+ XCTAssertEqual(state, ConfigManagerState.complete(ProjectConfig(domain: "https://test8.openremote.app", app: "Console 1", realm: "master1")))
+ state = try configManager.setRealm(realm: "master2")
+ XCTAssertEqual(state, ConfigManagerState.complete(ProjectConfig(domain: "https://test8.openremote.app", app: "Console 1", realm: "master2")))
+ }
+
+ func test9() async throws {
+ var state = try await configManager.setDomain(domain: "test9")
+ XCTAssertEqual(state, ConfigManagerState.selectApp("https://test9.openremote.app", ["Console 1", "Console 2"]))
+ state = try configManager.setApp(app: "Console 1")
+ XCTAssertEqual(state, ConfigManagerState.selectRealm("https://test9.openremote.app", "Console 1", ["master1", "master2"]))
+ state = try configManager.setRealm(realm: "master1")
+ XCTAssertEqual(state, ConfigManagerState.complete(ProjectConfig(domain: "https://test9.openremote.app", app: "Console 1", realm: "master1")))
+ }
+
+ func test10() async throws {
+ var state = try await configManager.setDomain(domain: "test10")
+ XCTAssertEqual(state, ConfigManagerState.selectApp("https://test10.openremote.app", ["Console 1", "Console 2"]))
+ state = try configManager.setApp(app: "Console 1")
+ XCTAssertEqual(state, ConfigManagerState.selectRealm("https://test10.openremote.app", "Console 1", ["master3", "master4"]))
+ state = try configManager.setRealm(realm: "master3")
+ XCTAssertEqual(state, ConfigManagerState.complete(ProjectConfig(domain: "https://test10.openremote.app", app: "Console 1", realm: "master3")))
+ }
+
+ func test11() async throws {
+ var state = try await configManager.setDomain(domain: "test11")
+ XCTAssertEqual(state, ConfigManagerState.selectApp("https://test11.openremote.app", ["Console 2"]))
+ state = try configManager.setApp(app: "Console 2")
+ XCTAssertEqual(state, ConfigManagerState.selectRealm("https://test11.openremote.app", "Console 2", nil))
+ state = try configManager.setRealm(realm: "master3")
+ XCTAssertEqual(state, ConfigManagerState.complete(ProjectConfig(domain: "https://test11.openremote.app", app: "Console 2", realm: "master3")))
+ }
+
+ func test12() async throws {
+ var state = try await configManager.setDomain(domain: "test12")
+ XCTAssertEqual(state, ConfigManagerState.selectApp("https://test12.openremote.app", ["Console 1", "Console 2"]))
+ state = try configManager.setApp(app: "Console 1")
+ XCTAssertEqual(state, ConfigManagerState.selectRealm("https://test12.openremote.app", "Console 1", nil))
+ state = try configManager.setRealm(realm: "master1")
+ XCTAssertEqual(state, ConfigManagerState.complete(ProjectConfig(domain: "https://test12.openremote.app", app: "Console 1", realm: "master1")))
+ }
+
+}
diff --git a/console/iOS/ORLib/Tests/FileApiManager.swift b/console/iOS/ORLib/Tests/FileApiManager.swift
new file mode 100644
index 000000000..4bfea2a38
--- /dev/null
+++ b/console/iOS/ORLib/Tests/FileApiManager.swift
@@ -0,0 +1,72 @@
+//
+// FileApiManager.swift
+// Tests
+//
+// Created by Eric Bariaux on 31/08/2022.
+//
+
+import Foundation
+@testable import ORLib
+
+class FileApiManager: ApiManager {
+
+ let decoder = JSONDecoder()
+
+ private var fixture: Fixture
+
+ public init(baseUrl: String) {
+ let pattern = #"https://(?<domain>.*)\.openremote\.app"#
+ do {
+ let regex = try NSRegularExpression(pattern: pattern, options: [])
+ let nsrange = NSRange(baseUrl.startIndex..<baseUrl.endIndex, in: baseUrl)
+ if let match = regex.firstMatch(in: baseUrl, options: [], range: nsrange) {
+ let nsrange = match.range(withName: "domain")
+ if nsrange.location != NSNotFound, let range = Range(nsrange, in: baseUrl) {
+ let domain = baseUrl[range]
+ if let fixtureFile = Bundle(for: FileApiManager.self).url(forResource: String(domain), withExtension: "json") {
+ if let fixtureData = try? Data(contentsOf: fixtureFile as URL) {
+ do {
+ fixture = try self.decoder.decode(Fixture.self, from: fixtureData)
+ return
+ } catch {
+ print(error)
+ }
+ }
+ }
+ }
+ }
+ } catch {
+ // Will use default value below
+ }
+ fixture = Fixture()
+ }
+
+
+ func getConsoleConfig(callback: ResponseBlock<ORConsoleConfig>?) {
+ }
+
+ public func getConsoleConfig() async throws -> ORConsoleConfig? {
+ if let returnCode = fixture.consoleConfigReturnCode {
+ throw ApiManagerError.communicationError(returnCode)
+ }
+ return fixture.consoleConfig
+ }
+
+ public func getApps(callback: ResponseBlock<[String]>?) {
+ }
+
+ public func getApps() async throws -> [String]? {
+ if let returnCode = fixture.appsReturnCode {
+ throw ApiManagerError.communicationError(returnCode)
+ }
+ return fixture.apps
+ }
+
+ public func getAppInfo(appName: String) async throws -> ORAppInfo? {
+ if let returnCode = fixture.appsInfoReturnCode {
+ throw ApiManagerError.communicationError(returnCode)
+ }
+ return fixture.appsInfo?[appName]
+ }
+
+}
diff --git a/console/iOS/ORLib/Tests/Fixture.swift b/console/iOS/ORLib/Tests/Fixture.swift
new file mode 100644
index 000000000..eb75839b2
--- /dev/null
+++ b/console/iOS/ORLib/Tests/Fixture.swift
@@ -0,0 +1,24 @@
+//
+// Fixture.swift
+// Tests
+//
+// Created by Eric Bariaux on 17/09/2022.
+//
+
+import Foundation
+@testable import ORLib
+
+struct Fixture: Codable {
+ var consoleConfigReturnCode: Int?
+ var consoleConfig: ORConsoleConfig?
+ var appsReturnCode: Int?
+ var apps: [String]?
+ var appsInfoReturnCode: Int?
+ var appsInfo: [String: ORAppInfo]?
+
+ init() {
+ consoleConfigReturnCode = 404
+ appsReturnCode = 404
+ appsInfoReturnCode = 404
+ }
+}
diff --git a/console/iOS/ORLib/Tests/Fixtures/Tests.md b/console/iOS/ORLib/Tests/Fixtures/Tests.md
new file mode 100644
index 000000000..3081843ab
--- /dev/null
+++ b/console/iOS/ORLib/Tests/Fixtures/Tests.md
@@ -0,0 +1,55 @@
+### Test0
+
+DefaultConfig, nothing present
+
+### Test1
+
+ConsoleConfig not asking for app or realm, no apps list -> defaults to manager, no realm
+
+### Test2
+
+ConsoleConfig with a specified app
+
+### Test3
+
+ConsoleConfig with a specified app but requesting the text field to enter an app name -> should still use the specified app
+
+### Test4
+
+ConsoleConfig with no specified app and a list of apps
+
+### Test5
+
+ConsoleConfig with no specified app and a list of apps but requesting the text field to enter an app name
+
+### Test6
+
+ConsoleConfig with no specified app and no allowed apps but apps list available via Apps call
+
+### Test 7
+
+Similar to Test6 but with a list of realm defined for the selected app
+
+### Test 8
+
+Similar to Test7 but with the realms defined for the default app
+
+### Test 9
+
+Similar to Test6 but with a project specific Info.json
+
+### Test 10
+
+Similar to Test 9 but with global override of realms
+
+### Test 11
+Similar to Test 9 but Console 1 is not selectable as app
+
+### Test 12
+Similar to Test 7 but with no realms defined in the AppInfo
+
+
+
+
+TODO:
+- add test for full URLs entry
diff --git a/console/iOS/ORLib/Tests/Fixtures/test1.json b/console/iOS/ORLib/Tests/Fixtures/test1.json
new file mode 100644
index 000000000..2c9fee105
--- /dev/null
+++ b/console/iOS/ORLib/Tests/Fixtures/test1.json
@@ -0,0 +1,10 @@
+{
+ "consoleConfig": {
+ "showAppTextInput" : false,
+ "showRealmTextInput" : false,
+ "app" : null,
+ "allowedApps" : [],
+ "apps" : {}
+ },
+ "appsReturnCode": 404
+}
diff --git a/console/iOS/ORLib/Tests/Fixtures/test10.json b/console/iOS/ORLib/Tests/Fixtures/test10.json
new file mode 100644
index 000000000..406786ee1
--- /dev/null
+++ b/console/iOS/ORLib/Tests/Fixtures/test10.json
@@ -0,0 +1,25 @@
+{
+ "consoleConfig": {
+ "showAppTextInput" : false,
+ "showRealmTextInput" : false,
+ "app" : null,
+ "allowedApps" : [],
+ "apps" : {
+ "Console 1" : {
+ "consoleAppIncompatible" : false,
+ "realms" : ["master3", "master4"],
+ "providers" : [],
+ "description" : ""
+ }
+ }
+ },
+ "apps": ["Console 1", "Console 2"],
+ "appsInfo" : {
+ "Console 1" : {
+ "consoleAppIncompatible" : false,
+ "realms" : ["master1", "master2"],
+ "providers" : [],
+ "description" : ""
+ }
+ }
+}
diff --git a/console/iOS/ORLib/Tests/Fixtures/test11.json b/console/iOS/ORLib/Tests/Fixtures/test11.json
new file mode 100644
index 000000000..bc098a5ec
--- /dev/null
+++ b/console/iOS/ORLib/Tests/Fixtures/test11.json
@@ -0,0 +1,18 @@
+{
+ "consoleConfig": {
+ "showAppTextInput" : false,
+ "showRealmTextInput" : false,
+ "app" : null,
+ "allowedApps" : [],
+ "apps" : {}
+ },
+ "apps": ["Console 1", "Console 2"],
+ "appsInfo" : {
+ "Console 1" : {
+ "consoleAppIncompatible" : true,
+ "realms" : ["master1", "master2"],
+ "providers" : [],
+ "description" : ""
+ }
+ }
+}
diff --git a/console/iOS/ORLib/Tests/Fixtures/test12.json b/console/iOS/ORLib/Tests/Fixtures/test12.json
new file mode 100644
index 000000000..9f3e18c6d
--- /dev/null
+++ b/console/iOS/ORLib/Tests/Fixtures/test12.json
@@ -0,0 +1,16 @@
+{
+ "consoleConfig": {
+ "showAppTextInput" : false,
+ "showRealmTextInput" : false,
+ "app" : null,
+ "allowedApps" : [],
+ "apps" : {
+ "Console 1" : {
+ "consoleAppIncompatible" : false,
+ "providers" : [],
+ "description" : ""
+ }
+ }
+ },
+ "apps": ["Console 1", "Console 2"]
+}
diff --git a/console/iOS/ORLib/Tests/Fixtures/test2.json b/console/iOS/ORLib/Tests/Fixtures/test2.json
new file mode 100644
index 000000000..cb58a550a
--- /dev/null
+++ b/console/iOS/ORLib/Tests/Fixtures/test2.json
@@ -0,0 +1,11 @@
+{
+ "consoleConfig": {
+ "showAppTextInput" : false,
+ "showRealmTextInput" : false,
+ "app" : "Console 1",
+ "allowedApps" : [],
+ "apps" : {}
+ },
+ "appsReturnCode": 404
+}
+
diff --git a/console/iOS/ORLib/Tests/Fixtures/test3.json b/console/iOS/ORLib/Tests/Fixtures/test3.json
new file mode 100644
index 000000000..dfa847266
--- /dev/null
+++ b/console/iOS/ORLib/Tests/Fixtures/test3.json
@@ -0,0 +1,10 @@
+{
+ "consoleConfig": {
+ "showAppTextInput" : true,
+ "showRealmTextInput" : false,
+ "app" : "Console 1",
+ "allowedApps" : [],
+ "apps" : {}
+ },
+ "appsReturnCode": 404
+}
diff --git a/console/iOS/ORLib/Tests/Fixtures/test4.json b/console/iOS/ORLib/Tests/Fixtures/test4.json
new file mode 100644
index 000000000..05457c991
--- /dev/null
+++ b/console/iOS/ORLib/Tests/Fixtures/test4.json
@@ -0,0 +1,10 @@
+{
+ "consoleConfig": {
+ "showAppTextInput" : false,
+ "showRealmTextInput" : false,
+ "app" : null,
+ "allowedApps" : ["Console 1", "Console 2"],
+ "apps" : {}
+ },
+ "appsReturnCode": 404
+}
diff --git a/console/iOS/ORLib/Tests/Fixtures/test5.json b/console/iOS/ORLib/Tests/Fixtures/test5.json
new file mode 100644
index 000000000..c82670dcf
--- /dev/null
+++ b/console/iOS/ORLib/Tests/Fixtures/test5.json
@@ -0,0 +1,10 @@
+{
+ "consoleConfig": {
+ "showAppTextInput" : true,
+ "showRealmTextInput" : false,
+ "app" : null,
+ "allowedApps" : ["Console 1", "Console 2"],
+ "apps" : {}
+ },
+ "appsReturnCode": 404
+}
diff --git a/console/iOS/ORLib/Tests/Fixtures/test6.json b/console/iOS/ORLib/Tests/Fixtures/test6.json
new file mode 100644
index 000000000..74ec733e9
--- /dev/null
+++ b/console/iOS/ORLib/Tests/Fixtures/test6.json
@@ -0,0 +1,10 @@
+{
+ "consoleConfig": {
+ "showAppTextInput" : false,
+ "showRealmTextInput" : false,
+ "app" : null,
+ "allowedApps" : [],
+ "apps" : {}
+ },
+ "apps": ["Console 1", "Console 2"]
+}
diff --git a/console/iOS/ORLib/Tests/Fixtures/test7.json b/console/iOS/ORLib/Tests/Fixtures/test7.json
new file mode 100644
index 000000000..a4b4006c0
--- /dev/null
+++ b/console/iOS/ORLib/Tests/Fixtures/test7.json
@@ -0,0 +1,17 @@
+{
+ "consoleConfig": {
+ "showAppTextInput" : false,
+ "showRealmTextInput" : false,
+ "app" : null,
+ "allowedApps" : [],
+ "apps" : {
+ "Console 1" : {
+ "consoleAppIncompatible" : false,
+ "realms" : ["master1", "master2"],
+ "providers" : [],
+ "description" : ""
+ }
+ }
+ },
+ "apps": ["Console 1", "Console 2"]
+}
diff --git a/console/iOS/ORLib/Tests/Fixtures/test8.json b/console/iOS/ORLib/Tests/Fixtures/test8.json
new file mode 100644
index 000000000..6a083aa56
--- /dev/null
+++ b/console/iOS/ORLib/Tests/Fixtures/test8.json
@@ -0,0 +1,17 @@
+{
+ "consoleConfig": {
+ "showAppTextInput" : false,
+ "showRealmTextInput" : false,
+ "app" : null,
+ "allowedApps" : [],
+ "apps" : {
+ "default" : {
+ "consoleAppIncompatible" : false,
+ "realms" : ["master1", "master2"],
+ "providers" : [],
+ "description" : ""
+ }
+ }
+ },
+ "apps": ["Console 1", "Console 2"]
+}
diff --git a/console/iOS/ORLib/Tests/Fixtures/test9.json b/console/iOS/ORLib/Tests/Fixtures/test9.json
new file mode 100644
index 000000000..9349335e8
--- /dev/null
+++ b/console/iOS/ORLib/Tests/Fixtures/test9.json
@@ -0,0 +1,18 @@
+{
+ "consoleConfig": {
+ "showAppTextInput" : false,
+ "showRealmTextInput" : false,
+ "app" : null,
+ "allowedApps" : [],
+ "apps" : {}
+ },
+ "apps": ["Console 1", "Console 2"],
+ "appsInfo" : {
+ "Console 1" : {
+ "consoleAppIncompatible" : false,
+ "realms" : ["master1", "master2"],
+ "providers" : [],
+ "description" : ""
+ }
+ }
+}
diff --git a/console/iOS/ORLib/Tests/Tests.swift b/console/iOS/ORLib/Tests/Tests.swift
new file mode 100644
index 000000000..f4185f5c1
--- /dev/null
+++ b/console/iOS/ORLib/Tests/Tests.swift
@@ -0,0 +1,35 @@
+//
+// Tests.swift
+// Tests
+//
+// Created by Eric Bariaux on 31/08/2022.
+//
+
+import XCTest
+
+class Tests: XCTestCase {
+
+ override func setUpWithError() throws {
+ // Put setup code here. This method is called before the invocation of each test method in the class.
+ }
+
+ override func tearDownWithError() throws {
+ // Put teardown code here. This method is called after the invocation of each test method in the class.
+ }
+
+ func testExample() throws {
+ // This is an example of a functional test case.
+ // Use XCTAssert and related functions to verify your tests produce the correct results.
+ // Any test you write for XCTest can be annotated as throws and async.
+ // Mark your test throws to produce an unexpected failure when your test encounters an uncaught error.
+ // Mark your test async to allow awaiting for asynchronous code to complete. Check the results with assertions afterwards.
+ }
+
+ func testPerformanceExample() throws {
+ // This is an example of a performance test case.
+ measure {
+ // Put the code you want to measure the time of here.
+ }
+ }
+
+}
diff --git a/manager/Dockerfile b/manager/Dockerfile
index 1dc4bd6e6..92ca3f810 100644
--- a/manager/Dockerfile
+++ b/manager/Dockerfile
@@ -40,7 +40,6 @@ ENV OR_KEYCLOAK_PORT ${OR_KEYCLOAK_PORT:-8080}
ENV OR_KEYCLOAK_GRANT_FILE ${OR_KEYCLOAK_GRANT_FILE:-/deployment/manager/keycloak.json}
ENV OR_APP_DOCROOT ${OR_APP_DOCROOT:-/opt/web}
ENV OR_CUSTOM_APP_DOCROOT ${OR_CUSTOM_APP_DOCROOT:-/deployment/manager/app}
-ENV OR_CONSOLE_APP_CONFIG_DOCROOT ${OR_CONSOLE_APP_CONFIG_DOCROOT:-/deployment/manager/consoleappconfig}
ENV OR_PROVISIONING_DOCROOT ${OR_PROVISIONING_DOCROOT:-/deployment/manager/provisioning}
ENV OR_ROOT_REDIRECT_PATH ${OR_ROOT_REDIRECT_PATH:-/manager}
ENV OR_DATA_POINTS_EXPORT_DIR ${OR_DATA_POINTS_EXPORT_DIR:-/tmp}
diff --git a/manager/src/main/java/org/openremote/manager/apps/AppResourceImpl.java b/manager/src/main/java/org/openremote/manager/apps/AppResourceImpl.java
new file mode 100644
index 000000000..099fea773
--- /dev/null
+++ b/manager/src/main/java/org/openremote/manager/apps/AppResourceImpl.java
@@ -0,0 +1,134 @@
+/*
+ * Copyright 2017, OpenRemote Inc.
+ *
+ * See the CONTRIBUTORS.txt file in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.openremote.manager.apps;
+
+import org.openremote.container.web.WebResource;
+import org.openremote.model.apps.AppResource;
+import org.openremote.model.apps.ConsoleAppConfig;
+import org.openremote.model.http.RequestParams;
+import org.openremote.model.util.ValueUtil;
+
+import javax.ws.rs.NotFoundException;
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import java.io.File;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+public class AppResourceImpl extends WebResource implements AppResource {
+
+ final protected ConsoleAppService consoleAppService;
+ protected Map<String, Object> consoleAppInfoMap;
+ protected Object consoleConfig;
+
+ public AppResourceImpl(ConsoleAppService consoleAppService) {
+ this.consoleAppService = consoleAppService;
+ }
+
+ @Override
+ public String[] getApps(RequestParams requestParams) {
+ try {
+ return consoleAppService.getInstalled();
+ } catch (Exception ex) {
+ throw new RuntimeException(ex);
+ }
+ }
+
+ @Override
+ public Response getAppInfos(RequestParams requestParams) {
+ if (!Files.isDirectory(consoleAppService.consoleAppDocRoot)) {
+ return Response
+ .status(Response.Status.INTERNAL_SERVER_ERROR)
+ .entity(String.format("%s is not a directory", consoleAppService.consoleAppDocRoot))
+ .type(MediaType.APPLICATION_JSON_TYPE)
+ .build();
+ }
+
+ if (consoleAppInfoMap == null) {
+ try {
+ consoleAppInfoMap = Files.find(consoleAppService.consoleAppDocRoot,
+ 2,
+ (filePath, fileAttr) -> filePath.getFileName().toString().endsWith("info.json") && fileAttr.isRegularFile())
+ .collect(Collectors.toMap(dir -> dir.getName(dir.getNameCount() - 2).toString(), dir -> {
+ try {
+ return ValueUtil.JSON.readValue(dir.toFile(), Object.class);
+ } catch (IOException e) {
+ throw new WebApplicationException(e);
+ }
+ }));
+ } catch (IOException e) {
+ throw new WebApplicationException(e);
+ }
+ }
+
+ return Response.ok(consoleAppInfoMap, MediaType.APPLICATION_JSON).build();
+ }
+
+ @Override
+ public Response getConsoleConfig(RequestParams requestParams) {
+ if (!Files.isDirectory(consoleAppService.consoleAppDocRoot)) {
+ return Response
+ .status(Response.Status.INTERNAL_SERVER_ERROR)
+ .entity(String.format("%s is not a directory", consoleAppService.consoleAppDocRoot))
+ .type(MediaType.APPLICATION_JSON_TYPE)
+ .build();
+ }
+
+ if (!Files.exists(consoleAppService.consoleAppDocRoot.resolve("console_config.json"))) {
+ return Response
+ .status(Response.Status.NOT_FOUND)
+ .build();
+ }
+
+ if (consoleConfig == null) {
+ try {
+ consoleConfig = ValueUtil.JSON.readValue(new File(consoleAppService.consoleAppDocRoot.resolve("console_config.json").toString()), Object.class);
+ } catch (IOException e) {
+ throw new WebApplicationException(e);
+ }
+ }
+ return Response.ok(consoleConfig, MediaType.APPLICATION_JSON).build();
+ }
+
+ @Deprecated
+ protected ConsoleAppConfig getAppConfig(String realm) {
+ try {
+ if (!Files.isDirectory(consoleAppService.consoleAppDocRoot)) {
+ return null;
+ }
+
+ return Files.list(consoleAppService.consoleAppDocRoot)
+ .filter(dir -> dir.getFileName().toString().startsWith(realm))
+ .map(dir -> {
+ try {
+ return ValueUtil.JSON.readValue(dir.toFile(), ConsoleAppConfig.class);
+ } catch (IOException e) {
+ throw new WebApplicationException(e);
+ }
+ })
+ .findFirst().orElseThrow(NotFoundException::new);
+ } catch (IOException e) {
+ throw new WebApplicationException(e);
+ }
+ }
+}
diff --git a/manager/src/main/java/org/openremote/manager/apps/ConsoleAppResourceImpl.java b/manager/src/main/java/org/openremote/manager/apps/ConsoleAppResourceImpl.java
deleted file mode 100644
index 8801d319c..000000000
--- a/manager/src/main/java/org/openremote/manager/apps/ConsoleAppResourceImpl.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Copyright 2017, OpenRemote Inc.
- *
- * See the CONTRIBUTORS.txt file in the distribution for a
- * full listing of individual contributors.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-package org.openremote.manager.apps;
-
-import org.openremote.container.web.WebResource;
-import org.openremote.model.apps.ConsoleAppConfig;
-import org.openremote.model.apps.AppResource;
-import org.openremote.model.http.RequestParams;
-import org.openremote.model.util.ValueUtil;
-
-import javax.ws.rs.BeanParam;
-import javax.ws.rs.NotFoundException;
-import javax.ws.rs.WebApplicationException;
-import javax.ws.rs.core.Response;
-import java.io.IOException;
-import java.nio.file.Files;
-
-public class ConsoleAppResourceImpl extends WebResource implements AppResource {
-
- final protected ConsoleAppService consoleAppService;
-
- public ConsoleAppResourceImpl(ConsoleAppService consoleAppService) {
- this.consoleAppService = consoleAppService;
- }
-
- @Override
- public String[] getApps(@BeanParam RequestParams requestParams) {
- if (!isSuperUser()) {
- throw new WebApplicationException(Response.Status.FORBIDDEN);
- }
- try {
- return consoleAppService.getInstalled();
- } catch (Exception ex) {
- throw new RuntimeException(ex);
- }
- }
-
- @Deprecated
- protected ConsoleAppConfig getAppConfig(String realm) {
- try {
- if (!Files.isDirectory(consoleAppService.consoleAppDocRoot)) {
- return null;
- }
-
- return Files.list(consoleAppService.consoleAppDocRoot)
- .filter(dir -> dir.getFileName().toString().startsWith(realm))
- .map(dir -> {
- try {
- return ValueUtil.JSON.readValue(dir.toFile(), ConsoleAppConfig.class);
- } catch (IOException e) {
- throw new WebApplicationException(e);
- }
- })
- .findFirst().orElseThrow(NotFoundException::new);
- } catch (IOException e) {
- throw new WebApplicationException(e);
- }
- }
-}
diff --git a/manager/src/main/java/org/openremote/manager/apps/ConsoleAppService.java b/manager/src/main/java/org/openremote/manager/apps/ConsoleAppService.java
index d9ecc3d6e..88d6c3fd9 100644
--- a/manager/src/main/java/org/openremote/manager/apps/ConsoleAppService.java
+++ b/manager/src/main/java/org/openremote/manager/apps/ConsoleAppService.java
@@ -21,37 +21,28 @@ package org.openremote.manager.apps;
import io.undertow.server.HttpHandler;
import io.undertow.server.handlers.PathHandler;
-import org.openremote.container.web.WebService;
-import org.openremote.model.Container;
-import org.openremote.model.ContainerService;
import org.openremote.container.persistence.PersistenceService;
import org.openremote.container.timer.TimerService;
import org.openremote.manager.security.ManagerIdentityService;
import org.openremote.manager.web.ManagerWebService;
-import org.openremote.model.apps.ConsoleAppConfig;
-import org.openremote.model.util.ValueUtil;
+import org.openremote.model.Container;
+import org.openremote.model.ContainerService;
-import javax.ws.rs.NotFoundException;
-import javax.ws.rs.WebApplicationException;
-import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
-import java.util.Map;
import java.util.logging.Logger;
import java.util.stream.Stream;
import static org.openremote.container.util.MapAccess.getString;
import static org.openremote.container.web.WebService.pathStartsWithHandler;
+import static org.openremote.manager.web.ManagerWebService.OR_CUSTOM_APP_DOCROOT;
+import static org.openremote.manager.web.ManagerWebService.OR_CUSTOM_APP_DOCROOT_DEFAULT;
public class ConsoleAppService implements ContainerService {
private static final Logger LOG = Logger.getLogger(ConsoleAppService.class.getName());
- public static final String CONSOLE_APP_CONFIG_PATH = "/consoleappconfig";
- public static final String OR_CONSOLE_APP_CONFIG_DOCROOT = "OR_CONSOLE_APP_CONFIG_DOCROOT";
- public static final String OR_CONSOLE_APP_CONFIG_DOCROOT_DEFAULT = "manager/src/consoleappconfig";
-
protected TimerService timerService;
protected ManagerWebService managerWebService;
protected ManagerIdentityService identityService;
@@ -67,19 +58,19 @@ public class ConsoleAppService implements ContainerService {
this.persistenceService = container.getService(PersistenceService.class);
container.getService(ManagerWebService.class).addApiSingleton(
- new ConsoleAppResourceImpl(this)
+ new AppResourceImpl(this)
);
- consoleAppDocRoot = Paths.get(getString(container.getConfig(), OR_CONSOLE_APP_CONFIG_DOCROOT, OR_CONSOLE_APP_CONFIG_DOCROOT_DEFAULT));
+ consoleAppDocRoot = Paths.get(getString(container.getConfig(), OR_CUSTOM_APP_DOCROOT, OR_CUSTOM_APP_DOCROOT_DEFAULT));
// Serve console app config files
if (Files.isDirectory(consoleAppDocRoot)) {
HttpHandler customBaseFileHandler = ManagerWebService.createFileHandler(container, consoleAppDocRoot, null);
- HttpHandler pathHandler = new PathHandler().addPrefixPath(CONSOLE_APP_CONFIG_PATH, customBaseFileHandler);
+ HttpHandler pathHandler = new PathHandler().addPrefixPath("info", customBaseFileHandler);
managerWebService.getRequestHandlers().add(0, pathStartsWithHandler(
- "Console app config files",
- CONSOLE_APP_CONFIG_PATH,
+ "Console app info files",
+ "info",
pathHandler));
}
}
@@ -97,7 +88,9 @@ public class ConsoleAppService implements ContainerService {
Files.list(managerWebService.getBuiltInAppDocRoot()),
Files.list(managerWebService.getCustomAppDocRoot()))
.filter(Files::isDirectory)
+ .filter(path -> !path.endsWith("shared") && !path.endsWith("swagger"))
.map(dir -> dir.getFileName().toString())
+ .distinct()
.toArray(String[]::new);
}
diff --git a/model/src/main/java/org/openremote/model/apps/AppResource.java b/model/src/main/java/org/openremote/model/apps/AppResource.java
index bc19b251b..d834120fd 100644
--- a/model/src/main/java/org/openremote/model/apps/AppResource.java
+++ b/model/src/main/java/org/openremote/model/apps/AppResource.java
@@ -22,10 +22,8 @@ package org.openremote.model.apps;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.openremote.model.http.RequestParams;
-import javax.ws.rs.BeanParam;
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.Produces;
+import javax.ws.rs.*;
+import javax.ws.rs.core.Response;
import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
@@ -34,10 +32,25 @@ import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
public interface AppResource {
/**
- * Retrieve installed console applications. Only the superuser can perform this operation,
- * a 403 status is returned if a regular user tries to access the console applications.
+ * Retrieve a list of available apps
*/
@GET
@Produces(APPLICATION_JSON)
String[] getApps(@BeanParam RequestParams requestParams);
+
+ /**
+ * Retrieve info json of all apps.
+ */
+ @GET
+ @Produces(APPLICATION_JSON)
+ @Path("info")
+ Response getAppInfos(@BeanParam RequestParams requestParams);
+
+ /**
+ * Retrieve console app config.
+ */
+ @GET
+ @Produces(APPLICATION_JSON)
+ @Path("consoleConfig")
+ Response getConsoleConfig(@BeanParam RequestParams requestParams);
}
diff --git a/profile/deploy.yml b/profile/deploy.yml
index 3f7121b15..9d0d81f62 100644
--- a/profile/deploy.yml
+++ b/profile/deploy.yml
@@ -230,9 +230,6 @@ services:
# Location for the provisioning files
OR_PROVISIONING_DOCROOT: ${OR_PROVISIONING_DOCROOT:-/deployment/manager/provisioning}
- # Location of the console app config files.
- OR_CONSOLE_APP_CONFIG_DOCROOT: ${OR_CONSOLE_APP_CONFIG_DOCROOT:-/deployment/manager/consoleappconfig}
-
# Redirect path when root URI is requested
OR_ROOT_REDIRECT_PATH: ${OR_ROOT_REDIRECT_PATH:-/manager}
diff --git a/ui/app/console_config.json b/ui/app/console_config.json
new file mode 100644
index 000000000..f83e364b1
--- /dev/null
+++ b/ui/app/console_config.json
@@ -0,0 +1,7 @@
+{
+ "showAppTextInput": false,
+ "showRealmTextInput": false,
+ "app": null,
+ "allowedApps": ["manager"],
+ "apps": null
+}
diff --git a/ui/app/manager/info.json b/ui/app/manager/info.json
new file mode 100644
index 000000000..292d994ae
--- /dev/null
+++ b/ui/app/manager/info.json
@@ -0,0 +1,6 @@
+{
+ "consoleAppIncompatible": false,
+ "realms": ["master", "smartcity"],
+ "providers": ["geofence", "push", "storage"],
+ "description": "The default app of OpenRemote"
+}