-
Notifications
You must be signed in to change notification settings - Fork 118
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'translations-build-step' of https://github.com/CovidShi…
…eld/mobile into translations-build-step
- Loading branch information
Showing
100 changed files
with
4,670 additions
and
4,113 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
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
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 18 additions & 6 deletions
24
android/app/src/main/java/app/covidshield/CustomPackage.kt
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,22 +1,34 @@ | ||
package app.covidshield | ||
|
||
import android.content.Intent | ||
import android.view.View | ||
import app.covidshield.module.CovidShieldModule | ||
import app.covidshield.module.ExposureNotificationModule | ||
import app.covidshield.module.PushNotificationModule | ||
import app.covidshield.utils.ActivityResultHelper | ||
import com.facebook.react.ReactPackage | ||
import com.facebook.react.bridge.NativeModule | ||
import com.facebook.react.bridge.ReactApplicationContext | ||
import com.facebook.react.uimanager.ReactShadowNode | ||
import com.facebook.react.uimanager.ViewManager | ||
|
||
class CustomPackage : ReactPackage { | ||
class CustomPackage : ReactPackage, ActivityResultHelper { | ||
|
||
override fun createNativeModules(reactContext: ReactApplicationContext): MutableList<NativeModule> = mutableListOf( | ||
ExposureNotificationModule(reactContext), | ||
PushNotificationModule(reactContext), | ||
CovidShieldModule(reactContext) | ||
) | ||
private var nativeModules: MutableList<NativeModule>? = null | ||
|
||
override fun createNativeModules(reactContext: ReactApplicationContext): MutableList<NativeModule> { | ||
val nativeModules = mutableListOf<NativeModule>( | ||
ExposureNotificationModule(reactContext), | ||
PushNotificationModule(reactContext), | ||
CovidShieldModule(reactContext) | ||
) | ||
this.nativeModules = nativeModules | ||
return nativeModules | ||
} | ||
|
||
override fun createViewManagers(reactContext: ReactApplicationContext): MutableList<ViewManager<View, ReactShadowNode<*>>> = mutableListOf() | ||
|
||
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { | ||
nativeModules?.mapNotNull { it as? ActivityResultHelper }?.forEach { it.onActivityResult(requestCode, resultCode, data) } | ||
} | ||
} |
23 changes: 0 additions & 23 deletions
23
android/app/src/main/java/app/covidshield/MainActivity.java
This file was deleted.
Oops, something went wrong.
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,28 @@ | ||
package app.covidshield | ||
|
||
import android.content.Intent | ||
import android.os.Bundle | ||
import app.covidshield.utils.ActivityResultHelper | ||
import com.facebook.react.ReactActivity | ||
import org.devio.rn.splashscreen.SplashScreen | ||
|
||
class MainActivity : ReactActivity() { | ||
|
||
override fun onCreate(savedInstanceState: Bundle?) { | ||
SplashScreen.show(this) | ||
super.onCreate(savedInstanceState) | ||
} | ||
|
||
/** | ||
* Returns the name of the main component registered from JavaScript. This is used to schedule | ||
* rendering of the component. | ||
*/ | ||
override fun getMainComponentName(): String? { | ||
return "CovidShield" | ||
} | ||
|
||
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { | ||
super.onActivityResult(requestCode, resultCode, data) | ||
reactInstanceManager.packages.mapNotNull { it as? ActivityResultHelper }.forEach { it.onActivityResult(requestCode, resultCode, data) } | ||
} | ||
} |
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
10 changes: 10 additions & 0 deletions
10
android/app/src/main/java/app/covidshield/extensions/FileExtensions.kt
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,10 @@ | ||
package app.covidshield.extensions | ||
|
||
import java.io.File | ||
|
||
fun File.cleanup() { | ||
try { | ||
deleteOnExit() | ||
} catch (_: Exception) { | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
android/app/src/main/java/app/covidshield/extensions/LogExtensions.kt
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,10 @@ | ||
package app.covidshield.extensions | ||
|
||
import android.util.Log | ||
import app.covidshield.BuildConfig | ||
|
||
fun Any.log(msg: String?, tag: String = this::class.java.simpleName) { | ||
if (BuildConfig.DEBUG) { | ||
Log.d(tag, msg) | ||
} | ||
} |
16 changes: 10 additions & 6 deletions
16
android/app/src/main/java/app/covidshield/extensions/PromiseExtensions.kt
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,11 +1,15 @@ | ||
package app.covidshield.extensions | ||
|
||
import com.facebook.react.bridge.Promise | ||
import kotlinx.coroutines.CoroutineExceptionHandler | ||
import kotlinx.coroutines.CoroutineScope | ||
import kotlinx.coroutines.launch | ||
|
||
fun Promise.rejectOnException(block: () -> Unit) { | ||
return try { | ||
block.invoke() | ||
} catch (e: Exception) { | ||
reject(e) | ||
} | ||
fun Promise.launch(scope: CoroutineScope, block: suspend CoroutineScope.() -> Unit) { | ||
scope.launch( | ||
context = CoroutineExceptionHandler { _, exception -> | ||
this@launch.reject(exception) | ||
}, | ||
block = block | ||
) | ||
} |
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
Oops, something went wrong.