Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
File renamed without changes.
49 changes: 49 additions & 0 deletions Hello_Celo/Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@

# ⚡ Hello Celo ⚡

#### Infrastructure and Web3 Track

##### US-Americas

##### Team Members

- Paul Brower (brower.paul@gmail.com), Sole

#### Project Description

An uncensorable micro-blogging platform built on Android and Celo

#### Summary

The project was able to accomplish:
* An android app
* creating accounts
* updating accounts
* meta-transactions on a deployed smart contract

Wanted to get to but did not

* integration with Valora
* offline posting
* contact import

#### URLs

Video: https://www.youtube.com/watch?v=morZB-JeXSc
Play Store Listing: https://play.google.com/store/apps/details?id=com.github.browep.hellocelo
Testnet Contract: https://alfajores-blockscout.celo-testnet.org/address/0x5abA1E96a9CaCDde213B8F66c25654DfC1C66ABC/transactions


#### Presentation

https://www.youtube.com/watch?v=morZB-JeXSc

#### Next Steps

* iOS App
* relayer nodes for meta transactions
* friend discovering via contact import

#### License

MIT
File renamed without changes.
12 changes: 12 additions & 0 deletions Hello_Celo/codebase/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# hello-celo


## Building Smart Contract

`cd smart-contracts`

`docker run -v $(pwd):/sources ethereum/solc:stable -o /sources/output --abi --bin /sources/hello-celo.sol`

using web3j v1.4.1

`~/Development/web3j-1.4.1/bin/web3j generate solidity --abiFile=./output/HelloWorld.abi --binFile=./output/HelloWorld.bin --outputDir=../android/domain/src/main/java/ --package=com.github.browep.hellocelo`
16 changes: 16 additions & 0 deletions Hello_Celo/codebase/android/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
*.iml
.gradle
/local.properties
/.idea/caches
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
/.idea/navEditor.xml
/.idea/assetWizardSettings.xml
.DS_Store
/build
/captures
.externalNativeBuild
.cxx
local.properties
/.idea/
1 change: 1 addition & 0 deletions Hello_Celo/codebase/android/app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
66 changes: 66 additions & 0 deletions Hello_Celo/codebase/android/app/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
plugins {
id 'com.android.application'
id 'kotlin-android'
}

android {
compileSdk 31

defaultConfig {
applicationId "com.github.browep.hellocelo"
minSdk 23
targetSdk 31
versionCode 1
versionName "1.0"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

signingConfigs {
release {
storeFile file("release.keystore")
storePassword 'password'
keyAlias 'key0'
keyPassword 'password'
}
}

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}
kotlinOptions {
jvmTarget = '1.8'
}
}

configurations.all {
resolutionStrategy.dependencySubstitution {
substitute module('org.hamcrest:hamcrest-core:1.1') with module('junit:junit:4.10')
}
}

dependencies {
implementation project(':domain')

implementation "io.ktor:ktor-client-android:$ktor_version"

implementation 'com.github.bumptech.glide:glide:4.12.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.12.0'
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.1.0"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$kotlin_coroutines_version"
implementation group: 'org.jetbrains.kotlin', name: 'kotlin-stdlib', version: kotlin_version
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlin_coroutines_version"
implementation 'com.google.android.material:material:1.4.0'
implementation 'androidx.core:core-ktx:1.6.0'
implementation 'androidx.appcompat:appcompat:1.3.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.1'
implementation "androidx.security:security-crypto:1.0.0"
}
21 changes: 21 additions & 0 deletions Hello_Celo/codebase/android/app/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
Binary file added Hello_Celo/codebase/android/app/release.keystore
Binary file not shown.
Binary file not shown.
20 changes: 20 additions & 0 deletions Hello_Celo/codebase/android/app/release/output-metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"version": 3,
"artifactType": {
"type": "APK",
"kind": "Directory"
},
"applicationId": "com.github.browep.hellocelo",
"variantName": "release",
"elements": [
{
"type": "SINGLE",
"filters": [],
"attributes": [],
"versionCode": 1,
"versionName": "1.0",
"outputFile": "app-release.apk"
}
],
"elementType": "File"
}
98 changes: 98 additions & 0 deletions Hello_Celo/codebase/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.github.browep.hellocelo">

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"
android:maxSdkVersion="18" />

<queries>
<intent>
<action android:name="android.media.action.IMAGE_CAPTURE" />
</intent>
</queries>

<application
android:name=".HelloCeloApplication"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.HelloCelo">
<activity
android:name=".activity.SplashActivity"
android:exported="true"
android:theme="@style/Theme.HelloCelo.NoActionBar.MatchStatus">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

<activity
android:name=".activity.MainActivity"
android:exported="false"
android:theme="@style/Theme.HelloCelo.NoActionBar" />

<activity
android:name=".activity.GenerateSeedPhraseActivity"
android:exported="false"
android:theme="@style/Theme.HelloCelo.NoActionBar" />

<activity
android:name=".activity.SetupProfileActivity"
android:exported="false"
android:theme="@style/Theme.HelloCelo.NoActionBar"
android:windowSoftInputMode="adjustResize"
/>
<activity
android:name=".activity.CreatePostActivity"
android:exported="false"
android:theme="@style/Theme.HelloCelo.NoActionBar"
android:windowSoftInputMode="adjustResize"
/>
<activity
android:name=".activity.UserPostsDetailActivity"
android:exported="false"
android:theme="@style/Theme.HelloCelo.NoActionBar"
android:windowSoftInputMode="adjustResize"
/>
<activity
android:name=".activity.FriendsActivity"
android:exported="false"
android:theme="@style/Theme.HelloCelo.NoActionBar"
android:windowSoftInputMode="adjustResize"
/>
<activity
android:name=".activity.AddFriendActivity"
android:exported="false"
android:theme="@style/Theme.HelloCelo.NoActionBar"
android:windowSoftInputMode="adjustResize"
/>
<activity
android:name=".activity.EditProfileActivity"
android:exported="false"
android:theme="@style/Theme.HelloCelo.NoActionBar"
android:windowSoftInputMode="adjustResize"
/>

<activity
android:name=".activity.SuccessActivity"
android:exported="false"
android:theme="@style/Theme.HelloCelo.NoActionBar.MatchStatus" />

<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.fileprovider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_paths"></meta-data>
</provider>

</application>

</manifest>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.github.browep.hellocelo

import android.app.Application

class HelloCeloApplication : Application() {

override fun onCreate() {
super.onCreate()
logger.debug("onCreate")
Provider(this)
}

companion object : LoggerCompanion(HelloCeloApplication::class) {

}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package com.github.browep.hellocelo

import android.app.Activity
import android.content.Context
import com.github.browep.hellocelo.data.AndroidDatastore
import com.github.browep.hellocelo.data.AndroidDbConnManager
import com.github.browep.hellocelo.blockchain.BlockchainService
import com.github.browep.hellocelo.blockchain.TestNetBlockchainService
import com.github.browep.hellocelo.dao.CredProvider
import com.github.browep.hellocelo.dao.Database
import com.github.browep.hellocelo.dao.Datastore
import io.ktor.client.*
import io.ktor.client.engine.android.*

class Provider(context: Context) {

val datastore: Datastore
val database: Database
val blockchainService: BlockchainService
val credProvider: CredProvider
val cloudService: CloudService

init {
val androidHttpClient = HttpClient(Android)
datastore = AndroidDatastore(context)
val dbConnManager = AndroidDbConnManager(context)
dbConnManager.writableDatabase // this should init the db
database = Database(dbConnManager)
cloudService = CloudService(database, androidHttpClient, "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySW5mb3JtYXRpb24iOnsiaWQiOiJkOTUwODQ4Ni0zYjZlLTQ5OTItYTQxMS1kZGI1ZjM3ZjNmODUiLCJlbWFpbCI6ImJyb3dlci5wYXVsQGdtYWlsLmNvbSIsImVtYWlsX3ZlcmlmaWVkIjp0cnVlLCJwaW5fcG9saWN5Ijp7InJlZ2lvbnMiOlt7ImlkIjoiTllDMSIsImRlc2lyZWRSZXBsaWNhdGlvbkNvdW50IjoxfV0sInZlcnNpb24iOjF9LCJtZmFfZW5hYmxlZCI6ZmFsc2V9LCJhdXRoZW50aWNhdGlvblR5cGUiOiJzY29wZWRLZXkiLCJzY29wZWRLZXlLZXkiOiJhYjYwMTQ0NjAxMGE4NWE1ZmViMiIsInNjb3BlZEtleVNlY3JldCI6Ijc3YWRjYTk4YmMwYzEzNDY1MDVkMTkzMTAxNmM3YWEyNjEzMmE5YzRmNjg0NGNlMTczODI2ZjgzNTE5MTc0YTQiLCJpYXQiOjE2MzQ5NTE2ODB9.B9SgqP9LUDpS4E3_AIUOKhmeglPA3XPxdwZ9Z1ZhuN4")
blockchainService = TestNetBlockchainService()
credProvider = CredProvider(datastore)
instance = this
}

companion object : LoggerCompanion(Provider::class) {
var instance: Provider? = null
}

}

val Activity.datastore
get() = Provider.instance!!.datastore
val Activity.database
get() = Provider.instance!!.database
val Activity.blockchainService
get() = Provider.instance!!.blockchainService
val Activity.credProvider
get() = Provider.instance!!.credProvider
val Activity.cloudService
get() = Provider.instance!!.cloudService
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package com.github.browep.hellocelo

import android.content.Intent
import com.github.browep.hellocelo.activity.AddFriendActivity
import com.github.browep.hellocelo.activity.BaseActivity
import com.github.browep.hellocelo.activity.CreatePostActivity
import com.github.browep.hellocelo.activity.EditProfileActivity
import com.github.browep.hellocelo.activity.SetupProfileActivity
import com.github.browep.hellocelo.activity.UserPostsDetailActivity
import org.jetbrains.anko.intentFor

class Router(private val baseActivity: BaseActivity) {

fun routeAuthorPost() = baseActivity.horizStartActivity(Intent(baseActivity, CreatePostActivity::class.java))

fun routeSetupProfile() = baseActivity.horizStartActivity(Intent(baseActivity, SetupProfileActivity::class.java))

fun routeEditProfile() = baseActivity.horizStartActivity(Intent(baseActivity, EditProfileActivity::class.java))

fun routeFriendsPosts(userName: String) = baseActivity.horizStartActivity(UserPostsDetailActivity.intent(baseActivity, userName))

fun routerAddFriend() = baseActivity.horizStartActivity(baseActivity.intentFor<AddFriendActivity>())
}
Loading