Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
0a2e4a6
[[ Bug 21434 ]] Force bitmap view visible for visual effects
montegoulding Jul 20, 2018
a65a665
Merge pull request #6610 from montegoulding/bugfix-21434
livecodepanos Jul 23, 2018
5264d86
[Android API 23+][mobilePickPhoto] Request for camera permissions on …
livecodepanos Jul 26, 2018
9a8c15b
[Android API 23+] Request for location permissions on runtime
livecodepanos Jul 26, 2018
0b857f1
Removed unnecessary comparison
livecodepanos Jul 26, 2018
3224c7d
[Runtime permissions] Created API that checks for permission
livecodepanos Jul 27, 2018
912d98e
Removed unused code
livecodepanos Jul 27, 2018
0509d62
Used blocking wait
livecodepanos Jul 28, 2018
5c9490e
Implemented "androidRequestPermission()" function
livecodepanos Jul 28, 2018
e5a704e
Added feature note
livecodepanos Jul 29, 2018
62f1651
[androidRequestPermission] Added dictionary entry
livecodepanos Jul 29, 2018
4c34eaf
Fixed a couple of issues on docs and with long lines
livecodepanos Jul 29, 2018
d2c5a3a
Added "androidHasPermission" and "androidPermissionExists" commands
livecodepanos Jul 30, 2018
120b71f
Added stubs for iphone and updated docs
livecodepanos Jul 31, 2018
39b59ee
[androidRequestPermission] Docs: removed parentheses from syntax
livecodepanos Jul 31, 2018
b1be19c
[9.0.1-rc-2] Updated version
livecodepanos Jul 31, 2018
720de35
Merge pull request #6614 from livecodepanos/bugfix-20427
livecodepanos Jul 31, 2018
3ba4498
[[ Bug 21443 ]] Dirty rect even if layer id is 0
montegoulding Aug 2, 2018
e16a652
Merge pull request #6620 from montegoulding/bugfix-21443
livecodepanos Aug 15, 2018
ac13890
Merge pull request #6617 from livecodepanos/update_version_9.0.1-rc-2
livecodepanos Aug 15, 2018
7e3c2bb
[[ Bug 21496 ]] Ensure emscripten startup_script is suitable for caps…
livecodeali Aug 15, 2018
016f200
[[ Bug 21417 ]] Remove externals list from emscripten deploy params
livecodeali Aug 15, 2018
964d263
[[ Bug 21396 ]] Fix crash on startup in iOS 12 beta
montegoulding Aug 15, 2018
d043856
Merge pull request #6640 from livecodeali/bugfix-21417
Aug 16, 2018
1a3e505
Merge pull request #6639 from livecodeali/bugfix-21496
Aug 16, 2018
048f906
Merge pull request #6622 from montegoulding/bugfix-21396
livecodepanos Aug 18, 2018
9d83967
Merge remote-tracking branch 'upstream/release-9.0.1' into merge-rele…
livecodepanos Aug 27, 2018
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
65 changes: 65 additions & 0 deletions docs/dictionary/command/androidRequestPermission.lcdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
Name: androidRequestPermission

Type: command

Syntax: androidRequestPermission <permissionName>

Summary:
Displays a dialog showing a permission request for <permissionName>. If a user has already granted permission for <permissionName>, this command does nothing.

Introduced: 9.0.1

OS: android

Platforms: mobile

Example:
local tCameraPermissionGranted
put androidHasPermission("android.permission.CAMERA") into tCameraPermissionGranted
if not tCameraPermissionGranted then
androidRequestPermission "android.permission.CAMERA"
end if
put androidHasPermission("android.permission.CAMERA") into tCameraPermissionGranted
if not tCameraPermissionGranted then
answer "This app is not permitted to access the device camera. You can change this" && \
"in the Settings app."
end if


Parameters:
permissionName (enum):
The name of the permission to request.

- "android.permission.READ_CALENDAR": permission to allow an application to read the device's calendar.
- "android.permission.WRITE_CALENDAR": permission to allow an application to write to the device's calendar.
- "android.permission.CAMERA": permission to allow an application to access the device's camera.
- "android.permission.ACCESS_COARSE_LOCATION": permission to allow an application to access the device's coarse location.
- "android.permission.ACCESS_FINE_LOCATION": permission to allow an application to access the device's fine location.
- "android.permission.READ_CONTACTS": permission to allow an application to read data from the device's contacts.
- "android.permission.WRITE_CONTACTS": permission to allow an application to write date to the device's contacts.
- "android.permission.GET_ACCOUNTS": permission to allow an application to access to the list of accounts in the Accounts Service.
- "android.permission.RECORD_AUDIO": permission to allow an application to allow an application to record audio.
- "android.permission.READ_EXTERNAL_STORAGE": permission to allow an application to read data from the device's external storage.
- "android.permission.WRITE_EXTERNAL_STORAGE": permission to allow an application to write data to the device's external storage.
- "android.permission.READ_PHONE_STATE": permission to allow an application to access phone state, including the phone number of the device, current cellular network information, the status of any ongoing calls, and a list of any PhoneAccounts registered on the device.
- "android.permission.READ_PHONE_NUMBERS": permission to allow an application to access the device's phone number(s).
- "android.permission.CALL_PHONE": permission to allow an application to initiate a phone call without going through the Dialer user interface for the user to confirm the call.
- "android.permission.ANSWER_PHONE_CALLS": permission to allow an application to answer an incoming phone call.
- "android.permission.READ_CALL_LOG": permission to allow an application to read the user's call log.
- "android.permission.WRITE_CALL_LOG": permission to allow an application to write to the user's call log.
- "android.permission.ADD_VOICEMAIL": permission to allow an application to add voicemails into the system.
- "android.permission.USE_SIP": permission to allow an application to use SIP service.
- "android.permission.PROCESS_OUTGOING_CALLS": permission to allow an application to see the number being dialed during an outgoing call with the option to redirect the call to a different number or abort the call altogether.
- "android.permission.SEND_SMS": permission to allow an application to send SMS messages.
- "android.permission.RECEIVE_SMS": permission to allow an application to receive SMS messages
- "android.permission.READ_SMS": permission to allow an application to read SMS messages.
- "android.permission.RECEIVE_WAP_PUSH": permission to allow an application to receive WAP push messages.
- "android.permission.RECEIVE_MMS": permission to allow an application to receive MMS messages.
- "android.permission.BODY_SENSORS": permission to allow an application to access data from sensors that the user uses to measure what is happening inside his/her body, such as heart rate.



Description:
Use the <androidRequestPermission> command to request permission for <permissionName> from the user.

>*Note:* Permission names are case sensitive.
66 changes: 66 additions & 0 deletions docs/dictionary/function/androidHasPermission.lcdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
Name: androidHasPermission

Type: function

Syntax: androidHasPermission(<permissionName>)

Summary:
Returns if permission <permissionName> has been granted by the user.

Introduced: 9.0.1

OS: android

Platforms: mobile

Example:
local tLocationPermissionGranted
put androidHasPermission("android.permission.ACCESS_FINE_LOCATION") into tLocationPermissionGranted
if not tLocationPermissionGranted then
androidRequestPermission "android.permission.ACCESS_FINE_LOCATION"
end if
if not tLocationPermissionGranted then
answer "This app is not permitted to access the device location. You can change this" && \
"in the Settings app."
end if


Parameters:
permissionName (enum):
The name of the permission to request.

- "android.permission.READ_CALENDAR": permission to allow an application to read the device's calendar.
- "android.permission.WRITE_CALENDAR": permission to allow an application to write to the device's calendar.
- "android.permission.CAMERA": permission to allow an application to access the device's camera.
- "android.permission.ACCESS_COARSE_LOCATION": permission to allow an application to access the device's coarse location.
- "android.permission.ACCESS_FINE_LOCATION": permission to allow an application to access the device's fine location.
- "android.permission.READ_CONTACTS": permission to allow an application to read data from the device's contacts.
- "android.permission.WRITE_CONTACTS": permission to allow an application to write date to the device's contacts.
- "android.permission.GET_ACCOUNTS": permission to allow an application to access to the list of accounts in the Accounts Service.
- "android.permission.RECORD_AUDIO": permission to allow an application to allow an application to record audio.
- "android.permission.READ_EXTERNAL_STORAGE": permission to allow an application to read data from the device's external storage.
- "android.permission.WRITE_EXTERNAL_STORAGE": permission to allow an application to write data to the device's external storage.
- "android.permission.READ_PHONE_STATE": permission to allow an application to access phone state, including the phone number of the device, current cellular network information, the status of any ongoing calls, and a list of any PhoneAccounts registered on the device.
- "android.permission.READ_PHONE_NUMBERS": permission to allow an application to access the device's phone number(s).
- "android.permission.CALL_PHONE": permission to allow an application to initiate a phone call without going through the Dialer user interface for the user to confirm the call.
- "android.permission.ANSWER_PHONE_CALLS": permission to allow an application to answer an incoming phone call.
- "android.permission.READ_CALL_LOG": permission to allow an application to read the user's call log.
- "android.permission.WRITE_CALL_LOG": permission to allow an application to write to the user's call log.
- "android.permission.ADD_VOICEMAIL": permission to allow an application to add voicemails into the system.
- "android.permission.USE_SIP": permission to allow an application to use SIP service.
- "android.permission.PROCESS_OUTGOING_CALLS": permission to allow an application to see the number being dialed during an outgoing call with the option to redirect the call to a different number or abort the call altogether.
- "android.permission.SEND_SMS": permission to allow an application to send SMS messages.
- "android.permission.RECEIVE_SMS": permission to allow an application to receive SMS messages
- "android.permission.READ_SMS": permission to allow an application to read SMS messages.
- "android.permission.RECEIVE_WAP_PUSH": permission to allow an application to receive WAP push messages.
- "android.permission.RECEIVE_MMS": permission to allow an application to receive MMS messages.
- "android.permission.BODY_SENSORS": permission to allow an application to access data from sensors that the user uses to measure what is happening inside his/her body, such as heart rate.

Returns(boolean):
True if permission has been granted, false otherwise.


Description:
Use the <androidRequestPermission> function to find out if permission <permissionName> has been granted by the user.

>*Note:* Permission names are case sensitive.
33 changes: 33 additions & 0 deletions docs/dictionary/function/androidPermissionExists.lcdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
Name: androidPermissionExists

Type: function

Syntax: androidPermissionExists(<permissionName>)

Summary:
Returns true if <permissionName> is a valid Android permission name

Introduced: 9.0.1

OS: android

Platforms: mobile

Example:

if not androidPermissionExists(pPermission) then
answer pPermission && "is not a valid permission name"
end if


Parameters:
permissionName (string):
The name of the permission to check.

Returns(boolean):
True if <permissionName> is a valid Android permission name, false otherwise.

Description:
Use the <androidPermissionExists> function to check if <permissionName> is a valid Android permission name.

>*Note:* Permission names are case sensitive.
1 change: 1 addition & 0 deletions docs/notes/bugfix-21396.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Fix crash on startup in iOS 12 beta
1 change: 1 addition & 0 deletions docs/notes/bugfix-21417.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Don't include any externals in emscripten standalones
1 change: 1 addition & 0 deletions docs/notes/bugfix-21434.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Fix visual effects not working when acceleratedRendering is true on Android
1 change: 1 addition & 0 deletions docs/notes/bugfix-21443.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Fix groups sometimes not redrawing when scrolled
1 change: 1 addition & 0 deletions docs/notes/bugfix-21496.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Ensure emscripten aux stacks are loaded on startup
26 changes: 26 additions & 0 deletions docs/notes/feature-android_runtime_permissions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Android 6.0 runtime permissions

Android 6.0 (API 23) Marshmallow introduced a new permissions model
that lets apps request permissions from the user at runtime, rather
than prior to installation. Apps built with LC 9.0.1 do support this
new permissions model, and request permissions automatically when the
app actually requires the services or data protected by the services.

For example, if the app calls `mobilePickPhoto "camera"`, a dialog will
be shown to the user asking for permission to access the device camera.

If the user does not grant permission, the call will fail. Moreover, the
app can use the function `androidRequestPermission(permissionName)` to
check if the permission for `permissionName` has been granted.

Notes:

- You have to make sure that you check the required permissions for your
app in the standalone settings.
- Apps that run on devices running Android 6+ will work with the new
permissions model.
- Apps that run on older devices (less than Android 6) will continue to
work with the old permissions model.
- If the user does not grant a permission when the dialog appears for the
first time, they can change this preference from the Settings app.

68 changes: 32 additions & 36 deletions engine/rsrc/emscripten-startup-template.livecodescript
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
script "__startup"
constant kEngineVersion = "@ENGINE_VERSION@"

-- Directories that engine expects to normally be present
Expand All @@ -7,41 +6,38 @@ constant kStandardFolders = "/tmp:/livecode:/boot:/boot/standalone:/boot/fonts"
-- Directory containing the initial stack files
constant kStartupFolder = "/boot/standalone"

on startup
local tError, tFolder
try
----------------------------------------------------------------
-- Create standard filesystem layout
set the itemdelimiter to ":"
repeat for each item tFolder in kStandardFolders
if there is not a folder tFolder then
create folder tFolder
if the result is not empty then
throw the result
end if
local tError, tFolder
try
----------------------------------------------------------------
-- Create standard filesystem layout
set the itemdelimiter to ":"
repeat for each item tFolder in kStandardFolders
if there is not a folder tFolder then
create folder tFolder
if the result is not empty then
throw the result
end if
end repeat

-------------------------------------------------------------
-- Validate engine version
if the version is not kEngineVersion then
throw "Engine mismatch: found" && the version & ", expected" && kEngineVersion
end if


@STARTUP_SCRIPT@

catch tError
end try

-- Set the initial working directory to the directory that contains
-- the initial stack.
set the defaultfolder to kStartupFolder

-- Try to print something vaguely helpful to the the log
if tError is not empty then
write "startup failed:" && tError & return to stderr
end repeat

-------------------------------------------------------------
-- Validate engine version
if the version is not kEngineVersion then
throw "Engine mismatch: found" && the version & ", expected" && kEngineVersion
end if

return tError
end startup


@STARTUP_SCRIPT@

catch tError
end try

-- Try to print something vaguely helpful to the the log
if tError is not empty then
write "startup failed:" && tError & return to stderr
throw tError
end if

-- Set the initial working directory to the directory that contains
-- the initial stack.
set the defaultfolder to kStartupFolder
6 changes: 4 additions & 2 deletions engine/src/cgimageutil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ bool MCGRasterCreateCGDataProvider(const MCGRaster &p_raster, const MCGIntegerRe
t_width = p_src_rect.size.width;
t_height = p_src_rect.size.height;

const uint8_t *t_src_ptr = (uint8_t*)MCGRasterGetPixelPtr(p_raster, t_x, t_y);
uint8_t *t_src_ptr = (uint8_t*)MCGRasterGetPixelPtr(p_raster, t_x, t_y);

uint32_t t_dst_stride;

Expand All @@ -125,8 +125,10 @@ bool MCGRasterCreateCGDataProvider(const MCGRaster &p_raster, const MCGIntegerRe
if (!p_copy)
{
t_dst_stride = p_raster.stride;
t_data_provider = CGDataProviderCreateWithData(nil, t_src_ptr, t_height * p_raster.stride, nil);
t_data_provider = CGDataProviderCreateWithData(nil, t_src_ptr, t_height * p_raster.stride, __CGDataProviderDeallocate);
t_success = t_data_provider != nil;
if (!t_success)
MCMemoryDeallocate(t_src_ptr);
}
else
{
Expand Down
25 changes: 25 additions & 0 deletions engine/src/exec-misc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,31 @@ void MCMiscGetDoNotBackupFile(MCExecContext& ctxt, MCStringRef p_path, bool& r_n
ctxt.Throw();
}

void MCMiscExecRequestPermission(MCExecContext& ctxt, MCStringRef p_permission, bool& r_granted)
{
if (MCSystemRequestPermission(p_permission, r_granted))
return;

ctxt.Throw();
}

void MCMiscExecPermissionExists(MCExecContext& ctxt, MCStringRef p_permission, bool& r_exists)
{
if (MCSystemPermissionExists(p_permission, r_exists))
return;

ctxt.Throw();
}

void MCMiscExecHasPermission(MCExecContext& ctxt, MCStringRef p_permission, bool& r_permission_granted)
{
if (MCSystemHasPermission(p_permission, r_permission_granted))
return;

ctxt.Throw();
}


void MCMiscSetDoNotBackupFile(MCExecContext& ctxt, MCStringRef p_path, bool p_no_backup)
{
if (MCSystemFileSetDoNotBackup(p_path, p_no_backup))
Expand Down
3 changes: 3 additions & 0 deletions engine/src/exec.h
Original file line number Diff line number Diff line change
Expand Up @@ -4043,6 +4043,9 @@ void MCMiscExecLibUrlDownloadToFile(MCExecContext& ctxt, MCStringRef p_url, MCSt
void MCMiscExecLibUrlSetSSLVerification(MCExecContext& ctxt, bool p_enabled);

void MCMiscGetBuildInfo(MCExecContext& ctxt, MCStringRef p_key, MCStringRef& r_value);
void MCMiscExecRequestPermission(MCExecContext& ctxt, MCStringRef p_permission, bool& r_granted);
void MCMiscExecPermissionExists(MCExecContext& ctxt, MCStringRef p_permission, bool& r_exists);
void MCMiscExecHasPermission(MCExecContext& ctxt, MCStringRef p_permission, bool& r_permission_granted);

void MCMiscExecEnableRemoteControl(MCExecContext& ctxt);
void MCMiscExecDisableRemoteControl(MCExecContext& ctxt);
Expand Down
3 changes: 3 additions & 0 deletions engine/src/executionerrors.h
Original file line number Diff line number Diff line change
Expand Up @@ -2774,6 +2774,9 @@ enum Exec_errors
// {EE-0908} fontLanguage: bad font name
EE_FONTLANGUAGE_BADFONTNAME,

// {EE-0909} android permission: bad permission name
EE_BAD_PERMISSION_NAME,

};

extern const char *MCexecutionerrors;
Expand Down
Loading