Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v2.11.0 #45

Merged
merged 4 commits into from
Aug 29, 2021
Merged
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
9 changes: 5 additions & 4 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,8 @@ android {
applicationId "com.portalnesia.app"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 19
versionName "2.10.0"
versionCode 20
versionName "2.11.0"
}
splits {
abi {
Expand Down Expand Up @@ -225,14 +225,15 @@ dependencies {
debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}") {
exclude group:'com.facebook.flipper'
}
implementation "com.google.android.gms:play-services-safetynet:17.0.0"
implementation "com.google.android.gms:play-services-auth:19.0.0"
implementation "com.google.android.gms:play-services-safetynet:17.0.1"
implementation "com.google.android.gms:play-services-auth:19.2.0"
implementation "com.github.bumptech.glide:glide:4.11.0"
implementation "com.github.bumptech.glide:annotations:4.11.0"
annotationProcessor("com.github.bumptech.glide:compiler:4.11.0")
annotationProcessor("com.android.support:support-annotations:28.0.0-alpha3")
implementation "com.github.bumptech.glide:okhttp3-integration:4.11.0"
implementation "com.github.stfalcon-studio:StfalconImageViewer:master-SNAPSHOT"
implementation "io.grpc:grpc-okhttp:1.32.2"
addUnimodulesDependencies([exclude:['expo-keep-awake','expo-linear-gradient','expo-sqlite','expo-sharing','expo-image-manipulator','unimodules-barcode-scanner-interface','unimodules-camera-interface','unimodules-face-detector-interface','unimodules-sensors-interface','expo-local-authentication']])

if (enableHermes) {
Expand Down
7 changes: 3 additions & 4 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<uses-permission android:name="android.permission.READ_CALENDAR"/>
<uses-permission android:name="android.permission.WRITE_CALENDAR"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:maxSdkVersion="28"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
<uses-permission android:name="android.permission.WAKE_LOCK"/>
Expand All @@ -33,7 +33,7 @@
<uses-permission android:name="android.permission.READ_SYNC_SETTINGS"/>
<uses-permission android:name="android.permission.WRITE_SYNC_SETTINGS"/>

<application android:name=".MainApplication" android:label="@string/app_name" android:icon="@mipmap/ic_launcher" android:roundIcon="@mipmap/ic_launcher_round" android:allowBackup="true" android:theme="@style/AppTheme" android:requestLegacyExternalStorage="true" android:hardwareAccelerated="true">
<application android:name=".MainApplication" android:label="@string/app_name" android:icon="@mipmap/ic_launcher" android:roundIcon="@mipmap/ic_launcher_round" android:allowBackup="true" android:fullBackupContent="@xml/backup" android:theme="@style/AppTheme" android:hardwareAccelerated="true">
<meta-data android:name="expo.modules.updates.EXPO_UPDATE_URL" android:value="https://datas.portalnesia.com/updates" />
<meta-data android:name="expo.modules.updates.EXPO_SDK_VERSION" android:value="42.0.0" />
<meta-data android:name="expo.modules.updates.EXPO_RUNTIME_VERSION" android:value="@string/versionName" />
Expand All @@ -43,7 +43,7 @@
<meta-data android:name="com.google.android.gms.ads.APPLICATION_ID" android:value="ca-app-pub-5345145600516995~7540046866"/>
<meta-data android:name="com.google.android.gms.ads.DELAY_APP_MEASUREMENT_INIT" android:value="true"/>
<meta-data android:name="asset_statements" android:resource="@string/asset_statements" />

<meta-data android:name="com.google.firebase.messaging.default_notification_icon" android:resource="@mipmap/ic_notif_icon"/>
<activity android:name=".MainActivity" android:label="@string/app_name" android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode" android:launchMode="singleTask" android:windowSoftInputMode="adjustResize" android:theme="@style/AppTheme" android:screenOrientation="portrait" android:supportsPictureInPicture="true" android:resizeableActivity="true"
tools:targetApi="n">
<intent-filter>
Expand Down Expand Up @@ -92,7 +92,6 @@
android:label="@string/account_type_sync"
android:exported="false"/>
<activity android:name="com.theartofdev.edmodo.cropper.CropImageActivity" android:theme="@style/Base.Theme.AppCompat" />
<service android:name="com.asterinet.react.bgactions.RNBackgroundActionsTask" />
<service android:name=".authentication.AuthenticatorService">
<intent-filter>
<action android:name="android.accounts.AccountAuthenticator" />
Expand Down
3,205 changes: 1,603 additions & 1,602 deletions android/app/src/main/assets/index.android.bundle

Large diffs are not rendered by default.

180 changes: 180 additions & 0 deletions android/app/src/main/java/com/portalnesia/app/PNFile.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,180 @@
package com.portalnesia.app;

import android.app.Activity;
import android.content.ContentUris;
import android.content.Context;
import android.content.Intent;
import android.content.UriPermission;
import android.database.Cursor;
import android.net.Uri;
import android.os.Environment;
import android.provider.DocumentsContract;
import android.provider.MediaStore;

import androidx.annotation.NonNull;

import com.facebook.react.bridge.Promise;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.ReactContextBaseJavaModule;
import com.facebook.react.bridge.ReactMethod;
import com.facebook.react.bridge.WritableNativeArray;

import java.util.List;

public class PNFile extends ReactContextBaseJavaModule {
public static final String REACT_CLASS = "PNFile";

private final ReactApplicationContext reactContext;

PNFile(ReactApplicationContext context) {
super(context);
this.reactContext = context;
}

@NonNull
@Override
public String getName() {
return REACT_CLASS;
}

@ReactMethod
public void getRealPathFromSaf(String saf, Promise promise){
try {
Uri uri = Uri.parse(saf);
Uri docUri = DocumentsContract.buildDocumentUriUsingTree(uri,DocumentsContract.getTreeDocumentId(uri));
String path = getPath(reactContext,docUri);
promise.resolve(path);
} catch(Throwable e) {
promise.reject(e);
}
}

@ReactMethod
public void getUriPermission(Promise promise) {
try {
List<UriPermission> uris = reactContext.getContentResolver().getPersistedUriPermissions();
WritableNativeArray result = new WritableNativeArray();
for(UriPermission uri : uris) {
result.pushString(uri.getUri().toString());
}
promise.resolve(result);
} catch(Throwable e) {
promise.reject(e);
}
}

@ReactMethod
public void removeUriPermission(String saf, Promise promise) {
try {
Uri uri = Uri.parse(saf);
reactContext.getContentResolver().releasePersistableUriPermission(uri,3);
promise.resolve(null);
} catch(Throwable e) {
promise.reject(e);
}
}

@ReactMethod
public void openFolder(String location,Promise promise) {
try {
Activity activity = getCurrentActivity();
if(activity == null) {
return;
}
Intent intent = new Intent(Intent.ACTION_VIEW);
Uri uri = Uri.parse(location);
intent.setDataAndType(uri,"*/*");
activity.startActivity(intent);
promise.resolve(null);
} catch(Throwable e) {
promise.reject(e);
}
}

public static String getPath(final Context context, final Uri uri) {
if(DocumentsContract.isDocumentUri(context,uri)) {
if(isExternalStorageDocument(uri)) {
final String docId = DocumentsContract.getDocumentId(uri);
final String[] split = docId.split(":");
final String type = split[0];

if("primary".equals(type)) {
return Environment.getExternalStorageDirectory() + "/" + split[1];
}
}
else if(isDownloadsDocument(uri)) {
final String id = DocumentsContract.getDocumentId(uri);
final Uri contentUri = ContentUris.withAppendedId(
Uri.parse("content://downloads/public_downloads"),Long.parseLong(id)
);
return getDataColumn(context,contentUri,null,null);
}
else if(isMediaDocument(uri)) {
final String docId = DocumentsContract.getDocumentId(uri);
final String[] split = docId.split(":");
final String type = split[0];
Uri contentUri = null;
if("image".equals(type)) {
contentUri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI;
} else if("video".equals(type)) {
contentUri = MediaStore.Video.Media.EXTERNAL_CONTENT_URI;
} else if("audio".equals(type)) {
contentUri = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI;
}
final String selection = "_id=?";
final String[] selectionArgs = new String[] {
split[1]
};
return getDataColumn(context,contentUri,selection,selectionArgs);
}
}
// MediaStore
else if("content".equalsIgnoreCase(uri.getScheme())) {
if(isGooglePhotosUri(uri)) {
return uri.getLastPathSegment();
}
return getDataColumn(context,uri,null,null);
}
//File
else if("file".equalsIgnoreCase(uri.getScheme())) {
return uri.getPath();
}
return null;
}

public static String getDataColumn(Context context,Uri uri, String selection,String[] selectionArgs) {
Cursor cursor=null;
final String column = "_data";
final String[] projection = {
column
};
try {
cursor = context.getContentResolver().query(uri,projection,selection,selectionArgs,null);
if(cursor != null && cursor.moveToFirst()) {
final int index = cursor.getColumnIndexOrThrow(column);
return cursor.getString(index);
}
} finally {
if(cursor!=null) {
cursor.close();
}
}
return null;
}

public static boolean isExternalStorageDocument(Uri uri){
return "com.android.externalstorage.documents".equals(uri.getAuthority());
}

public static boolean isDownloadsDocument(Uri uri) {
return "com.android.providers.downloads.documents".equals(uri.getAuthority());
}

public static boolean isMediaDocument(Uri uri) {
return "com.android.providers.media.documents".equals(uri.getAuthority());
}

public static boolean isGooglePhotosUri(Uri uri) {
return "com.google.android.apps.photos.content".equals(uri.getAuthority());
}
}
9 changes: 3 additions & 6 deletions android/app/src/main/java/com/portalnesia/app/PNModules.java
Original file line number Diff line number Diff line change
Expand Up @@ -278,12 +278,9 @@ public void installApkView(String pathname,final Promise promise) {
@ReactMethod
public void installApk(String pathname,final Promise promise) {
try {
//if(Build.VERSION.SDK_INT > Build.VERSION_CODES.M) {
// uri = FileProvider.getUriForFile(reactContext,reactContext.getPackageName() + ".fileprovider",file);
//}

Intent intent = new Intent(Intent.ACTION_INSTALL_PACKAGE);
intent.setData(getApkUri(pathname));
Uri uri = Uri.parse(pathname);
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(uri,"application/vnd.android.package-archive");
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
reactContext.startActivity(intent);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public Map<String,Object> getConstants(){
public void notify(int notification_id, String channel_id, ReadableMap options, Promise promise) {
final String packageName = reactContext.getPackageName();
NotificationCompat.Builder builder = new NotificationCompat.Builder(reactContext,channel_id);
builder.setSmallIcon(R.mipmap.ic_launcher);
builder.setSmallIcon(R.mipmap.ic_notif_icon);

Intent openApp = reactContext.getPackageManager().getLaunchIntentForPackage(packageName);
if(openApp == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public List<NativeModule> createNativeModules(@NonNull ReactApplicationContext r
modules.add(new PNImageViewModule(reactContext));
modules.add(new PNSafety(reactContext));
modules.add(new PNNotification(reactContext));
modules.add(new PNFile(reactContext));
return modules;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public void onCreate(){
Notification notification = new NotificationCompat.Builder(this,NOTIFICATION_ID)
.setContentTitle("Sync Service")
.setContentText("Running...")
.setSmallIcon(R.mipmap.ic_launcher)
.setSmallIcon(R.mipmap.ic_notif_icon)
.setContentIntent(contentIntent)
.setOngoing(true)
.build();
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 5 additions & 2 deletions android/app/src/main/res/raw/locale_en.json
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,9 @@
"sure":"Are you sure?",
"location_disabled":"Your location services is not active",
"google_play_available":"Please update your Google Play Services to continue using this application.",
"verify_failed":"We failed to verify the application you are using. Make sure you use the official Portalnesia application.\n\nIf you feel we made a mistake, please contact us at support@portalnesia.com"
"verify_failed":"We failed to verify the application you are using. Make sure you use the official Portalnesia application.\n\nIf you feel we made a mistake, please contact us at support@portalnesia.com",
"ext_permission":"Please select directory to save files",
"not_set":"Not set"
},
"report_placeholder":{
"placeholder_url":"We are sorry for the inconvenience, it seems that there is a problem with our internal server service. Can you tell us how this happened?",
Expand Down Expand Up @@ -243,7 +245,8 @@
"email_birthday":"Receive email notifications for the birthdays of someone you are following",
"email_komentar":"Receive email notifications for comments, including someone commenting on your content or someone replying to your comment",
"email_feature":"Receive email notifications about the new features and promotion on Portalnesia"
}
},
"storage_location":"Storage location"
},
"auth":{
"new_password":"Password Again",
Expand Down
7 changes: 5 additions & 2 deletions android/app/src/main/res/raw/locale_id.json
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,9 @@
"sure":"Apakah Anda yakin?",
"location_disabled":"Layanan lokasi Anda tidak aktif",
"google_play_available":"Harap perbarui Google Play Services Anda untuk menggunakan aplikasi ini.",
"verify_failed":"Kami gagal memverifikasi aplikasi yang sedang Anda gunakan. Pastikan Anda menggunakan aplikasi resmi Portalnesia.\n\nJika Anda merasa kami melakukan kesalahan, silahkan hubungi kami di support@portalnesia.com"
"verify_failed":"Kami gagal memverifikasi aplikasi yang sedang Anda gunakan. Pastikan Anda menggunakan aplikasi resmi Portalnesia.\n\nJika Anda merasa kami melakukan kesalahan, silahkan hubungi kami di support@portalnesia.com",
"ext_permission":"Pilih penyimpanan untuk menyimpan files",
"not_set":"Belum disetel"
},
"report_placeholder":{
"placeholder_url":"Mohon maaf atas ketidaknyamanannya, sepertinya ada masalah dengan layanan server internal kami. Bisakah Anda memberi tahu kami bagaimana ini bisa terjadi?",
Expand Down Expand Up @@ -239,7 +241,8 @@
"email_birthday":"Terima pemberitahuan email ulang tahun seseorang yang Anda ikuti",
"email_komentar":"Terima pemberitahuan email komentar, termasuk jika seseorang mengomentari konten Anda atau jika seseorang membalas komentar Anda",
"email_feature":"Terima pemberitahuan email tentang fitur baru dan promosi dari Portalnesia"
}
},
"storage_location":"Lokasi penyimpanan"
},
"auth":{
"new_password":"Kata Sandi Lagi",
Expand Down
4 changes: 4 additions & 0 deletions android/app/src/main/res/xml/backup.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<full-backup-content>
<include domain="database" path="RKStorage" />
</full-backup-content>
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ buildscript {
}
dependencies {
classpath('com.android.tools.build:gradle:4.1.3')
classpath("com.google.gms:google-services:4.3.5")
classpath("com.google.gms:google-services:4.3.10")
classpath("com.google.firebase:firebase-crashlytics-gradle:2.7.1")
classpath("com.google.firebase:perf-plugin:1.4.0")
// classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.32")
Expand Down
7 changes: 5 additions & 2 deletions app.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "Portalnesia",
"slug": "portalnesia",
"scheme": "pn",
"version": "2.10.1",
"version": "2.11.0",
"orientation": "portrait",
"icon": "./assets/icon.png",
"backgroundColor": "#ffffff",
Expand All @@ -16,7 +16,7 @@
"silentLaunch": true
},
"extra": {
"minimumVersion": "2.10.0"
"minimumVersion": "2.11.0"
},
"splash": {
"image": "./assets/splash.png",
Expand All @@ -40,6 +40,9 @@
},
"useNextNotificationsApi": true,
"googleServicesFile": "./android/app/google-services.json"
},
"notification": {
"icon":"./android/app/src/main/res/mipmap-xxxhdpi/ic_notif_icon.png"
}
}
}
6 changes: 3 additions & 3 deletions components/global/ImageCropper/ImageViewer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
State,
TapGestureHandler,
} from 'react-native-gesture-handler';
import Animated, { Easing } from 'react-native-reanimated';
import Animated, { EasingNode } from 'react-native-reanimated';
import { timing } from './helpers';
import { IImageViewerData } from './types';
import ViewShot from 'react-native-view-shot'
Expand Down Expand Up @@ -118,7 +118,7 @@ class ImageViewer extends Component<IProps> {

const timingDefaultParams = {
duration: 200,
easing: Easing.linear,
easing: EasingNode.linear,
};

const maxScale = minScale + 3;
Expand Down Expand Up @@ -386,7 +386,7 @@ class ImageViewer extends Component<IProps> {

componentDidUpdate(prevProps: IProps){
if(prevProps.rotation !== this.props.rotation) {
AniTiming(this.rotation,{toValue: this.props.rotation,duration:200,easing:Easing.linear}).start();
AniTiming(this.rotation,{toValue: this.props.rotation,duration:200,easing:EasingNode.linear}).start();
}
}

Expand Down
Loading