Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make the main code supportable to compile in AppyBuilder Code Editor or any compiler #1

Merged
merged 2 commits into from Jul 30, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
22 changes: 0 additions & 22 deletions DeepActivity.java

This file was deleted.

29 changes: 26 additions & 3 deletions DeepLink.java
@@ -1,4 +1,5 @@
package com.sunny.DeepLink;
package com.appybuilder.sunny.DeepLink;

import com.google.appinventor.components.annotations.DesignerComponent;
import com.google.appinventor.components.annotations.SimpleFunction;
import com.google.appinventor.components.annotations.SimpleObject;
Expand All @@ -10,12 +11,34 @@
import com.google.appinventor.components.runtime.ComponentContainer;
import com.google.appinventor.components.annotations.androidmanifest.*;
import com.google.appinventor.components.annotations.UsesActivities;
import android.app.Activity;
import android.net.Uri;
import android.os.Bundle;
import android.content.Intent;
import android.content.pm.PackageManager;

@DesignerComponent(version = 1, description ="Adds deep link support<br> Developed by Sunny Gupta", category = ComponentCategory.EXTENSION, nonVisible = true, iconName = "https://res.cloudinary.com/andromedaviewflyvipul/image/upload/c_scale,h_20,w_20/v1571472765/ktvu4bapylsvnykoyhdm.png")
@UsesActivities(activities = {@ActivityElement(intentFilters = {@IntentFilterElement(actionElements = {@ActionElement(name = "android.intent.action.VIEW")}, categoryElements = {@CategoryElement(name = "android.intent.category.DEFAULT"), @CategoryElement(name = "android.intent.category.BROWSABLE")}, dataElements = {@DataElement(scheme = "deepLink",host="Screen1"), @DataElement(scheme = "https",host="community.kodular.io")})},name="com.sunny.DeepLink.DeepActivity")})
@UsesActivities(activities = {@ActivityElement(intentFilters = {@IntentFilterElement(actionElements = {@ActionElement(name = "android.intent.action.VIEW")}, categoryElements = {@CategoryElement(name = "android.intent.category.DEFAULT"), @CategoryElement(name = "android.intent.category.BROWSABLE")}, dataElements = {@DataElement(scheme = "deepLink",host="Screen1"), @DataElement(scheme = "https",host="community.kodular.io")})},name="com.appybuilder.sunny.DeepLink.DeepLink$DeepActivity")})
@SimpleObject(external=true)
public final class DeepLink extends AndroidNonvisibleComponent{
public DeepLink(ComponentContainer container) {
super(container.$form());
}

public static class DeepActivity extends Activity{
@Override
protected void onCreate(Bundle saved){
super.onCreate(saved);
if (getIntent() != null){
Uri uri = getIntent().getData();
if (uri != null){
PackageManager packageManager = getPackageManager();
Intent intent = packageManager.getLaunchIntentForPackage(getPackageName());
intent.putExtra("APP_INVENTOR_START",'"'+ uri.toString() +'"');
startActivity(intent);
finish();
}
}
}
}
}