Skip to content

Commit

Permalink
Merge pull request #5 from freshbits/v2.2
Browse files Browse the repository at this point in the history
Add nullable email for user and custome
  • Loading branch information
jhabr committed Sep 10, 2018
2 parents bbc7dd1 + fe6333f commit 43866f4
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 19 deletions.
6 changes: 3 additions & 3 deletions android-example-app/app-kotlin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ android {
applicationId "ch.freshbits.pathshare.example"
minSdkVersion 21
targetSdkVersion 27
versionCode 2_1_0
versionName "2.1.0"
versionCode 2_2_0
versionName "2.2.0"

testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
Expand Down Expand Up @@ -41,7 +41,7 @@ dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'ch.freshbits.pathshare.sdk:pathshare-sdk:2.1.0'
implementation 'ch.freshbits.pathshare.sdk:pathshare-sdk:2.2.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:design:27.1.1'
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,6 @@ class MainActivity : AppCompatActivity() {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)

createButton = findViewById<View>(R.id.create_session) as Button
joinButton = findViewById<View>(R.id.join_session) as Button
inviteButton = findViewById<View>(R.id.invite_customer) as Button
leaveButton = findViewById<View>(R.id.leave_session) as Button

initializeCreateButton()
initializeJoinButton()
initializeInviteButton()
Expand All @@ -49,9 +44,10 @@ class MainActivity : AppCompatActivity() {
}

private fun initializeCreateButton() {
createButton = findViewById<View>(R.id.create_session) as Button
createButton.isEnabled = true
createButton.setOnClickListener {
Pathshare.client().saveUser("SDK User Android", "+12345678901", UserType.DRIVER, object: ResponseListener {
Pathshare.client().saveUser("SDK User Android", "me@email.com", "+12345678901", UserType.DRIVER, object: ResponseListener {
override fun onSuccess() {
Log.d("User", "Success")
createSession()
Expand All @@ -65,16 +61,19 @@ class MainActivity : AppCompatActivity() {
}

private fun initializeJoinButton() {
joinButton = findViewById<View>(R.id.join_session) as Button
joinButton.isEnabled = false
joinButton.setOnClickListener { joinSession() }
}

private fun initializeInviteButton() {
inviteButton = findViewById<View>(R.id.invite_customer) as Button
inviteButton.isEnabled = false
inviteButton.setOnClickListener { inviteCustomer() }
}

private fun initializeLeaveButton() {
leaveButton = findViewById<View>(R.id.leave_session) as Button
leaveButton.isEnabled = false
leaveButton.setOnClickListener { leaveSession() }
}
Expand Down Expand Up @@ -225,7 +224,6 @@ class MainActivity : AppCompatActivity() {
deleteSessionIdentifier()
showToast("Session expired")
}

}

private fun showToast(message: String) {
Expand Down
6 changes: 3 additions & 3 deletions android-example-app/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ android {
applicationId "ch.freshbits.pathshare.example"
minSdkVersion 25
targetSdkVersion 27
versionCode 2_1_0
versionName "2.1.0"
versionCode 2_2_0
versionName "2.2.0"
}

lintOptions {
Expand Down Expand Up @@ -40,5 +40,5 @@ dependencies {
testCompile 'junit:junit:4.12'
//noinspection GradleCompatible
compile 'com.android.support:appcompat-v7:27.1.1'
compile 'ch.freshbits.pathshare.sdk:pathshare-sdk:2.1.0'
compile 'ch.freshbits.pathshare.sdk:pathshare-sdk:2.2.0'
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,6 @@ protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

mCreateButton = findViewById(R.id.create_session);
mJoinButton = findViewById(R.id.join_session);
mInviteButton = findViewById(R.id.invite_customer);
mLeaveButton = findViewById(R.id.leave_session);

initializeCreateButton();
initializeJoinButton();
initializeInviteButton();
Expand All @@ -55,11 +50,12 @@ protected void onCreate(Bundle savedInstanceState) {
}

private void initializeCreateButton() {
setCreateButton((Button) findViewById(R.id.create_session));
getCreateButton().setEnabled(true);
getCreateButton().setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Pathshare.client().saveUser("SDK User", "+12345678901", UserType.DRIVER, new ResponseListener() {
Pathshare.client().saveUser("SDK User", "me@email.com", "+12345678901", UserType.DRIVER, new ResponseListener() {
@Override
public void onSuccess() {
Log.d("User", "Success");
Expand All @@ -76,6 +72,7 @@ public void onError() {
}

private void initializeJoinButton() {
setJoinButton((Button) findViewById(R.id.join_session));
getJoinButton().setEnabled(false);
getJoinButton().setOnClickListener(new View.OnClickListener() {
@Override
Expand All @@ -86,6 +83,7 @@ public void onClick(View v) {
}

private void initializeInviteButton() {
setInviteButton((Button) findViewById(R.id.invite_customer));
getInviteButton().setEnabled(false);
getInviteButton().setOnClickListener(new View.OnClickListener() {
@Override
Expand All @@ -96,6 +94,7 @@ public void onClick(View v) {
}

private void initializeLeaveButton() {
setLeaveButton((Button) findViewById(R.id.leave_session));
getLeaveButton().setEnabled(false);
getLeaveButton().setOnClickListener(new View.OnClickListener() {
@Override
Expand Down Expand Up @@ -281,6 +280,22 @@ public Session getSession() {
return mSession;
}

public void setCreateButton(Button createButton) {
this.mCreateButton = createButton;
}

public void setJoinButton(Button joinButton) {
this.mJoinButton = joinButton;
}

public void setInviteButton(Button inviteButton) {
this.mInviteButton = inviteButton;
}

public void setLeaveButton(Button leaveButton) {
this.mLeaveButton = leaveButton;
}

public Button getCreateButton() {
return mCreateButton;
}
Expand Down

0 comments on commit 43866f4

Please sign in to comment.