Skip to content

Commit

Permalink
feat init dapp browser function
Browse files Browse the repository at this point in the history
  • Loading branch information
john committed Nov 29, 2022
1 parent a1538fc commit 09d63f0
Show file tree
Hide file tree
Showing 225 changed files with 42,816 additions and 1,091 deletions.
6 changes: 6 additions & 0 deletions .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

50 changes: 50 additions & 0 deletions .idea/jarRepositories.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 14 additions & 3 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 0 additions & 10 deletions .idea/modules.xml

This file was deleted.

12 changes: 0 additions & 12 deletions .idea/runConfigurations.xml

This file was deleted.

51 changes: 40 additions & 11 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'realm-android'
apply plugin: 'org.greenrobot.greendao' // apply plugin
//apply plugin: 'com.android.library'
apply plugin: 'com.jakewharton.butterknife'

android {
compileSdkVersion 27
compileSdkVersion 28
buildToolsVersion '28.0.3'

defaultConfig {
applicationId "pro.upchain.ethwallet"
minSdkVersion 21
minSdkVersion 23
//noinspection ExpiredTargetSdkVersion
targetSdkVersion 26
versionCode 2
Expand Down Expand Up @@ -44,28 +49,47 @@ android {
targetCompatibility JavaVersion.VERSION_1_8
}
}

//dexOptions{
// incrementaltruejavaMaxHeapSize"4g"
//}

dependencies {


implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'androidx.core:core-ktx:1.2.0'

// implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:27.0.2'
implementation 'com.android.support:recyclerview-v7:27.0.2'
implementation 'com.android.support:design:27.0.2'
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'androidx.drawerlayout:drawerlayout:1.1.1'
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
// implementation 'com.android.support:support-v4:28.0.0'

implementation 'com.android.support.constraint:constraint-layout:1.1.2'
implementation "com.android.support:multidex:1.0.2"
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'


implementation "com.trustwallet:wallet-core:2.9.7"
implementation "com.louiscad.splitties:splitties-alertdialog-material:3.0.0"
implementation 'com.github.trustwallet:trust-web3-provider:2.0.0-alpha'

// implementation 'android.arch.lifecycle:runtime:1.0.3'
implementation 'android.arch.lifecycle:extensions:1.1.1'
// implementation 'android.arch.core:runtime:1.1.1'



// Annotation
implementation 'com.jakewharton:butterknife:8.8.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
// implementation 'com.jakewharton:butterknife:8.8.1'
// annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'

implementation "com.jakewharton:butterknife:10.2.3"
annotationProcessor "com.jakewharton:butterknife-compiler:10.2.3"

// leakcanary 可以迅速定位内存泄漏
debugImplementation 'com.squareup.leakcanary:leakcanary-android:1.5.4'
Expand All @@ -75,6 +99,7 @@ dependencies {
// Rx ReactiveX
implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
implementation 'io.reactivex.rxjava2:rxjava:2.2.6'
implementation 'org.slf4j:slf4j-jdk14:1.7.25'

//Retrofit
implementation 'com.squareup.retrofit2:retrofit:2.3.0'
Expand All @@ -89,7 +114,7 @@ dependencies {
// 沉浸式状态栏
implementation 'com.gyf.barlibrary:barlibrary:2.3.0'
implementation 'com.lcodecorex:tkrefreshlayout:1.0.7'
implementation 'com.github.CymChad:BaseRecyclerViewAdapterHelper:2.9.22'
implementation 'com.github.CymChad:BaseRecyclerViewAdapterHelper:2.9.50'

// 圆形图片
implementation 'de.hdodenhof:circleimageview:2.1.0'
Expand All @@ -106,7 +131,7 @@ dependencies {
annotationProcessor 'com.github.bumptech.glide:compiler:4.6.1'

// greenDao
implementation 'org.greenrobot:greendao:3.2.2'
implementation 'org.greenrobot:greendao:3.3.0'

// ViewPagerIndicator
implementation 'com.shizhefei:ViewPagerIndicator:1.1.6'
Expand All @@ -115,7 +140,7 @@ dependencies {
implementation 'com.google.android:flexbox:1.0.0'

// 以太坊开发库
implementation 'org.web3j:core:4.1.0-android'
implementation 'org.web3j:core:4.8.7-android'

// compile 'com.google.guava:guava:24.1-jre'

Expand All @@ -129,9 +154,13 @@ dependencies {
implementation 'cn.bingoogolapple:bga-qrcode-zxing:1.3.6'

implementation 'pub.devrel:easypermissions:1.0.1'
api "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"

}

greendao {
schemaVersion 1
}
repositories {
mavenCentral()
}
8 changes: 6 additions & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@
android:supportsRtl="true"
android:hardwareAccelerated="false"
android:largeHeap="true"
android:theme="@style/AppTheme.NoActionBar">
android:theme="@style/AppTheme.NoActionBar"
android:networkSecurityConfig="@xml/network_security_config"
>
<activity
android:name="pro.upchain.wallet.ui.activity.SplashActivity"
android:screenOrientation="portrait"
Expand All @@ -38,7 +40,8 @@
android:screenOrientation="portrait"></activity>
<activity
android:name="pro.upchain.wallet.ui.activity.MainActivity"
android:screenOrientation="portrait"></activity>
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustPan"></activity>

<activity android:name="pro.upchain.wallet.ui.activity.QRCodeScannerActivity" />

Expand Down Expand Up @@ -67,6 +70,7 @@
<activity android:name="pro.upchain.wallet.ui.activity.ExportKeystoreActivity" />
<activity android:name="pro.upchain.wallet.ui.activity.HelpActivity" />
<activity android:name="pro.upchain.wallet.ui.activity.TransactionDetailActivity"></activity>
<activity android:name="pro.upchain.wallet.ui.activity.ConfirmationActivity"></activity>
</application>

</manifest>
32 changes: 32 additions & 0 deletions app/src/main/java/pro/upchain/wallet/C.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,29 @@ public abstract class C {
public static final String EXTRA_GAS_PRICE = "GAS_PRICE";
public static final String EXTRA_GAS_LIMIT = "GAS_LIMIT";

public static final String EXTRA_CONTRACT_NAME = "NAME";
public static final String TOKEN_TYPE = "TOKEN_TYPE";
public static final String MARKET_INSTANCE = "MARKET_INSTANCE";
public static final String IMPORT_STRING = "TOKEN_IMPORT";
public static final String EXTRA_PRICE = "TOKEN_PRICE";
public static final String EXTRA_STATE = "TRANSFER_STATE";
public static final String EXTRA_WEB3TRANSACTION = "WEB3_TRANSACTION";
public static final String EXTRA_NETWORK_NAME = "NETWORK_NAME";
public static final String EXTRA_NETWORK_MAINNET = "NETWORK_MAINNET";
public static final String EXTRA_ENS_DETAILS = "ENS_DETAILS";
public static final String EXTRA_HAS_DEFINITION = "HAS_TOKEN_DEF";
public static final String EXTRA_SUCCESS = "TX_SUCCESS";
public static final String EXTRA_HEXDATA = "TX_HEX";
public static final String EXTRA_NETWORKID = "NET_ID";
public static final String EXTRA_TOKENID_LIST = "TOKENIDLIST";

public static final String PRUNE_ACTIVITY =
"pro.upchain.wallet.PRUNE_ACTIVITY";


public static final String SIGN_DAPP_TRANSACTION =
"pro.upchain.wallet.SIGN_TRANSACTION";

public static final String COINBASE_WIDGET_CODE = "88d6141a-ff60-536c-841c-8f830adaacfd";
public static final String SHAPESHIFT_KEY = "c4097b033e02163da6114fbbc1bf15155e759ddfd8352c88c55e7fef162e901a800e7eaecf836062a0c075b2b881054e0b9aa2324be7bc3694578493faf59af4";
public static final String CHANGELLY_REF_ID = "968d4f0f0bf9";
Expand All @@ -63,6 +86,15 @@ public abstract class C {
public static final long NETWORK_FEE_MAX = 20000000000000000L;
public static final int ETHER_DECIMALS = 18;

public static final String DAPP_LASTURL_KEY = "dappURL";
public static final String DAPP_BROWSER_HISTORY = "dappBrowserHistory";
public static final String DAPP_BROWSER_BOOKMARKS = "dappBrowserBookmarks";
public static final String DAPP_DEFAULT_URL = "http://192.168.0.103:8080/";
// public static final String DAPP_DEFAULT_URL = "https://www.stateofthedapps.com/";

public static final String GOOGLE_SEARCH_PREFIX = "http://www.google.com/search?q=";
public static final String HTTP_PREFIX = "http://";

public interface ErrorCode {

int UNKNOWN = 1;
Expand Down
22 changes: 14 additions & 8 deletions app/src/main/java/pro/upchain/wallet/UpChainWalletApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,22 @@

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.support.multidex.MultiDexApplication;

import pro.upchain.wallet.domain.DaoMaster;
import pro.upchain.wallet.domain.DaoSession;
import pro.upchain.wallet.repository.RepositoryFactory;
import pro.upchain.wallet.repository.SharedPreferenceRepository;
import pro.upchain.wallet.utils.AppFilePath;
import pro.upchain.wallet.utils.LogInterceptor;
import androidx.multidex.MultiDex;
import androidx.multidex.MultiDexApplication;

import com.google.gson.Gson;
import com.squareup.leakcanary.LeakCanary;
import com.squareup.leakcanary.RefWatcher;

import io.realm.Realm;
import okhttp3.OkHttpClient;
import pro.upchain.wallet.repository.RepositoryFactory;
import pro.upchain.wallet.repository.SharedPreferenceRepository;
import pro.upchain.wallet.utils.AppFilePath;
import pro.upchain.wallet.utils.LogInterceptor;
import wallet.domain.DaoMaster;
import wallet.domain.DaoSession;


/**
Expand Down Expand Up @@ -47,6 +49,10 @@ public static RefWatcher getRefWatcher(Context context) {
@Override
public void onCreate() {
super.onCreate();
System.loadLibrary("TrustWalletCore");
// 主要是添加下面这句代码
MultiDex.install(this);

sInstance = this;
init();

Expand Down Expand Up @@ -90,7 +96,7 @@ public static OkHttpClient okHttpClient() {
}

public static RepositoryFactory repositoryFactory() {
return repositoryFactory;
return repositoryFactory;
}


Expand Down
Loading

0 comments on commit 09d63f0

Please sign in to comment.