-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated capacitor version to ^3.0.0 Updated Android
- Loading branch information
1 parent
46987a4
commit 696c09f
Showing
13 changed files
with
1,248 additions
and
252 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0-all.zip | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 0 additions & 26 deletions
26
android/src/androidTest/java/com/getcapacitor/android/ExampleInstrumentedTest.java
This file was deleted.
Oops, something went wrong.
67 changes: 0 additions & 67 deletions
67
android/src/main/java/io/mati/plugins/capacitor/MatiCapacitorPlugin.java
This file was deleted.
Oops, something went wrong.
73 changes: 73 additions & 0 deletions
73
android/src/main/java/space/serenity/mati/capacitor/MatiCapacitorPlugin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
package space.serenity.mati.capacitor; | ||
|
||
import android.app.Activity; | ||
import android.content.Intent; | ||
import android.util.Log; | ||
|
||
import androidx.activity.result.ActivityResult; | ||
|
||
import com.getcapacitor.JSObject; | ||
import com.getcapacitor.Plugin; | ||
import com.getcapacitor.PluginCall; | ||
import com.getcapacitor.PluginMethod; | ||
import com.getcapacitor.annotation.ActivityCallback; | ||
import com.getcapacitor.annotation.CapacitorPlugin; | ||
import com.getmati.mati_sdk.MatiButton; | ||
import com.getmati.mati_sdk.MatiSdk; | ||
import com.getmati.mati_sdk.Metadata; | ||
import com.getmati.mati_sdk.ui.data_prefetch.DataPrefetchActivity; | ||
|
||
import org.json.JSONObject; | ||
|
||
@CapacitorPlugin(name = "MatiCapacitor") | ||
public class MatiCapacitorPlugin extends Plugin { | ||
|
||
@SuppressWarnings("unused") | ||
@PluginMethod | ||
public void showMatiFlow(PluginCall call) { | ||
Log.e("MatiCapacitorPlugin", "showMatiFlow"); | ||
bridge.getActivity().runOnUiThread(new Runnable() { | ||
@Override | ||
public void run() { | ||
|
||
final String clientId = call.getString("clientId"); | ||
final String flowId = call.getString("flowId"); | ||
final JSONObject metadata = call.getObject("metadata", null); | ||
|
||
Intent intent = new Intent(bridge.getActivity(), DataPrefetchActivity.class); | ||
|
||
intent.putExtra("ARG_CLIENT_ID", clientId); | ||
if(flowId != null) { | ||
intent.putExtra("ARG_FLOW_ID", flowId); | ||
} | ||
if(metadata != null) { | ||
intent.putExtra("ARG_METADATA", metadata.toString()); | ||
} | ||
|
||
// MatiSdk.INSTANCE.startFlow(bridge.getActivity(), clientId, flowId, Metadata.fromJson(metadata.toString())); | ||
|
||
startActivityForResult(call, intent, "callback"); | ||
} | ||
}); | ||
} | ||
|
||
@Override | ||
protected void handleOnActivityResult(int requestCode, int resultCode, Intent data) { | ||
super.handleOnActivityResult(requestCode, resultCode, data); | ||
Log.e("MatiCapacitorPlugin", "WILL NOT BE CALLED"); | ||
} | ||
|
||
@SuppressWarnings("unused") | ||
@ActivityCallback | ||
public void callback(PluginCall call, ActivityResult activityResult) { | ||
if(activityResult.getResultCode() == Activity.RESULT_OK) { | ||
JSObject result = new JSObject(); | ||
result.put("verificationId", activityResult.getData().getStringExtra(MatiSdk.ARG_VERIFICATION_ID)); | ||
call.resolve(result); | ||
Log.e("MatiCapacitorPlugin", "Activity.RESULT_OK"); | ||
} else { | ||
call.reject("Verification cancelled"); | ||
Log.e("MatiCapacitorPlugin", "Activity.RESULT_CANCELLED"); | ||
} | ||
} | ||
} |
Oops, something went wrong.