This file contains hidden or 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
<?php | |
namespace App\Notifications; | |
use Illuminate\Bus\Queueable; | |
use App\Channels\FirebaseChannel; | |
use Illuminate\Notifications\Notification; | |
use Illuminate\Contracts\Queue\ShouldQueue; | |
class GenericFirebaseNotification extends Notification implements ShouldQueue |
This file contains hidden or 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
<?php | |
namespace App\Channels; | |
use Kreait\Firebase\Factory; | |
use Illuminate\Support\Facades\Log; | |
use Kreait\Firebase\Messaging\CloudMessage; | |
use Kreait\Firebase\Messaging\Notification as FcmNotification; | |
class FirebaseChannel |
This file contains hidden or 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
#!/usr/bin/env bash | |
clear | |
function prompt_and_clear() { | |
local folder_path=$1 | |
local folder_name=$2 | |
if [ -d "$folder_path" ]; then | |
local folder_size=$(du -sh $folder_path | cut -f1) |
This file contains hidden or 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
#!/usr/bin/env bash | |
clear | |
ROOT_PATH="put/your/parent/folder/path/here" | |
# Function to prompt and remove | |
function prompt_and_remove() { | |
local folder_path="$1" | |
local folder_size=$(du -sh "$folder_path" | cut -f1) |
This file contains hidden or 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
#!/bin/sh | |
# This script is used to clean up the log files in the Gradle Daemon directory. | |
# All of the *.out.log files will be removed | |
# Use it if you have storage space issue, caused of gradle daemon log | |
GRADLE_HOME=$HOME/.gradle | |
GRADLE_DAEMON_DIR=$GRADLE_HOME/daemon | |
if [ -d "$GRADLE_HOME" ]; then |
This file contains hidden or 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
import org.w3c.dom.Node | |
/** | |
* This function will check child nodes from the AndroidManifest.xml file | |
* whether the nodes (activity, service, receiver) which contains "intent-filter" tag | |
* has the "android:exported" attribute or not. | |
* @param manifestFile | |
* @return List of nodes which doesn't have "android:exported" attribute | |
*/ |
This file contains hidden or 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
class DashboardActivity : BaseActivity() { | |
private val dashboardViewModel by viewModel<DashboardViewModel>() | |
private val movieAdapter by lazy { | |
DashboardMovieAdapter { | |
launchActivity<MovieDetailActivity>( | |
MovieDetailActivity.ExtraKey.EXTRA_MOVIE_ID to it.first, | |
MovieDetailActivity.ExtraKey.EXTRA_MOVIE_TITLE to it.second | |
) | |
} |
This file contains hidden or 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
class DashboardViewModel(private val movieRemoteDataSource: MovieRemoteDataSource) : ViewModel() { | |
fun discoverAllMovies() = movieRemoteDataSource.discoverAllMovies(viewModelScope) | |
} |
This file contains hidden or 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
class DashboardViewModel(private val movieRemoteDataSource: MovieRemoteDataSource) : ViewModel() { | |
private val _movieResult = MutableLiveData<ResponseResult<ResponseWrapper<MovieResponse>>>() | |
val movieResult: LiveData<ResponseResult<ResponseWrapper<MovieResponse>>> get() = _movieResult | |
fun discoverAllMovies() { | |
viewModelScope.launch { | |
val response = movieRemoteDataSource.discoverAllMovies(it) | |
//usually i do like this, but it will give null when we observe movieResult |
This file contains hidden or 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
class MovieRemoteDataSource(private val movieApiService: MovieApiService) : BaseDataSource() { | |
fun discoverAllMovies(scope: CoroutineScope): LiveData<ResponseResult<ResponseWrapper<MovieResponse>>> = resultLiveData(scope) { | |
getResult { | |
movieApiService.discoverAllMovies() | |
} | |
} | |
fun getMovieDetails(movieId: Int, scope: CoroutineScope): LiveData<ResponseResult<ResponseWrapper<MovieDetailResponse>>> = resultLiveData(scope) { | |
getResult { |
NewerOlder