Skip to content

Commit 43866f4

Browse files
authored
Merge pull request #5 from freshbits/v2.2
Add nullable email for user and custome
2 parents bbc7dd1 + fe6333f commit 43866f4

File tree

4 files changed

+32
-19
lines changed

4 files changed

+32
-19
lines changed

android-example-app/app-kotlin/build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ android {
88
applicationId "ch.freshbits.pathshare.example"
99
minSdkVersion 21
1010
targetSdkVersion 27
11-
versionCode 2_1_0
12-
versionName "2.1.0"
11+
versionCode 2_2_0
12+
versionName "2.2.0"
1313

1414
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
1515
}
@@ -41,7 +41,7 @@ dependencies {
4141
implementation fileTree(dir: 'libs', include: ['*.jar'])
4242
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
4343
implementation 'com.android.support:appcompat-v7:27.1.1'
44-
implementation 'ch.freshbits.pathshare.sdk:pathshare-sdk:2.1.0'
44+
implementation 'ch.freshbits.pathshare.sdk:pathshare-sdk:2.2.0'
4545
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
4646
implementation 'com.android.support:design:27.1.1'
4747
}

android-example-app/app-kotlin/src/main/java/ch/freshbits/pathshare/example/MainActivity.kt

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,6 @@ class MainActivity : AppCompatActivity() {
3535
super.onCreate(savedInstanceState)
3636
setContentView(R.layout.activity_main)
3737

38-
createButton = findViewById<View>(R.id.create_session) as Button
39-
joinButton = findViewById<View>(R.id.join_session) as Button
40-
inviteButton = findViewById<View>(R.id.invite_customer) as Button
41-
leaveButton = findViewById<View>(R.id.leave_session) as Button
42-
4338
initializeCreateButton()
4439
initializeJoinButton()
4540
initializeInviteButton()
@@ -49,9 +44,10 @@ class MainActivity : AppCompatActivity() {
4944
}
5045

5146
private fun initializeCreateButton() {
47+
createButton = findViewById<View>(R.id.create_session) as Button
5248
createButton.isEnabled = true
5349
createButton.setOnClickListener {
54-
Pathshare.client().saveUser("SDK User Android", "+12345678901", UserType.DRIVER, object: ResponseListener {
50+
Pathshare.client().saveUser("SDK User Android", "[email protected]", "+12345678901", UserType.DRIVER, object: ResponseListener {
5551
override fun onSuccess() {
5652
Log.d("User", "Success")
5753
createSession()
@@ -65,16 +61,19 @@ class MainActivity : AppCompatActivity() {
6561
}
6662

6763
private fun initializeJoinButton() {
64+
joinButton = findViewById<View>(R.id.join_session) as Button
6865
joinButton.isEnabled = false
6966
joinButton.setOnClickListener { joinSession() }
7067
}
7168

7269
private fun initializeInviteButton() {
70+
inviteButton = findViewById<View>(R.id.invite_customer) as Button
7371
inviteButton.isEnabled = false
7472
inviteButton.setOnClickListener { inviteCustomer() }
7573
}
7674

7775
private fun initializeLeaveButton() {
76+
leaveButton = findViewById<View>(R.id.leave_session) as Button
7877
leaveButton.isEnabled = false
7978
leaveButton.setOnClickListener { leaveSession() }
8079
}
@@ -225,7 +224,6 @@ class MainActivity : AppCompatActivity() {
225224
deleteSessionIdentifier()
226225
showToast("Session expired")
227226
}
228-
229227
}
230228

231229
private fun showToast(message: String) {

android-example-app/app/build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ android {
88
applicationId "ch.freshbits.pathshare.example"
99
minSdkVersion 25
1010
targetSdkVersion 27
11-
versionCode 2_1_0
12-
versionName "2.1.0"
11+
versionCode 2_2_0
12+
versionName "2.2.0"
1313
}
1414

1515
lintOptions {
@@ -40,5 +40,5 @@ dependencies {
4040
testCompile 'junit:junit:4.12'
4141
//noinspection GradleCompatible
4242
compile 'com.android.support:appcompat-v7:27.1.1'
43-
compile 'ch.freshbits.pathshare.sdk:pathshare-sdk:2.1.0'
43+
compile 'ch.freshbits.pathshare.sdk:pathshare-sdk:2.2.0'
4444
}

android-example-app/app/src/main/java/ch/freshbits/pathshare/example/MainActivity.java

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,6 @@ protected void onCreate(Bundle savedInstanceState) {
4141
super.onCreate(savedInstanceState);
4242
setContentView(R.layout.activity_main);
4343

44-
mCreateButton = findViewById(R.id.create_session);
45-
mJoinButton = findViewById(R.id.join_session);
46-
mInviteButton = findViewById(R.id.invite_customer);
47-
mLeaveButton = findViewById(R.id.leave_session);
48-
4944
initializeCreateButton();
5045
initializeJoinButton();
5146
initializeInviteButton();
@@ -55,11 +50,12 @@ protected void onCreate(Bundle savedInstanceState) {
5550
}
5651

5752
private void initializeCreateButton() {
53+
setCreateButton((Button) findViewById(R.id.create_session));
5854
getCreateButton().setEnabled(true);
5955
getCreateButton().setOnClickListener(new View.OnClickListener() {
6056
@Override
6157
public void onClick(View view) {
62-
Pathshare.client().saveUser("SDK User", "+12345678901", UserType.DRIVER, new ResponseListener() {
58+
Pathshare.client().saveUser("SDK User", "[email protected]", "+12345678901", UserType.DRIVER, new ResponseListener() {
6359
@Override
6460
public void onSuccess() {
6561
Log.d("User", "Success");
@@ -76,6 +72,7 @@ public void onError() {
7672
}
7773

7874
private void initializeJoinButton() {
75+
setJoinButton((Button) findViewById(R.id.join_session));
7976
getJoinButton().setEnabled(false);
8077
getJoinButton().setOnClickListener(new View.OnClickListener() {
8178
@Override
@@ -86,6 +83,7 @@ public void onClick(View v) {
8683
}
8784

8885
private void initializeInviteButton() {
86+
setInviteButton((Button) findViewById(R.id.invite_customer));
8987
getInviteButton().setEnabled(false);
9088
getInviteButton().setOnClickListener(new View.OnClickListener() {
9189
@Override
@@ -96,6 +94,7 @@ public void onClick(View v) {
9694
}
9795

9896
private void initializeLeaveButton() {
97+
setLeaveButton((Button) findViewById(R.id.leave_session));
9998
getLeaveButton().setEnabled(false);
10099
getLeaveButton().setOnClickListener(new View.OnClickListener() {
101100
@Override
@@ -281,6 +280,22 @@ public Session getSession() {
281280
return mSession;
282281
}
283282

283+
public void setCreateButton(Button createButton) {
284+
this.mCreateButton = createButton;
285+
}
286+
287+
public void setJoinButton(Button joinButton) {
288+
this.mJoinButton = joinButton;
289+
}
290+
291+
public void setInviteButton(Button inviteButton) {
292+
this.mInviteButton = inviteButton;
293+
}
294+
295+
public void setLeaveButton(Button leaveButton) {
296+
this.mLeaveButton = leaveButton;
297+
}
298+
284299
public Button getCreateButton() {
285300
return mCreateButton;
286301
}

0 commit comments

Comments
 (0)