-
Notifications
You must be signed in to change notification settings - Fork 0
/
MainActivity.java
99 lines (89 loc) · 3.81 KB
/
MainActivity.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
package com.charke.partyapp;
import android.os.Bundle;
import com.getcapacitor.BridgeActivity;
public class MainActivity extends BridgeActivity {
//public static final String TAG = "tag";
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
/*createDynamicLink_Basic();
handleIntent(getIntent());*/
//Intent intent = getIntent();
//String action = intent.getAction();
//Uri data = intent.getData(); in case we need later
}
}
/*FirebaseDynamicLinks.getInstance().getDynamicLink(getIntent())
.addOnSuccessListener(this, pendingDynamicLinkData -> {
Log.i(TAG, "Dynamic link detected");
if (pendingDynamicLinkData != null & pendingDynamicLinkData.getLink() != null) {
String oobCode = pendingDynamicLinkData.getLink().getQueryParameter("oobCode");
if (oobCode != null) {
FirebaseAuth.checkActionCode(oobCode).addOnSuccessListener(result -> {
switch (result.getOperation()) {
case ActionCodeResult.VERIFY_EMAIL: {
FirebaseAuth.applyActionCode(oobCode).addOnSuccessListener(resultCode -> {
Log.i(TAG, "Verified email");
finish();
}).addOnFailureListener(resultCode -> Log.w(TAG, "Failed to Verified Email", resultCode));
break;
}
case ActionCodeResult.PASSWORD_RESET: {
Intent passWordResetInetemnt = new Intent(MainActivity.this, PassWordReset.class);
passWordResetInetemnt.putExtra("oobCode", oobCode);
startActivity(passWordResetInetemnt);
finish();
break;
}
}
}).addOnFailureListener(result -> {
Log.w(TAG, "Invalid code sent");
finish();
});
}
}
}).addOnFailureListener(result -> {
Log.w(TAG, "Failed to get dynamic link");
finish();
});
private void handleIntent(Intent intent) {
String appLinkAction = intent.getAction();
Uri appLinkData = intent.getData();
}
public void createDynamicLink_Basic() {
// [START create_link_basic]
DynamicLink dynamicLink = FirebaseDynamicLinks.getInstance().createDynamicLink()
.setLink(Uri.parse("https://www.test1619.com/"))
.setDomainUriPrefix("https://test1619.page.link")
// Open links with this app on Android
.setAndroidParameters(new DynamicLink.AndroidParameters.Builder().build())
// Open links with com.example.ios on iOS
//.setIosParameters(new DynamicLink.IosParameters.Builder("com.example.ios").build())
.buildDynamicLink();
Uri dynamicLinkUri = dynamicLink.getUri();
// [END create_link_basic]
}*/
/*public void createShortLink() {
// [START create_short_link]
Task<ShortDynamicLink> shortLinkTask = FirebaseDynamicLinks.getInstance().createDynamicLink()
.setLink(Uri.parse("https://www.test1619.com/"))
.setDomainUriPrefix("https://test1619.page.link")
// Set parameters
// ...
.buildShortDynamicLink()
.addOnCompleteListener(this, new OnCompleteListener<ShortDynamicLink>() {
@Override
public void onComplete(@NonNull Task<ShortDynamicLink> task) {
if (task.isSuccessful()) {
// Short link created
Uri shortLink = task.getResult().getShortLink();
Uri flowchartLink = task.getResult().getPreviewLink();
} else {
// Error
// ...
}
}
});
// [END create_short_link]
}*/