Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sync: roboscript enabling (fixes #4880) #4881

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import android.content.DialogInterface
import android.content.SharedPreferences
import android.net.Uri
import android.text.TextUtils
import android.util.Log
import com.google.gson.Gson
import com.google.gson.JsonObject
import io.realm.Realm
Expand Down Expand Up @@ -101,6 +102,7 @@ class Service(private val context: Context) {
}

fun checkVersion(callback: CheckVersionCallback, settings: SharedPreferences) {
Log.d("okuro", "${settings.getString("couchdbURL", "")?.isEmpty()}")
if (settings.getString("couchdbURL", "")?.isEmpty() == true) {
callback.onError(context.getString(R.string.config_not_available), true)
return
Expand Down
18 changes: 12 additions & 6 deletions app/src/main/java/org/ole/planet/myplanet/ui/sync/LoginActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import android.graphics.drawable.AnimationDrawable
import android.os.*
import android.os.Build.VERSION_CODES.TIRAMISU
import android.text.*
import android.util.Log
import android.view.*
import android.view.inputmethod.EditorInfo
import android.widget.*
Expand Down Expand Up @@ -59,6 +60,7 @@ class LoginActivity : SyncActivity(), TeamListAdapter.OnItemClickListener {
declareMoreElements()
showWifiDialog()
registerReceiver()

forceSync = intent.getBooleanExtra("forceSync", false)
processedUrl = getUrl()
if (forceSync) {
Expand Down Expand Up @@ -110,6 +112,10 @@ class LoginActivity : SyncActivity(), TeamListAdapter.OnItemClickListener {
}
}
})
Log.d("LoginActivity", "onCreate: ${settings.getBoolean("firstSync", false)}")
if (!settings.getBoolean("firstSync", false)) {
setupDefaultSync()
}
}

private fun declareElements() {
Expand Down Expand Up @@ -149,18 +155,18 @@ class LoginActivity : SyncActivity(), TeamListAdapter.OnItemClickListener {
becomeAMember()
}

activityLoginBinding.imgBtnSetting.setOnClickListener {
activityLoginBinding.inputName.setText(R.string.empty_text)
settingDialog()
}
// activityLoginBinding.imgBtnSetting.setOnClickListener {
// activityLoginBinding.inputName.setText(R.string.empty_text)
// settingDialog()
// }

activityLoginBinding.btnGuestLogin.setOnClickListener {
if (getUrl().isNotEmpty()) {
activityLoginBinding.inputName.setText(R.string.empty_text)
showGuestLoginDialog()
} else {
toast(this, getString(R.string.please_enter_server_url_first))
settingDialog()
// settingDialog()
}
}
}
Expand Down Expand Up @@ -655,7 +661,7 @@ class LoginActivity : SyncActivity(), TeamListAdapter.OnItemClickListener {
startActivity(Intent(this, BecomeMemberActivity::class.java))
} else {
toast(this, getString(R.string.please_enter_server_url_first))
settingDialog()
// settingDialog()
}
}

Expand Down
Loading
Loading