Skip to content

Commit

Permalink
sdk changes based on jira requirements
Browse files Browse the repository at this point in the history
  • Loading branch information
Sukru Avcuoglu committed Mar 3, 2021
1 parent 84d85a8 commit aba299b
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 66 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import android.app.Application
import com.benbria.loopandroidrefapp.di.mainModules
import com.benbria.loopandroidsdk.core.Loop
import com.benbria.loopandroidsdk.data.listeners.InitListener
import com.benbria.loopandroidsdk.data.view.LoopWebView
import com.benbria.loopandroidsdk.domain.entities.Configuration
import org.koin.android.ext.koin.androidContext
import org.koin.android.logger.AndroidLogger
Expand Down Expand Up @@ -31,15 +32,16 @@ class LoopApplication : Application() {
Loop.getInstance(this).init(
Configuration().apply {
this.apiKey = "api_key"
this.projectName = "demo"
this.mobileChannelId = "channel_id"
},
object : InitListener {
override fun onInitCompleted(surveys: List<String>) {

override fun displayRequested(webView: LoopWebView) {
}

override fun onInitError(message: String) {
override fun failure(message: String) {
}

override fun ready() {
}
})
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,48 +20,7 @@ class MainActivity : AppCompatActivity() {

button_survey.setOnClickListener {
webview_container.removeAllViews()

mainViewModel.view(baseContext, "surveyid1", null, object : ViewListener {
override fun onViewClose() {
webview_container.removeAllViews()
}

override fun onViewCreateError(message: String) {
}

override fun onViewCreated(view: LoopWebView) {
val lp = LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)
webview_container.addView(view, lp)
}

override fun onViewError(message: String) {
}
})
}

button_survey_with_location.setOnClickListener {
webview_container.removeAllViews()
mainViewModel.view(baseContext, "surveyid1", "0079", object : ViewListener {
override fun onViewClose() {
webview_container.removeAllViews()
}

override fun onViewCreateError(message: String) {
}

override fun onViewCreated(view: LoopWebView) {
val lp = LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)
webview_container.addView(view, lp)
}

override fun onViewError(message: String) {
}
})
}

button_messenger.setOnClickListener {
webview_container.removeAllViews()
mainViewModel.view(baseContext, "chfwebmessenger", "00033", object : ViewListener {
mainViewModel.view(baseContext, "00033", object : ViewListener {
override fun onViewClose() {
webview_container.removeAllViews()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class MainViewModel() : BaseViewModel() {

}

fun view(context: Context, channelId: String, locationId: String? = null, viewListener: ViewListener? = null) =
Loop.getInstance(context).view(channelId, locationId, UserInfo().apply { this.name = "John" }, viewListener)
fun view(context: Context, experienceId: String, viewListener: ViewListener? = null) =
Loop.getInstance(context).view(experienceId, UserInfo().apply { this.name = "John" }, viewListener)

}
18 changes: 0 additions & 18 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,24 +27,6 @@
android:layout_marginTop="10dp"
android:layout_marginEnd="20dp"
android:text="Click Me!-Survey"/>

<Button
android:id="@+id/button_survey_with_location"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="20dp"
android:text="Click Me!-Survey(0079)"/>

<Button
android:id="@+id/button_messenger"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="20dp"
android:text="Click Me!-Messenger(00033)"/>
</LinearLayout>

<LinearLayout
Expand Down

0 comments on commit aba299b

Please sign in to comment.