Skip to content
This repository was archived by the owner on Aug 4, 2019. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
707146f
Set version code and verison name in build gradle , closed #1
miladsalimiiii Jul 17, 2019
35b9cd8
Merge pull request #2 from Carrene/feature/appversioning
EhsanMashhadi Jul 17, 2019
70eaba7
Create README.md
miladsalimiiii Jul 17, 2019
0797788
Merge pull request #3 from Carrene/feature/readme
EhsanMashhadi Jul 17, 2019
e589772
Add login
Jul 21, 2019
14bc9b5
Registeration UI,#6
TinaT2 Jul 21, 2019
4a71ef1
Add claim with all MVVM and web service packages,#6
TinaT2 Jul 21, 2019
2febd8a
Claim enhancement,#6
TinaT2 Jul 22, 2019
ec389a3
Claim test,closed #12
TinaT2 Jul 22, 2019
5212971
Flag image view bug fixed,closed #6
TinaT2 Jul 23, 2019
4da65ef
Add toolbar and font,#18
TinaT2 Jul 23, 2019
8e701e4
Fix issues from pull request reviews
Jul 24, 2019
1d38f45
Registration bug fixed for review 1,#18
TinaT2 Jul 24, 2019
861ee7a
Add base (activty and fragment)
Jul 24, 2019
5a4046d
Toolbar title,class exception,dialog bottom sheet fixed,#18
TinaT2 Jul 24, 2019
9c9f3e1
App style changed to Material components,#18
TinaT2 Jul 24, 2019
912621a
Fix a mistake in BaseActivity
Jul 24, 2019
e1f91c2
Fix pattern redraw
Jul 27, 2019
27383f6
Registration fix: phone input format,#18
TinaT2 Jul 27, 2019
9644d45
Name convention and not using from deprecated code fixed,#18
TinaT2 Jul 28, 2019
e4bd3db
Add ViewModel and Koin #5
Jul 28, 2019
1a159c4
Review the code, Add pattern view model test closed #25
EhsanMashhadi Jul 28, 2019
7f3553e
Merge branch 'feature/loginpattern' into develop
EhsanMashhadi Jul 28, 2019
e492a6b
Review the code
EhsanMashhadi Jul 28, 2019
b010162
Fix ViewModel, compelete tests and some name conventions,closed #18"
TinaT2 Jul 29, 2019
5f8fa35
Merge the feature/registration into develop, Review the code, Add TODOs
ehsan-mashhadi Jul 29, 2019
cbd0532
Refactor styles, strings, colors, dimens,closed #30
TinaT2 Jul 29, 2019
5da055e
Refactor gradle files for removing duplicate lines,closed #32
TinaT2 Jul 29, 2019
6b1322b
Set the default country for the country picker,closed #29
TinaT2 Jul 30, 2019
4263c1c
Fix phone validator convention,closed #36
TinaT2 Jul 30, 2019
9d31442
Add test for failed status,closed #33
TinaT2 Jul 30, 2019
4f4dfe0
Fixed selector problem for set in the button,closed #38
TinaT2 Jul 30, 2019
f55f1cb
Merge branch 'refactor/code-convention' into develop
ehsan-mashhadi Jul 30, 2019
2dc12fb
Add code verification , closed #46
Miladsalimiiiii Aug 1, 2019
1b1f30f
Wrok on set timer test in code verification view model test , issue #34
Miladsalimiiiii Aug 1, 2019
3454332
Complete set timer test , closed #34
Miladsalimiiiii Aug 3, 2019
226cb9a
Create resend text color selector and button text color selector , cl…
Miladsalimiiiii Aug 3, 2019
46ae7dc
Add reset Schedulers to code verification view model test , closed #52
Miladsalimiiiii Aug 3, 2019
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
27 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# peacock

![peacock](https://user-images.githubusercontent.com/31917346/61375032-123b4f80-a8b3-11e9-8cdd-0e41947ecb1c.jpg)

Setting up development Environment
----------------------------------

### Installing Dependencies

JDK
SDK

### Setup Android environment

Install Android Studio and config JDK and SDK.

#### Upgrade SKD, BuildTool and etc.

Sync gradle and install what it needs.

### Debug Mode

Run project on device/emulator.

### Release Mode

Run project on device/emulator.
86 changes: 80 additions & 6 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
apply plugin: 'com.android.application'

apply plugin: 'kotlin-android'

apply plugin: 'kotlin-android-extensions'
apply plugin: "androidx.navigation.safeargs.kotlin"
apply plugin: 'kotlin-kapt'

ext.versionMajor = 00
ext.versionMinor = 00
ext.versionPatch = 01
ext.versionClassifier = null
ext.isSnapshot = false
ext.minimumSdkVersion = 17
ext.minimumScreenSize = 1
ext.maximumScreenSize = 4

android {
compileSdkVersion 29
Expand All @@ -11,24 +20,89 @@ android {
applicationId "de.netalic.peacock"
minSdkVersion 17
targetSdkVersion 29
versionCode 1
versionName "1.0"
versionCode generateVersionCode()
versionName generateVersionName()
vectorDrawables.useSupportLibrary = true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}

compileOptions {
sourceCompatibility 1.8
targetCompatibility 1.8
}
}


private Integer generateVersionCode() {
return ext.minimumSdkVersion * 100000000 + ext.minimumScreenSize * 10000000 + ext.maximumScreenSize * 1000000 + ext.versionMajor * 10000 + ext.versionMinor * 100 + ext.versionPatch
}

private String generateVersionName() {
String versionName = "${ext.versionMajor}.${ext.versionMinor}.${ext.versionPatch}"
if (ext.versionClassifier == null) {
if (ext.isSnapshot) {
ext.versionClassifier = "SNAPSHOT"
}
}

if (ext.versionClassifier != null) {
versionName += "-" + ext.versionClassifier
}
return versionName
}

repositories {
mavenCentral()
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.core:core-ktx:1.0.2'
implementation 'com.google.android.material:material:1.1.0-alpha08'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.navigation:navigation-fragment-ktx:2.1.0-beta02'
implementation 'androidx.navigation:navigation-ui-ktx:2.1.0-beta02'
implementation 'com.andrognito.patternlockview:patternlockview:1.0.0'
implementation 'com.jakewharton.timber:timber:4.7.1'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation "org.koin:koin-android:2.0.1"
implementation "org.koin:koin-android-viewmodel:2.0.1"
implementation 'com.mikhaellopez:circularimageview:4.0.1'
implementation 'com.github.EhsanMashhadi:CountryPicker:0.4.0'
implementation "com.squareup.retrofit2:retrofit:2.6.0"
implementation "com.squareup.retrofit2:converter-gson:2.6.0"
implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
implementation 'io.reactivex.rxjava2:rxjava:2.2.6'
implementation 'com.squareup.retrofit2:adapter-rxjava2:2.6.0'
implementation "android.arch.lifecycle:extensions:1.1.1"
implementation 'com.googlecode.libphonenumber:libphonenumber:8.2.0'

testImplementation 'junit:junit:4.12'
testImplementation "org.mockito:mockito-inline:3.0.0"
testImplementation 'org.koin:koin-test:2.0.1'
testImplementation "android.arch.core:core-testing:1.1.1"

androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}


implementation ('com.alimuzaffar.lib:pinentryedittext:2.0.6') {
exclude group: 'androidx.appcompat', module: 'appcompat'
}
implementation 'androidx.lifecycle:lifecycle-extensions:2.0.0'

implementation 'com.github.EhsanMashhadi:helpdroid:0.9.0'
implementation 'com.github.franmontiel:PersistentCookieJar:v1.0.1'
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@ package de.netalic.peacock

import androidx.test.InstrumentationRegistry
import androidx.test.runner.AndroidJUnit4

import org.junit.Assert.assertEquals
import org.junit.Test
import org.junit.runner.RunWith

import org.junit.Assert.*

/**
* Instrumented test, which will execute on an Android device.
*
Expand Down
40 changes: 30 additions & 10 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,30 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="de.netalic.peacock">

<application android:allowBackup="true"
android:label="@string/app_name"
android:icon="@mipmap/ic_launcher"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme"/>
</manifest>
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="de.netalic.peacock">

<uses-permission android:name="android.permission.INTERNET"/>

<application
android:allowBackup="true"
android:name=".common.MyApplication"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme"
tools:ignore="GoogleAppIndexingWarning">

<activity
android:name=".ui.main.MainHostActivity"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
</application>

</manifest>
43 changes: 43 additions & 0 deletions app/src/main/java/de/netalic/peacock/common/MyApplication.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package de.netalic.peacock.common

import android.app.Application
import de.netalic.peacock.BuildConfig
import de.netalic.peacock.di.apiModule
import de.netalic.peacock.di.repositoryModule
import de.netalic.peacock.di.viewModelModule
import okhttp3.internal.Internal.instance
import org.koin.android.ext.koin.androidContext
import org.koin.android.ext.koin.androidLogger
import org.koin.core.context.startKoin
import timber.log.Timber

class MyApplication : Application() {


override fun onCreate() {
super.onCreate()

instance = this

if (BuildConfig.DEBUG) {
Timber.plant(Timber.DebugTree())
}
startKoin {
androidLogger()
androidContext(this@MyApplication)
modules(
listOf(
repositoryModule,
viewModelModule,
apiModule
)
)
}
}

companion object {

lateinit var instance: Application
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package de.netalic.peacock.data.exception

class ActivationCodeIsNotValid :Throwable()
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package de.netalic.peacock.data.exception

class BadRequestException : BaseException()
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package de.netalic.peacock.data.exception

open class BaseException:Throwable()
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package de.netalic.peacock.data.exception

class InvalidDeviceName:Throwable()
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package de.netalic.peacock.data.exception

class InvalidPhoneNumberException:BaseException()
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package de.netalic.peacock.data.exception

class InvalidUdidOrPhone :Throwable()
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package de.netalic.peacock.data.exception

class InvalidUdidOrPhoneException : BaseException()
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package de.netalic.peacock.data.exception

class ServerException : BaseException()
29 changes: 29 additions & 0 deletions app/src/main/java/de/netalic/peacock/data/model/MyResponse.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package de.netalic.peacock.data.model

data class MyResponse<T>(
val status: Status,
val data: T? = null,
val throwable: Throwable? = null
) {

companion object {

fun <T> loading(): MyResponse<T> {
return MyResponse(status = Status.LOADING)
}

fun <T> success(data: T): MyResponse<T> {
return MyResponse(status = Status.SUCCESS, data = data)
}

fun <T> failed(throwable: Throwable): MyResponse<T> {
return MyResponse(status = Status.FAILED, throwable = throwable)
}
}
}

enum class Status {
LOADING,
SUCCESS,
FAILED
}
13 changes: 13 additions & 0 deletions app/src/main/java/de/netalic/peacock/data/model/UserModel.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package de.netalic.peacock.data.model

import com.google.gson.annotations.SerializedName

data class UserModel(
@SerializedName("id") val mId: String? = null,
@SerializedName("name") val mName: String? = null,
@SerializedName("phone") val mPhone: String,
@SerializedName("udid") val mUdid: String,
@SerializedName("firebaseToken") val mFirebaseToken: String = "",
val mActivateToken:String,
val mDeviceType:String
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package de.netalic.peacock.data.repository

open class BaseRepository
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package de.netalic.peacock.data.repository

import de.netalic.peacock.data.model.UserModel
import de.netalic.peacock.data.webservice.ApiInterface
import io.reactivex.Single
import okhttp3.ResponseBody
import retrofit2.Response

class UserRepository(private val apiInterface: ApiInterface) : BaseRepository() {


fun claim(phone: String, udid: String): Single<Response<UserModel>> {
return apiInterface.claim(phone, udid)
}

fun bind(user:UserModel) :Single<Response<ResponseBody>>{

return apiInterface.bind(user.mPhone,user.mUdid, user.mName!!,user.mDeviceType,user.mFirebaseToken,
user.mActivateToken)
}
}
Loading