-
-
Notifications
You must be signed in to change notification settings - Fork 108
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11008 from keymanapp/chore/beta-to-master-b17s3
chore: Merge beta to master for Sprint B17S3
- Loading branch information
Showing
277 changed files
with
14,056 additions
and
1,372 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
94 changes: 94 additions & 0 deletions
94
android/KMAPro/kMAPro/src/main/java/com/tavultesoft/kmapro/CheckPermissions.java
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,94 @@ | ||
/** | ||
* Copyright 2024 SIL International | ||
*/ | ||
package com.tavultesoft.kmapro; | ||
|
||
import static com.tavultesoft.kmapro.MainActivity.PERMISSION_REQUEST_STORAGE; | ||
|
||
import android.Manifest; | ||
import android.app.Activity; | ||
import android.content.Context; | ||
import android.content.pm.PackageManager; | ||
import android.os.Build; | ||
import android.os.Environment; | ||
import android.widget.Toast; | ||
|
||
import androidx.appcompat.app.AlertDialog; | ||
import androidx.core.app.ActivityCompat; | ||
import androidx.core.content.ContextCompat; | ||
|
||
public class CheckPermissions { | ||
|
||
public static boolean isPermissionOK(Activity activity) { | ||
boolean permissionsOK = true; | ||
|
||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) { | ||
return permissionsOK; | ||
} | ||
|
||
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.R) { | ||
permissionsOK = Environment.isExternalStorageManager(); | ||
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.TIRAMISU) { | ||
// TODO: Workout scoped storage permission #10659 | ||
} | ||
} else { | ||
permissionsOK = checkPermission(activity, Manifest.permission.WRITE_EXTERNAL_STORAGE); | ||
} | ||
|
||
return permissionsOK; | ||
} | ||
|
||
public static boolean checkPermission(Activity activity, String permission) { | ||
return ContextCompat.checkSelfPermission(activity.getApplicationContext(), permission) == PackageManager.PERMISSION_GRANTED; | ||
} | ||
|
||
public static void requestPermission (Activity activity, Context context) { | ||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) { | ||
// Need to request multiple permissions at once | ||
// TODO: request multiple permissions at once #10659 | ||
showPermissionDenied(context); | ||
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) { | ||
// TODO: find alternative to below. #10659 | ||
// It works, but would need Play Store approval | ||
// For now, show permission denied | ||
showPermissionDenied(context); | ||
/* | ||
try { | ||
Intent intent = new Intent(); | ||
intent.setAction(Settings.ACTION_MANAGE_APP_ALL_FILES_ACCESS_PERMISSION); | ||
Uri uri = Uri.fromParts("package", activity.getPackageName(), null); | ||
intent.setData(uri); | ||
activity.startActivity(intent); | ||
} catch (Exception e) { | ||
Intent intent = new Intent(); | ||
intent.setAction(Settings.ACTION_MANAGE_ALL_FILES_ACCESS_PERMISSION); | ||
activity.startActivity(intent); | ||
} | ||
*/ | ||
} else if (ActivityCompat.shouldShowRequestPermissionRationale(activity, Manifest.permission.READ_EXTERNAL_STORAGE)) { | ||
// Provide additional rationale to the user if the permission was not granted | ||
String message = activity.getApplicationContext().getString(R.string.request_storage_permission); | ||
Toast.makeText(activity.getApplicationContext(), message , | ||
Toast.LENGTH_LONG).show(); | ||
ActivityCompat.requestPermissions(activity, | ||
new String[]{ Manifest.permission.READ_EXTERNAL_STORAGE }, | ||
PERMISSION_REQUEST_STORAGE); | ||
} else { | ||
// Request the permission. The result will be received in onRequestPermissionsResult(). | ||
ActivityCompat.requestPermissions(activity, | ||
new String[]{ Manifest.permission.READ_EXTERNAL_STORAGE }, | ||
PERMISSION_REQUEST_STORAGE); | ||
} | ||
} | ||
|
||
public static void showPermissionDenied(Context context) { | ||
// Permission request denied | ||
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(context); | ||
dialogBuilder.setTitle(String.format(context.getString(R.string.title_add_keyboard))); | ||
dialogBuilder.setMessage(String.format(context.getString(R.string.storage_permission_denied2))); | ||
dialogBuilder.setPositiveButton(context.getString(R.string.label_ok), null); | ||
AlertDialog dialog = dialogBuilder.create(); | ||
dialog.show(); | ||
|
||
} | ||
} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
--- | ||
title: Data Privacy Policy | ||
--- | ||
|
||
## Privacy Policy for Keyman | ||
|
||
This application will send crash reporting information to https://sentry.keyman.com. No personally identifiable information or keyboard strokes are recorded or shared. | ||
|
||
You can disable crash reporting on the Keyman | ||
[settings menu](../basic/config/) | ||
|
||
### Data Deletion | ||
|
||
Crash reporting information is retained for 90 days. | ||
|
||
Keyman does not use user accounts, so we are unable to identify which crash reports associated with you or your device can be deleted. | ||
|
||
|
||
|
||
### Developer Information | ||
|
||
Keyman is developed and published by SIL International. | ||
|
||
You can contact SIL or provide any feedback using the app store. | ||
|
||
https://play.google.com/store/apps/details?id=com.tavultesoft.kmapro | ||
|
||
The full SIL software privacy policy is at | ||
|
||
https://software.sil.org/language-software-privacy-policy/ | ||
|
||
This Keyman data privacy policy is also available at | ||
|
||
https://help.keyman.com/products/android/current-version/about/privacy |
Oops, something went wrong.